diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index 1b750539..64f35e00 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -88,6 +88,8 @@ public class BuildCraftCore { public static boolean dropBrokenBlocks = true; // Set to false to prevent the filler from dropping broken blocks. + public static int itemLifespan = 1200; + public static int updateFactor = 10; public static BuildCraftConfiguration mainConfiguration; @@ -164,17 +166,23 @@ public class BuildCraftCore { stripesLaserTexture = 0 * 16 + 3; transparentTexture = 0 * 16 + 0; - Property continuousCurrent = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"current.continuous", DefaultProps.CURRENT_CONTINUOUS); + Property continuousCurrent = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "current.continuous", DefaultProps.CURRENT_CONTINUOUS); continuousCurrent.comment = "set to true for allowing machines to be driven by continuous current"; continuousCurrentModel = continuousCurrent.getBoolean(DefaultProps.CURRENT_CONTINUOUS); - Property trackNetwork = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"trackNetworkUsage", false); + Property trackNetwork = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "trackNetworkUsage", false); trackNetworkUsage = trackNetwork.getBoolean(false); Property dropBlock = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"dropBrokenBlocks", true); dropBlock.comment = "set to false to prevent fillers from dropping blocks."; dropBrokenBlocks = dropBlock.getBoolean(true); + Property lifespan = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "itemLifespan", itemLifespan); + lifespan.comment = "the lifespan in ticks of items dropped on the ground by pipes and machines, vanilla = 6000, default = 1200"; + itemLifespan = lifespan.getInt(itemLifespan); + if(itemLifespan < 100) + itemLifespan = 100; + Property powerFrameworkClass = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"power.framework", "buildcraft.energy.PneumaticPowerFramework"); Property factor = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"network.updateFactor", 10); diff --git a/common/buildcraft/core/EntityPassiveItem.java b/common/buildcraft/core/EntityPassiveItem.java index fbc03cff..2b361b8c 100644 --- a/common/buildcraft/core/EntityPassiveItem.java +++ b/common/buildcraft/core/EntityPassiveItem.java @@ -304,6 +304,9 @@ public class EntityPassiveItem implements IPipedItem { EntityItem entityitem = new EntityItem(worldObj, position.x, position.y, position.z, getItemStack()); + entityitem.lifespan = BuildCraftCore.itemLifespan; + entityitem.delayBeforeCanPickup = 10; + float f3 = 0.00F + worldObj.rand.nextFloat() * 0.04F - 0.02F; entityitem.motionX = (float) worldObj.rand.nextGaussian() * f3 + motion.x; entityitem.motionY = (float) worldObj.rand.nextGaussian() * f3 + motion.y; @@ -311,7 +314,6 @@ public class EntityPassiveItem implements IPipedItem { worldObj.spawnEntityInWorld(entityitem); remove(); - entityitem.delayBeforeCanPickup = 20; return entityitem; } else { return null; diff --git a/common/buildcraft/core/utils/BlockUtil.java b/common/buildcraft/core/utils/BlockUtil.java index 8837329a..686479d6 100644 --- a/common/buildcraft/core/utils/BlockUtil.java +++ b/common/buildcraft/core/utils/BlockUtil.java @@ -34,8 +34,22 @@ public class BlockUtil { public static void breakBlock(World world, int x, int y, int z) { int blockId = world.getBlockId(x, y, z); - if (blockId != 0 && BuildCraftCore.dropBrokenBlocks) - Block.blocksList[blockId].dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + if (blockId != 0 && BuildCraftCore.dropBrokenBlocks && !world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) { + List items = getBlockDropped(world, x, y, z, world.getBlockMetadata(x, y, z), 0); + + for (ItemStack item : items) { + float var = 0.7F; + double dx = world.rand.nextFloat() * var + (1.0F - var) * 0.5D; + double dy = world.rand.nextFloat() * var + (1.0F - var) * 0.5D; + double dz = world.rand.nextFloat() * var + (1.0F - var) * 0.5D; + EntityItem entityitem = new EntityItem(world, x + dx, y + dy, z + dz, item); + + entityitem.lifespan = BuildCraftCore.itemLifespan; + entityitem.delayBeforeCanPickup = 10; + + world.spawnEntityInWorld(entityitem); + } + } world.setBlockWithNotify(x, y, z, 0); } diff --git a/common/buildcraft/factory/TileMiningWell.java b/common/buildcraft/factory/TileMiningWell.java index 1afb6012..8dac4d7f 100644 --- a/common/buildcraft/factory/TileMiningWell.java +++ b/common/buildcraft/factory/TileMiningWell.java @@ -93,6 +93,9 @@ public class TileMiningWell extends TileMachine implements IMachine, IPowerRecep EntityItem entityitem = new EntityItem(world, xCoord + f, yCoord + f1 + 0.5F, zCoord + f2, stack); + entityitem.lifespan = BuildCraftCore.itemLifespan; + entityitem.delayBeforeCanPickup = 10; + float f3 = 0.05F; entityitem.motionX = (float) world.rand.nextGaussian() * f3; entityitem.motionY = (float) world.rand.nextGaussian() * f3 + 1.0F; diff --git a/common/buildcraft/factory/TileQuarry.java b/common/buildcraft/factory/TileQuarry.java index dd15a54a..aa7e84cd 100644 --- a/common/buildcraft/factory/TileQuarry.java +++ b/common/buildcraft/factory/TileQuarry.java @@ -390,7 +390,7 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, // Collect any lost items laying around double[] head = getHead(); - AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(head[0] - 1.5, head[1], head[2] - 1.5, head[0] + 2.5, head[1] + 2.5, head[2] + 2.5); + AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(head[0] - 2, head[1] - 2, head[2] - 2, head[0] + 3, head[1] + 3, head[2] + 3); List result = worldObj.getEntitiesWithinAABB(EntityItem.class, axis); for (int ii = 0; ii < result.size(); ii++) { if (result.get(ii) instanceof EntityItem) { @@ -422,6 +422,9 @@ public class TileQuarry extends TileMachine implements IMachine, IPowerReceptor, EntityItem entityitem = new EntityItem(worldObj, xCoord + f, yCoord + f1 + 0.5F, zCoord + f2, stack); + entityitem.lifespan = BuildCraftCore.itemLifespan; + entityitem.delayBeforeCanPickup = 10; + float f3 = 0.05F; entityitem.motionX = (float) worldObj.rand.nextGaussian() * f3; entityitem.motionY = (float) worldObj.rand.nextGaussian() * f3 + 1.0F; diff --git a/common/buildcraft/transport/PipeTransportItems.java b/common/buildcraft/transport/PipeTransportItems.java index 13818784..d60d6161 100644 --- a/common/buildcraft/transport/PipeTransportItems.java +++ b/common/buildcraft/transport/PipeTransportItems.java @@ -360,7 +360,7 @@ public class PipeTransportItems extends PipeTransport { entity.setContainer(container); EntityData data = new EntityData(entity, ForgeDirection.values()[dataTag.getInteger("input")]); - data.output = ForgeDirection.values()[dataTag.getInteger("output")]; + data.output = ForgeDirection.getOrientation(dataTag.getInteger("output")); data.toCenter = dataTag.getBoolean("toCenter"); entitiesToLoad.add(data);