From 1f9280c4b4d126908f104934928c68f2df4eba38 Mon Sep 17 00:00:00 2001 From: asiekierka Date: Mon, 6 Apr 2015 20:00:04 +0200 Subject: [PATCH 1/2] fix #2616 --- .../core/recipes/FlexibleRecipe.java | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/common/buildcraft/core/recipes/FlexibleRecipe.java b/common/buildcraft/core/recipes/FlexibleRecipe.java index 98ac2193..2f196bed 100644 --- a/common/buildcraft/core/recipes/FlexibleRecipe.java +++ b/common/buildcraft/core/recipes/FlexibleRecipe.java @@ -23,11 +23,58 @@ import buildcraft.api.recipes.CraftingResult; import buildcraft.api.recipes.IFlexibleCrafter; import buildcraft.api.recipes.IFlexibleRecipe; import buildcraft.api.recipes.IFlexibleRecipeViewable; +import buildcraft.core.inventory.SimpleInventory; import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.filters.ArrayStackFilter; import buildcraft.core.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; @@ -95,11 +142,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; @@ -110,7 +162,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; } } @@ -121,7 +173,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; } } From 180a020fc71d28e50f8c1ae99e7791db2c0641d5 Mon Sep 17 00:00:00 2001 From: asiekierka Date: Mon, 6 Apr 2015 21:20:34 +0200 Subject: [PATCH 2/2] BuildCraft 6.4.8 --- build.gradle | 2 +- buildcraft_resources/changelog/6.4.8 | 8 ++++++++ buildcraft_resources/versions.txt | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 buildcraft_resources/changelog/6.4.8 diff --git a/build.gradle b/build.gradle index 4e082920..c739bc1a 100755 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ apply plugin: 'forge' // adds the forge dependency apply plugin: 'maven' // for uploading to a maven repo apply plugin: 'checkstyle' -version = "6.4.7" +version = "6.4.8" group= "com.mod-buildcraft" archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] 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