Created
July 26, 2011 20:51
-
-
Save Flow86/1107981 to your computer and use it in GitHub Desktop.
fixed a possible crash and added possibility to "soak" in items which will be dropped on framebuilding otherwise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src\minecraft\net\minecraft\src\buildcraft\factory\TileQuarry.java Wed Jul 20 00:03:29 2011 | |
+++ src\minecraft\net\minecraft\src\buildcraft\factory\TileQuarry.java Tue Jul 26 22:46:55 2011 | |
@@ -153,11 +153,30 @@ | |
powerProvider.timeTracker.markTime(worldObj); | |
BlockContents contents = bluePrintBuilder.findNextBlock(worldObj); | |
- int blockId = worldObj.getBlockId(contents.x, contents.y, contents.z); | |
- | |
if (contents != null) { | |
+ int blockId = worldObj.getBlockId(contents.x, contents.y, contents.z); | |
+ | |
if (!Utils.softBlock(blockId)) { | |
- Utils.breakBlock (worldObj, contents.x, contents.y, contents.z); | |
+ ItemStack stack = BuildCraftBlockUtil.getItemStackFromBlock(worldObj, contents.x, contents.y, contents.z); | |
+ | |
+ boolean added = false; | |
+ if (stack != null) { | |
+ // First, try to add to a nearby chest | |
+ | |
+ StackUtil stackUtils = new StackUtil(stack); | |
+ | |
+ added = stackUtils.addToRandomInventory(this, Orientations.Unknown); | |
+ | |
+ if (!added || stackUtils.items.stackSize > 0) { | |
+ added = Utils.addToRandomPipeEntry(this, Orientations.Unknown, stackUtils.items); | |
+ } | |
+ } | |
+ | |
+ if(added) | |
+ worldObj.setBlockWithNotify(contents.x, contents.y, contents.z, 0); | |
+ else | |
+ Utils.breakBlock(worldObj, contents.x, contents.y, contents.z); | |
+ | |
} else if (contents.blockId != 0) { | |
worldObj.setBlockWithNotify(contents.x, contents.y, contents.z, | |
contents.blockId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment