Compressor Jei Support
This commit is contained in:
parent
391b28e50f
commit
fcb8cc0a8e
6 changed files with 153 additions and 3 deletions
|
@ -18,4 +18,5 @@ public class RecipeCategoryUids {
|
|||
public static final String VACUUM_FREEZER = "TechReborn.VacuumFreezer";
|
||||
public static final String GRINDER = "TechReborn.Grinder";
|
||||
public static final String EXTRACTOR = "TechReborn.Extractor";
|
||||
public static final String COMPRESSOR = "TechReborn.Compressor";
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import techreborn.client.container.ContainerAssemblingMachine;
|
|||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.container.ContainerCentrifuge;
|
||||
import techreborn.client.container.ContainerChemicalReactor;
|
||||
import techreborn.client.container.ContainerCompressor;
|
||||
import techreborn.client.container.ContainerExtractor;
|
||||
import techreborn.client.container.ContainerFusionReactor;
|
||||
import techreborn.client.container.ContainerGrinder;
|
||||
|
@ -39,6 +40,7 @@ import techreborn.client.gui.GuiAssemblingMachine;
|
|||
import techreborn.client.gui.GuiBlastFurnace;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.client.gui.GuiChemicalReactor;
|
||||
import techreborn.client.gui.GuiCompressor;
|
||||
import techreborn.client.gui.GuiExtractor;
|
||||
import techreborn.client.gui.GuiFusionReactor;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
|
@ -58,6 +60,8 @@ import techreborn.compat.jei.centrifuge.CentrifugeRecipeCategory;
|
|||
import techreborn.compat.jei.centrifuge.CentrifugeRecipeHandler;
|
||||
import techreborn.compat.jei.chemicalReactor.ChemicalReactorRecipeCategory;
|
||||
import techreborn.compat.jei.chemicalReactor.ChemicalReactorRecipeHandler;
|
||||
import techreborn.compat.jei.compressor.CompressorRecipeCategory;
|
||||
import techreborn.compat.jei.compressor.CompressorRecipeHandler;
|
||||
import techreborn.compat.jei.extractor.ExtractorRecipeCategory;
|
||||
import techreborn.compat.jei.extractor.ExtractorRecipeHandler;
|
||||
import techreborn.compat.jei.fusionReactor.FusionReactorRecipeCategory;
|
||||
|
@ -99,7 +103,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
new RollingMachineRecipeCategory(guiHelper),
|
||||
new VacuumFreezerRecipeCategory(guiHelper),
|
||||
new GrinderRecipeCategory(guiHelper),
|
||||
new ExtractorRecipeCategory(guiHelper)
|
||||
new ExtractorRecipeCategory(guiHelper),
|
||||
new CompressorRecipeCategory(guiHelper)
|
||||
);
|
||||
|
||||
registry.addRecipeHandlers(
|
||||
|
@ -116,7 +121,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
new RollingMachineRecipeHandler(),
|
||||
new VacuumFreezerRecipeHandler(jeiHelpers),
|
||||
new GrinderRecipeHandler(jeiHelpers),
|
||||
new ExtractorRecipeHandler(jeiHelpers)
|
||||
new ExtractorRecipeHandler(jeiHelpers),
|
||||
new CompressorRecipeHandler(jeiHelpers)
|
||||
);
|
||||
|
||||
registry.addRecipes(RecipeHandler.recipeList);
|
||||
|
@ -151,6 +157,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
registry.addRecipeClickArea(GuiVacuumFreezer.class, 78, 36, 24, 16, RecipeCategoryUids.VACUUM_FREEZER);
|
||||
registry.addRecipeClickArea(GuiGrinder.class, 78, 36, 24, 16, RecipeCategoryUids.GRINDER);
|
||||
registry.addRecipeClickArea(GuiExtractor.class, 78, 36, 24, 16, RecipeCategoryUids.EXTRACTOR);
|
||||
registry.addRecipeClickArea(GuiCompressor.class, 78, 36, 24, 16, RecipeCategoryUids.COMPRESSOR);
|
||||
|
||||
|
||||
IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
|
||||
|
@ -170,6 +177,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
|||
recipeTransferRegistry.addRecipeTransferHandler(ContainerVacuumFreezer.class, RecipeCategoryUids.VACUUM_FREEZER, 0, 1, 2, 36);
|
||||
recipeTransferRegistry.addRecipeTransferHandler(ContainerGrinder.class, RecipeCategoryUids.GRINDER, 0, 1, 2, 36);
|
||||
recipeTransferRegistry.addRecipeTransferHandler(ContainerExtractor.class, RecipeCategoryUids.EXTRACTOR, 0, 1, 2, 36);
|
||||
recipeTransferRegistry.addRecipeTransferHandler(ContainerCompressor.class, RecipeCategoryUids.COMPRESSOR, 0, 1, 2, 36);
|
||||
|
||||
}
|
||||
|
||||
private static void addDebugRecipes(IModRegistry registry) {
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package techreborn.compat.jei.compressor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import techreborn.client.gui.GuiCompressor;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
import techreborn.compat.jei.RecipeUtil;
|
||||
|
||||
public class CompressorRecipeCategory extends BlankRecipeCategory {
|
||||
private static final int[] INPUT_SLOTS = {0};
|
||||
private static final int[] OUTPUT_SLOTS = {1};
|
||||
|
||||
private final IDrawable background;
|
||||
private final String title;
|
||||
|
||||
public CompressorRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(GuiCompressor.texture, 55, 30, 82, 26);
|
||||
title = StatCollector.translateToLocal("tile.techreborn.compressor.name");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return RecipeCategoryUids.COMPRESSOR;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
|
||||
|
||||
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
|
||||
|
||||
if (recipeWrapper instanceof CompressorRecipeWrapper) {
|
||||
CompressorRecipeWrapper recipe = (CompressorRecipeWrapper) recipeWrapper;
|
||||
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package techreborn.compat.jei.compressor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import techreborn.api.recipe.machines.CompressorRecipe;
|
||||
import techreborn.api.recipe.machines.GrinderRecipe;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
||||
public class CompressorRecipeHandler implements IRecipeHandler<CompressorRecipe> {
|
||||
@Nonnull
|
||||
private final IJeiHelpers jeiHelpers;
|
||||
|
||||
public CompressorRecipeHandler(@Nonnull IJeiHelpers jeiHelpers) {
|
||||
this.jeiHelpers = jeiHelpers;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<CompressorRecipe> getRecipeClass() {
|
||||
return CompressorRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return RecipeCategoryUids.COMPRESSOR;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull CompressorRecipe recipe) {
|
||||
return new CompressorRecipeWrapper(jeiHelpers, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull CompressorRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package techreborn.compat.jei.compressor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import techreborn.api.recipe.machines.CompressorRecipe;
|
||||
import techreborn.api.recipe.machines.GrinderRecipe;
|
||||
import techreborn.client.gui.GuiCompressor;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
import techreborn.compat.jei.BaseRecipeWrapper;
|
||||
|
||||
public class CompressorRecipeWrapper extends BaseRecipeWrapper<CompressorRecipe> {
|
||||
private final IDrawableAnimated progress;
|
||||
|
||||
public CompressorRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull CompressorRecipe baseRecipe) {
|
||||
super(baseRecipe);
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiCompressor.texture, 176, 14, 20, 11);
|
||||
|
||||
int ticksPerCycle = baseRecipe.tickTime();
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
super.drawAnimations(minecraft, recipeWidth, recipeHeight);
|
||||
progress.draw(minecraft, 25, 7);
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
|||
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
|
||||
import techreborn.api.recipe.machines.CentrifugeRecipe;
|
||||
import techreborn.api.recipe.machines.ChemicalReactorRecipe;
|
||||
import techreborn.api.recipe.machines.CompressorRecipe;
|
||||
import techreborn.api.recipe.machines.ExtractorRecipe;
|
||||
import techreborn.api.recipe.machines.GrinderRecipe;
|
||||
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
|
||||
|
@ -75,9 +76,14 @@ public class
|
|||
addHammerRecipes();
|
||||
addIc2ReplacementReicpes();
|
||||
addExtractorRecipes();
|
||||
addCompressorRecipes();
|
||||
}
|
||||
|
||||
static void addExtractorRecipes() {
|
||||
private static void addCompressorRecipes() {
|
||||
RecipeHandler.addRecipe(new CompressorRecipe(new ItemStack(Items.diamond), new ItemStack(Items.coal), 400, 20));
|
||||
}
|
||||
|
||||
static void addExtractorRecipes() {
|
||||
RecipeHandler.addRecipe(new ExtractorRecipe(ItemParts.getPartByName("rubberSap"), ItemParts.getPartByName("rubber", 3), 400, 20));
|
||||
RecipeHandler.addRecipe(new ExtractorRecipe(new ItemStack(ModBlocks.rubberLog), ItemParts.getPartByName("rubber"), 400, 20));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue