From 903ec1c107e7d7ba320e6af4e56c95ff418c93a4 Mon Sep 17 00:00:00 2001 From: AEnterprise Date: Sun, 14 Sep 2014 13:16:27 +0200 Subject: [PATCH 1/2] fix blueprint not dropping form construction marker fix construction marker accepting more then 1 blueprint --- .../builders/BlockConstructionMarker.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/common/buildcraft/builders/BlockConstructionMarker.java b/common/buildcraft/builders/BlockConstructionMarker.java index 04af9b43..59a36b2e 100755 --- a/common/buildcraft/builders/BlockConstructionMarker.java +++ b/common/buildcraft/builders/BlockConstructionMarker.java @@ -11,6 +11,7 @@ package buildcraft.builders; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -37,6 +38,17 @@ public class BlockConstructionMarker extends BlockMarker { @Override public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); + TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); + if (marker != null && marker.itemBlueprint != null) { + float f1 = 0.7F; + double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; + double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; + double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; + EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); + itemToDrop.delayBeforeCanPickup = 10; + if (!world.isRemote) + world.spawnEntityInWorld(itemToDrop); + } super.breakBlock(world, x, y, z, block, par6); } @@ -72,8 +84,15 @@ public class BlockConstructionMarker extends BlockMarker { if (equipped instanceof ItemBlueprint) { if (marker.itemBlueprint == null) { - marker.setBlueprint(entityplayer.inventory.getCurrentItem().copy()); - entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); + ItemStack stack = entityplayer.inventory.getCurrentItem().copy(); + stack.stackSize = 1; + marker.setBlueprint(stack); + stack = null; + if (entityplayer.inventory.getCurrentItem().stackSize > 1) { + stack = entityplayer.getCurrentEquippedItem().copy(); + stack.stackSize = entityplayer.getCurrentEquippedItem().stackSize - 1; + } + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, stack); return true; } From 1ef8640417c8981b15070a45e82567dac1f96e2a Mon Sep 17 00:00:00 2001 From: AEnterprise Date: Sun, 14 Sep 2014 15:15:44 +0200 Subject: [PATCH 2/2] no need to compute item if not droped --- common/buildcraft/builders/BlockConstructionMarker.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/buildcraft/builders/BlockConstructionMarker.java b/common/buildcraft/builders/BlockConstructionMarker.java index 59a36b2e..11ab3f60 100755 --- a/common/buildcraft/builders/BlockConstructionMarker.java +++ b/common/buildcraft/builders/BlockConstructionMarker.java @@ -39,15 +39,14 @@ public class BlockConstructionMarker extends BlockMarker { public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); - if (marker != null && marker.itemBlueprint != null) { + if (marker != null && marker.itemBlueprint != null && !world.isRemote) { float f1 = 0.7F; double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); itemToDrop.delayBeforeCanPickup = 10; - if (!world.isRemote) - world.spawnEntityInWorld(itemToDrop); + world.spawnEntityInWorld(itemToDrop); } super.breakBlock(world, x, y, z, block, par6); }