From 7a542e21025f38156b480e9b6c75c6b2b7a0db4b Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sun, 26 Oct 2014 09:40:16 +0100 Subject: [PATCH] try to fix #1995 --- .../buildcraft/transport/BlockGenericPipe.java | 2 +- common/buildcraft/transport/Pipe.java | 8 +++++--- common/buildcraft/transport/PipeTransport.java | 9 +++++++-- .../transport/PipeTransportItems.java | 17 +++++++++++++++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index 3de2c006..37b2ecf3 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -579,8 +579,8 @@ public class BlockGenericPipe extends BlockBuildCraft { if (pipe != null) { if (pipe.item != null) { - pipe.dropContents(); list.add(new ItemStack(pipe.item, 1, pipe.container.getItemMetadata())); + list.addAll(pipe.getDroppedItems()); } } } diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index a03f009d..dd9ea947 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.Random; @@ -25,12 +26,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.WorldSettings.GameType; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - import net.minecraftforge.common.util.ForgeDirection; - import buildcraft.BuildCraftTransport; import buildcraft.api.core.IIconProvider; import buildcraft.api.gates.ActionState; @@ -590,6 +588,10 @@ public abstract class Pipe implements IDropControlInven transport.dropContents(); } + public List getDroppedItems() { + return transport.getDroppedItems(); + } + /** * If this pipe is open on one side, return it. */ diff --git a/common/buildcraft/transport/PipeTransport.java b/common/buildcraft/transport/PipeTransport.java index 145c66b3..0c6e12f7 100644 --- a/common/buildcraft/transport/PipeTransport.java +++ b/common/buildcraft/transport/PipeTransport.java @@ -8,14 +8,15 @@ */ package buildcraft.transport; +import java.util.ArrayList; import java.util.BitSet; +import java.util.List; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; - import net.minecraftforge.common.util.ForgeDirection; - import buildcraft.api.transport.IPipeTile.PipeType; public abstract class PipeTransport { @@ -114,6 +115,10 @@ public abstract class PipeTransport { public void dropContents() { } + + public List getDroppedItems() { + return new ArrayList(); + } public void sendDescriptionPacket() { } diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index fe1fb184..354d1ba6 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -8,6 +8,7 @@ */ package buildcraft.transport; +import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; import java.util.LinkedList; @@ -22,10 +23,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; - import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.ForgeDirection; - import buildcraft.BuildCraftTransport; import buildcraft.api.core.BCLog; import buildcraft.api.core.Position; @@ -526,6 +525,20 @@ public class PipeTransportItems extends PipeTransport { items.clear(); } + + public List getDroppedItems() { + groupEntities(); + + ArrayList itemsDropped = new ArrayList(items.size()); + + for (TravelingItem item : items) { + if (!item.isCorrupted()) { + itemsDropped.add(item.getItemStack()); + } + } + + return itemsDropped; + } @Override public boolean delveIntoUnloadedChunks() {