-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* only let the category register once * added EMI support * finalized the oreproc page * Update GTJEIPlugin.java * Update GTOreProcessingDisplayCategory.java * Update GTOreProcessingInfoCategory.java * Update GTOreProcessingEmiCategory.java * more requested changes * Update GTOreProcessingEmiCategory.java * more changes
- Loading branch information
Showing
32 changed files
with
855 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
494 changes: 494 additions & 0 deletions
494
common/src/main/java/com/gregtechceu/gtceu/integration/GTOreProcessingWidget.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<WidgetGroup> { | ||
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()); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
.../java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<MachineDefinition> 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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GTOreProcessingInfoWrapper> { | ||
public final static RecipeType<GTOreProcessingInfoWrapper> 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<GTOreProcessingInfoWrapper> 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; | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
.../java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GTOreProcessingWidget> { | ||
public final Material material; | ||
|
||
public GTOreProcessingInfoWrapper(Material mat) { | ||
super(new GTOreProcessingWidget(mat)); | ||
this.material = mat; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<WidgetGroup> { | ||
|
||
private final Material material; | ||
|
||
public GTOreProcessingDisplay(Material material) { | ||
super(() -> new GTOreProcessingWidget(material), GTOreProcessingDisplayCategory.CATEGORY); | ||
this.material = material; | ||
} | ||
|
||
@Override | ||
public List<EntryIngredient> getInputEntries() { | ||
List<EntryIngredient> ingredients = new ArrayList<>(); | ||
ingredients.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(ore, material))); | ||
ingredients.add(EntryIngredients.ofItemTag(ChemicalHelper.getTag(rawOre, material))); | ||
return ingredients; | ||
} | ||
|
||
@Override | ||
public List<EntryIngredient> getOutputEntries() { | ||
List<EntryIngredient> 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; | ||
} | ||
} |
Oops, something went wrong.