From 0a0dc0f5dd9070f1609c443530a52261b4c87080 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sun, 22 Dec 2024 02:42:11 -0700 Subject: [PATCH 1/2] add Turbine and GT Tool durability based decomposition recipes --- .../gtceu/api/item/tool/GTToolType.java | 30 +++++- .../gtceu/common/data/GTRecipeTypes.java | 8 +- .../trait/customlogic/ArcFurnaceLogic.java | 93 +++++++++++++++++++ .../trait/customlogic/MaceratorLogic.java | 87 +++++++++++++++++ 4 files changed, 211 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java create mode 100644 src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java index bcf22fb8f6..66bb6bf54d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java @@ -48,6 +48,7 @@ public class GTToolType { .toolStats(b -> b.attacking().attackDamage(3.0F).attackSpeed(-2.4F)) .constructor(GTSwordItem::create) .toolClassNames("sword") + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType PICKAXE = GTToolType.builder("pickaxe") .toolTag(TagUtil.createItemTag("pickaxes", true)) @@ -56,6 +57,7 @@ public class GTToolType { .toolStats(b -> b.blockBreaking().attackDamage(1.0F).attackSpeed(-2.8F) .behaviors(TorchPlaceBehavior.INSTANCE)) .toolClassNames("pickaxe") + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SHOVEL = GTToolType.builder("shovel") .toolTag(TagUtil.createItemTag("shovels", true)) @@ -64,6 +66,7 @@ public class GTToolType { b -> b.blockBreaking().attackDamage(1.5F).attackSpeed(-3.0F).behaviors(GrassPathBehavior.INSTANCE)) .constructor(GTShovelItem::create) .toolClassNames("shovel") + .materialAmount(GTValues.M) .build(); public static final GTToolType AXE = GTToolType.builder("axe") .toolTag(TagUtil.createItemTag("axes", true)) @@ -74,6 +77,7 @@ public class GTToolType { ScrapeBehavior.INSTANCE, WaxOffBehavior.INSTANCE)) .constructor(GTAxeItem::create) .toolClassNames("axe") + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType HOE = GTToolType.builder("hoe") .toolTag(TagUtil.createItemTag("hoes", true)) @@ -81,6 +85,7 @@ public class GTToolType { .toolStats(b -> b.cannotAttack().attackSpeed(-1.0F).behaviors(HoeGroundBehavior.INSTANCE)) .constructor(GTHoeItem::create) .toolClassNames("hoe") + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType MINING_HAMMER = GTToolType.builder("mining_hammer") @@ -91,6 +96,7 @@ public class GTToolType { .durabilityMultiplier(3.0F) .behaviors(TorchPlaceBehavior.INSTANCE)) .toolClasses(GTToolType.PICKAXE) + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType SPADE = GTToolType.builder("spade") .toolTag(TagUtil.createItemTag("tools/spades", false)) @@ -100,6 +106,7 @@ public class GTToolType { .durabilityMultiplier(3.0F) .behaviors(GrassPathBehavior.INSTANCE)) .toolClasses(GTToolType.SHOVEL) + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SCYTHE = GTToolType.builder("scythe") .toolTag(TagUtil.createItemTag("tools/scythes", false)) @@ -112,6 +119,7 @@ public class GTToolType { .constructor(GTHoeItem::create) .toolClassNames("scythe") .toolClasses(GTToolType.HOE) + .materialAmount(3 * GTValues.M) .build(); public static final GTToolType SAW = GTToolType.builder("saw") @@ -122,6 +130,7 @@ public class GTToolType { .behaviors(HarvestIceBehavior.INSTANCE)) .sound(GTSoundEntries.SAW_TOOL) .symbol('s') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType HARD_HAMMER = GTToolType.builder("hammer") .toolTag(TagUtil.createItemTag("tools/hammers", false)) @@ -133,6 +142,7 @@ public class GTToolType { .sound(GTSoundEntries.FORGE_HAMMER) .symbol('h') .toolClasses(GTToolType.PICKAXE) + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType SOFT_MALLET = GTToolType.builder("mallet") .toolTag(TagUtil.createItemTag("tools/mallets", false)) @@ -140,6 +150,7 @@ public class GTToolType { .behaviors(ToolModeSwitchBehavior.INSTANCE)) .sound(GTSoundEntries.SOFT_MALLET_TOOL) .symbol('r') + .materialAmount(6 * GTValues.M) .build(); public static final GTToolType WRENCH = GTToolType.builder("wrench") .toolTag(TagUtil.createItemTag("tools/wrenches", false)) @@ -151,6 +162,7 @@ public class GTToolType { ToolModeSwitchBehavior.INSTANCE)) .sound(GTSoundEntries.WRENCH_TOOL, true) .symbol('w') + .materialAmount(4 * GTValues.M) .build(); public static final GTToolType FILE = GTToolType.builder("file") .toolTag(TagUtil.createItemTag("tools/files", false)) @@ -158,6 +170,7 @@ public class GTToolType { .cannotAttack().attackSpeed(-2.4F)) .sound(GTSoundEntries.FILE_TOOL) .symbol('f') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType CROWBAR = GTToolType.builder("crowbar") .toolTag(TagUtil.createItemTag("tools/crowbars", false)) @@ -167,6 +180,7 @@ public class GTToolType { .sneakBypassUse().behaviors(RotateRailBehavior.INSTANCE)) .sound(new ExistingSoundEntry(SoundEvents.ITEM_BREAK, SoundSource.BLOCKS), true) .symbol('c') + .materialAmount(3 * GTValues.M / 2) .build(); public static final GTToolType SCREWDRIVER = GTToolType.builder("screwdriver") .toolTag(TagUtil.createItemTag("tools/screwdrivers", false)) @@ -175,12 +189,14 @@ public class GTToolType { .behaviors(new EntityDamageBehavior(3.0F, Spider.class))) .sound(GTSoundEntries.SCREWDRIVER_TOOL) .symbol('d') + .materialAmount(GTValues.M) .build(); public static final GTToolType MORTAR = GTToolType.builder("mortar") .toolTag(TagUtil.createItemTag("tools/mortars", false)) .toolStats(b -> b.crafting().damagePerCraftingAction(2).cannotAttack().attackSpeed(-2.4F)) .sound(GTSoundEntries.MORTAR_TOOL) .symbol('m') + .materialAmount(2 * GTValues.M) .build(); public static final GTToolType WIRE_CUTTER = GTToolType.builder("wire_cutter") .toolTag(TagUtil.createItemTag("tools/wire_cutters", false)) @@ -189,6 +205,7 @@ public class GTToolType { .damagePerCraftingAction(4).attackDamage(-1.0F).attackSpeed(-2.4F)) .sound(GTSoundEntries.WIRECUTTER_TOOL, true) .symbol('x') + .materialAmount(4 * GTValues.M) // 3 plates + 2 rods .build(); public static final GTToolType KNIFE = GTToolType.builder("knife") .toolTag(TagUtil.createItemTag("tools/knives", false)) @@ -197,12 +214,14 @@ public class GTToolType { .constructor(GTSwordItem::create) .symbol('k') .toolClasses(GTToolType.SWORD) + .materialAmount(GTValues.M) .build(); public static final GTToolType BUTCHERY_KNIFE = GTToolType.builder("butchery_knife") .toolTag(TagUtil.createItemTag("tools/butchery_knives", false)) .toolStats(b -> b.attacking().attackDamage(1.5F).attackSpeed(-1.3F) .defaultEnchantment(Enchantments.MOB_LOOTING, 3)) .constructor(GTSwordItem::create) + .materialAmount(4 * GTValues.M) .build(); // public static GTToolType GRAFTER = new GTToolType("grafter", 1, 1, GTCEu.id("item/tools/handle_hammer"), // GTCEu.id("item/tools/hammer")); @@ -426,7 +445,7 @@ public class GTToolType { public final SoundEntry soundEntry; public final boolean playSoundOnBlockDestroy; public final Character symbol; - + public final long materialAmount; public final IGTToolDefinition toolDefinition; public final ToolConstructor constructor; public final int electricTier; @@ -434,7 +453,8 @@ public class GTToolType { public GTToolType(String name, String idFormat, Character symbol, Set toolClasses, IGTToolDefinition toolDefinition, ToolConstructor constructor, List> harvestTags, List> itemTags, ResourceLocation modelLocation, Set toolClassNames, - @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier) { + @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier, + long materialAmount) { this.name = name; this.idFormat = idFormat; this.symbol = symbol; @@ -449,6 +469,7 @@ public GTToolType(String name, String idFormat, Character symbol, Set GTMachines.MACERATOR[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_MACERATE_STEAM, LEFT_TO_RIGHT) + .addCustomRecipeLogic(new MaceratorLogic()) .setSound(GTSoundEntries.MACERATOR); public final static GTRecipeType CANNER_RECIPES = register("canner", ELECTRIC).setMaxIOSize(2, 2, 1, 1) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java new file mode 100644 index 0000000000..f78050e208 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java @@ -0,0 +1,93 @@ +package com.gregtechceu.gtceu.common.machine.trait.customlogic; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; +import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.data.GTMaterials; +import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.CombinedInvWrapper; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Objects; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.ARC_FURNACE_RECIPES; + +public class ArcFurnaceLogic implements GTRecipeType.ICustomRecipeLogic { + + @Override + public @Nullable GTRecipe createCustomRecipe(IRecipeCapabilityHolder holder) { + var itemInputs = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), + ArrayList::new) + .stream() + .filter(IItemHandlerModifiable.class::isInstance) + .map(IItemHandlerModifiable.class::cast) + .toArray(IItemHandlerModifiable[]::new); + + var inputs = new CombinedInvWrapper(itemInputs); + var stack = inputs.getStackInSlot(0); + + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + if (turbineBehaviour != null) { + float durability = 1.f - (float) turbineBehaviour.getPartDamage(stack) / + (float) turbineBehaviour.getPartMaxDurability(stack); + return applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + } + + if (stack.getItem() instanceof IGTTool tool && !tool.isElectric()) { + float durability = (float) (tool.getTotalMaxDurability(stack) - stack.getDamageValue() + 1) / + (tool.getTotalMaxDurability(stack) + 1); + return applyDurabilityRecipe("tool_decomp", stack, tool.getMaterial(), + (float) (tool.getToolType().materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + } + + return null; + } + + public @Nullable GTRecipe applyDurabilityRecipe(String id, ItemStack inputStack, @NotNull Material mat, + float fullAmount, float durability, long voltage, + int durationFactor) { + if (!mat.hasProperty(PropertyKey.INGOT)) + return null; + + var material = mat.getProperty(PropertyKey.INGOT); + var materialArc = material.getArcSmeltingInto(); + + float outputAmount = (durability * fullAmount); + int dustAmount = (int) outputAmount; + int leftover = (int) ((outputAmount - (float) dustAmount) * 9.f); + + if (dustAmount == 0 && leftover == 0) + return null; + + var builder = ARC_FURNACE_RECIPES.recipeBuilder(id + "/" + mat.getName()) + .inputItems(inputStack) + .inputFluids(GTMaterials.Oxygen.getFluid((int) (materialArc.getMass() * outputAmount) * durationFactor)) + .EUt(voltage) + .duration((int) (materialArc.getMass() * outputAmount) * durationFactor); + + if (dustAmount > 0) { + builder.outputItems(ingot, materialArc, dustAmount); + } + if (leftover > 0) { + builder.outputItems(nugget, materialArc, leftover); + } + + return builder.buildRawRecipe(); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java new file mode 100644 index 0000000000..da7673f4b6 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java @@ -0,0 +1,87 @@ +package com.gregtechceu.gtceu.common.machine.trait.customlogic; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; +import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.wrapper.CombinedInvWrapper; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Objects; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.MACERATOR_RECIPES; + +public class MaceratorLogic implements GTRecipeType.ICustomRecipeLogic { + + @Override + public @Nullable GTRecipe createCustomRecipe(IRecipeCapabilityHolder holder) { + var itemInputs = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), + ArrayList::new) + .stream() + .filter(IItemHandlerModifiable.class::isInstance) + .map(IItemHandlerModifiable.class::cast) + .toArray(IItemHandlerModifiable[]::new); + + var inputs = new CombinedInvWrapper(itemInputs); + var stack = inputs.getStackInSlot(0); + + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + if (turbineBehaviour != null) { + float durability = 1.f - (float) turbineBehaviour.getPartDamage(stack) / + (float) turbineBehaviour.getPartMaxDurability(stack); + return applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + } + + if (stack.getItem() instanceof IGTTool tool && !tool.isElectric()) { + float durability = (float) (tool.getTotalMaxDurability(stack) - stack.getDamageValue() + 1) / + (tool.getTotalMaxDurability(stack) + 1); + return applyDurabilityRecipe("tool_decomp", stack, tool.getMaterial(), + (float) (tool.getToolType().materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + } + + return null; + } + + public @Nullable GTRecipe applyDurabilityRecipe(String id, ItemStack inputStack, @NotNull Material mat, + float fullAmount, float durability, long voltage, + int durationFactor) { + float outputAmount = (durability * fullAmount); + int dustAmount = (int) outputAmount; + int leftover = (int) ((outputAmount - (float) dustAmount) * 36.f); + TagPrefix tag = leftover % 4 >= leftover % 9 ? dustSmall : dustTiny; + int leftAmount = leftover % 4 >= leftover % 9 ? leftover / 9 : leftover / 4; + + if (dustAmount == 0 && leftAmount == 0) + return null; + + var builder = MACERATOR_RECIPES.recipeBuilder(id + "/" + mat.getName()) + .inputItems(inputStack) + .EUt(voltage) + .duration((int) (mat.getMass() * outputAmount) * durationFactor); + + if (dustAmount > 0) { + builder.outputItems(dust, mat, dustAmount); + } + if (leftAmount > 0) { + builder.outputItems(tag, mat, leftAmount); + } + + return builder.buildRawRecipe(); + } +} From 42463d680d7785c9e3c11599397bced4415bd2e9 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Sat, 28 Dec 2024 23:09:41 -0700 Subject: [PATCH 2/2] representative recipes --- .../resources/assets/gtceu/lang/en_ud.json | 3 +- .../resources/assets/gtceu/lang/en_us.json | 3 +- .../trait/customlogic/ArcFurnaceLogic.java | 33 ++++++++++++++++++ .../trait/customlogic/MaceratorLogic.java | 34 +++++++++++++++++++ .../gtceu/data/lang/MachineLang.java | 4 +++ 5 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 18580338c0..dfb75c36b9 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -1742,7 +1742,6 @@ "config.gtceu.option.enableCleanroom": "ɯooɹuɐǝןƆǝןqɐuǝ", "config.gtceu.option.enableFEConverters": "sɹǝʇɹǝʌuoƆƎℲǝןqɐuǝ", "config.gtceu.option.enableMaintenance": "ǝɔuɐuǝʇuıɐWǝןqɐuǝ", - "config.gtceu.option.enableMoreDualHatchAbility": "ʎʇıןıqⱯɥɔʇɐHןɐnᗡǝɹoWǝןqɐuǝ", "config.gtceu.option.enableResearch": "ɥɔɹɐǝsǝᴚǝןqɐuǝ", "config.gtceu.option.enableTieredCasings": "sbuısɐƆpǝɹǝı⟘ǝןqɐuǝ", "config.gtceu.option.enableWorldAccelerators": "sɹoʇɐɹǝןǝɔɔⱯpןɹoMǝןqɐuǝ", @@ -2128,6 +2127,8 @@ "gtceu.arc_furnace": "ǝɔɐuɹnℲ ɔɹⱯ", "gtceu.assembler": "ɹǝןqɯǝssⱯ", "gtceu.assembly_line": "ǝuıꞀ ʎןqɯǝssⱯ", + "gtceu.auto_decomp.rotor": "ɹoʇoᴚ ǝuıqɹn⟘", + "gtceu.auto_decomp.tool": "ןooʇ ɔıɹʇɔǝןǝ-uoN", "gtceu.autoclave": "ǝʌɐןɔoʇnⱯ", "gtceu.battery_buffer.average_input": "ʇ/∩Ǝ %s :ʇnduı ǝbɐɹǝʌⱯ", "gtceu.battery_buffer.average_output": "ʇ/∩Ǝ %s :ʇndʇno ǝbɐɹǝʌⱯ", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index b3fdb619c0..4f07ac1730 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -1742,7 +1742,6 @@ "config.gtceu.option.enableCleanroom": "enableCleanroom", "config.gtceu.option.enableFEConverters": "enableFEConverters", "config.gtceu.option.enableMaintenance": "enableMaintenance", - "config.gtceu.option.enableMoreDualHatchAbility": "enableMoreDualHatchAbility", "config.gtceu.option.enableResearch": "enableResearch", "config.gtceu.option.enableTieredCasings": "enableTieredCasings", "config.gtceu.option.enableWorldAccelerators": "enableWorldAccelerators", @@ -2128,6 +2127,8 @@ "gtceu.arc_furnace": "Arc Furnace", "gtceu.assembler": "Assembler", "gtceu.assembly_line": "Assembly Line", + "gtceu.auto_decomp.rotor": "Turbine Rotor", + "gtceu.auto_decomp.tool": "Non-electric tool", "gtceu.autoclave": "Autoclave", "gtceu.battery_buffer.average_input": "Average input: %s EU/t", "gtceu.battery_buffer.average_output": "Average output: %s EU/t", diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java index f78050e208..5a129b8ca3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/ArcFurnaceLogic.java @@ -7,11 +7,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.data.GTItems; +import com.gregtechceu.gtceu.common.data.GTMaterialItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; +import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.wrapper.CombinedInvWrapper; @@ -90,4 +94,33 @@ public class ArcFurnaceLogic implements GTRecipeType.ICustomRecipeLogic { return builder.buildRawRecipe(); } + + @Override + public void buildRepresentativeRecipes() { + ItemStack stack = GTItems.TURBINE_ROTOR.asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.rotor")); + GTRecipe rotorRecipe; + GTRecipe pickaxeRecipe; + float durability = 0.69f; + // noinspection ConstantConditions + TurbineRotorBehaviour.getBehaviour(stack).setPartMaterial(stack, GTMaterials.Iron); + TurbineRotorBehaviour.getBehaviour(stack).setPartDamage(stack, 8928); + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + + rotorRecipe = applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + rotorRecipe.setId(rotorRecipe.getId().withPrefix("/")); + + stack = GTMaterialItems.TOOL_ITEMS.get(GTMaterials.Iron, GTToolType.PICKAXE).asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.tool")); + stack.setDamageValue(79); + pickaxeRecipe = applyDurabilityRecipe("tool_decomp", stack, GTMaterials.Iron, + (float) (GTToolType.PICKAXE.materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + + pickaxeRecipe.setId(pickaxeRecipe.getId().withPrefix("/")); + ARC_FURNACE_RECIPES.addToMainCategory(pickaxeRecipe); + ARC_FURNACE_RECIPES.addToMainCategory(rotorRecipe); + GTRecipeType.ICustomRecipeLogic.super.buildRepresentativeRecipes(); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java index da7673f4b6..a599517b16 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/customlogic/MaceratorLogic.java @@ -7,10 +7,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.IGTTool; +import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.common.data.GTItems; +import com.gregtechceu.gtceu.common.data.GTMaterialItems; +import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; +import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.wrapper.CombinedInvWrapper; @@ -84,4 +89,33 @@ public class MaceratorLogic implements GTRecipeType.ICustomRecipeLogic { return builder.buildRawRecipe(); } + + @Override + public void buildRepresentativeRecipes() { + ItemStack stack = GTItems.TURBINE_ROTOR.asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.rotor")); + GTRecipe rotorRecipe; + GTRecipe pickaxeRecipe; + float durability = 0.75f; + // noinspection ConstantConditions + TurbineRotorBehaviour.getBehaviour(stack).setPartMaterial(stack, GTMaterials.Iron); + TurbineRotorBehaviour.getBehaviour(stack).setPartDamage(stack, 8928); + var turbineBehaviour = TurbineRotorBehaviour.getBehaviour(stack); + + rotorRecipe = applyDurabilityRecipe("rotor_decomp", stack, turbineBehaviour.getPartMaterial(stack), + (float) (turbineBlade.materialAmount() * 8) / GTValues.M, durability, GTValues.VH[GTValues.EV], 1); + rotorRecipe.setId(rotorRecipe.getId().withPrefix("/")); + + stack = GTMaterialItems.TOOL_ITEMS.get(GTMaterials.Iron, GTToolType.PICKAXE).asStack(); + stack.setHoverName(Component.translatable("gtceu.auto_decomp.tool")); + stack.setDamageValue(79); + pickaxeRecipe = applyDurabilityRecipe("tool_decomp", stack, GTMaterials.Iron, + (float) (GTToolType.PICKAXE.materialAmount / GTValues.M), durability, + GTValues.VH[GTValues.LV], 2); + + pickaxeRecipe.setId(pickaxeRecipe.getId().withPrefix("/")); + MACERATOR_RECIPES.addToMainCategory(pickaxeRecipe); + MACERATOR_RECIPES.addToMainCategory(rotorRecipe); + GTRecipeType.ICustomRecipeLogic.super.buildRepresentativeRecipes(); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java index 367d156e20..4f1dff814f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java @@ -415,6 +415,10 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.scanner.copy_stick_empty", "§oEmpty Stick"); provider.add("gtceu.scanner.copy_stick_to", "§oCopy of Stick"); + // rotor/tool recipes + provider.add("gtceu.auto_decomp.rotor", "Turbine Rotor"); + provider.add("gtceu.auto_decomp.tool", "Non-electric tool"); + // HPCA Components provider.add("gtceu.machine.hpca.empty_component.tooltip", "Just for filling space"); provider.add("gtceu.machine.hpca.heat_sink_component.tooltip", "Free cooling! Is anything free?");