diff --git a/buildcraft_resources/changelog/6.4.8 b/buildcraft_resources/changelog/6.4.8 new file mode 100644 index 00000000..ca3689a4 --- /dev/null +++ b/buildcraft_resources/changelog/6.4.8 @@ -0,0 +1,8 @@ +Improvements: +* Pipes are now much more conservative about causing chunk re-renders (asie) +* Rewrote fluid extraction pipe code to be more controllable (asie) +* The [BuildCraft] fake player UUID is now output to console logs (asie) + +Bugs fixed: +* [#2616] Crash in specific usages of the Assembly Table (asie, TheLoneWolfling) +* Robots change color after picking up a leaf block (hea3ven) diff --git a/buildcraft_resources/versions.txt b/buildcraft_resources/versions.txt index 69b4b98b..acbd65eb 100755 --- a/buildcraft_resources/versions.txt +++ b/buildcraft_resources/versions.txt @@ -1,3 +1,3 @@ 1.6.4:BuildCraft:4.2.2 1.7.2:BuildCraft:6.0.16 -1.7.10:BuildCraft:6.4.7 +1.7.10:BuildCraft:6.4.8 diff --git a/common/buildcraft/core/recipes/FlexibleRecipe.java b/common/buildcraft/core/recipes/FlexibleRecipe.java index 2a80979a..3ddc101b 100644 --- a/common/buildcraft/core/recipes/FlexibleRecipe.java +++ b/common/buildcraft/core/recipes/FlexibleRecipe.java @@ -20,11 +20,58 @@ import buildcraft.api.recipes.CraftingResult; import buildcraft.api.recipes.IFlexibleCrafter; import buildcraft.api.recipes.IFlexibleRecipe; import buildcraft.api.recipes.IFlexibleRecipeViewable; +import buildcraft.core.lib.inventory.SimpleInventory; import buildcraft.core.lib.inventory.StackHelper; import buildcraft.core.lib.inventory.filters.ArrayStackFilter; import buildcraft.core.lib.inventory.filters.IStackFilter; public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeViewable { + private class PreviewCrafter implements IFlexibleCrafter { + private final SimpleInventory inventory; + private final IFlexibleCrafter crafter; + + // TODO: Make a safe copy of fluids too + public PreviewCrafter(IFlexibleCrafter crafter) { + this.crafter = crafter; + this.inventory = new SimpleInventory(crafter.getCraftingItemStackSize(), "Preview", 64); + for (int i = 0; i < inventory.getSizeInventory(); i++) { + ItemStack s = crafter.getCraftingItemStack(i); + if (s != null) { + inventory.setInventorySlotContents(i, s.copy()); + } + } + } + + @Override + public int getCraftingItemStackSize() { + return inventory.getSizeInventory(); + } + + @Override + public ItemStack getCraftingItemStack(int slotid) { + return inventory.getStackInSlot(slotid); + } + + @Override + public ItemStack decrCraftingItemStack(int slotid, int val) { + return inventory.decrStackSize(slotid, val); + } + + @Override + public FluidStack getCraftingFluidStack(int tankid) { + return crafter.getCraftingFluidStack(tankid); + } + + @Override + public FluidStack decrCraftingFluidStack(int tankid, int val) { + return crafter.decrCraftingFluidStack(tankid, val); + } + + @Override + public int getCraftingFluidStackSize() { + return crafter.getCraftingFluidStackSize(); + } + } public int energyCost = 0; public long craftingTime = 0; public String id; @@ -92,11 +139,16 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie } @Override - public CraftingResult craft(IFlexibleCrafter crafter, boolean preview) { + public CraftingResult craft(IFlexibleCrafter baseCrafter, boolean preview) { if (output == null) { return null; } + IFlexibleCrafter crafter = baseCrafter; + if (preview) { + crafter = new PreviewCrafter(baseCrafter); + } + CraftingResult result = new CraftingResult(); result.recipe = this; @@ -107,7 +159,7 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie IStackFilter filter = new ArrayStackFilter(requirement); int amount = requirement.stackSize; - if (consumeItems(crafter, result, filter, amount, preview) != 0) { + if (consumeItems(crafter, result, filter, amount, false) != 0) { return null; } } @@ -118,7 +170,7 @@ public class FlexibleRecipe implements IFlexibleRecipe, IFlexibleRecipeVie IStackFilter filter = new ArrayStackFilter(requirements.toArray(new ItemStack[requirements.size()])); int amount = requirements.get(0).stackSize; - if (consumeItems(crafter, result, filter, amount, preview) != 0) { + if (consumeItems(crafter, result, filter, amount, false) != 0) { return null; } }