mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 07:35:47 +00:00
Fix #1561 Crash when using the carpenter
This commit is contained in:
1 parent
bb0a0343c1
commit
0b491f26fc
5 files changed
+16
-7
No files matched your search
@@ -6,6 +6,7 @@
|
||||
package forestry.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
@@ -33,5 +34,8 @@ public interface IDescriptiveRecipe {
|
||||
|
||||
NonNullList<String> getOreDicts();
|
||||
|
||||
ItemStack getRecipeOutput();
|
||||
/**
|
||||
* Must not be named the same as {@link IRecipe#getRecipeOutput()} to avoid obfuscation for recipes that implement both.
|
||||
*/
|
||||
ItemStack getOutput();
|
||||
}
|
||||
@@ -148,6 +148,11 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
|
||||
return oreDicts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput() {
|
||||
return getRecipeOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterReci
|
||||
ingredients.setInputs(FluidStack.class, Collections.singletonList(fluidResource));
|
||||
}
|
||||
|
||||
ItemStack recipeOutput = craftingGridRecipe.getRecipeOutput();
|
||||
ItemStack recipeOutput = craftingGridRecipe.getOutput();
|
||||
ingredients.setOutput(ItemStack.class, recipeOutput);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
setTicksPerWorkCycle(recipeTime * TICKS_PER_RECIPE_TIME);
|
||||
setEnergyPerWorkCycle(recipeTime * ENERGY_PER_RECIPE_TIME);
|
||||
|
||||
ItemStack craftingResult = currentRecipe.getCraftingGridRecipe().getRecipeOutput();
|
||||
ItemStack craftingResult = currentRecipe.getCraftingGridRecipe().getOutput();
|
||||
craftPreviewInventory.setInventorySlotContents(0, craftingResult);
|
||||
} else {
|
||||
craftPreviewInventory.setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
@@ -144,7 +144,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
}
|
||||
|
||||
if (currentRecipe != null) {
|
||||
ItemStack pendingProduct = currentRecipe.getCraftingGridRecipe().getRecipeOutput();
|
||||
ItemStack pendingProduct = currentRecipe.getCraftingGridRecipe().getOutput();
|
||||
InventoryUtil.tryAddStack(this, pendingProduct, InventoryCarpenter.SLOT_PRODUCT, InventoryCarpenter.SLOT_PRODUCT_COUNT, true);
|
||||
}
|
||||
return true;
|
||||
@@ -158,7 +158,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
FluidStack fluid = currentRecipe.getFluidResource();
|
||||
if (fluid != null) {
|
||||
FluidStack drained = resourceTank.drainInternal(fluid, false);
|
||||
if (!drained.isFluidStackIdentical(fluid)) {
|
||||
if (!fluid.isFluidStackIdentical(drained)) {
|
||||
return false;
|
||||
}
|
||||
if (doRemove) {
|
||||
@@ -205,7 +205,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
hasLiquidResources = removeLiquidResources(false);
|
||||
hasItemResources = removeItemResources(false);
|
||||
|
||||
ItemStack pendingProduct = currentRecipe.getCraftingGridRecipe().getRecipeOutput();
|
||||
ItemStack pendingProduct = currentRecipe.getCraftingGridRecipe().getOutput();
|
||||
canAdd = InventoryUtil.tryAddStack(this, pendingProduct, InventoryCarpenter.SLOT_PRODUCT, InventoryCarpenter.SLOT_PRODUCT_COUNT, true, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -756,7 +756,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
@Override
|
||||
public boolean hasLiquid(FluidStack liquid) {
|
||||
FluidStack drained = resourceTank.drainInternal(liquid, false);
|
||||
return drained.isFluidStackIdentical(liquid);
|
||||
return liquid.isFluidStackIdentical(drained);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user