PipeLogic Smash
This commit is contained in:
parent
1860ebc300
commit
9cb75de1df
30 changed files with 115 additions and 219 deletions
|
@ -885,7 +885,7 @@ public class BlockGenericPipe extends BlockContainer {
|
|||
}
|
||||
|
||||
public static boolean isFullyDefined(Pipe pipe) {
|
||||
return pipe != null && pipe.transport != null && pipe.logic != null;
|
||||
return pipe != null && pipe.transport != null;
|
||||
}
|
||||
|
||||
public static boolean isValid(Pipe pipe) {
|
||||
|
|
|
@ -50,7 +50,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
public int[] signalStrength = new int[]{0, 0, 0, 0};
|
||||
public TileGenericPipe container;
|
||||
public final PipeTransport transport;
|
||||
public final PipeLogic logic;
|
||||
public final int itemID;
|
||||
private boolean internalUpdateScheduled = false;
|
||||
public boolean[] wireSet = new boolean[]{false, false, false, false};
|
||||
|
@ -64,14 +63,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
public boolean broadcastRedstone = false;
|
||||
public SafeTimeTracker actionTracker = new SafeTimeTracker();
|
||||
|
||||
public Pipe(PipeTransport transport, PipeLogic logic, int itemID) {
|
||||
public Pipe(PipeTransport transport, int itemID) {
|
||||
this.transport = transport;
|
||||
this.logic = logic;
|
||||
this.itemID = itemID;
|
||||
|
||||
if (!networkWrappers.containsKey(this.getClass())) {
|
||||
networkWrappers
|
||||
.put(this.getClass(), new TilePacketWrapper(new Class[]{TileGenericPipe.class, this.transport.getClass(), this.logic.getClass()}));
|
||||
.put(this.getClass(), new TilePacketWrapper(new Class[]{TileGenericPipe.class, this.transport.getClass()}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,15 +78,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
this.container = (TileGenericPipe) tile;
|
||||
|
||||
transport.setTile((TileGenericPipe) tile);
|
||||
logic.setTile((TileGenericPipe) tile);
|
||||
}
|
||||
|
||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||
return logic.blockActivated(entityplayer);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onBlockPlaced() {
|
||||
logic.onBlockPlaced();
|
||||
transport.onBlockPlaced();
|
||||
}
|
||||
|
||||
|
@ -96,7 +92,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
logic.onNeighborBlockChange(blockId);
|
||||
transport.onNeighborBlockChange(blockId);
|
||||
|
||||
updateSignalState();
|
||||
|
@ -109,7 +104,7 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
if (!PipeConnectionBans.canPipesConnect(getClass(), otherPipe.getClass()))
|
||||
return false;
|
||||
}
|
||||
return logic.canPipeConnect(tile, side) && transport.canPipeConnect(tile, side);
|
||||
return transport.canPipeConnect(tile, side);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,7 +140,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
public void updateEntity() {
|
||||
|
||||
transport.updateEntity();
|
||||
logic.updateEntity();
|
||||
|
||||
if (internalUpdateScheduled) {
|
||||
internalUpdate();
|
||||
|
@ -173,7 +167,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
transport.writeToNBT(nbttagcompound);
|
||||
logic.writeToNBT(nbttagcompound);
|
||||
|
||||
// Save pulser if any
|
||||
if (gate != null) {
|
||||
|
@ -207,7 +200,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
transport.readFromNBT(nbttagcompound);
|
||||
logic.readFromNBT(nbttagcompound);
|
||||
|
||||
// Load pulser if any
|
||||
if (nbttagcompound.hasKey("Gate")) {
|
||||
|
@ -256,7 +248,6 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
|
||||
public void initialize() {
|
||||
transport.initialize();
|
||||
logic.initialize();
|
||||
updateSignalState();
|
||||
initialized = true;
|
||||
}
|
||||
|
@ -354,11 +345,11 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
|
|||
}
|
||||
|
||||
public boolean inputOpen(ForgeDirection from) {
|
||||
return transport.inputOpen(from) && logic.inputOpen(from);
|
||||
return transport.inputOpen(from);
|
||||
}
|
||||
|
||||
public boolean outputOpen(ForgeDirection to) {
|
||||
return transport.outputOpen(to) && logic.outputOpen(to);
|
||||
return transport.outputOpen(to);
|
||||
}
|
||||
|
||||
public void onEntityCollidedWithBlock(Entity entity) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeFluidsCobblestone extends Pipe {
|
||||
|
||||
public PipeFluidsCobblestone(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
@ -18,7 +17,7 @@ import buildcraft.transport.PipeTransportFluids;
|
|||
public class PipeFluidsEmerald extends PipeFluidsWood {
|
||||
|
||||
public PipeFluidsEmerald(int itemID) {
|
||||
super(new PipeLogic(), itemID);
|
||||
super(itemID);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipeFluidsEmerald_Standard.ordinal();
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/**
|
||||
* BuildCraft is open-source. It is distributed under the terms of the
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||
* or its modifications in any form, binary or source, except if expressively
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||
* its modifications in any form, binary or source, except if expressively
|
||||
* granted by the copyright holder.
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -20,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeFluidsGold extends Pipe {
|
||||
|
||||
public PipeFluidsGold(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
|
||||
((PipeTransportFluids) transport).flowRate = 40;
|
||||
((PipeTransportFluids) transport).travelDelay = 4;
|
||||
|
@ -36,5 +35,4 @@ public class PipeFluidsGold extends Pipe {
|
|||
public int getIconIndex(ForgeDirection direction) {
|
||||
return PipeIconProvider.TYPE.PipeFluidsGold.ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PipeFluidsIron extends Pipe {
|
|||
};
|
||||
|
||||
public PipeFluidsIron(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class PipeFluidsIron extends Pipe {
|
|||
|
||||
@Override
|
||||
public boolean outputOpen(ForgeDirection to) {
|
||||
return logic.outputOpen(to);
|
||||
return super.outputOpen(to) && logic.outputOpen(to);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,6 @@ package buildcraft.transport.pipes;
|
|||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.transport.IPipeTransportFluidsHook;
|
||||
import buildcraft.transport.Pipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
|
@ -24,7 +23,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
public class PipeFluidsSandstone extends Pipe implements IPipeTransportFluidsHook {
|
||||
|
||||
public PipeFluidsSandstone(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeFluidsStone extends Pipe {
|
||||
|
||||
public PipeFluidsStone(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
// ((PipeTransportFluids) transport).flowRate = 40;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -23,7 +21,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
public class PipeFluidsVoid extends Pipe implements IPipeTransportFluidsHook {
|
||||
|
||||
public PipeFluidsVoid(int itemID) {
|
||||
super(new PipeTransportFluids(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,11 +51,7 @@ public class PipeFluidsWood extends Pipe implements IPowerReceptor {
|
|||
};
|
||||
|
||||
public PipeFluidsWood(int itemID) {
|
||||
this(new PipeLogic(), itemID);
|
||||
}
|
||||
|
||||
protected PipeFluidsWood(PipeLogic logic, int itemID) {
|
||||
super(new PipeTransportFluids(), logic, itemID);
|
||||
super(new PipeTransportFluids(), itemID);
|
||||
|
||||
powerHandler = new PowerHandler(this, Type.MACHINE);
|
||||
powerHandler.configure(1, 100, 1, 250);
|
||||
|
@ -78,7 +74,7 @@ public class PipeFluidsWood extends Pipe implements IPowerReceptor {
|
|||
logic.initialize();
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts a random piece of item outside of a nearby chest.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/**
|
||||
* BuildCraft is open-source. It is distributed under the terms of the
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||
* or its modifications in any form, binary or source, except if expressively
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||
* its modifications in any form, binary or source, except if expressively
|
||||
* granted by the copyright holder.
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -20,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsCobblestone extends Pipe {
|
||||
|
||||
public PipeItemsCobblestone(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,5 +32,4 @@ public class PipeItemsCobblestone extends Pipe {
|
|||
public int getIconIndex(ForgeDirection direction) {
|
||||
return PipeIconProvider.TYPE.PipeItemsCobbleStone.ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PipeItemsDiamond extends Pipe implements IPipeTransportItemsHook, I
|
|||
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
|
||||
|
||||
public PipeItemsDiamond(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
}
|
||||
|
||||
public IInventory getFilters() {
|
||||
|
|
|
@ -17,7 +17,6 @@ import buildcraft.core.proxy.CoreProxy;
|
|||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeTransportItems;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -34,17 +33,13 @@ public class PipeItemsEmerald extends PipeItemsWood implements IClientState {
|
|||
private SimpleInventory filters = new SimpleInventory(9, "Filters", 1);
|
||||
private int currentFilter = 0;
|
||||
|
||||
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
|
||||
super(transport, new PipeLogic(), itemID);
|
||||
public PipeItemsEmerald(int itemID) {
|
||||
super(itemID);
|
||||
|
||||
standardIconIndex = PipeIconProvider.TYPE.PipeItemsEmerald_Standard.ordinal();
|
||||
solidIconIndex = PipeIconProvider.TYPE.PipeAllEmerald_Solid.ordinal();
|
||||
}
|
||||
|
||||
public PipeItemsEmerald(int itemID) {
|
||||
this(itemID, new PipeTransportItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||
if (entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID < Block.blocksList.length) {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/**
|
||||
* BuildCraft is open-source. It is distributed under the terms of the
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||
* or its modifications in any form, binary or source, except if expressively
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||
* its modifications in any form, binary or source, except if expressively
|
||||
* granted by the copyright holder.
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -25,7 +24,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook {
|
||||
|
||||
public PipeItemsGold(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PipeItemsIron extends Pipe {
|
|||
};
|
||||
|
||||
public PipeItemsIron(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
|
||||
((PipeTransportItems) transport).allowBouncing = true;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class PipeItemsIron extends Pipe {
|
|||
|
||||
@Override
|
||||
public boolean outputOpen(ForgeDirection to) {
|
||||
return logic.outputOpen(to);
|
||||
return super.outputOpen(to) && logic.outputOpen(to);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/**
|
||||
* BuildCraft is open-source. It is distributed under the terms of the
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile
|
||||
* or run the code. It does *NOT* grant the right to redistribute this software
|
||||
* or its modifications in any form, binary or source, except if expressively
|
||||
* BuildCraft Open Source License. It grants rights to read, modify, compile or
|
||||
* run the code. It does *NOT* grant the right to redistribute this software or
|
||||
* its modifications in any form, binary or source, except if expressively
|
||||
* granted by the copyright holder.
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -38,12 +37,11 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
||||
|
||||
private PowerHandler powerHandler;
|
||||
|
||||
private int[] entitiesDropped;
|
||||
private int entitiesDroppedIndex = 0;
|
||||
|
||||
public PipeItemsObsidian(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
|
||||
entitiesDropped = new int[32];
|
||||
|
||||
|
@ -61,7 +59,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
public IIconProvider getIconProvider() {
|
||||
return BuildCraftTransport.instance.pipeIconProvider;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getIconIndex(ForgeDirection direction) {
|
||||
return PipeIconProvider.TYPE.PipeItemsObsidian.ordinal();
|
||||
|
@ -86,56 +84,56 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
Position p2 = new Position(container.xCoord, container.yCoord, container.zCoord, orientation);
|
||||
|
||||
switch (orientation) {
|
||||
case EAST:
|
||||
p1.x += distance;
|
||||
p2.x += 1 + distance;
|
||||
break;
|
||||
case WEST:
|
||||
p1.x -= (distance - 1);
|
||||
p2.x -= distance;
|
||||
break;
|
||||
case UP:
|
||||
case DOWN:
|
||||
p1.x += distance + 1;
|
||||
p2.x -= distance;
|
||||
p1.z += distance + 1;
|
||||
p2.z -= distance;
|
||||
break;
|
||||
case SOUTH:
|
||||
p1.z += distance;
|
||||
p2.z += distance + 1;
|
||||
break;
|
||||
case NORTH:
|
||||
default:
|
||||
p1.z -= (distance - 1);
|
||||
p2.z -= distance;
|
||||
break;
|
||||
case EAST:
|
||||
p1.x += distance;
|
||||
p2.x += 1 + distance;
|
||||
break;
|
||||
case WEST:
|
||||
p1.x -= (distance - 1);
|
||||
p2.x -= distance;
|
||||
break;
|
||||
case UP:
|
||||
case DOWN:
|
||||
p1.x += distance + 1;
|
||||
p2.x -= distance;
|
||||
p1.z += distance + 1;
|
||||
p2.z -= distance;
|
||||
break;
|
||||
case SOUTH:
|
||||
p1.z += distance;
|
||||
p2.z += distance + 1;
|
||||
break;
|
||||
case NORTH:
|
||||
default:
|
||||
p1.z -= (distance - 1);
|
||||
p2.z -= distance;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (orientation) {
|
||||
case EAST:
|
||||
case WEST:
|
||||
p1.y += distance + 1;
|
||||
p2.y -= distance;
|
||||
p1.z += distance + 1;
|
||||
p2.z -= distance;
|
||||
break;
|
||||
case UP:
|
||||
p1.y += distance + 1;
|
||||
p2.y += distance;
|
||||
break;
|
||||
case DOWN:
|
||||
p1.y -= (distance - 1);
|
||||
p2.y -= distance;
|
||||
break;
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
default:
|
||||
p1.y += distance + 1;
|
||||
p2.y -= distance;
|
||||
p1.x += distance + 1;
|
||||
p2.x -= distance;
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
p1.y += distance + 1;
|
||||
p2.y -= distance;
|
||||
p1.z += distance + 1;
|
||||
p2.z -= distance;
|
||||
break;
|
||||
case UP:
|
||||
p1.y += distance + 1;
|
||||
p2.y += distance;
|
||||
break;
|
||||
case DOWN:
|
||||
p1.y -= (distance - 1);
|
||||
p2.y -= distance;
|
||||
break;
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
default:
|
||||
p1.y += distance + 1;
|
||||
p2.y -= distance;
|
||||
p1.x += distance + 1;
|
||||
p2.x -= distance;
|
||||
break;
|
||||
}
|
||||
|
||||
Position min = p1.min(p2);
|
||||
|
@ -146,9 +144,10 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
|
||||
@Override
|
||||
public void doWork(PowerHandler workProvider) {
|
||||
for (int j = 1; j < 5; ++j)
|
||||
for (int j = 1; j < 5; ++j) {
|
||||
if (trySucc(j))
|
||||
return;
|
||||
}
|
||||
|
||||
powerHandler.useEnergy(1, 1, true);
|
||||
}
|
||||
|
@ -162,7 +161,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
@SuppressWarnings("rawtypes")
|
||||
List list = container.worldObj.getEntitiesWithinAABB(Entity.class, box);
|
||||
|
||||
for (int g = 0; g < list.size(); g++)
|
||||
for (int g = 0; g < list.size(); g++) {
|
||||
if (list.get(g) instanceof Entity) {
|
||||
Entity entity = (Entity) list.get(g);
|
||||
|
||||
|
@ -185,12 +184,13 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack checkExtractGeneric(IInventory inventory, boolean doRemove, ForgeDirection from) {
|
||||
for (int k = 0; k < inventory.getSizeInventory(); ++k)
|
||||
for (int k = 0; k < inventory.getSizeInventory(); ++k) {
|
||||
if (inventory.getStackInSlot(k) != null && inventory.getStackInSlot(k).stackSize > 0) {
|
||||
|
||||
ItemStack slot = inventory.getStackInSlot(k);
|
||||
|
@ -201,6 +201,7 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
else
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -273,9 +274,10 @@ public class PipeItemsObsidian extends Pipe implements IPowerReceptor {
|
|||
if (item.getEntityItem().stackSize <= 0)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < entitiesDropped.length; ++i)
|
||||
for (int i = 0; i < entitiesDropped.length; ++i) {
|
||||
if (item.entityId == entitiesDropped[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return powerHandler.useEnergy(1, distance, false) >= distance;
|
||||
} else if (entity instanceof EntityArrow)
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsQuartz extends Pipe implements IPipeTransportItemsHook {
|
||||
|
||||
public PipeItemsQuartz(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsSandstone extends Pipe {
|
||||
|
||||
public PipeItemsSandstone(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsStone extends Pipe implements IPipeTransportItemsHook {
|
||||
|
||||
public PipeItemsStone(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.BuildCraftTransport;
|
||||
|
@ -24,7 +22,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeItemsVoid extends Pipe implements IItemTravelingHook {
|
||||
|
||||
public PipeItemsVoid(int itemID) {
|
||||
super(new PipeTransportItems(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportItems(), itemID);
|
||||
((PipeTransportItems) transport).travelHook = this;
|
||||
}
|
||||
|
||||
|
@ -54,5 +52,4 @@ public class PipeItemsVoid extends Pipe implements IItemTravelingHook {
|
|||
@Override
|
||||
public void endReached(PipeTransportItems pipe, EntityData data, TileEntity tile) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,22 +49,14 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
|
|||
}
|
||||
};
|
||||
|
||||
protected PipeItemsWood(PipeTransportItems transport, PipeLogic logic, int itemID) {
|
||||
super(transport, logic, itemID);
|
||||
public PipeItemsWood(int itemID) {
|
||||
super(new PipeTransportItems(), itemID);
|
||||
|
||||
powerHandler = new PowerHandler(this, Type.MACHINE);
|
||||
powerHandler.configure(1, 64, 1, 64);
|
||||
powerHandler.configurePowerPerdition(0, 0);
|
||||
}
|
||||
|
||||
protected PipeItemsWood(int itemID, PipeTransportItems transport) {
|
||||
this(transport, new PipeLogic(), itemID);
|
||||
}
|
||||
|
||||
public PipeItemsWood(int itemID) {
|
||||
this(itemID, new PipeTransportItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||
return logic.blockActivated(entityplayer);
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.transport.pipes;
|
||||
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Note: The entire PipeLogic framework will probably eventually disappear. Use
|
||||
* sparingly.
|
||||
*/
|
||||
public class PipeLogic {
|
||||
|
||||
public TileGenericPipe container;
|
||||
|
||||
public void setTile(TileGenericPipe tile) {
|
||||
this.container = tile;
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
}
|
||||
|
||||
/* PIPE LOGIC */
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
public void updateEntity() {
|
||||
}
|
||||
|
||||
public boolean blockActivated(EntityPlayer entityplayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
}
|
||||
|
||||
public void onBlockPlaced() {
|
||||
}
|
||||
|
||||
public boolean inputOpen(ForgeDirection from) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean outputOpen(ForgeDirection to) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -53,11 +53,6 @@ public abstract class PipeLogicWood {
|
|||
}
|
||||
|
||||
protected abstract boolean isValidFacing(ForgeDirection facing);
|
||||
//
|
||||
// private boolean isInput(TileEntity tile) {
|
||||
// return !(tile instanceof TileGenericPipe) && (tile instanceof IInventory || tile instanceof IFluidHandler)
|
||||
// && Utils.checkPipesConnections(pipe.container, tile);
|
||||
// }
|
||||
|
||||
public void initialize() {
|
||||
if (!CoreProxy.proxy.isRenderWorld(pipe.container.worldObj)) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipePowerCobblestone extends Pipe {
|
||||
|
||||
public PipePowerCobblestone(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
((PipeTransportPower) transport).initFromPipe(getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipePowerDiamond extends Pipe {
|
||||
|
||||
public PipePowerDiamond(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
((PipeTransportPower) transport).initFromPipe(getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipePowerGold extends Pipe {
|
||||
|
||||
public PipePowerGold(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
((PipeTransportPower) transport).initFromPipe(getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipePowerQuartz extends Pipe {
|
||||
|
||||
public PipePowerQuartz(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
((PipeTransportPower) transport).initFromPipe(getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipePowerStone extends Pipe {
|
||||
|
||||
public PipePowerStone(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
((PipeTransportPower) transport).initFromPipe(getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
|
|||
private boolean full;
|
||||
|
||||
public PipePowerWood(int itemID) {
|
||||
super(new PipeTransportPower(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportPower(), itemID);
|
||||
|
||||
powerHandler = new PowerHandler(this, Type.PIPE);
|
||||
initPowerProvider();
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public class PipeStructureCobblestone extends Pipe {
|
||||
|
||||
public PipeStructureCobblestone(int itemID) {
|
||||
super(new PipeTransportStructure(), new PipeLogic(), itemID);
|
||||
super(new PipeTransportStructure(), itemID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue