diff --git a/common/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java b/common/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java index 55052674b0..b0bf13cfee 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java +++ b/common/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java @@ -102,6 +102,14 @@ public class GuiTextures { public static final ResourceTexture MAINTENANCE_ICON = new ResourceTexture("gtceu:textures/block/overlay/machine/overlay_maintenance.png"); public static final ResourceTexture BUTTON_MINER_MODES = new ResourceTexture("gtceu:textures/gui/widget/button_miner_modes.png"); + //ORE PROCESSING + public static final ResourceTexture OREBY_BASE = new ResourceTexture("gtceu:textures/gui/arrows/oreby-base.png"); + public static final ResourceTexture OREBY_CHEM = new ResourceTexture("gtceu:textures/gui/arrows/oreby-chem.png"); + public static final ResourceTexture OREBY_SEP = new ResourceTexture("gtceu:textures/gui/arrows/oreby-sep.png"); + public static final ResourceTexture OREBY_SIFT = new ResourceTexture("gtceu:textures/gui/arrows/oreby-sift.png"); + public static final ResourceTexture OREBY_SMELT = new ResourceTexture("gtceu:textures/gui/arrows/oreby-smelt.png"); + + //PRIMITIVE public static final ResourceBorderTexture PRIMITIVE_BACKGROUND = new ResourceBorderTexture("gtceu:textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); public static final ResourceBorderTexture PRIMITIVE_SLOT = new ResourceBorderTexture("gtceu:textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); diff --git a/common/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java b/common/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java index 2bb156f748..0bb1fa268a 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java +++ b/common/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java @@ -12,6 +12,7 @@ public static void init(RegistrateLangProvider provider) { /** JEI, REI, EMI */ private static void initRecipeViewerLang(RegistrateLangProvider provider) { provider.add("gtceu.jei.multiblock_info", "Multiblock Info"); + provider.add("gtceu.jei.ore_processing_diagram", "Ore Processing Diagram"); } /** Jade, TheOneProbe, WTHIT */ diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/GTOreProcessingWidget.java b/common/src/main/java/com/gregtechceu/gtceu/integration/GTOreProcessingWidget.java new file mode 100644 index 0000000000..99c9c0168a --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/GTOreProcessingWidget.java @@ -0,0 +1,494 @@ +package com.gregtechceu.gtceu.integration; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.recipe.content.Content; +import com.gregtechceu.gtceu.utils.GTUtil; +import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; +import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; +import com.lowdragmc.lowdraglib.gui.widget.PhantomSlotWidget; +import com.lowdragmc.lowdraglib.gui.widget.TankWidget; +import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import com.lowdragmc.lowdraglib.misc.FluidStorage; +import com.lowdragmc.lowdraglib.utils.CycleItemStackHandler; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.api.gui.GuiTextures.*; +import static com.gregtechceu.gtceu.common.data.GTMachines.*; +import static com.gregtechceu.gtceu.common.data.GTMaterials.Water; + +/** + * @author Rundas + * @implNote GTOreProcessingWidget + */ +public class GTOreProcessingWidget extends WidgetGroup { + public GTOreProcessingWidget(Material material) { + super(0, 0, 186, 174); + setClientSideWidget(); + //Handlers Setup + List> mainproducts = new ArrayList<>(); + List> byproducts = new ArrayList<>(); + List> machines = new ArrayList<>(); + List chanceContent = new ArrayList<>(); + OreProperty prop = material.getProperty(PropertyKey.ORE); + //Items + addItemSlots(mainproducts, byproducts, material, prop, chanceContent); + //Machines + addMachineSlots(machines); + //GUI + setupGui(mainproducts, byproducts, machines, material, prop, chanceContent); + } + + private void setupGui(List> mainproducts, List> byproducts, List> machines, Material material, OreProperty prop, List chanceContent) { + setupBaseGui(mainproducts, byproducts, machines, chanceContent); + if(!material.hasProperty(PropertyKey.BLAST)){ + setupSmeltGui(mainproducts, machines); + } + if(prop.getWashedIn().getLeft() != null){ + setupChemGui(mainproducts,byproducts,machines,prop,chanceContent); + } + if(prop.getSeparatedInto() != null && !prop.getSeparatedInto().isEmpty()) { + setupSepGui(mainproducts,byproducts,machines,chanceContent); + } + if(material.hasProperty(PropertyKey.GEM)){ + setupSiftGui(mainproducts, byproducts,machines,chanceContent); + } + } + + //Base + + private void setupBaseGui(List> mainproducts, List> byproducts, List> machines, List chanceContent) { + addWidget(new ImageWidget(0,0,186,174,OREBY_BASE)); + setupBaseGuiItems(mainproducts, byproducts, chanceContent); + setupBaseGuiMachines(machines); + } + + private void setupBaseGuiMachines(List> machines) { + //Ore -> Crushed Ore + PhantomSlotWidget maceratorSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),1,3,25); + maceratorSlot.setBackgroundTexture(null); + addWidget(maceratorSlot); + //Crushed Ore -> Impure Dust + PhantomSlotWidget maceratorSlot2 = new PhantomSlotWidget(new CycleItemStackHandler(machines),1,23,70); + maceratorSlot2.setBackgroundTexture(null); + addWidget(maceratorSlot2); + //Washed Ore -> Pure Dust + PhantomSlotWidget maceratorSlot3 = new PhantomSlotWidget(new CycleItemStackHandler(machines),1,114,47); + maceratorSlot3.setBackgroundTexture(null); + addWidget(maceratorSlot3); + //TC'ed Ore -> Dust + PhantomSlotWidget maceratorSlot4 = new PhantomSlotWidget(new CycleItemStackHandler(machines),1,70,80); + maceratorSlot4.setBackgroundTexture(null); + addWidget(maceratorSlot4); + //Crushed Ore -> Washed Ore + PhantomSlotWidget washerSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),2,25,25); + washerSlot.setBackgroundTexture(null); + addWidget(washerSlot); + TankWidget waterSlot = new TankWidget(new FluidStorage(Water.getFluid(1000)),42,25,false,false); + waterSlot.initTemplate(); + addWidget(waterSlot); + //Impure Dust -> Dust + PhantomSlotWidget centrifugeSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),4,51,80); + centrifugeSlot.setBackgroundTexture(null); + addWidget(centrifugeSlot); + //Pure Dust -> Dust + PhantomSlotWidget centrifugeSlot2 = new PhantomSlotWidget(new CycleItemStackHandler(machines),4,133,70); + centrifugeSlot2.setBackgroundTexture(null); + addWidget(centrifugeSlot2); + //Crushed Ore/Washed Ore -> TC'ed Ore + PhantomSlotWidget thermalCentrifugeSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),5,97,70); + thermalCentrifugeSlot.setBackgroundTexture(null); + addWidget(thermalCentrifugeSlot); + //Crushed Ore -> Washed Ore + PhantomSlotWidget cauldronWasherSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),8,4,124); + cauldronWasherSlot.setBackgroundTexture(null); + addWidget(cauldronWasherSlot); + //Impure Dust -> Dust + PhantomSlotWidget cauldronWasherSlot2 = new PhantomSlotWidget(new CycleItemStackHandler(machines),8,42,144); + cauldronWasherSlot2.setBackgroundTexture(null); + addWidget(cauldronWasherSlot2); + //Pure Dust -> Dust + PhantomSlotWidget cauldronWasherSlot3 = new PhantomSlotWidget(new CycleItemStackHandler(machines),8,103,144); + cauldronWasherSlot3.setBackgroundTexture(null); + addWidget(cauldronWasherSlot3); + } + + private void setupBaseGuiItems(List> mainproducts, List> byproducts, List chanceContent) { + //Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),0,3,3)); + //Crushing Ore + PhantomSlotWidget crushedSlot = new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),2,3,47); + addWidget(crushedSlot); + //Crushing Ore BP + PhantomSlotWidget crushedOreBPSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),0,3,65); + crushedOreBPSlot.setOverlay(chanceContent.get(1).createOverlay(false)); + crushedOreBPSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 14f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 8.5) + "%")); + }); + addWidget(crushedOreBPSlot); + //Washing Crushed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),3,64,25)); + //Washing Crushed Ore BP + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(byproducts),1,82,25)); + //Crushing Crushed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),5,23,92)); + //Crushing Crushed Ore BP + PhantomSlotWidget crushingCrushedOreBPSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),0,23,110); + crushingCrushedOreBPSlot.setOverlay(chanceContent.get(2).createOverlay(false)); + crushingCrushedOreBPSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 14f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 8.5) + "%")); + }); + addWidget(crushingCrushedOreBPSlot); + //Centrifuging Impure Dust + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,51,101)); + //Centrifuging Impure Dust BP + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(byproducts),5,51,119)); + //Crushing Washed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),6,137,47)); + //Crushing Washed Ore BP + PhantomSlotWidget crushingWashedOreBPSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),3,155,47); + crushingWashedOreBPSlot.setOverlay(chanceContent.get(3).createOverlay(false)); + crushingWashedOreBPSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 14f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 8.5) + "%")); + }); + addWidget(crushingWashedOreBPSlot); + //Centrifuging Pure Dust + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,133,92)); + //Centrifuging Pure Dust BP + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(byproducts),6,133,110)); + //Centrifuging Impure Dust + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,51,101)); + //Centrifuging Impure Dust BP + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(byproducts),5,51,119)); + //TC'ing Crushed/Washed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),4,97,92)); + //TC'ing Crushed/Washed Ore BP + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(byproducts),7,97,110)); + //Crushing TC'ed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,70,101)); + //Crushing TC'ed Ore BP + PhantomSlotWidget crushingTCedOreBPSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),4,70,119); + crushingTCedOreBPSlot.setOverlay(chanceContent.get(4).createOverlay(false)); + crushingTCedOreBPSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 14f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 8.5) + "%")); + }); + addWidget(crushingTCedOreBPSlot); + //Simple Washing Crushed Ore + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),9,3,105)); + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),3,3,145)); + //Simple Washing Impure Dust + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),5,23,145)); + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,63,145)); + //Simple Washing Pure Dust + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),6,84,145)); + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,124,145)); + } + + //Smelt + + private void setupSmeltGui(List> mainproducts, List> machines) { + addWidget(new ImageWidget(0,0,186,174,OREBY_SMELT)); + setupSmeltGuiItems(mainproducts); + setupSmeltGuiMachines(machines); + } + + private void setupSmeltGuiMachines(List> machines) { + PhantomSlotWidget furnaceSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),0,23,3); + furnaceSlot.setBackgroundTexture(null); + addWidget(furnaceSlot); + } + + private void setupSmeltGuiItems(List> mainproducts) { + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),1,46,3)); + } + + //Bath + + private void setupChemGui(List> mainproducts, List> byproducts, List> machines, OreProperty prop, List chanceContent) { + addWidget(new ImageWidget(0,0,186,174,OREBY_CHEM)); + setupChemGuiItems(mainproducts,byproducts,chanceContent); + setupChemGuiMachines(machines,prop); + } + + private void setupChemGuiMachines(List> machines, OreProperty prop) { + Pair reagent = prop.getWashedIn(); + PhantomSlotWidget chembathSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),3,25,48); + chembathSlot.setBackgroundTexture(null); + addWidget(chembathSlot); + TankWidget washingReagentSlot = new TankWidget(new FluidStorage(reagent.getLeft().getFluid(reagent.getRight())),42,48,false,false); + washingReagentSlot.initTemplate(); + addWidget(washingReagentSlot); + } + + private void setupChemGuiItems(List> mainproducts, List> byproducts, List chanceContent) { + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),3,64,48)); + PhantomSlotWidget bathingCrushedOreBPSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),8,82,48); + bathingCrushedOreBPSlot.setOverlay(chanceContent.get(5).createOverlay(false)); + bathingCrushedOreBPSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 70f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 5.8) + "%")); + }); + addWidget(bathingCrushedOreBPSlot); + } + + //Sep + + private void setupSepGui(List> mainproducts, List> byproducts, List> machines, List chanceContent) { + addWidget(new ImageWidget(0,0,186,174,OREBY_SEP)); + setupSepGuiItems(mainproducts,byproducts,chanceContent); + setupSepGuiMachines(machines); + } + + private void setupSepGuiMachines(List> machines) { + PhantomSlotWidget separatorSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),7,155,69); + separatorSlot.setBackgroundTexture(null); + addWidget(separatorSlot); + } + + private void setupSepGuiItems(List> mainproducts, List> byproducts, List chanceContent) { + addWidget(new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),7,155,92)); + PhantomSlotWidget separatorBPSlot1 = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),9,155,110); + separatorBPSlot1.setOverlay(chanceContent.get(6).createOverlay(false)); + separatorBPSlot1.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 40f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 8.5) + "%")); + }); + addWidget(separatorBPSlot1); + PhantomSlotWidget separatorBPSlot2 = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),10,155,128); + separatorBPSlot2.setOverlay(chanceContent.get(7).createOverlay(false)); + separatorBPSlot2.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 20f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 6f) + "%")); + }); + addWidget(separatorBPSlot2); + } + + //Sift + + private void setupSiftGui(List> mainproducts, List> byproducts, List> machines, List chanceContent) { + addWidget(new ImageWidget(0,0,186,174,OREBY_SIFT)); + setupSiftGuiItems(mainproducts,byproducts,chanceContent); + setupSiftGuiMachines(machines); + } + + private void setupSiftGuiMachines(List> machines) { + PhantomSlotWidget sifterSlot = new PhantomSlotWidget(new CycleItemStackHandler(machines),6,101,24); + sifterSlot.setBackgroundTexture(null); + addWidget(sifterSlot); + } + + private void setupSiftGuiItems(List> mainproducts, List> byproducts, List chanceContent) { + PhantomSlotWidget exquisiteSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),11,119,3); + exquisiteSlot.setOverlay(chanceContent.get(8).createOverlay(false)); + exquisiteSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(exquisiteSlot); + PhantomSlotWidget flawlessSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),12,137,3); + flawlessSlot.setOverlay(chanceContent.get(9).createOverlay(false)); + flawlessSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(flawlessSlot); + PhantomSlotWidget gemSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),13,155,3); + gemSlot.setOverlay(chanceContent.get(10).createOverlay(false)); + gemSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(gemSlot); + PhantomSlotWidget dustSlot = new PhantomSlotWidget(new CycleItemStackHandler(mainproducts),6,119,21); + dustSlot.setOverlay(chanceContent.get(0).createOverlay(false)); + dustSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(dustSlot); + PhantomSlotWidget flawedSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),14,137,21); + flawlessSlot.setOverlay(chanceContent.get(11).createOverlay(false)); + flawedSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(flawedSlot); + PhantomSlotWidget chippedSlot = new PhantomSlotWidget(new CycleItemStackHandler(byproducts),15,155,21); + chippedSlot.setOverlay(chanceContent.get(12).createOverlay(false)); + chippedSlot.setOnAddedTooltips((w, tooltips) -> { + tooltips.add(Component.translatable("gtceu.gui.content.chance_1", String.format("%.1f", 3f) + "%")); + tooltips.add(Component.translatable("gtceu.gui.content.tier_boost", String.format("%.1f", 1f) + "%")); + }); + addWidget(chippedSlot); + } + + //Slots + + private void addMachineSlots(List> machines) { + List furnaceSlot = Collections.singletonList(new ItemStack(Blocks.FURNACE.asItem())); + machines.add(furnaceSlot); + List maceratorSlot = Collections.singletonList(MACERATOR[GTValues.LV].asStack()); + machines.add(maceratorSlot); + List washerSlot = Collections.singletonList(ORE_WASHER[GTValues.LV].asStack()); + machines.add(washerSlot); + List bathSlot = Collections.singletonList(CHEMICAL_BATH[GTValues.LV].asStack()); + machines.add(bathSlot); + List centrifugeSlot = Collections.singletonList(CENTRIFUGE[GTValues.LV].asStack()); + machines.add(centrifugeSlot); + List thermalCentrifugeSlot = Collections.singletonList(THERMAL_CENTRIFUGE[GTValues.LV].asStack()); + machines.add(thermalCentrifugeSlot); + List sifterSlot = Collections.singletonList(SIFTER[GTValues.LV].asStack()); + machines.add(sifterSlot); + List separatorSlot = Collections.singletonList(ELECTROMAGNETIC_SEPARATOR[GTValues.LV].asStack()); + machines.add(separatorSlot); + List cauldronWasherSlot = new ArrayList<>(); + cauldronWasherSlot.add(new ItemStack(Items.CAULDRON)); + cauldronWasherSlot.add(ORE_WASHER[GTValues.LV].asStack()); + machines.add(cauldronWasherSlot); + } + + private void addItemSlots(List> mainproducts, List> byproducts, Material material, OreProperty prop, List chanceContent) { + setupMainProducts(mainproducts, material, prop, chanceContent); + setupByproducts(byproducts, material, prop, chanceContent); + } + + private void setupMainProducts(List> mainproducts, Material material, OreProperty prop, List chanceContent) { + //Ore + List oreSlot = Collections.singletonList(ChemicalHelper.get(ore, material)); + mainproducts.add(oreSlot); + //Direct Smelt Result + Material smeltingResult = prop.getDirectSmeltResult() != null ? prop.getDirectSmeltResult() : material; + List smeltSlot = new ArrayList<>(); + if(smeltingResult.hasProperty(PropertyKey.INGOT)){ + smeltSlot.add(ChemicalHelper.get(ingot,smeltingResult)); + }else if(smeltingResult.hasProperty(PropertyKey.GEM)) { + smeltSlot.add(ChemicalHelper.get(gem,smeltingResult)); + }else if(smeltingResult.hasProperty(PropertyKey.DUST)){ + smeltSlot.add(ChemicalHelper.get(dust,smeltingResult)); + }else{ + smeltSlot.add(new ItemStack(Items.AIR)); + } + mainproducts.add(smeltSlot); + //Crushed Ore + List crushedSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(TagPrefix.crushed, material)).stream().map(Holder::value).map(item -> new ItemStack(item, 2 * prop.getOreMultiplier())).toList(); + mainproducts.add(crushedSlot); + //Washed Ore + List crushedPurifiedSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(crushedPurified, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(crushedPurifiedSlot); + //TC'ed Ore + List crushedRefinedSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(crushedRefined, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(crushedRefinedSlot); + //Impure Dust + List dustImpureSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustImpure, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(dustImpureSlot); + //Pure Dust + List dustPureSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustPure, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(dustPureSlot); + //Dust + List dustSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dust, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(dustSlot); + //Gem + List gemSlot = new ArrayList<>(); + if(material.hasProperty(PropertyKey.GEM)){ + gemSlot.add(ChemicalHelper.get(gem, material)); + } + mainproducts.add(gemSlot); + chanceContent.add(new Content(gemSlot,0.35f,0.05f,null,null)); + List simpleCrushedSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(crushed, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + mainproducts.add(simpleCrushedSlot); + } + + private void setupByproducts(List> byproducts, Material material, OreProperty prop, List chanceContent) { + Material byproductMaterial1 = GTUtil.selectItemInList(0, material, prop.getOreByProducts(), Material.class); + Material byproductMaterial2 = GTUtil.selectItemInList(1, material, prop.getOreByProducts(), Material.class); + Material byproductMaterial3 = GTUtil.selectItemInList(3, material, prop.getOreByProducts(), Material.class); + List separatedMaterial = prop.getSeparatedInto(); + //Crushing Ore BP + ItemStack crushingOreByproductStack = ChemicalHelper.get(gem, byproductMaterial1); + if (crushingOreByproductStack.isEmpty()) crushingOreByproductStack = ChemicalHelper.get(dust, byproductMaterial1); + List maceratorBPSlot1 = Collections.singletonList(crushingOreByproductStack); + byproducts.add(maceratorBPSlot1); + chanceContent.add(new Content(crushingOreByproductStack,0.14f,0.07f,null,null)); + //Washing Crushed Ore BP + List washerBPSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustTiny, byproductMaterial1)).stream().map(Holder::value).map(item -> new ItemStack(item,3)).toList(); + byproducts.add(washerBPSlot); + //Crushing Crushed Ore BP + List maceratorBPSlot2 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dust, byproductMaterial1)).stream().map(Holder::value).map(ItemStack::new).toList();; + byproducts.add(maceratorBPSlot2); + chanceContent.add(new Content(maceratorBPSlot2,0.14f,0.085f,null,null)); + //Crushing Washed Ore BP + List maceratorBPSlot3 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dust, byproductMaterial2)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(maceratorBPSlot3); + chanceContent.add(new Content(maceratorBPSlot3,0.14f,0.085f,null,null)); + //Crushing TC'ed Ore BP + List maceratorBPSlot4 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dust, byproductMaterial2)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(maceratorBPSlot4); + chanceContent.add(new Content(maceratorBPSlot4,0.14f,0.085f,null,null)); + //Centrifuging Impure Dust BP + List centrifugeBPSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustTiny, byproductMaterial1)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(centrifugeBPSlot); + //Centrifuging Pure Dust BP + List centrifugeBPSlot2 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustTiny, byproductMaterial2)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(centrifugeBPSlot2); + //TC'ing Crushed/Washed Ore BP + List tcBPSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dustTiny, byproductMaterial2)).stream().map(Holder::value).map(item -> new ItemStack(item,3)).toList(); + byproducts.add(tcBPSlot); + //Bathing Crushed Ore BP + List bathBPSlot = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(dust, byproductMaterial3)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(bathBPSlot); + chanceContent.add(new Content(bathBPSlot,0.7f,0.58f,null,null)); + //Separating Pure Dust BP + ItemStack separatedStack1 = new ItemStack(Items.AIR); + ItemStack separatedStack2 = new ItemStack(Items.AIR); + TagPrefix prefix; + if(prop.getSeparatedInto() != null && !prop.getSeparatedInto().isEmpty()) { + separatedStack1 = ChemicalHelper.get(dustSmall, separatedMaterial.get(0)); + prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 + && separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) ? nugget : dustSmall; + separatedStack2 = ChemicalHelper.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), prefix == nugget ? 2 : 1); + } + List sepBPSlot1 = Collections.singletonList(separatedStack1); + byproducts.add(sepBPSlot1); + chanceContent.add(new Content(sepBPSlot1,0.4f,0.85f,null,null)); + List sepBPSlot2 = Collections.singletonList(separatedStack2); + byproducts.add(sepBPSlot2); + chanceContent.add(new Content(sepBPSlot2,0.2f,0.6f,null,null)); + //Sifting Washed Ore BP + if(material.hasProperty(PropertyKey.GEM)){ + List siftBPSlot1 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(gemExquisite, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + List siftBPSlot2 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(gemFlawless, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + List siftBPSlot3 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(gem, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + List siftBPSlot4 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(gemFlawed, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + List siftBPSlot5 = Registry.ITEM.getOrCreateTag(ChemicalHelper.getTag(gemChipped, material)).stream().map(Holder::value).map(ItemStack::new).toList(); + byproducts.add(siftBPSlot1); + chanceContent.add(new Content(siftBPSlot1,0.03f,0.01f,null,null)); + byproducts.add(siftBPSlot2); + chanceContent.add(new Content(siftBPSlot2,0.1f,0.015f,null,null)); + byproducts.add(siftBPSlot3); + chanceContent.add(new Content(siftBPSlot3,0.5f,0.075f,null,null)); + byproducts.add(siftBPSlot4); + chanceContent.add(new Content(siftBPSlot4,0.25f,0.03f,null,null)); + byproducts.add(siftBPSlot5); + chanceContent.add(new Content(siftBPSlot5,0.35f,0.04f,null,null)); + } + } +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java index b444e15545..08e3d16921 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.integration.emi.multipage.MultiblockInfoEmiCategory; +import com.gregtechceu.gtceu.integration.emi.oreprocessing.GTOreProcessingEmiCategory; import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeTypeEmiCategory; import dev.emi.emi.api.EmiEntrypoint; import dev.emi.emi.api.EmiPlugin; @@ -23,6 +24,7 @@ public class GTEMIPlugin implements EmiPlugin { @Override public void register(EmiRegistry registry) { registry.addCategory(MultiblockInfoEmiCategory.CATEGORY); + registry.addCategory(GTOreProcessingEmiCategory.CATEGORY); for (RecipeType recipeType : Registry.RECIPE_TYPE) { if (recipeType instanceof GTRecipeType gtRecipeType) { registry.addCategory(GTRecipeTypeEmiCategory.CATEGORIES.apply(gtRecipeType)); @@ -31,9 +33,11 @@ public void register(EmiRegistry registry) { // recipes MultiblockInfoEmiCategory.registerDisplays(registry); GTRecipeTypeEmiCategory.registerDisplays(registry); + GTOreProcessingEmiCategory.registerDisplays(registry); // workstations MultiblockInfoEmiCategory.registerWorkStations(registry); GTRecipeTypeEmiCategory.registerWorkStations(registry); + GTOreProcessingEmiCategory.registerWorkStations(registry); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { if (definition != null) { registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(definition.asStack())); diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java new file mode 100644 index 0000000000..27b7c7d5f2 --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java @@ -0,0 +1,29 @@ +package com.gregtechceu.gtceu.integration.emi.oreprocessing; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.integration.GTOreProcessingWidget; +import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; +import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +public class GTEmiOreProcessing extends ModularEmiRecipe { + final Material material; + + public GTEmiOreProcessing(Material material) { + super(() -> new GTOreProcessingWidget(material)); + this.material = material; + } + + @Override + public EmiRecipeCategory getCategory() { + return GTOreProcessingEmiCategory.CATEGORY; + } + + @Override + public @Nullable ResourceLocation getId() { + return GTCEu.id(material.getName()); + } +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java new file mode 100644 index 0000000000..f9c978a4db --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java @@ -0,0 +1,60 @@ +package com.gregtechceu.gtceu.integration.emi.oreprocessing; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.api.registry.GTRegistries; +import com.gregtechceu.gtceu.integration.rei.oreprocessing.GTOreProcessingDisplayCategory; +import com.lowdragmc.lowdraglib.emi.ModularUIEmiRecipeCategory; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.stack.EmiStack; +import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Items; + +import java.util.ArrayList; +import java.util.List; + +import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.ORE; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; + +public class GTOreProcessingEmiCategory extends ModularUIEmiRecipeCategory { + public static final GTOreProcessingEmiCategory CATEGORY = new GTOreProcessingEmiCategory(); + public GTOreProcessingEmiCategory() { + super(GTCEu.id("ore_processing_diagram"), EmiStack.of(Items.IRON_ORE)); + } + + public static void registerDisplays(EmiRegistry registry) { + for (Material mat : GTRegistries.MATERIALS) { + if (mat.hasProperty(ORE)) { + registry.addRecipe(new GTEmiOreProcessing(mat)); + } + } + } + + public static void registerWorkStations(EmiRegistry registry) { + List registeredMachines = new ArrayList<>(); + GTRecipeType[] validTypes = new GTRecipeType[] { + MACERATOR_RECIPES,ORE_WASHER_RECIPES,THERMAL_CENTRIFUGE_RECIPES,CENTRIFUGE_RECIPES,CHEMICAL_BATH_RECIPES,ELECTROMAGNETIC_SEPARATOR_RECIPES,SIFTER_RECIPES + }; + for (MachineDefinition machine : GTRegistries.MACHINES) { + if (machine.getRecipeTypes() != null) { + for (GTRecipeType type : machine.getRecipeTypes()){ + for (GTRecipeType validType : validTypes){ + if (type == validType && !registeredMachines.contains(machine)) { + registry.addWorkstation(CATEGORY, EmiStack.of(machine.asStack())); + registeredMachines.add(machine); + } + } + } + } + } + } + + @Override + public Component getName() { + return Component.translatable("gtceu.jei.ore_processing_diagram"); + } +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java index a27a633a54..0061c7726c 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.integration.jei.multipage.MultiblockInfoCategory; +import com.gregtechceu.gtceu.integration.jei.oreprocessing.GTOreProcessingInfoCategory; import com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeTypeCategory; import com.lowdragmc.lowdraglib.LDLib; import mezz.jei.api.IModPlugin; @@ -43,6 +44,7 @@ public void registerCategories(@Nonnull IRecipeCategoryRegistration registry) { GTCEu.LOGGER.info("JEI register categories"); IJeiHelpers jeiHelpers = registry.getJeiHelpers(); registry.addRecipeCategories(new MultiblockInfoCategory(jeiHelpers)); + registry.addRecipeCategories(new GTOreProcessingInfoCategory(jeiHelpers)); for (RecipeType recipeType : Registry.RECIPE_TYPE) { if (recipeType instanceof GTRecipeType gtRecipeType) { registry.addRecipeCategories(new GTRecipeTypeCategory(jeiHelpers, gtRecipeType)); @@ -55,6 +57,7 @@ public void registerRecipeCatalysts(@Nonnull IRecipeCatalystRegistration registr if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; MultiblockInfoCategory.registerRecipeCatalysts(registration); GTRecipeTypeCategory.registerRecipeCatalysts(registration); + GTOreProcessingInfoCategory.registerRecipeCatalysts(registration); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { if (definition != null) { registration.addRecipeCatalyst(definition.asStack(), RecipeTypes.SMELTING); @@ -72,6 +75,7 @@ public void registerRecipes(@Nonnull IRecipeRegistration registration) { GTCEu.LOGGER.info("JEI register"); MultiblockInfoCategory.registerRecipes(registration); GTRecipeTypeCategory.registerRecipes(registration); + GTOreProcessingInfoCategory.registerRecipes(registration); } @Override diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java new file mode 100644 index 0000000000..b273462e32 --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java @@ -0,0 +1,85 @@ +package com.gregtechceu.gtceu.integration.jei.oreprocessing; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.registry.GTRegistries; +import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.helpers.IJeiHelpers; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.registration.IRecipeCatalystRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; + +import javax.annotation.Nonnull; + +import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.DUST; +import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.ORE; +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; +import static com.gregtechceu.gtceu.common.data.GTMaterials.Aluminium; +import static com.gregtechceu.gtceu.common.data.GTMaterials.Iron; + +public class GTOreProcessingInfoCategory extends ModularUIRecipeCategory { + public final static RecipeType RECIPE_TYPE = new RecipeType<>(GTCEu.id("ore_processing_diagram"), GTOreProcessingInfoWrapper.class); + private final IDrawable background; + private final IDrawable icon; + + public GTOreProcessingInfoCategory(IJeiHelpers helpers) { + IGuiHelper guiHelper = helpers.getGuiHelper(); + this.background = guiHelper.createBlankDrawable(186, 174); + this.icon = helpers.getGuiHelper().createDrawableItemStack(ChemicalHelper.get(ore,Iron)); + } + + public static void registerRecipes(IRecipeRegistration registry) { + registry.addRecipes(RECIPE_TYPE, GTRegistries.MATERIALS.values().stream() + .filter((material) -> material.hasProperty(PropertyKey.ORE)) + .map(GTOreProcessingInfoWrapper::new) + .toList()); + } + + public static void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { + for (Material mat : GTRegistries.MATERIALS) { + if (mat.hasProperty(ORE)) { + registration.addRecipeCatalyst(ChemicalHelper.get(ore, mat), RECIPE_TYPE); + registration.addRecipeCatalyst(ChemicalHelper.get(rawOre, mat), RECIPE_TYPE); + registration.addRecipeCatalyst(ChemicalHelper.get(crushed, mat), RECIPE_TYPE); + registration.addRecipeCatalyst(ChemicalHelper.get(crushedPurified, mat), RECIPE_TYPE); + registration.addRecipeCatalyst(ChemicalHelper.get(crushedRefined, mat), RECIPE_TYPE); + registration.addRecipeCatalyst(ChemicalHelper.get(ore, mat), RECIPE_TYPE); + if (mat.hasProperty(DUST)) { + registration.addRecipeCatalyst(ChemicalHelper.get(dust, mat), RECIPE_TYPE); + } + } + } + } + + + @Override + @Nonnull + public RecipeType getRecipeType() { + return RECIPE_TYPE; + } + + @Nonnull + @Override + public Component getTitle() { + return Component.translatable("gtceu.jei.ore_processing_info"); + } + + @Nonnull + @Override + public IDrawable getBackground() { + return background; + } + + @Nonnull + @Override + public IDrawable getIcon() { + return icon; + } + +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java new file mode 100644 index 0000000000..2747932a08 --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java @@ -0,0 +1,15 @@ +package com.gregtechceu.gtceu.integration.jei.oreprocessing; + +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.integration.GTOreProcessingWidget; +import com.lowdragmc.lowdraglib.jei.ModularWrapper; + +public class GTOreProcessingInfoWrapper extends ModularWrapper { + public final Material material; + + public GTOreProcessingInfoWrapper(Material mat) { + super(new GTOreProcessingWidget(mat)); + this.material = mat; + } + +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java index 90debc24f1..c3dcf41ecd 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.integration.rei; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.integration.rei.multipage.MultiblockInfoDisplayCategory; +import com.gregtechceu.gtceu.integration.rei.oreprocessing.GTOreProcessingDisplayCategory; import com.gregtechceu.gtceu.integration.rei.recipe.GTRecipeTypeDisplayCategory; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; @@ -28,6 +31,7 @@ public class GTREIPlugin implements REIClientPlugin { @Override public void registerCategories(CategoryRegistry registry) { registry.add(new MultiblockInfoDisplayCategory()); + registry.add(new GTOreProcessingDisplayCategory()); for (RecipeType recipeType : Registry.RECIPE_TYPE) { if (recipeType instanceof GTRecipeType gtRecipeType) { registry.add(new GTRecipeTypeDisplayCategory(gtRecipeType)); @@ -36,6 +40,7 @@ public void registerCategories(CategoryRegistry registry) { // workstations MultiblockInfoDisplayCategory.registerWorkStations(registry); GTRecipeTypeDisplayCategory.registerWorkStations(registry); + GTOreProcessingDisplayCategory.registerWorkstations(registry); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { if (definition != null) { registry.addWorkstations(SMELTING, EntryStacks.of(definition.asStack())); @@ -51,6 +56,7 @@ public void registerCategories(CategoryRegistry registry) { public void registerDisplays(DisplayRegistry registry) { GTRecipeTypeDisplayCategory.registerDisplays(registry); MultiblockInfoDisplayCategory.registerDisplays(registry); + GTOreProcessingDisplayCategory.registerDisplays(registry); } @Override diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java new file mode 100644 index 0000000000..762ff25a19 --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java @@ -0,0 +1,46 @@ +package com.gregtechceu.gtceu.integration.rei.oreprocessing; + +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.integration.GTOreProcessingWidget; +import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import com.lowdragmc.lowdraglib.rei.ModularDisplay; +import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.entry.EntryStack; +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import me.shedaniel.rei.api.common.util.EntryIngredients; + +import java.util.ArrayList; +import java.util.List; + +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; + +public class GTOreProcessingDisplay extends ModularDisplay { + + private final Material material; + + public GTOreProcessingDisplay(Material material) { + super(() -> new GTOreProcessingWidget(material), GTOreProcessingDisplayCategory.CATEGORY); + this.material = material; + } + + @Override + public List getInputEntries() { + List ingredients = new ArrayList<>(); + ingredients.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(ore, material))); + ingredients.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(rawOre, material))); + return ingredients; + } + + @Override + public List getOutputEntries() { + List outputs = new ArrayList<>(); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(crushed, material))); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(crushedPurified, material))); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(crushedRefined, material))); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(dust, material))); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(dustImpure, material))); + outputs.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(dustPure, material))); + return outputs; + } +} diff --git a/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java new file mode 100644 index 0000000000..7b40205f5d --- /dev/null +++ b/common/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java @@ -0,0 +1,95 @@ +package com.gregtechceu.gtceu.integration.rei.oreprocessing; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; +import com.gregtechceu.gtceu.api.registry.GTRegistries; +import com.gregtechceu.gtceu.common.data.GTMaterials; +import com.gregtechceu.gtceu.common.data.GTRecipeTypes; +import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; +import com.lowdragmc.lowdraglib.rei.IGui2Renderer; +import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; +import com.lowdragmc.lowdraglib.utils.Size; +import lombok.Getter; +import me.shedaniel.rei.api.client.gui.Renderer; +import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; +import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Blocks; + +import javax.annotation.Nonnull; + +import java.util.ArrayList; +import java.util.List; + +import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.ORE; +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.ingot; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; + +public class GTOreProcessingDisplayCategory extends ModularUIDisplayCategory { + public static final CategoryIdentifier CATEGORY = CategoryIdentifier.of(GTCEu.id("ore_processing_diagram")); + @Getter + private final Renderer icon; + + @Getter + private final Size size; + + public GTOreProcessingDisplayCategory() { + this.icon = IGui2Renderer.toDrawable(new ItemStackTexture(Blocks.IRON_ORE.asItem())); + this.size = new Size(186,174); + } + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return CATEGORY; + } + + @Override + public int getDisplayHeight() { + return getSize().height; + } + + @Override + public int getDisplayWidth(GTOreProcessingDisplay display) { + return getSize().width; + } + + @Nonnull + @Override + public Component getTitle() { + return Component.translatable("gtceu.jei.ore_processing_diagram"); + } + + public static void registerDisplays(DisplayRegistry registry) { + for (Material mat : GTRegistries.MATERIALS) { + if (mat.hasProperty(ORE)) { + registry.add(new GTOreProcessingDisplay(mat)); + } + } + } + + public static void registerWorkstations(CategoryRegistry registry) { + List registeredMachines = new ArrayList<>(); + GTRecipeType[] validTypes = new GTRecipeType[] { + MACERATOR_RECIPES,ORE_WASHER_RECIPES,THERMAL_CENTRIFUGE_RECIPES,CENTRIFUGE_RECIPES,CHEMICAL_BATH_RECIPES,ELECTROMAGNETIC_SEPARATOR_RECIPES,SIFTER_RECIPES + }; + for (MachineDefinition machine : GTRegistries.MACHINES) { + if (machine.getRecipeTypes() != null) { + for (GTRecipeType type : machine.getRecipeTypes()){ + for (GTRecipeType validType : validTypes){ + if (type == validType && !registeredMachines.contains(machine)) { + registry.addWorkstations(GTOreProcessingDisplayCategory.CATEGORY, EntryStacks.of(machine.asStack())); + registeredMachines.add(machine); + } + } + } + } + } + } + +} diff --git a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-base.png b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-base.png index 4322edd99d..08f91544b5 100644 Binary files a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-base.png and b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-base.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-chem.png b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-chem.png index 5a0ddf58b3..351e0f6073 100644 Binary files a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-chem.png and b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-chem.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sep.png b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sep.png index 2cbc23214a..eed8906c25 100644 Binary files a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sep.png and b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sep.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sift.png b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sift.png index 50c16fa065..aa1e446cd3 100644 Binary files a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sift.png and b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-sift.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-smelt.png b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-smelt.png index 03c05311a0..5bf5d46b4e 100644 Binary files a/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-smelt.png and b/common/src/main/resources/assets/gtceu/textures/gui/arrows/oreby-smelt.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/base.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/base.png new file mode 100644 index 0000000000..b7031c23b9 Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/base.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/chem.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/chem.png new file mode 100644 index 0000000000..ae51366a45 Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/chem.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sep.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sep.png new file mode 100644 index 0000000000..b07b863b5d Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sep.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sift.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sift.png new file mode 100644 index 0000000000..108f32f652 Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/sift.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt1.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt1.png new file mode 100644 index 0000000000..3527baa385 Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt1.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt2.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt2.png new file mode 100644 index 0000000000..290304a58f Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/smelt2.png differ diff --git a/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/vac.png b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/vac.png new file mode 100644 index 0000000000..f7f2191b2f Binary files /dev/null and b/common/src/main/resources/assets/gtceu/textures/gui/oreprocessing/vac.png differ diff --git a/fabric/src/generated/resources/assets/gtceu/lang/en_ud.json b/fabric/src/generated/resources/assets/gtceu/lang/en_ud.json index 3c7f9feb89..af16e3e6c7 100644 --- a/fabric/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/fabric/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -1751,6 +1751,7 @@ "gtceu.jei.ore.sporadic.1": "uıǝʌ ǝɥʇ uı ǝɹǝɥʍʎuɐ suʍɐdS", "gtceu.jei.ore.surface_rock.0": "˙suoıʇɐɔoן uʍɐds uıǝʌ ǝʇouǝp ןɐıɹǝʇɐɯ sıɥʇ ɥʇıʍ sʞɔoᴚ ǝɔɐɟɹnS", "gtceu.jei.ore.surface_rock.1": "˙snuoq ɐ buıʌıb ǝunʇɹoℲ ɥʇıʍ 'ʇsnp ǝɥʇ ɟo sǝןıԀ ʎuı⟘ Ɛ ɹoɟ uǝʞoɹq ǝq uɐɔ ʎǝɥ⟘", + "gtceu.jei.ore_processing_diagram": "ɯɐɹbɐıᗡ buıssǝɔoɹԀ ǝɹO", "gtceu.key.armor_charging": "ǝןbbo⟘ ʎɹoʇuǝʌuI oʇ buıbɹɐɥƆ ɹoɯɹⱯ", "gtceu.key.armor_hover": "ǝןbbo⟘ ɹǝʌoH ɹoɯɹⱯ", "gtceu.key.armor_mode_switch": "ɥɔʇıʍS ǝpoW ɹoɯɹⱯ", diff --git a/fabric/src/generated/resources/assets/gtceu/lang/en_us.json b/fabric/src/generated/resources/assets/gtceu/lang/en_us.json index e332bd6926..618f1d4498 100644 --- a/fabric/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/fabric/src/generated/resources/assets/gtceu/lang/en_us.json @@ -1751,6 +1751,7 @@ "gtceu.jei.ore.sporadic.1": "Spawns anywhere in the vein", "gtceu.jei.ore.surface_rock.0": "Surface Rocks with this material denote vein spawn locations.", "gtceu.jei.ore.surface_rock.1": "They can be broken for 3 Tiny Piles of the dust, with Fortune giving a bonus.", + "gtceu.jei.ore_processing_diagram": "Ore Processing Diagram", "gtceu.key.armor_charging": "Armor Charging to Inventory Toggle", "gtceu.key.armor_hover": "Armor Hover Toggle", "gtceu.key.armor_mode_switch": "Armor Mode Switch", diff --git a/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json b/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json index 85f62088d5..87c12076d1 100644 --- a/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json +++ b/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json @@ -16,6 +16,5 @@ ], "rolls": 1.0 } - ], - "random_sequence": "gtceu:blocks/long_distance_fluid_pipeline" + ] } \ No newline at end of file diff --git a/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json b/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json index 262f0dc70a..b0da2f9805 100644 --- a/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json +++ b/fabric/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json @@ -16,6 +16,5 @@ ], "rolls": 1.0 } - ], - "random_sequence": "gtceu:blocks/long_distance_item_pipeline" + ] } \ No newline at end of file diff --git a/forge/src/generated/resources/assets/gtceu/lang/en_ud.json b/forge/src/generated/resources/assets/gtceu/lang/en_ud.json index 3c7f9feb89..af16e3e6c7 100644 --- a/forge/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/forge/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -1751,6 +1751,7 @@ "gtceu.jei.ore.sporadic.1": "uıǝʌ ǝɥʇ uı ǝɹǝɥʍʎuɐ suʍɐdS", "gtceu.jei.ore.surface_rock.0": "˙suoıʇɐɔoן uʍɐds uıǝʌ ǝʇouǝp ןɐıɹǝʇɐɯ sıɥʇ ɥʇıʍ sʞɔoᴚ ǝɔɐɟɹnS", "gtceu.jei.ore.surface_rock.1": "˙snuoq ɐ buıʌıb ǝunʇɹoℲ ɥʇıʍ 'ʇsnp ǝɥʇ ɟo sǝןıԀ ʎuı⟘ Ɛ ɹoɟ uǝʞoɹq ǝq uɐɔ ʎǝɥ⟘", + "gtceu.jei.ore_processing_diagram": "ɯɐɹbɐıᗡ buıssǝɔoɹԀ ǝɹO", "gtceu.key.armor_charging": "ǝןbbo⟘ ʎɹoʇuǝʌuI oʇ buıbɹɐɥƆ ɹoɯɹⱯ", "gtceu.key.armor_hover": "ǝןbbo⟘ ɹǝʌoH ɹoɯɹⱯ", "gtceu.key.armor_mode_switch": "ɥɔʇıʍS ǝpoW ɹoɯɹⱯ", diff --git a/forge/src/generated/resources/assets/gtceu/lang/en_us.json b/forge/src/generated/resources/assets/gtceu/lang/en_us.json index e332bd6926..618f1d4498 100644 --- a/forge/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/forge/src/generated/resources/assets/gtceu/lang/en_us.json @@ -1751,6 +1751,7 @@ "gtceu.jei.ore.sporadic.1": "Spawns anywhere in the vein", "gtceu.jei.ore.surface_rock.0": "Surface Rocks with this material denote vein spawn locations.", "gtceu.jei.ore.surface_rock.1": "They can be broken for 3 Tiny Piles of the dust, with Fortune giving a bonus.", + "gtceu.jei.ore_processing_diagram": "Ore Processing Diagram", "gtceu.key.armor_charging": "Armor Charging to Inventory Toggle", "gtceu.key.armor_hover": "Armor Hover Toggle", "gtceu.key.armor_mode_switch": "Armor Mode Switch", diff --git a/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json b/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json index 85f62088d5..87c12076d1 100644 --- a/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json +++ b/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_fluid_pipeline.json @@ -16,6 +16,5 @@ ], "rolls": 1.0 } - ], - "random_sequence": "gtceu:blocks/long_distance_fluid_pipeline" + ] } \ No newline at end of file diff --git a/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json b/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json index 262f0dc70a..b0da2f9805 100644 --- a/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json +++ b/forge/src/generated/resources/data/gtceu/loot_tables/blocks/long_distance_item_pipeline.json @@ -16,6 +16,5 @@ ], "rolls": 1.0 } - ], - "random_sequence": "gtceu:blocks/long_distance_item_pipeline" + ] } \ No newline at end of file