parent
4ee70e100b
commit
842e520b60
3 changed files with 21 additions and 9 deletions
|
@ -47,7 +47,9 @@ import buildcraft.transport.render.PipeWorldRenderer;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class BlockGenericPipe extends BlockContainer {
|
||||
static enum Part {
|
||||
|
@ -822,10 +824,10 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
|
||||
/* Registration ******************************************************** */
|
||||
|
||||
public static TreeMap<Integer, Class<? extends Pipe>> pipes = new TreeMap<Integer, Class<? extends Pipe>>();
|
||||
public static Map<Integer, Class<? extends Pipe>> pipes = new HashMap<Integer, Class<? extends Pipe>>();
|
||||
|
||||
static long lastRemovedDate = -1;
|
||||
public static TreeMap<BlockIndex, Pipe> pipeRemoved = new TreeMap<BlockIndex, Pipe>();
|
||||
public static Map<BlockIndex, Pipe> pipeRemoved = new HashMap<BlockIndex, Pipe>();
|
||||
|
||||
public static ItemPipe registerPipe(int key, Class<? extends Pipe> clas) {
|
||||
ItemPipe item = new ItemPipe(key);
|
||||
|
|
|
@ -23,6 +23,7 @@ import buildcraft.core.IItemPipe;
|
|||
import buildcraft.core.ItemBuildCraft;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
||||
|
||||
|
@ -75,7 +76,7 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
|||
|
||||
Pipe pipe = BlockGenericPipe.createPipe(itemID);
|
||||
if (pipe == null) {
|
||||
BuildCraftCore.bcLog.warning("Pipe failed to create during placement at "+i+","+j+","+k);
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to create during placement at {0},{1},{2}", new Object[]{i, j, k});
|
||||
return true;
|
||||
}
|
||||
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) {
|
||||
|
|
|
@ -51,6 +51,7 @@ import buildcraft.transport.Gate.GateKind;
|
|||
import buildcraft.transport.network.PipeRenderStatePacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITankContainer, IPipeEntry, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder,
|
||||
IPipeConnection, IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile {
|
||||
|
@ -76,6 +77,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
private PipeRenderState renderState = new PipeRenderState();
|
||||
private CoreState coreState = new CoreState();
|
||||
private boolean deletePipe = false;
|
||||
|
||||
public TileBuffer[] tileBuffer;
|
||||
public boolean[] pipeConnectionsBuffer = new boolean[6];
|
||||
|
@ -122,7 +124,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
if (pipe != null) {
|
||||
pipe.readFromNBT(nbttagcompound);
|
||||
} else {
|
||||
BuildCraftCore.bcLog.warning("Pipe failed to load from NBT at "+xCoord+","+yCoord+","+zCoord);
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to load from NBT at {0},{1},{2}", new Object[]{xCoord, yCoord, zCoord});
|
||||
deletePipe = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||
|
@ -154,6 +157,10 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(deletePipe){
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (pipe == null)
|
||||
return;
|
||||
|
@ -251,6 +258,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
}
|
||||
|
||||
public void initialize(Pipe pipe) {
|
||||
|
||||
if(pipe == null){
|
||||
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to initialize at {0},{1},{2}, deleting", new Object[]{xCoord, yCoord, zCoord});
|
||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||
return;
|
||||
}
|
||||
|
||||
this.pipe = pipe;
|
||||
|
||||
|
@ -277,11 +290,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
|
|||
computeConnections();
|
||||
scheduleRenderUpdate();
|
||||
|
||||
if (pipe != null) {
|
||||
pipe.initialize();
|
||||
} else {
|
||||
BuildCraftCore.bcLog.warning("Pipe failed to initialize pipe at "+xCoord+","+yCoord+","+zCoord);
|
||||
}
|
||||
pipe.initialize();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue