More moves and compilation fixes
This commit is contained in:
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.me;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
public class GridStorage implements IGridStorage {
|
||||
|
||||
private final long myID;
|
||||
private final CompoundTag data;
|
||||
private final WeakHashMap<GridStorage, Boolean> divided = new WeakHashMap<>();
|
||||
private WeakReference<IGrid> internalGrid = null;
|
||||
|
||||
/**
|
||||
* for use with world settings
|
||||
*
|
||||
* @param id ID of grid storage
|
||||
*/
|
||||
public GridStorage(final long id) {
|
||||
this.myID = id;
|
||||
this.data = new CompoundTag();
|
||||
}
|
||||
|
||||
/**
|
||||
* for use with world settings
|
||||
*
|
||||
* @param data The Grid data.
|
||||
* @param id ID of grid storage
|
||||
*/
|
||||
public GridStorage(final long id, final CompoundTag data) {
|
||||
this.myID = id;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* fake storage.
|
||||
*/
|
||||
public GridStorage() {
|
||||
this.myID = 0;
|
||||
this.data = new CompoundTag();
|
||||
}
|
||||
|
||||
public void saveState() {
|
||||
final Grid currentGrid = (Grid) this.getGrid();
|
||||
if (currentGrid != null) {
|
||||
currentGrid.saveState();
|
||||
}
|
||||
}
|
||||
|
||||
public IGrid getGrid() {
|
||||
return this.internalGrid == null ? null : this.internalGrid.get();
|
||||
}
|
||||
|
||||
void setGrid(final IGrid grid) {
|
||||
this.internalGrid = new WeakReference<>(grid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag dataObject() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getID() {
|
||||
return this.myID;
|
||||
}
|
||||
|
||||
void addDivided(final GridStorage gs) {
|
||||
this.divided.put(gs, true);
|
||||
}
|
||||
|
||||
boolean hasDivided(final GridStorage myStorage) {
|
||||
return this.divided.containsKey(myStorage);
|
||||
}
|
||||
|
||||
void remove() {
|
||||
WorldData.instance().storageData().destroyGridStorage(this.myID);
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -23,9 +23,10 @@ import java.util.PriorityQueue;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.crash.ReportedException;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
import net.minecraft.util.crash.CrashException;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
@@ -116,11 +117,11 @@ public class TickManagerCache implements ITickManager {
|
||||
}
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
final CrashReport crashreport = CrashReport.makeCrashReport(t, "Ticking GridNode");
|
||||
final CrashReportCategory crashreportcategory = crashreport
|
||||
.makeCategory(tt.getGridTickable().getClass().getSimpleName() + " being ticked.");
|
||||
tt.addEntityCrashInfo(crashreportcategory);
|
||||
throw new ReportedException(crashreport);
|
||||
final CrashReport crashreport = CrashReport.create(t, "Ticking GridNode");
|
||||
final CrashReportSection section = crashreport
|
||||
.addElement(tt.getGridTickable().getClass().getSimpleName() + " being ticked.");
|
||||
tt.addEntityCrashInfo(section);
|
||||
throw new CrashException(crashreport);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-10
@@ -20,7 +20,7 @@ package appeng.me.cache.helpers;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
@@ -28,6 +28,7 @@ import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.parts.AEBasePart;
|
||||
import net.minecraft.util.crash.CrashReportSection;
|
||||
|
||||
public class TickTracker implements Comparable<TickTracker> {
|
||||
|
||||
@@ -71,22 +72,22 @@ public class TickTracker implements Comparable<TickTracker> {
|
||||
|
||||
}
|
||||
|
||||
public void addEntityCrashInfo(final CrashReportCategory crashreportcategory) {
|
||||
public void addEntityCrashInfo(final CrashReportSection section) {
|
||||
if (this.getGridTickable() instanceof AEBasePart) {
|
||||
final AEBasePart part = (AEBasePart) this.getGridTickable();
|
||||
part.addEntityCrashInfo(crashreportcategory);
|
||||
part.addEntityCrashInfo(section);
|
||||
}
|
||||
|
||||
crashreportcategory.addDetail("CurrentTickRate", this.getCurrentRate());
|
||||
crashreportcategory.addDetail("MinTickRate", this.getRequest().minTickRate);
|
||||
crashreportcategory.addDetail("MaxTickRate", this.getRequest().maxTickRate);
|
||||
crashreportcategory.addDetail("MachineType", this.getGridTickable().getClass().getName());
|
||||
crashreportcategory.addDetail("GridBlockType", this.getNode().getGridBlock().getClass().getName());
|
||||
crashreportcategory.addDetail("ConnectedSides", this.getNode().getConnectedSides());
|
||||
section.add("CurrentTickRate", this.getCurrentRate());
|
||||
section.add("MinTickRate", this.getRequest().minTickRate);
|
||||
section.add("MaxTickRate", this.getRequest().maxTickRate);
|
||||
section.add("MachineType", this.getGridTickable().getClass().getName());
|
||||
section.add("GridBlockType", this.getNode().getGridBlock().getClass().getName());
|
||||
section.add("ConnectedSides", this.getNode().getConnectedSides());
|
||||
|
||||
final DimensionalCoord dc = this.getNode().getGridBlock().getLocation();
|
||||
if (dc != null) {
|
||||
crashreportcategory.addDetail("Location", dc);
|
||||
section.add("Location", dc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,9 +1087,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
|
||||
if (te.hasCustomInventoryName()) {
|
||||
if (this.myName != null) {
|
||||
this.myName.append(" ").append(te.getCustomInventoryName());
|
||||
this.myName = this.myName.copy().append(" ").append(te.getCustomInventoryName());
|
||||
} else {
|
||||
this.myName = te.getCustomInventoryName().deepCopy();
|
||||
this.myName = te.getCustomInventoryName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class QuantumCluster implements ILocatable, IAECluster {
|
||||
final World theWorld = qc.center.getWorld();
|
||||
if (!qc.isDestroyed) {
|
||||
ChunkPos cPos = new ChunkPos(qc.center.getPos());
|
||||
if (theWorld.getChunkProvider().isChunkLoaded(cPos)) {
|
||||
if (theWorld.getChunkManager().isChunkLoaded(cPos)) {
|
||||
final DimensionType id = theWorld.dimension.getType();
|
||||
final World cur = theWorld.getServer().getWorld(id);
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.me.helpers;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
|
||||
public interface IGridProxyable extends IGridHost {
|
||||
|
||||
AENetworkProxy getProxy();
|
||||
|
||||
DimensionalCoord getLocation();
|
||||
|
||||
void gridChanged();
|
||||
}
|
||||
@@ -130,11 +130,11 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
// Just to safeguard against tanks that prevent non-bucket-size extractions
|
||||
if (this.handler.drain(FluidAttributes.BUCKET_VOLUME, IFluidHandler.FluidAction.SIMULATE)
|
||||
.isEmpty()) {
|
||||
newIS = FluidVolume.EMPTY;
|
||||
newIS = FluidVolumeUtil.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
final FluidVolume oldIS = old == null ? FluidVolume.EMPTY : old.fluidStack;
|
||||
final FluidVolume oldIS = old == null ? FluidVolumeUtil.EMPTY : old.fluidStack;
|
||||
|
||||
if (isDifferent(newIS, oldIS)) {
|
||||
final CachedFluidStack cis = new CachedFluidStack(newIS);
|
||||
@@ -206,7 +206,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
if (a.isEmpty() || b.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return !a.getFluid().equals(b.getFluid());
|
||||
return !a.getFluidKey().equals(b.getFluidKey());
|
||||
}
|
||||
|
||||
private void postDifference(final Iterable<IAEFluidStack> a) {
|
||||
@@ -293,7 +293,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
|
||||
CachedFluidStack(final FluidVolume is) {
|
||||
if (is.isEmpty()) {
|
||||
this.fluidStack = FluidVolume.EMPTY;
|
||||
this.fluidStack = FluidVolumeUtil.EMPTY;
|
||||
this.aeStack = null;
|
||||
} else {
|
||||
this.fluidStack = is.copy();
|
||||
|
||||
Reference in New Issue
Block a user