-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.20.1] Added the rest of JEI compat (#2)
* started work on jei compat * added clickable area for producers (dna wip) * finished producers * fixed recipe path typo * finished dna labware display, moving to processing machines * added recipe catalysts * forgot to run data generators * cleaned up some code, made it less congested * moved producers code under same path
- Loading branch information
Showing
22 changed files
with
269 additions
and
18 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/generated/resources/.cache/17bf486417190b9b075888bd20665b89993b9d5d
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// 1.20.1 2025-01-14T18:00:20.7166039 ModKit Language: en_us for mod 'gendustry' | ||
a67e95b70c92f62f4d94c6831fced1974ff2d8ae assets/gendustry/lang/en_us.json | ||
// 1.20.1 2025-01-20T18:49:21.4418297 ModKit Language: en_us for mod 'gendustry' | ||
dc3ec84cadb2f83e7e36bcc5e6e5d5be1c1ef5cb assets/gendustry/lang/en_us.json |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
18 changes: 18 additions & 0 deletions
18
src/main/java/thedarkcolour/gendustry/compat/jei/GendustryRecipeType.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,18 @@ | ||
package thedarkcolour.gendustry.compat.jei; | ||
|
||
import mezz.jei.api.recipe.RecipeType; | ||
import thedarkcolour.gendustry.Gendustry; | ||
import thedarkcolour.gendustry.recipe.DnaRecipe; | ||
import thedarkcolour.gendustry.recipe.MutagenRecipe; | ||
import thedarkcolour.gendustry.recipe.ProteinRecipe; | ||
|
||
public class GendustryRecipeType { | ||
|
||
public static final RecipeType<MutagenRecipe> MUTAGEN_PRODUCER = create("mutagen_producer", MutagenRecipe.class); | ||
public static final RecipeType<DnaRecipe> DNA_EXTRACTOR = create("dna_extractor", DnaRecipe.class); | ||
public static final RecipeType<ProteinRecipe> PROTEIN_LIQUEFIER = create("protein_liquefier", ProteinRecipe.class); | ||
|
||
private static <T> RecipeType<T> create(String uid, Class<? extends T> recipeClass) { | ||
return RecipeType.create(Gendustry.ID, uid, recipeClass); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/thedarkcolour/gendustry/compat/jei/producers/DNAExtractorRecipeCategory.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,51 @@ | ||
package thedarkcolour.gendustry.compat.jei.producers; | ||
|
||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; | ||
import mezz.jei.api.gui.drawable.IDrawable; | ||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView; | ||
import mezz.jei.api.helpers.IGuiHelper; | ||
import mezz.jei.api.recipe.IFocusGroup; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.ItemStack; | ||
import thedarkcolour.gendustry.block.GendustryMachineType; | ||
import thedarkcolour.gendustry.compat.jei.GendustryRecipeType; | ||
import thedarkcolour.gendustry.item.GendustryResourceType; | ||
import thedarkcolour.gendustry.recipe.DnaRecipe; | ||
import thedarkcolour.gendustry.registry.GBlocks; | ||
import thedarkcolour.gendustry.registry.GFluids; | ||
import thedarkcolour.gendustry.registry.GItems; | ||
|
||
public class DNAExtractorRecipeCategory extends ProducerRecipeCategory<DnaRecipe> { | ||
|
||
public static final ItemStack ICON_STACK = new ItemStack(GBlocks.MACHINE.get(GendustryMachineType.DNA_EXTRACTOR).block()); | ||
private final IDrawable labwareSlot; | ||
|
||
public DNAExtractorRecipeCategory(IGuiHelper helper) { | ||
super(helper, "block.gendustry.dna_extractor", ICON_STACK); | ||
this.labwareSlot = helper.createDrawable(GUI, 176, 78, 18, 18); | ||
} | ||
|
||
@Override | ||
public RecipeType<DnaRecipe> getRecipeType() { | ||
return GendustryRecipeType.DNA_EXTRACTOR; | ||
} | ||
|
||
@Override | ||
public void setRecipe(IRecipeLayoutBuilder builder, DnaRecipe recipe, IFocusGroup iFocusGroup) { | ||
builder.addSlot(RecipeIngredientRole.INPUT, 1, 23).addItemStack(recipe.getSpeciesType().getDefaultSpecies().createStack(recipe.getStage())); | ||
addFluidTank(builder, GFluids.LIQUID_DNA.fluid(), recipe.getAmount()); | ||
builder.addSlot(RecipeIngredientRole.INPUT, 51, 1).addItemStack(GItems.RESOURCE.item(GendustryResourceType.LABWARE).getDefaultInstance()).addRichTooltipCallback((recipeSlotView, tooltip) -> { | ||
tooltip.add(Component.translatable("gen.for.chance", 10).withStyle(ChatFormatting.AQUA)); | ||
}); | ||
} | ||
|
||
@Override | ||
public void draw(DnaRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { | ||
super.draw(recipe, recipeSlotsView, graphics, mouseX, mouseY); | ||
this.labwareSlot.draw(graphics, 50, 0); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/thedarkcolour/gendustry/compat/jei/producers/MutagenRecipeCategory.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,33 @@ | ||
package thedarkcolour.gendustry.compat.jei.producers; | ||
|
||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; | ||
import mezz.jei.api.helpers.IGuiHelper; | ||
import mezz.jei.api.recipe.IFocusGroup; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import net.minecraft.world.item.ItemStack; | ||
import thedarkcolour.gendustry.block.GendustryMachineType; | ||
import thedarkcolour.gendustry.compat.jei.GendustryRecipeType; | ||
import thedarkcolour.gendustry.recipe.MutagenRecipe; | ||
import thedarkcolour.gendustry.registry.GBlocks; | ||
import thedarkcolour.gendustry.registry.GFluids; | ||
|
||
public class MutagenRecipeCategory extends ProducerRecipeCategory<MutagenRecipe> { | ||
|
||
public static final ItemStack ICON_STACK = new ItemStack(GBlocks.MACHINE.get(GendustryMachineType.MUTAGEN_PRODUCER).block()); | ||
|
||
public MutagenRecipeCategory(IGuiHelper helper) { | ||
super(helper, "block.gendustry.mutagen_producer", ICON_STACK); | ||
} | ||
|
||
@Override | ||
public RecipeType<MutagenRecipe> getRecipeType() { | ||
return GendustryRecipeType.MUTAGEN_PRODUCER; | ||
} | ||
|
||
@Override | ||
public void setRecipe(IRecipeLayoutBuilder builder, MutagenRecipe recipe, IFocusGroup focuses) { | ||
builder.addSlot(RecipeIngredientRole.INPUT, 1, 23).addIngredients(recipe.getIngredient()); | ||
addFluidTank(builder, GFluids.MUTAGEN.fluid(), recipe.getAmount()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/thedarkcolour/gendustry/compat/jei/producers/ProducerGuiContainerHandler.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 thedarkcolour.gendustry.compat.jei.producers; | ||
|
||
import mezz.jei.api.gui.handlers.IGuiClickableArea; | ||
import mezz.jei.api.gui.handlers.IGuiContainerHandler; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import thedarkcolour.gendustry.blockentity.DnaExtractorBlockEntity; | ||
import thedarkcolour.gendustry.blockentity.MutagenProducerBlockEntity; | ||
import thedarkcolour.gendustry.blockentity.ProteinLiquefierBlockEntity; | ||
import thedarkcolour.gendustry.client.screen.ProducerScreen; | ||
import thedarkcolour.gendustry.compat.jei.GendustryRecipeType; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
public class ProducerGuiContainerHandler implements IGuiContainerHandler<ProducerScreen> { | ||
|
||
@Override | ||
public Collection<IGuiClickableArea> getGuiClickableAreas(ProducerScreen containerScreen, double guiMouseX, double guiMouseY) { | ||
BlockEntity blockEntity = containerScreen.getMenu().getTile(); | ||
if (blockEntity instanceof MutagenProducerBlockEntity) { | ||
return Collections.singleton(IGuiClickableArea.createBasic(48, 40, 55, 18, GendustryRecipeType.MUTAGEN_PRODUCER)); | ||
} else if (blockEntity instanceof DnaExtractorBlockEntity) { | ||
return Collections.singleton(IGuiClickableArea.createBasic(48, 40, 55, 18, GendustryRecipeType.DNA_EXTRACTOR)); | ||
} else if (blockEntity instanceof ProteinLiquefierBlockEntity) { | ||
return Collections.singleton(IGuiClickableArea.createBasic(48, 40, 55, 18, GendustryRecipeType.PROTEIN_LIQUEFIER)); | ||
} | ||
return Collections.emptyList(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/thedarkcolour/gendustry/compat/jei/producers/ProducerRecipeCategory.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,54 @@ | ||
package thedarkcolour.gendustry.compat.jei.producers; | ||
|
||
import forestry.core.recipes.jei.ForestryRecipeCategory; | ||
import mezz.jei.api.constants.VanillaTypes; | ||
import mezz.jei.api.forge.ForgeTypes; | ||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; | ||
import mezz.jei.api.gui.drawable.IDrawable; | ||
import mezz.jei.api.gui.drawable.IDrawableAnimated; | ||
import mezz.jei.api.gui.drawable.IDrawableStatic; | ||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView; | ||
import mezz.jei.api.helpers.IGuiHelper; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import org.jetbrains.annotations.Nullable; | ||
import thedarkcolour.gendustry.Gendustry; | ||
import thedarkcolour.gendustry.recipe.ProcessorRecipe; | ||
|
||
public abstract class ProducerRecipeCategory<T extends ProcessorRecipe> extends ForestryRecipeCategory<T> { | ||
|
||
protected static final ResourceLocation GUI = new ResourceLocation(Gendustry.ID, "textures/gui/processor.png"); | ||
private final IDrawableAnimated arrow; | ||
private final IDrawable tankOverlay; | ||
private final IDrawable icon; | ||
|
||
public ProducerRecipeCategory(IGuiHelper helper, String unlocalizedName, ItemStack stack) { | ||
super(helper.createDrawable(GUI, 13, 18, 151, 60), unlocalizedName); | ||
|
||
IDrawableStatic arrowDrawable = helper.createDrawable(GUI, 176, 60, 55, 18); | ||
this.arrow = helper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false); | ||
this.tankOverlay = helper.createDrawable(GUI, 176, 0, 16, 58); | ||
this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM_STACK, stack); | ||
} | ||
|
||
@Override | ||
public @Nullable IDrawable getIcon() { | ||
return this.icon; | ||
} | ||
|
||
@Override | ||
public void draw(T recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) { | ||
this.arrow.draw(graphics, 35, 23); | ||
} | ||
|
||
protected void addFluidTank(IRecipeLayoutBuilder builder, Fluid fluid, int amount) { | ||
builder.addSlot(RecipeIngredientRole.OUTPUT, 109, 1) | ||
.setFluidRenderer(10000, false, 16, 58) | ||
.setOverlay(tankOverlay, 0, 0) | ||
.addIngredient(ForgeTypes.FLUID_STACK, new FluidStack(fluid, amount)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...main/java/thedarkcolour/gendustry/compat/jei/producers/ProteinProducerRecipeCategory.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,33 @@ | ||
package thedarkcolour.gendustry.compat.jei.producers; | ||
|
||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; | ||
import mezz.jei.api.helpers.IGuiHelper; | ||
import mezz.jei.api.recipe.IFocusGroup; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import net.minecraft.world.item.ItemStack; | ||
import thedarkcolour.gendustry.block.GendustryMachineType; | ||
import thedarkcolour.gendustry.compat.jei.GendustryRecipeType; | ||
import thedarkcolour.gendustry.recipe.ProteinRecipe; | ||
import thedarkcolour.gendustry.registry.GBlocks; | ||
import thedarkcolour.gendustry.registry.GFluids; | ||
|
||
public class ProteinProducerRecipeCategory extends ProducerRecipeCategory<ProteinRecipe> { | ||
|
||
public static final ItemStack ICON_STACK = new ItemStack(GBlocks.MACHINE.get(GendustryMachineType.PROTEIN_LIQUEFIER).block()); | ||
|
||
public ProteinProducerRecipeCategory(IGuiHelper helper) { | ||
super(helper, "block.gendustry.protein_liquefier", ICON_STACK); | ||
} | ||
|
||
@Override | ||
public RecipeType<ProteinRecipe> getRecipeType() { | ||
return GendustryRecipeType.PROTEIN_LIQUEFIER; | ||
} | ||
|
||
@Override | ||
public void setRecipe(IRecipeLayoutBuilder builder, ProteinRecipe recipe, IFocusGroup iFocusGroup) { | ||
builder.addSlot(RecipeIngredientRole.INPUT, 1, 23).addIngredients(recipe.getIngredient()); | ||
addFluidTank(builder, GFluids.PROTEIN.fluid(), recipe.getAmount()); | ||
} | ||
} |
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