update
This commit is contained in:
parent
d5f75bd23e
commit
0d9946a4ce
8 changed files with 74 additions and 63 deletions
|
@ -7,4 +7,9 @@ import java.util.List;
|
|||
*/
|
||||
public interface IPathProvider {
|
||||
List<BlockIndex> getPath();
|
||||
|
||||
/**
|
||||
* Remove from the world all objects used to define the path.
|
||||
*/
|
||||
void removeFromWorld();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Please check the contents of the license, which should be located
|
||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||
*/
|
||||
@API(apiVersion = "1.6", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
package buildcraft.api.core;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
|
|
|
@ -14,11 +14,9 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import cofh.api.energy.IEnergyStorage;
|
||||
|
||||
import buildcraft.api.boards.RedstoneBoardRobot;
|
||||
import buildcraft.api.core.IZone;
|
||||
|
||||
|
|
|
@ -8,5 +8,7 @@
|
|||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
public interface IStripesPipe extends IPipe, IStripesActivator {
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler {
|
||||
}
|
||||
|
|
|
@ -13,3 +13,4 @@ Bugs fixed:
|
|||
* [#2948] Precise damage checking not working (asie)
|
||||
* Force/Forbid Robot statements not accepting lists (asie)
|
||||
* Hovering over slot causing incorrect item lighting (asie)
|
||||
* Tweaks to lens/filter behaviour to stop a pretty odd "lens/filter diode" bug (asie)
|
||||
|
|
|
@ -45,9 +45,13 @@ public class LensFilterHandler {
|
|||
if (sideColor >= 0 && otherColor != sideColor) {
|
||||
// Filter colors conflict - the side is unpassable
|
||||
continue;
|
||||
} else if (sideLensColor != -1 && sideColor != otherColor) {
|
||||
// The closer lens color differs from the further away filter color - the side is unpassable
|
||||
continue;
|
||||
} else if (sideLensColor >= 0) {
|
||||
// The closer lens color differs from the further away filter color - the side is unpassable OR treated as colorless
|
||||
if (sideLensColor == otherColor) {
|
||||
sideColor = -1;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
sideColor = otherColor;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public class PipeEventBus {
|
|||
|
||||
public PipeEventBus() {
|
||||
for (Object o : globalHandlers) {
|
||||
System.out.println("Registering " + o.getClass().getName());
|
||||
registerHandler(o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import buildcraft.api.transport.IStripesHandler;
|
|||
import buildcraft.api.transport.IStripesHandler.StripesHandlerType;
|
||||
import buildcraft.api.transport.IStripesPipe;
|
||||
import buildcraft.api.transport.PipeManager;
|
||||
import buildcraft.core.lib.RFBattery;
|
||||
import buildcraft.core.lib.inventory.InvUtils;
|
||||
import buildcraft.core.lib.utils.BlockUtils;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
@ -45,6 +46,7 @@ import buildcraft.transport.statements.ActionPipeDirection;
|
|||
import buildcraft.transport.utils.TransportUtils;
|
||||
|
||||
public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnergyHandler, IStripesPipe {
|
||||
private RFBattery battery = new RFBattery(320 * 50, 640, 0);
|
||||
private ForgeDirection actionDir = ForgeDirection.UNKNOWN;
|
||||
|
||||
public PipeItemsStripes(Item item) {
|
||||
|
@ -58,6 +60,59 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
|
|||
if (container.getWorldObj().isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (battery.getEnergyStored() >= 10) {
|
||||
ForgeDirection o = actionDir;
|
||||
if (o == ForgeDirection.UNKNOWN) {
|
||||
o = getOpenOrientation();
|
||||
}
|
||||
|
||||
if (o != ForgeDirection.UNKNOWN) {
|
||||
Position p = new Position(container.xCoord, container.yCoord,
|
||||
container.zCoord, o);
|
||||
p.moveForwards(1.0);
|
||||
|
||||
if (!BlockUtils.isUnbreakableBlock(getWorld(), (int) p.x, (int) p.y, (int) p.z)) {
|
||||
Block block = getWorld().getBlock((int) p.x, (int) p.y, (int) p.z);
|
||||
int metadata = getWorld().getBlockMetadata((int) p.x, (int) p.y, (int) p.z);
|
||||
|
||||
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, metadata);
|
||||
EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(),
|
||||
(int) p.x, (int) p.y, (int) p.z).get();
|
||||
|
||||
for (IStripesHandler handler : PipeManager.stripesHandlers) {
|
||||
if (handler.getType() == StripesHandlerType.BLOCK_BREAK
|
||||
&& handler.shouldHandle(stack)) {
|
||||
if (handler.handle(getWorld(), (int) p.x, (int) p.y, (int) p.z,
|
||||
o, stack, player, this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> stacks = block.getDrops(
|
||||
getWorld(), (int) p.x, (int) p.y, (int) p.z,
|
||||
metadata, 0
|
||||
);
|
||||
|
||||
if (stacks != null) {
|
||||
for (ItemStack s : stacks) {
|
||||
if (s != null) {
|
||||
sendItem(s, o.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getWorld().setBlockToAir((int) p.x, (int) p.y, (int) p.z);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void eventHandler(PipeEventItem.DropItem event) {
|
||||
|
@ -199,62 +254,7 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
|
|||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive,
|
||||
boolean simulate) {
|
||||
if (maxReceive == 0) {
|
||||
return 0;
|
||||
} else if (simulate) {
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
ForgeDirection o = actionDir;
|
||||
if (o == ForgeDirection.UNKNOWN) {
|
||||
o = getOpenOrientation();
|
||||
}
|
||||
|
||||
if (o != ForgeDirection.UNKNOWN) {
|
||||
Position p = new Position(container.xCoord, container.yCoord,
|
||||
container.zCoord, o);
|
||||
p.moveForwards(1.0);
|
||||
|
||||
if (!BlockUtils.isUnbreakableBlock(getWorld(), (int) p.x, (int) p.y, (int) p.z)) {
|
||||
Block block = getWorld().getBlock((int) p.x, (int) p.y, (int) p.z);
|
||||
int metadata = getWorld().getBlockMetadata((int) p.x, (int) p.y, (int) p.z);
|
||||
|
||||
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, metadata);
|
||||
EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(),
|
||||
(int) p.x, (int) p.y, (int) p.z).get();
|
||||
|
||||
for (IStripesHandler handler : PipeManager.stripesHandlers) {
|
||||
if (handler.getType() == StripesHandlerType.BLOCK_BREAK
|
||||
&& handler.shouldHandle(stack)) {
|
||||
if (handler.handle(getWorld(), (int) p.x, (int) p.y, (int) p.z,
|
||||
o, stack, player, this)) {
|
||||
return maxReceive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> stacks = block.getDrops(
|
||||
getWorld(), (int) p.x, (int) p.y, (int) p.z,
|
||||
metadata, 0
|
||||
);
|
||||
|
||||
if (stacks != null) {
|
||||
for (ItemStack s : stacks) {
|
||||
if (s != null) {
|
||||
sendItem(s, o.getOpposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getWorld().setBlockToAir((int) p.x, (int) p.y, (int) p.z);
|
||||
}
|
||||
}
|
||||
|
||||
return maxReceive;
|
||||
return battery.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue