diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 45f52504c..978c43169 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -844,13 +844,13 @@ a63b57c27d8548ddd13d64d18b098d4f5c127a30 data/actuallyadditions/recipes/restonia 85d2537a973d520c9eaaf2f15109c265faa2df3a data/actuallyadditions/recipes/rice_slime_potion.json d4ca5d77d16ff6fdfc60e665694fdd97bce25463 data/actuallyadditions/recipes/shock_suppressor.json 655fab699bb97ec252deb61d91fbef6f4738fe1c data/actuallyadditions/recipes/single_battery.json -cc4cd7379a8de3372d2a8310ea576bf5ca08c20e data/actuallyadditions/recipes/solid_fuel/charcoal-block.json -8cb9b0e94a5de6e0bb74d808207ddf041d444280 data/actuallyadditions/recipes/solid_fuel/charcoal.json -1207208a8393f613e537cb4542e1766a837282e4 data/actuallyadditions/recipes/solid_fuel/coal-block.json -3a4c2b0ca2e150ef24edb2defe018f6574cb4827 data/actuallyadditions/recipes/solid_fuel/coal.json -a7488a05a2fbc4e4017a4b7769f65ff8ce48613a data/actuallyadditions/recipes/solid_fuel/lava.json -5bf07f52f8a4b7734a800dc64e5759caf48257b9 data/actuallyadditions/recipes/solid_fuel/stick.json -1234e59cf88f96ae64032ce6bb0c734dc8870471 data/actuallyadditions/recipes/solid_fuel/tiny-coal.json +dcf0bf28f7be72a9d65b7d34626d1a211c97365a data/actuallyadditions/recipes/solid_fuel/charcoal-block.json +000ef9362f2202191f74132c3079ec4c1e2bfec8 data/actuallyadditions/recipes/solid_fuel/charcoal.json +64211ff8cd4ae617f3be4bc6d7e9ff1f73c46e7d data/actuallyadditions/recipes/solid_fuel/coal-block.json +340732fadc7be543ba9ae17f6f1c974022d31de3 data/actuallyadditions/recipes/solid_fuel/coal.json +2bfd72d945bdffcb4c3daf722c85fcbc66cd5caa data/actuallyadditions/recipes/solid_fuel/lava.json +7cea1293846d740cd9470ee0e86e12004ce36bd4 data/actuallyadditions/recipes/solid_fuel/stick.json +652b6e46c68cc83528e47b09a57bef3c91ccbb07 data/actuallyadditions/recipes/solid_fuel/tiny-coal.json 8ebd738f3968564e22ba6841eb821e5064c78588 data/actuallyadditions/recipes/stone_aiot.json bc7a41d9f36cc43e146e0b727b6f439cc0d29343 data/actuallyadditions/recipes/teleport_staff.json bdf7dbf563485903e444400d341e56d0bf308481 data/actuallyadditions/recipes/tiny_torch.json diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal-block.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal-block.json index 11b56613d..259882d0b 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal-block.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal-block.json @@ -3,6 +3,6 @@ "item": { "item": "actuallyadditions:charcoal_block" }, - "total_energy": 480000, + "total_energy": 320000, "burn_time": 16000 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal.json index f8c592b45..913bb42ce 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/charcoal.json @@ -3,6 +3,6 @@ "item": { "item": "minecraft:charcoal" }, - "total_energy": 48000, + "total_energy": 32000, "burn_time": 1600 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal-block.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal-block.json index b7b2c20ee..85e175b74 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal-block.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal-block.json @@ -3,6 +3,6 @@ "item": { "item": "minecraft:coal_block" }, - "total_energy": 480000, + "total_energy": 320000, "burn_time": 16000 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal.json index ba2f65c9a..676388ab8 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/coal.json @@ -3,6 +3,6 @@ "item": { "item": "minecraft:coal" }, - "total_energy": 48000, + "total_energy": 32000, "burn_time": 1600 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/lava.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/lava.json index 6477657ae..fa19d9336 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/lava.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/lava.json @@ -3,6 +3,6 @@ "item": { "item": "minecraft:lava_bucket" }, - "total_energy": 600000, + "total_energy": 400000, "burn_time": 20000 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/stick.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/stick.json index 52194118f..4efd9904e 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/stick.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/stick.json @@ -3,6 +3,6 @@ "item": { "item": "minecraft:stick" }, - "total_energy": 3000, + "total_energy": 2000, "burn_time": 100 } \ No newline at end of file diff --git a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/tiny-coal.json b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/tiny-coal.json index 77b0eb458..d07e114bc 100644 --- a/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/tiny-coal.json +++ b/src/generated/resources/data/actuallyadditions/recipes/solid_fuel/tiny-coal.json @@ -3,6 +3,6 @@ "item": { "tag": "actuallyadditions:tiny_coals" }, - "total_energy": 6000, + "total_energy": 4000, "burn_time": 200 } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/data/SolidFuelGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/data/SolidFuelGenerator.java index 108ec151f..83b7d04e4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/data/SolidFuelGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/data/SolidFuelGenerator.java @@ -33,13 +33,13 @@ public class SolidFuelGenerator extends RecipeProvider { @Override protected void buildShapelessRecipes(@Nonnull Consumer consumer) { - addFuel(consumer, "coal", Items.COAL, 48000, 1600); - addFuel(consumer, "stick", Items.STICK, 3000, 100); - addFuel(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 6000, 200); - addFuel(consumer, "charcoal", Items.CHARCOAL, 48000, 1600); - addFuel(consumer, "coal-block", Items.COAL_BLOCK, 480000, 16000); - addFuel(consumer, "charcoal-block", ActuallyBlocks.CHARCOAL_BLOCK.getItem(), 480000, 16000); - addFuel(consumer, "lava", Items.LAVA_BUCKET, 600000, 20000); + addFuel(consumer, "coal", Items.COAL, 32000, 1600); + addFuel(consumer, "stick", Items.STICK, 2000, 100); + addFuel(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200); + addFuel(consumer, "charcoal", Items.CHARCOAL, 32000, 1600); + addFuel(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000); + addFuel(consumer, "charcoal-block", ActuallyBlocks.CHARCOAL_BLOCK.getItem(), 320000, 16000); + addFuel(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000); } private void addFuel(Consumer consumer, String name, Item item, int energy, int burnTime) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java index fb671f2c3..a16b95b41 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCanolaPress.java @@ -46,7 +46,6 @@ import java.util.Optional; public class TileEntityCanolaPress extends TileEntityInventoryBase implements INamedContainerProvider, ISharingFluidHandler { - //public static final int PRODUCE = 80; public static final int ENERGY_USE = 35; private static final int TIME = 30; public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0); @@ -64,10 +63,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), 1); } -// public static boolean isCanola(ItemStack stack) { -// return stack.getItem() == ActuallyBlocks.CANOLA.getItem(); -// } - @OnlyIn(Dist.CLIENT) public int getTankScaled(int i) { return this.tank.getFluidAmount() * i / this.tank.getCapacity(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java index ecada31cf..33b1746d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPoweredFurnace.java @@ -10,7 +10,9 @@ package de.ellpeck.actuallyadditions.mod.tile; +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; +import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe; import de.ellpeck.actuallyadditions.mod.crafting.SingleItem; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; @@ -41,6 +43,7 @@ import net.minecraftforge.energy.IEnergyStorage; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.Optional; public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { @@ -184,9 +187,17 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } } + public boolean validInput(ItemStack stack) { + return getOutputForInput(stack).isPresent(); + } + + public Optional getOutputForInput(ItemStack stack) { + return level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), level).map(AbstractCookingRecipe::getResultItem); + } + @Override public IAcceptor getAcceptor() { - return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY)); + return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && validInput(stack); } @Override @@ -195,18 +206,20 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements } public boolean canSmeltOn(int theInput, int theOutput) { - if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { - ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY); - if (StackUtil.isValid(output)) { - return !StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount(); + ItemStack input = this.inv.getStackInSlot(theInput); + ItemStack output = this.inv.getStackInSlot(theOutput); + if (!input.isEmpty()) { + ItemStack outputStack = getOutputForInput(input).orElse(ItemStack.EMPTY); + if (!output.isEmpty()) { + return output.isEmpty() || output.sameItem(outputStack) && output.getCount() <= output.getMaxStackSize() - outputStack.getCount(); } } return false; } public void finishBurning(int theInput, int theOutput) { - ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY); - if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) { + ItemStack output = getOutputForInput(inv.getStackInSlot(theInput)).orElse(ItemStack.EMPTY); + if (inv.getStackInSlot(theOutput).isEmpty()) { this.inv.setStackInSlot(theOutput, output.copy()); } else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) { this.inv.getStackInSlot(theOutput).grow(output.getCount());