diff --git a/common/buildcraft/transport/pipes/PipeItemsStripes.java b/common/buildcraft/transport/pipes/PipeItemsStripes.java index a09a0d35..9ac0f3b1 100644 --- a/common/buildcraft/transport/pipes/PipeItemsStripes.java +++ b/common/buildcraft/transport/pipes/PipeItemsStripes.java @@ -104,6 +104,7 @@ public class PipeItemsStripes extends Pipe implements IEnerg && handler.shouldHandle(stack)) { if (handler.handle(getWorld(), (int) p.x, (int) p.y, (int) p.z, event.direction, stack, player, this)) { + event.entity = null; return; } } diff --git a/common/buildcraft/transport/stripes/StripesHandlerArrow.java b/common/buildcraft/transport/stripes/StripesHandlerArrow.java index cdcb9db0..132cb364 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerArrow.java +++ b/common/buildcraft/transport/stripes/StripesHandlerArrow.java @@ -27,7 +27,6 @@ public class StripesHandlerArrow implements IStripesHandler { public boolean handle(World world, int x, int y, int z, ForgeDirection direction, ItemStack stack, EntityPlayer player, IStripesPipe pipe) { - stack.stackSize--; EntityArrow entityArrow = new EntityArrow(world, player, 0); entityArrow.setPosition(x + 0.5d, y + 0.5d, z + 0.5d); @@ -38,6 +37,11 @@ public class StripesHandlerArrow implements IStripesHandler { entityArrow.motionZ = direction.offsetZ * 1.8d + world.rand.nextGaussian() * 0.007499999832361937D; world.spawnEntityInWorld(entityArrow); + stack.stackSize--; + if (stack.stackSize > 0) { + pipe.sendItem(stack, direction.getOpposite()); + } + return true; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerBucket.java b/common/buildcraft/transport/stripes/StripesHandlerBucket.java index c460f927..b2dd9e3b 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerBucket.java +++ b/common/buildcraft/transport/stripes/StripesHandlerBucket.java @@ -39,8 +39,11 @@ public class StripesHandlerBucket implements IStripesHandler { Block underblock = world.getBlock(x, y - 1, z); if (((ItemBucket) stack.getItem()).tryPlaceContainedLiquid(world, x, y - 1, z)) { - stack.stackSize = 0; pipe.sendItem(emptyBucket, direction.getOpposite()); + stack.stackSize--; + if(stack.stackSize > 0) { + pipe.sendItem(stack, direction.getOpposite()); + } return true; } else { @@ -63,14 +66,15 @@ public class StripesHandlerBucket implements IStripesHandler { if (filledBucket != null) { world.setBlockToAir(x, y - 1, z); - stack.stackSize = 0; pipe.sendItem(filledBucket, direction.getOpposite()); + stack.stackSize--; + if(stack.stackSize > 0) { + pipe.sendItem(stack, direction.getOpposite()); + } return true; } } - - return false; } return false; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerPipes.java b/common/buildcraft/transport/stripes/StripesHandlerPipes.java index 43f6987f..77460f76 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerPipes.java +++ b/common/buildcraft/transport/stripes/StripesHandlerPipes.java @@ -74,11 +74,9 @@ public class StripesHandlerPipes implements IStripesHandler { pipeTile.pipe.container.pipe = newPipe; pipeTile.updateEntity(); // Needed so that the tile does computeConnections() - ItemStack transportStack = stack.copy(); - stack.stackSize = 0; - transportStack.stackSize--; - if (transportStack.stackSize > 0) { - pipeTile.pipe.container.injectItem(transportStack, true, direction.getOpposite()); + stack.stackSize--; + if (stack.stackSize > 0) { + pipeTile.pipe.container.injectItem(stack, true, direction.getOpposite()); } return true; diff --git a/common/buildcraft/transport/stripes/StripesHandlerRightClick.java b/common/buildcraft/transport/stripes/StripesHandlerRightClick.java index 99b05acc..75511144 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerRightClick.java +++ b/common/buildcraft/transport/stripes/StripesHandlerRightClick.java @@ -29,7 +29,8 @@ public class StripesHandlerRightClick implements IStripesHandler { public boolean handle(World world, int x, int y, int z, ForgeDirection direction, ItemStack stack, EntityPlayer player, IStripesPipe pipe) { - stack.getItem().onItemRightClick(stack, world, player); + ItemStack remainingStack = stack.getItem().onItemRightClick(stack, world, player); + pipe.sendItem(remainingStack, direction.getOpposite()); return true; } diff --git a/common/buildcraft/transport/stripes/StripesHandlerShears.java b/common/buildcraft/transport/stripes/StripesHandlerShears.java index 342d03e3..a695b060 100644 --- a/common/buildcraft/transport/stripes/StripesHandlerShears.java +++ b/common/buildcraft/transport/stripes/StripesHandlerShears.java @@ -1,12 +1,16 @@ package buildcraft.transport.stripes; +import java.util.List; + import net.minecraft.block.Block; -import net.minecraft.block.BlockLeavesBase; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemShears; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; import net.minecraftforge.common.util.ForgeDirection; import buildcraft.api.transport.IStripesHandler; @@ -30,11 +34,20 @@ public class StripesHandlerShears implements IStripesHandler { IStripesPipe pipe) { Block block = world.getBlock(x, y, z); - if (block instanceof BlockLeavesBase) { - world.playSoundEffect(x, y, z, Block.soundTypeGrass.getBreakSound(), 1, 1); - world.setBlockToAir(x, y, z); - stack.damageItem(1, player); - return true; + if (block instanceof IShearable) { + IShearable shearableBlock = (IShearable)block; + if(shearableBlock.isShearable(stack, world, x, y, z)) { + world.playSoundEffect(x, y, z, Block.soundTypeGrass.getBreakSound(), 1, 1); + List drops = shearableBlock.onSheared(stack, world, x, y, z, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + world.setBlockToAir(x, y, z); + stack.damageItem(1, player); + pipe.sendItem(stack, direction.getOpposite()); + for (ItemStack dropStack : drops) { + pipe.sendItem(dropStack, direction.getOpposite()); + } + return true; + } } return false;