This commit is contained in:
asiekierka 2014-10-26 09:40:16 +01:00
parent 0fe11813e8
commit 7a542e2102
4 changed files with 28 additions and 8 deletions

View file

@ -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());
}
}
}

View file

@ -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<T extends PipeTransport> implements IDropControlInven
transport.dropContents();
}
public List<ItemStack> getDroppedItems() {
return transport.getDroppedItems();
}
/**
* If this pipe is open on one side, return it.
*/

View file

@ -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 {
@ -115,6 +116,10 @@ public abstract class PipeTransport {
public void dropContents() {
}
public List<ItemStack> getDroppedItems() {
return new ArrayList<ItemStack>();
}
public void sendDescriptionPacket() {
}

View file

@ -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;
@ -527,6 +526,20 @@ public class PipeTransportItems extends PipeTransport {
items.clear();
}
public List<ItemStack> getDroppedItems() {
groupEntities();
ArrayList<ItemStack> itemsDropped = new ArrayList<ItemStack>(items.size());
for (TravelingItem item : items) {
if (!item.isCorrupted()) {
itemsDropped.add(item.getItemStack());
}
}
return itemsDropped;
}
@Override
public boolean delveIntoUnloadedChunks() {
return true;