Merge branch '6.4.x' of github.com:BuildCraft/BuildCraft into 6.5.x
Conflicts: build.gradle common/buildcraft/core/recipes/FlexibleRecipe.java
This commit is contained in:
commit
5de8bb327b
3 changed files with 64 additions and 4 deletions
8
buildcraft_resources/changelog/6.4.8
Normal file
8
buildcraft_resources/changelog/6.4.8
Normal file
|
@ -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)
|
|
@ -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
|
||||
|
|
|
@ -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<T> implements IFlexibleRecipe<T>, 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<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
|
|||
}
|
||||
|
||||
@Override
|
||||
public CraftingResult<T> craft(IFlexibleCrafter crafter, boolean preview) {
|
||||
public CraftingResult<T> craft(IFlexibleCrafter baseCrafter, boolean preview) {
|
||||
if (output == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IFlexibleCrafter crafter = baseCrafter;
|
||||
if (preview) {
|
||||
crafter = new PreviewCrafter(baseCrafter);
|
||||
}
|
||||
|
||||
CraftingResult<T> result = new CraftingResult<T>();
|
||||
|
||||
result.recipe = this;
|
||||
|
@ -107,7 +159,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, 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<T> implements IFlexibleRecipe<T>, 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue