Update JEI support, in a few places I could not figure it out, so there may be some issues.

This commit is contained in:
modmuss50 2016-11-28 15:28:32 +00:00
parent 9c33676b3d
commit c72c3b5851
51 changed files with 72 additions and 403 deletions

View file

@ -10,6 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
@ -91,5 +92,9 @@ public class BlockMachineCasing extends BlockMultiblockBase {
return b != this && super.shouldSideBeRendered(blockState, worldIn, pos, side);
}
@Override
public boolean canRenderInLayer(BlockRenderLayer layer) {
return true;
}
}

View file

@ -0,0 +1,91 @@
package techreborn.compat.jei;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.api.recipe.BaseRecipe;
import javax.annotation.Nonnull;
import java.util.*;
public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecipeWrapper {
protected final T baseRecipe;
@Nonnull
private final List<List<ItemStack>> inputs;
@Nonnull
private final List<List<ItemStack>> outputs;
public BaseRecipeWrapper(T baseRecipe) {
this.baseRecipe = baseRecipe;
inputs = new ArrayList<>();
outputs = new ArrayList<>();
for (ItemStack input : baseRecipe.getInputs()) {
if (baseRecipe.useOreDic()) {
List<ItemStack> oreDictInputs = expandOreDict(input);
inputs.add(oreDictInputs);
} else {
inputs.add(Collections.singletonList(input));
}
}
for (ItemStack input : baseRecipe.getOutputs()) {
if (baseRecipe.useOreDic()) {
List<ItemStack> oreDictInputs = expandOreDict(input);
outputs.add(oreDictInputs);
} else {
outputs.add(Collections.singletonList(input));
}
}
}
private static List<ItemStack> expandOreDict(ItemStack itemStack) {
int[] oreIds = OreDictionary.getOreIDs(itemStack);
if (oreIds.length == 0) {
return Collections.singletonList(itemStack);
}
Set<ItemStack> itemStackSet = new HashSet<>();
for (int oreId : oreIds) {
String oreName = OreDictionary.getOreName(oreId);
List<ItemStack> ores = OreDictionary.getOres(oreName);
for (ItemStack ore : ores) {
if (ore.getCount() != itemStack.getCount()) {
ItemStack oreCopy = ore.copy();
oreCopy.setCount(itemStack.getCount());
itemStackSet.add(oreCopy);
} else {
itemStackSet.add(ore);
}
}
}
return new ArrayList<>(itemStackSet);
}
@Override
public void getIngredients(
@Nonnull
IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, inputs);
ingredients.setOutputs(ItemStack.class, baseRecipe.getOutputs());
}
@Nonnull
public List<List<ItemStack>> getInputs() {
return inputs;
}
public List<FluidStack> getFluidInputs(){
return new ArrayList<>();
}
@Nonnull
public List<ItemStack> getOutputs() {
List<ItemStack> stacks = new ArrayList<>();
for(List<ItemStack> stackList : outputs){
stacks.addAll(stackList);
}
return stacks;
}
}

View file

@ -0,0 +1,22 @@
package techreborn.compat.jei;
public class RecipeCategoryUids {
public static final String ALLOY_SMELTER = "TechReborn.AlloySmelter";
public static final String ASSEMBLING_MACHINE = "TechReborn.AssemblingMachine";
public static final String BLAST_FURNACE = "TechReborn.BlastFurnace";
public static final String CENTRIFUGE = "TechReborn.Centrifuge";
public static final String CHEMICAL_REACTOR = "TechReborn.ChemicalReactor";
public static final String FUSION_REACTOR = "TechReborn.FusionReactor";
public static final String INDUSTRIAL_GRINDER = "TechReborn.IndustrialGrinder";
public static final String IMPLOSION_COMPRESSOR = "TechReborn.ImplosionCompressor";
public static final String INDUSTRIAL_ELECTROLYZER = "TechReborn.IndustrialElectrolyzer";
public static final String ROLLING_MACHINE = "TechReborn.RollingMachine";
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";
public static final String SCRAPBOX = "TechReborn.Scrapbox";
private RecipeCategoryUids() {
}
}

View file

@ -0,0 +1,161 @@
package techreborn.compat.jei;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.awt.*;
import java.text.NumberFormat;
import java.util.List;
public class RecipeUtil {
private static final int color = Color.darkGray.getRGB();
private RecipeUtil() {
}
public static void drawInfo(
@Nonnull
Minecraft minecraft, int x, int y, final double startCost,
final double euPerTick, final int tickTime) {
FontRenderer fontRendererObj = minecraft.fontRendererObj;
int lineSpacing = fontRendererObj.FONT_HEIGHT + 1;
NumberFormat formatter = NumberFormat.getInstance();
String startCostEU = formatter.format(startCost);
String startCostString = I18n.translateToLocalFormatted("techreborn.jei.recipe.start.cost", startCostEU);
fontRendererObj.drawString(startCostString, x, y, color);
y += lineSpacing;
drawInfo(minecraft, x, y, euPerTick, tickTime);
}
public static void drawInfo(
@Nonnull
Minecraft minecraft, int x, int y, final double euPerTick, final int tickTime) {
FontRenderer fontRendererObj = minecraft.fontRendererObj;
int lineSpacing = fontRendererObj.FONT_HEIGHT + 1;
String runningCostString = I18n.translateToLocalFormatted("techreborn.jei.recipe.running.cost", euPerTick);
fontRendererObj.drawString(runningCostString, x, y, color);
y += lineSpacing;
String processingTimeString1 = I18n.translateToLocalFormatted("techreborn.jei.recipe.processing.time.1",
tickTime);
fontRendererObj.drawString(processingTimeString1, x, y, color);
y += lineSpacing;
int seconds = tickTime / 20;
String processingTimeString2 = I18n.translateToLocalFormatted("techreborn.jei.recipe.processing.time.2",
seconds);
fontRendererObj.drawString(processingTimeString2, x + 10, y, color);
}
@Deprecated
public static void setRecipeItems(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
BaseRecipeWrapper<?> recipe,
@Nullable
int[] itemInputSlots,
@Nullable
int[] itemOutputSlots,
@Nullable
int[] fluidInputSlots,
@Nullable
int[] fluidOutputSlots) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
if (itemInputSlots != null) {
List<List<ItemStack>> inputs = recipe.getInputs();
for (int i = 0; i < inputs.size() && i < itemInputSlots.length; i++) {
int inputSlot = itemInputSlots[i];
guiItemStacks.set(inputSlot, inputs.get(i));
}
}
if (itemOutputSlots != null) {
List<ItemStack> outputs = recipe.getOutputs();
for (int i = 0; i < outputs.size() && i < itemOutputSlots.length; i++) {
int outputSlot = itemOutputSlots[i];
guiItemStacks.set(outputSlot, outputs.get(i));
}
}
if (fluidInputSlots != null) {
List<FluidStack> fluidInputs = recipe.getFluidInputs();
for (int i = 0; i < fluidInputs.size() && i < fluidInputSlots.length; i++) {
int inputTank = fluidInputSlots[i];
guiFluidStacks.set(inputTank, fluidInputs.get(i));
}
}
//TODO 1.11
// if (fluidOutputSlots != null) {
// List<FluidStack> fluidOutputs = recipe.getFluidOutputs();
// for (int i = 0; i < fluidOutputs.size() && i < fluidOutputSlots.length; i++) {
// int outputTank = fluidOutputSlots[i];
// guiFluidStacks.set(outputTank, fluidOutputs.get(i));
// }
// }
}
public static void setRecipeItems(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
IIngredients ingredients,
@Nullable
int[] itemInputSlots,
@Nullable
int[] itemOutputSlots,
@Nullable
int[] fluidInputSlots,
@Nullable
int[] fluidOutputSlots) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
if (itemInputSlots != null) {
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
for (int i = 0; i < inputs.size() && i < itemInputSlots.length; i++) {
int inputSlot = itemInputSlots[i];
guiItemStacks.set(inputSlot, inputs.get(i));
}
}
if (itemOutputSlots != null) {
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
for (int i = 0; i < outputs.size() && i < itemOutputSlots.length; i++) {
int outputSlot = itemOutputSlots[i];
guiItemStacks.set(outputSlot, outputs.get(i));
}
}
if (fluidInputSlots != null) {
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
for (int i = 0; i < fluidInputs.size() && i < fluidInputSlots.length; i++) {
int inputTank = fluidInputSlots[i];
guiFluidStacks.set(inputTank, fluidInputs.get(i));
}
}
if (fluidOutputSlots != null) {
List<List<FluidStack>> fluidOutputs = ingredients.getOutputs(FluidStack.class);
for (int i = 0; i < fluidOutputs.size() && i < fluidOutputSlots.length; i++) {
int outputTank = fluidOutputSlots[i];
guiFluidStacks.set(outputTank, fluidOutputs.get(i));
}
}
}
}

View file

@ -0,0 +1,259 @@
package techreborn.compat.jei;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import reborncore.api.recipe.RecipeHandler;
import techreborn.Core;
import techreborn.api.reactor.FusionReactorRecipeHelper;
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
import techreborn.client.container.*;
import techreborn.client.gui.*;
import techreborn.compat.CompatManager;
import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory;
import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeHandler;
import techreborn.compat.jei.assemblingMachine.AssemblingMachineRecipeCategory;
import techreborn.compat.jei.assemblingMachine.AssemblingMachineRecipeHandler;
import techreborn.compat.jei.blastFurnace.BlastFurnaceRecipeCategory;
import techreborn.compat.jei.blastFurnace.BlastFurnaceRecipeHandler;
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;
import techreborn.compat.jei.fusionReactor.FusionReactorRecipeHandler;
import techreborn.compat.jei.grinder.GrinderRecipeCategory;
import techreborn.compat.jei.grinder.GrinderRecipeHandler;
import techreborn.compat.jei.implosionCompressor.ImplosionCompressorRecipeCategory;
import techreborn.compat.jei.implosionCompressor.ImplosionCompressorRecipeHandler;
import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipeCategory;
import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipeHandler;
import techreborn.compat.jei.industrialGrinder.IndustrialGrinderRecipeCategory;
import techreborn.compat.jei.industrialGrinder.IndustrialGrinderRecipeHandler;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeCategory;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeHandler;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeMaker;
import techreborn.compat.jei.scrapbox.ScrapboxRecipeCategory;
import techreborn.compat.jei.scrapbox.ScrapboxRecipeHandler;
import techreborn.compat.jei.vacuumFreezer.VacuumFreezerRecipeCategory;
import techreborn.compat.jei.vacuumFreezer.VacuumFreezerRecipeHandler;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks;
import techreborn.init.ModFluids;
import techreborn.init.ModItems;
import techreborn.items.ItemParts;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
@mezz.jei.api.JEIPlugin
public class TechRebornJeiPlugin extends BlankModPlugin {
private static void addDebugRecipes(IModRegistry registry) {
ItemStack diamondBlock = new ItemStack(Blocks.DIAMOND_BLOCK);
ItemStack dirtBlock = new ItemStack(Blocks.DIRT);
List<Object> debugRecipes = new ArrayList<>();
for (int i = 0; i < 10; i++) {
int time = (int) Math.round(200 + Math.random() * 100);
AssemblingMachineRecipe assemblingMachineRecipe = new AssemblingMachineRecipe(diamondBlock, diamondBlock,
dirtBlock, time, 120);
debugRecipes.add(assemblingMachineRecipe);
}
for (int i = 0; i < 10; i++) {
int time = (int) Math.round(200 + Math.random() * 100);
ImplosionCompressorRecipe recipe = new ImplosionCompressorRecipe(diamondBlock, diamondBlock, dirtBlock,
dirtBlock, time, 120);
debugRecipes.add(recipe);
}
registry.addRecipes(debugRecipes);
}
@Override
public void register(
@Nonnull
IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidBerylium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCalcium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCalciumCarbonate));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidChlorite));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidDeuterium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidGlyceryl));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidHelium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidHelium3));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidHeliumplasma));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidHydrogen));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidLithium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidMercury));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidMethane));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitrocoalfuel));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitrofuel));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitrogen));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitrogendioxide));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidPotassium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSilicon));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSodium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSodiumpersulfate));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidTritium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidWolframium));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSulfur));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSulfuricAcid));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCarbon));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidCarbonFiber));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitroCarbon));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidSodiumSulfide));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidDiesel));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidNitroDiesel));
jeiHelpers.getItemBlacklist().addItemToBlacklist(new ItemStack(ModFluids.BlockFluidOil));
registry.addRecipeCategories(new AlloySmelterRecipeCategory(guiHelper),
new AssemblingMachineRecipeCategory(guiHelper), new BlastFurnaceRecipeCategory(guiHelper),
new CentrifugeRecipeCategory(guiHelper), new ChemicalReactorRecipeCategory(guiHelper),
new FusionReactorRecipeCategory(guiHelper), new IndustrialGrinderRecipeCategory(guiHelper),
new ImplosionCompressorRecipeCategory(guiHelper), new IndustrialElectrolyzerRecipeCategory(guiHelper),
new RollingMachineRecipeCategory(guiHelper),
new VacuumFreezerRecipeCategory(guiHelper), new GrinderRecipeCategory(guiHelper),
new ExtractorRecipeCategory(guiHelper), new CompressorRecipeCategory(guiHelper), new ScrapboxRecipeCategory(guiHelper));
registry.addRecipeHandlers(new AlloySmelterRecipeHandler(jeiHelpers),
new AssemblingMachineRecipeHandler(jeiHelpers), new BlastFurnaceRecipeHandler(jeiHelpers),
new CentrifugeRecipeHandler(jeiHelpers), new ChemicalReactorRecipeHandler(jeiHelpers),
new FusionReactorRecipeHandler(), new IndustrialGrinderRecipeHandler(jeiHelpers),
new ImplosionCompressorRecipeHandler(jeiHelpers), new IndustrialElectrolyzerRecipeHandler(jeiHelpers),
new RollingMachineRecipeHandler(),
new VacuumFreezerRecipeHandler(jeiHelpers), new GrinderRecipeHandler(jeiHelpers),
new ExtractorRecipeHandler(jeiHelpers), new CompressorRecipeHandler(jeiHelpers),
new ScrapboxRecipeHandler(jeiHelpers));
registry.addRecipes(RecipeHandler.recipeList);
registry.addRecipes(FusionReactorRecipeHelper.reactorRecipes);
try {
registry.addRecipes(RollingMachineRecipeMaker.getRecipes(jeiHelpers));
} catch (RuntimeException e) {
Core.logHelper
.error("Could not register rolling machine recipes. JEI may have changed its internal recipe wrapper locations.");
e.printStackTrace();
}
if (mezz.jei.config.Config.isDebugModeEnabled()) {
addDebugRecipes(registry);
}
registry.addDescription(ItemParts.getPartByName("rubberSap"),
I18n.translateToLocal("techreborn.desc.rubberSap"));
if (!ConfigTechReborn.ScrapboxDispenser) {
registry.addDescription(new ItemStack(ModItems.scrapBox),
I18n.translateToLocal("techreborn.desc.scrapBoxNoDispenser"));
} else {
registry.addDescription(new ItemStack(ModItems.scrapBox),
I18n.translateToLocal("techreborn.desc.scrapBox"));
}
registry.addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER,
VanillaRecipeCategoryUid.FUEL);
registry.addRecipeClickArea(GuiAlloySmelter.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE);
registry.addRecipeClickArea(GuiBlastFurnace.class, 63, 36, 24, 15, RecipeCategoryUids.BLAST_FURNACE);
registry.addRecipeClickArea(GuiCentrifuge.class, 98, 37, 9, 12, RecipeCategoryUids.CENTRIFUGE);
registry.addRecipeClickArea(GuiCentrifuge.class, 68, 37, 9, 12, RecipeCategoryUids.CENTRIFUGE);
registry.addRecipeClickArea(GuiCentrifuge.class, 83, 23, 12, 9, RecipeCategoryUids.CENTRIFUGE);
registry.addRecipeClickArea(GuiCentrifuge.class, 83, 53, 12, 9, RecipeCategoryUids.CENTRIFUGE);
registry.addRecipeClickArea(GuiChemicalReactor.class, 73, 39, 32, 12, RecipeCategoryUids.CHEMICAL_REACTOR);
registry.addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR);
registry.addRecipeClickArea(GuiIndustrialGrinder.class, 50, 35, 25, 16, RecipeCategoryUids.INDUSTRIAL_GRINDER);
registry.addRecipeClickArea(GuiImplosionCompressor.class, 60, 37, 24, 15,
RecipeCategoryUids.IMPLOSION_COMPRESSOR);
registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14,
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);
registry.addRecipeClickArea(GuiRollingMachine.class, 89, 32, 26, 25, RecipeCategoryUids.ROLLING_MACHINE);
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);
registry.addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING,
VanillaRecipeCategoryUid.FUEL);
registry.addRecipeClickArea(GuiElectricFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.Compressor), RecipeCategoryUids.COMPRESSOR);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.AlloyFurnace), RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.AlloySmelter), RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.AssemblyMachine),
RecipeCategoryUids.ASSEMBLING_MACHINE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.BlastFurnace), RecipeCategoryUids.BLAST_FURNACE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.centrifuge), RecipeCategoryUids.CENTRIFUGE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ChemicalReactor),
RecipeCategoryUids.CHEMICAL_REACTOR);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.Extractor), RecipeCategoryUids.EXTRACTOR);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.FusionControlComputer),
RecipeCategoryUids.FUSION_REACTOR);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.Grinder), RecipeCategoryUids.GRINDER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.ImplosionCompressor),
RecipeCategoryUids.IMPLOSION_COMPRESSOR);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IndustrialElectrolyzer),
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IndustrialGrinder),
RecipeCategoryUids.INDUSTRIAL_GRINDER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.RollingMachine),
RecipeCategoryUids.ROLLING_MACHINE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModItems.scrapBox), RecipeCategoryUids.SCRAPBOX);
IRecipeTransferRegistry recipeTransferRegistry = registry.getRecipeTransferRegistry();
recipeTransferRegistry
.addRecipeTransferHandler(ContainerAlloyFurnace.class, RecipeCategoryUids.ALLOY_SMELTER, 0, 2, 4, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerAlloySmelter.class, RecipeCategoryUids.ALLOY_SMELTER, 0, 2, 8, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerAlloyFurnace.class, VanillaRecipeCategoryUid.FUEL, 3, 1, 4, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerAssemblingMachine.class, RecipeCategoryUids.ASSEMBLING_MACHINE, 0, 2,
8, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerBlastFurnace.class, RecipeCategoryUids.BLAST_FURNACE, 0, 2, 4, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerCentrifuge.class, RecipeCategoryUids.CENTRIFUGE, 0, 2, 11, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerChemicalReactor.class, RecipeCategoryUids.CHEMICAL_REACTOR, 0, 2, 8,
36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerFusionReactor.class, RecipeCategoryUids.FUSION_REACTOR, 0, 2, 3, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerIndustrialGrinder.class, RecipeCategoryUids.GRINDER, 0, 2, 6, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerImplosionCompressor.class, RecipeCategoryUids.IMPLOSION_COMPRESSOR,
0, 2, 4, 36);
recipeTransferRegistry.addRecipeTransferHandler(ContainerIndustrialElectrolyzer.class,
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER, 0, 2, 7, 36);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerRollingMachine.class, RecipeCategoryUids.ROLLING_MACHINE, 0, 9, 11,
36);
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);
if (CompatManager.isQuantumStorageLoaded) {
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.quantumChest));
registry.getJeiHelpers().getItemBlacklist().addItemToBlacklist(new ItemStack(ModBlocks.quantumTank));
}
}
}

View file

@ -0,0 +1,71 @@
package techreborn.compat.jei.alloySmelter;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.*;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class AlloySmelterRecipeCategory extends BlankRecipeCategory<AlloySmelterRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 };
private final IDrawable background;
private final IDrawableAnimated electricity;
private final String title;
public AlloySmelterRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiAlloySmelter.texture, 46, 16, 91, 54);
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiAlloySmelter.texture, 176, 0, 14, 14);
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
true);
title = I18n.translateToLocal("techreborn.jei.category.alloy.furnace");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.ALLOY_SMELTER;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(
@Nonnull
Minecraft minecraft) {
electricity.draw(minecraft, 10, 20);
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
AlloySmelterRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,49 @@
package techreborn.compat.jei.alloySmelter;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.AlloySmelterRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class AlloySmelterRecipeHandler implements IRecipeHandler<AlloySmelterRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public AlloySmelterRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<AlloySmelterRecipe> getRecipeClass() {
return AlloySmelterRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
AlloySmelterRecipe recipe) {
return RecipeCategoryUids.ALLOY_SMELTER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
AlloySmelterRecipe recipe) {
return new AlloySmelterRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
AlloySmelterRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,42 @@
package techreborn.compat.jei.alloySmelter;
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.AlloySmelterRecipe;
import techreborn.client.gui.GuiAlloySmelter;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class AlloySmelterRecipeWrapper extends BaseRecipeWrapper<AlloySmelterRecipe> {
private final IDrawableAnimated arrow;
public AlloySmelterRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
AlloySmelterRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic arrowStatic = guiHelper.createDrawable(GuiAlloySmelter.texture, 176, 14, 24, 17);
this.arrow = guiHelper.createAnimatedDrawable(arrowStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
arrow.draw(minecraft, 33, 19);
int x = recipeWidth / 2;
int y = recipeHeight - recipeHeight / 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + (baseRecipe.tickTime / 20) + " secs", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,72 @@
package techreborn.compat.jei.assemblingMachine;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.*;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class AssemblingMachineRecipeCategory extends BlankRecipeCategory<AssemblingMachineRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 };
private final IDrawable background;
private final IDrawableAnimated electricity;
private final String title;
public AssemblingMachineRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiAssemblingMachine.texture, 46, 16, 91, 54);
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiAssemblingMachine.texture, 176, 0, 14, 14);
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
true);
title = I18n.translateToLocal("tile.techreborn.assemblingmachine.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.ASSEMBLING_MACHINE;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(
@Nonnull
Minecraft minecraft) {
electricity.draw(minecraft, 10, 20);
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
AssemblingMachineRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 18, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 18);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,49 @@
package techreborn.compat.jei.assemblingMachine;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.AssemblingMachineRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class AssemblingMachineRecipeHandler implements IRecipeHandler<AssemblingMachineRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public AssemblingMachineRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<AssemblingMachineRecipe> getRecipeClass() {
return AssemblingMachineRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
AssemblingMachineRecipe recipe) {
return RecipeCategoryUids.ASSEMBLING_MACHINE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
AssemblingMachineRecipe recipe) {
return new AssemblingMachineRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
AssemblingMachineRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,34 @@
package techreborn.compat.jei.assemblingMachine;
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.AssemblingMachineRecipe;
import techreborn.client.gui.GuiAssemblingMachine;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class AssemblingMachineRecipeWrapper extends BaseRecipeWrapper<AssemblingMachineRecipe> {
private final IDrawableAnimated progress;
public AssemblingMachineRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
AssemblingMachineRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiAssemblingMachine.texture, 176, 14, 20, 18);
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 40, 18);
}
}

View file

@ -0,0 +1,63 @@
package techreborn.compat.jei.blastFurnace;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class BlastFurnaceRecipeCategory extends BlankRecipeCategory<BlastFurnaceRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3 };
private final IDrawable background;
private final String title;
public BlastFurnaceRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiBlastFurnace.texture, 39, 24, 90, 60);
title = I18n.translateToLocal("tile.techreborn.blastfurnace.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.BLAST_FURNACE;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
BlastFurnaceRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 18);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 10);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 78, 10);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,49 @@
package techreborn.compat.jei.blastFurnace;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.BlastFurnaceRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class BlastFurnaceRecipeHandler implements IRecipeHandler<BlastFurnaceRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public BlastFurnaceRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<BlastFurnaceRecipe> getRecipeClass() {
return BlastFurnaceRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
BlastFurnaceRecipe recipe) {
return RecipeCategoryUids.BLAST_FURNACE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
BlastFurnaceRecipe recipe) {
return new BlastFurnaceRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
BlastFurnaceRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,42 @@
package techreborn.compat.jei.blastFurnace;
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.BlastFurnaceRecipe;
import techreborn.client.gui.GuiBlastFurnace;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class BlastFurnaceRecipeWrapper extends BaseRecipeWrapper<BlastFurnaceRecipe> {
private final IDrawableAnimated progress;
public BlastFurnaceRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
BlastFurnaceRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiBlastFurnace.texture, 176, 14, 20, 11);
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 54 - 29, 13);
int x = recipeWidth / 3;
int y = (int) (recipeHeight - recipeHeight / 2.2F);
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " secs", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
minecraft.fontRendererObj.drawString("Heat capacity: " + baseRecipe.neededHeat, x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,65 @@
package techreborn.compat.jei.centrifuge;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class CentrifugeRecipeCategory extends BlankRecipeCategory<CentrifugeRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
private final IDrawable background;
private final String title;
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiCentrifuge.texture, 49, 4, 78, 78);
title = I18n.translateToLocal("tile.techreborn.centrifuge.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.CENTRIFUGE;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
CentrifugeRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 30);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 30, 0);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 60, 30);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 30, 60);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 0, 30);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.centrifuge;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.CentrifugeRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class CentrifugeRecipeHandler implements IRecipeHandler<CentrifugeRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public CentrifugeRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<CentrifugeRecipe> getRecipeClass() {
return CentrifugeRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
CentrifugeRecipe recipe) {
return RecipeCategoryUids.CENTRIFUGE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
CentrifugeRecipe recipe) {
return new CentrifugeRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
CentrifugeRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,60 @@
package techreborn.compat.jei.centrifuge;
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.CentrifugeRecipe;
import techreborn.client.gui.GuiCentrifuge;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class CentrifugeRecipeWrapper extends BaseRecipeWrapper<CentrifugeRecipe> {
private final IDrawableAnimated progressUp;
private final IDrawableAnimated progressLeft;
private final IDrawableAnimated progressDown;
private final IDrawableAnimated progressRight;
public CentrifugeRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
CentrifugeRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressUpStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 14, 12, 12);
IDrawableStatic progressLeftStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 26, 12, 12);
IDrawableStatic progressDownStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 38, 12, 12);
IDrawableStatic progressRightStatic = guiHelper.createDrawable(GuiCentrifuge.texture, 176, 50, 12, 12);
int ticksPerCycle = baseRecipe.tickTime() / 4; // speed up the animation
// a bit
this.progressUp = guiHelper.createAnimatedDrawable(progressUpStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.BOTTOM, false);
this.progressLeft = guiHelper.createAnimatedDrawable(progressLeftStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.RIGHT, false);
this.progressDown = guiHelper.createAnimatedDrawable(progressDownStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.TOP, false);
this.progressRight = guiHelper.createAnimatedDrawable(progressRightStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progressUp.draw(minecraft, 33, 18);
progressLeft.draw(minecraft, 18, 33);
progressDown.draw(minecraft, 33, 48);
progressRight.draw(minecraft, 48, 33);
int x = -45;
int y = 60;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " secs", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,63 @@
package techreborn.compat.jei.chemicalReactor;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiChemicalReactor;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class ChemicalReactorRecipeCategory extends BlankRecipeCategory<ChemicalReactorRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2 };
private final IDrawable background;
private final String title;
public ChemicalReactorRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiChemicalReactor.texture, 69, 20, 38, 48);
title = I18n.translateToLocal("tile.techreborn.chemicalreactor.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.CHEMICAL_REACTOR;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
ChemicalReactorRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 20, 0);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 10, 30);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.chemicalReactor;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.ChemicalReactorRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class ChemicalReactorRecipeHandler implements IRecipeHandler<ChemicalReactorRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public ChemicalReactorRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<ChemicalReactorRecipe> getRecipeClass() {
return ChemicalReactorRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
ChemicalReactorRecipe recipe) {
return RecipeCategoryUids.CHEMICAL_REACTOR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
ChemicalReactorRecipe recipe) {
return new ChemicalReactorRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
ChemicalReactorRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,43 @@
package techreborn.compat.jei.chemicalReactor;
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.ChemicalReactorRecipe;
import techreborn.client.gui.GuiChemicalReactor;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class ChemicalReactorRecipeWrapper extends BaseRecipeWrapper<ChemicalReactorRecipe> {
private final IDrawableAnimated progress;
public ChemicalReactorRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ChemicalReactorRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiChemicalReactor.texture, 176, 14, 32, 12);
int ticksPerCycle = baseRecipe.tickTime();
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.TOP, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 3, 18);
int x = (int) (-recipeWidth * 1.6f);
int y = (int) (recipeHeight - recipeHeight / 3F);
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " secs", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,63 @@
package techreborn.compat.jei.compressor;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiCompressor;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class CompressorRecipeCategory extends BlankRecipeCategory<CompressorRecipeWrapper> {
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 = I18n.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
CompressorRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.compressor;
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.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
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(
@Nonnull
CompressorRecipe recipe) {
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;
}
}

View file

@ -0,0 +1,43 @@
package techreborn.compat.jei.compressor;
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.client.gui.GuiCompressor;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
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 drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 25, 7);
int x = -45;
int y = 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,63 @@
package techreborn.compat.jei.extractor;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiExtractor;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class ExtractorRecipeCategory extends BlankRecipeCategory<ExtractorRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 };
private final IDrawable background;
private final String title;
public ExtractorRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiExtractor.texture, 55, 30, 82, 26);
title = I18n.translateToLocal("tile.techreborn.extractor.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.EXTRACTOR;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
ExtractorRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.extractor;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.ExtractorRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class ExtractorRecipeHandler implements IRecipeHandler<ExtractorRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public ExtractorRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<ExtractorRecipe> getRecipeClass() {
return ExtractorRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
ExtractorRecipe recipe) {
return RecipeCategoryUids.EXTRACTOR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
ExtractorRecipe recipe) {
return new ExtractorRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
ExtractorRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,43 @@
package techreborn.compat.jei.extractor;
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.ExtractorRecipe;
import techreborn.client.gui.GuiExtractor;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class ExtractorRecipeWrapper extends BaseRecipeWrapper<ExtractorRecipe> {
private final IDrawableAnimated progress;
public ExtractorRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ExtractorRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiExtractor.texture, 176, 17, 22, 11);
int ticksPerCycle = baseRecipe.tickTime();
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 25, 7);
int x = -45;
int y = 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,69 @@
package techreborn.compat.jei.fusionReactor;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiFusionReactor;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class FusionReactorRecipeCategory extends BlankRecipeCategory<FusionReactorRecipeWrapper> {
private static final int inputSlotTop = 0;
private static final int inputSlotBottom = 1;
private static final int outputSlot = 2;
@Nonnull
private final IDrawable background;
@Nonnull
private final String title;
public FusionReactorRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiFusionReactor.texture, 86, 16, 85, 64, 0, 40, 20, 20);
title = I18n.translateToLocal("tile.techreborn.fusioncontrolcomputer.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.FUSION_REACTOR;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
FusionReactorRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(inputSlotTop, true, 21, 0);
itemStacks.init(inputSlotBottom, true, 21, 36);
itemStacks.init(outputSlot, false, 81, 18);
itemStacks.set(inputSlotTop, recipeWrapper.getTopInput());
itemStacks.set(inputSlotBottom, recipeWrapper.getBottomInput());
itemStacks.set(outputSlot, ingredients.getOutputs(ItemStack.class).get(0));
}
}

View file

@ -0,0 +1,41 @@
package techreborn.compat.jei.fusionReactor;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.reactor.FusionReactorRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class FusionReactorRecipeHandler implements IRecipeHandler<FusionReactorRecipe> {
@Nonnull
@Override
public Class<FusionReactorRecipe> getRecipeClass() {
return FusionReactorRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
FusionReactorRecipe recipe) {
return RecipeCategoryUids.FUSION_REACTOR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
FusionReactorRecipe recipe) {
return new FusionReactorRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
FusionReactorRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,46 @@
package techreborn.compat.jei.fusionReactor;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import techreborn.api.reactor.FusionReactorRecipe;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class FusionReactorRecipeWrapper extends BlankRecipeWrapper {
private final FusionReactorRecipe baseRecipe;
public FusionReactorRecipeWrapper(FusionReactorRecipe baseRecipe) {
this.baseRecipe = baseRecipe;
}
@Override
public void getIngredients(
@Nonnull
IIngredients ingredients) {
ingredients.setOutputs(ItemStack.class, Arrays.asList(baseRecipe.getTopInput(), baseRecipe.getBottomInput()));
ingredients.setInput(ItemStack.class, baseRecipe.getOutput());
}
public ItemStack getTopInput() {
return baseRecipe.getTopInput();
}
public ItemStack getBottomInput() {
return baseRecipe.getBottomInput();
}
@Override
public void drawInfo(
@Nonnull
Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
RecipeUtil.drawInfo(minecraft, 0, 67, baseRecipe.getStartEU(), baseRecipe.getEuTick(),
baseRecipe.getTickTime());
}
}

View file

@ -0,0 +1,62 @@
package techreborn.compat.jei.grinder;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiGrinder;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class GrinderRecipeCategory extends BlankRecipeCategory<GrinderRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 };
private final IDrawable background;
private final String title;
public GrinderRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiGrinder.texture, 55, 30, 82, 26);
title = I18n.translateToLocal("tile.techreborn.grinder.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.GRINDER;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
GrinderRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.grinder;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.GrinderRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class GrinderRecipeHandler implements IRecipeHandler<GrinderRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public GrinderRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<GrinderRecipe> getRecipeClass() {
return GrinderRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
GrinderRecipe recipe) {
return RecipeCategoryUids.GRINDER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
GrinderRecipe recipe) {
return new GrinderRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
GrinderRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,43 @@
package techreborn.compat.jei.grinder;
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.GrinderRecipe;
import techreborn.client.gui.GuiGrinder;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class GrinderRecipeWrapper extends BaseRecipeWrapper<GrinderRecipe> {
private final IDrawableAnimated progress;
public GrinderRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
GrinderRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiGrinder.texture, 176, 14, 20, 11);
int ticksPerCycle = baseRecipe.tickTime();
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 25, 7);
int x = -45;
int y = 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,72 @@
package techreborn.compat.jei.implosionCompressor;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.*;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<ImplosionCompressorRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3 };
private final IDrawable background;
private final IDrawable electricity;
private final String title;
public ImplosionCompressorRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiImplosionCompressor.texture, 16, 25, 116, 36);
IDrawableStatic electricityDrawable = guiHelper.createDrawable(GuiImplosionCompressor.texture, 176, 0, 14, 14);
electricity = guiHelper.createAnimatedDrawable(electricityDrawable, 300, IDrawableAnimated.StartDirection.TOP,
true);
title = I18n.translateToLocal("tile.techreborn.implosioncompressor.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.IMPLOSION_COMPRESSOR;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
electricity.draw(minecraft, 0, 12);
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
ImplosionCompressorRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 20, 0);
guiItemStacks.init(INPUT_SLOTS[1], true, 20, 18);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 76, 9);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 9);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.implosionCompressor;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.ImplosionCompressorRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class ImplosionCompressorRecipeHandler implements IRecipeHandler<ImplosionCompressorRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public ImplosionCompressorRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<ImplosionCompressorRecipe> getRecipeClass() {
return ImplosionCompressorRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
ImplosionCompressorRecipe recipe) {
return RecipeCategoryUids.IMPLOSION_COMPRESSOR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
ImplosionCompressorRecipe recipe) {
return new ImplosionCompressorRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
ImplosionCompressorRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,41 @@
package techreborn.compat.jei.implosionCompressor;
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.ImplosionCompressorRecipe;
import techreborn.client.gui.GuiImplosionCompressor;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class ImplosionCompressorRecipeWrapper extends BaseRecipeWrapper<ImplosionCompressorRecipe> {
private final IDrawableAnimated progress;
public ImplosionCompressorRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ImplosionCompressorRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiImplosionCompressor.texture, 176, 14, 21, 11);
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 44, 13);
int x = -45;
int y = 4;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,65 @@
package techreborn.compat.jei.industrialElectrolyzer;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiIndustrialElectrolyzer;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class IndustrialElectrolyzerRecipeCategory extends BlankRecipeCategory<IndustrialElectrolyzerRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
private final IDrawable background;
private final String title;
public IndustrialElectrolyzerRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiIndustrialElectrolyzer.texture, 49, 18, 78, 50);
title = I18n.translateToLocal("tile.techreborn.industrialelectrolyzer.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
IndustrialElectrolyzerRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 30, 32);
guiItemStacks.init(INPUT_SLOTS[1], true, 0, 32);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 0, 0);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 20, 0);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 40, 0);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 60, 0);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.industrialElectrolyzer;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.IndustrialElectrolyzerRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class IndustrialElectrolyzerRecipeHandler implements IRecipeHandler<IndustrialElectrolyzerRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public IndustrialElectrolyzerRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<IndustrialElectrolyzerRecipe> getRecipeClass() {
return IndustrialElectrolyzerRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
IndustrialElectrolyzerRecipe recipe) {
return RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
IndustrialElectrolyzerRecipe recipe) {
return new IndustrialElectrolyzerRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
IndustrialElectrolyzerRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,41 @@
package techreborn.compat.jei.industrialElectrolyzer;
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.IndustrialElectrolyzerRecipe;
import techreborn.client.gui.GuiIndustrialElectrolyzer;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class IndustrialElectrolyzerRecipeWrapper extends BaseRecipeWrapper<IndustrialElectrolyzerRecipe> {
private final IDrawableAnimated progress;
public IndustrialElectrolyzerRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
IndustrialElectrolyzerRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiIndustrialElectrolyzer.texture, 176, 14, 30, 10);
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.BOTTOM, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 24, 20);
int x = 60;
int y = 30;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,85 @@
package techreborn.compat.jei.industrialGrinder;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiIndustrialGrinder;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import techreborn.tiles.multiblock.TileIndustrialGrinder;
import javax.annotation.Nonnull;
public class IndustrialGrinderRecipeCategory extends BlankRecipeCategory<IndustrialGrinderRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1 };
private static final int[] OUTPUT_SLOTS = { 2, 3, 4, 5 };
private static final int[] INPUT_TANKS = { 0 };
private final IDrawable background;
private final IDrawable blankArea; // for covering the lightning power
// symbol
private final IDrawable tankOverlay;
private final String title;
public IndustrialGrinderRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 7, 15, 141, 55);
blankArea = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 50, 45, 6, 6);
tankOverlay = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 176, 86, 12, 47);
title = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.INDUSTRIAL_GRINDER;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(
@Nonnull
Minecraft minecraft) {
blankArea.draw(minecraft, 129, 49);
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
IndustrialGrinderRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 24, 10);
guiItemStacks.init(INPUT_SLOTS[1], true, 24, 28);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 69, 19);
guiItemStacks.init(OUTPUT_SLOTS[1], false, 87, 19);
guiItemStacks.init(OUTPUT_SLOTS[2], false, 105, 19);
guiItemStacks.init(OUTPUT_SLOTS[3], false, 123, 19);
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
guiFluidStacks.init(INPUT_TANKS[0], true, 4, 4, 12, 47, TileIndustrialGrinder.TANK_CAPACITY, true, tankOverlay);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.industrialGrinder;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class IndustrialGrinderRecipeHandler implements IRecipeHandler<IndustrialGrinderRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public IndustrialGrinderRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<IndustrialGrinderRecipe> getRecipeClass() {
return IndustrialGrinderRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
IndustrialGrinderRecipe recipe) {
return RecipeCategoryUids.INDUSTRIAL_GRINDER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
IndustrialGrinderRecipe recipe) {
return new IndustrialGrinderRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
IndustrialGrinderRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,56 @@
package techreborn.compat.jei.industrialGrinder;
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 net.minecraftforge.fluids.FluidStack;
import techreborn.api.recipe.machines.IndustrialGrinderRecipe;
import techreborn.client.gui.GuiIndustrialGrinder;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
public class IndustrialGrinderRecipeWrapper extends BaseRecipeWrapper<IndustrialGrinderRecipe> {
private final IDrawableAnimated progress;
public IndustrialGrinderRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
IndustrialGrinderRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiIndustrialGrinder.texture, 176, 14, 24, 17);
int ticksPerCycle = baseRecipe.tickTime();
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
@Nonnull
public List<FluidStack> getFluidInputs() {
if (baseRecipe.fluidStack != null) {
return Collections.singletonList(baseRecipe.fluidStack);
} else {
return Collections.emptyList();
}
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 44, 20);
int x = 70;
int y = 40;
int lineHeight = minecraft.fontRendererObj.FONT_HEIGHT;
minecraft.fontRendererObj.drawString("Time: " + baseRecipe.tickTime / 20 + " s", x, y, 0x444444);
minecraft.fontRendererObj.drawString("EU: " + baseRecipe.euPerTick + " EU/t", x, y += lineHeight, 0x444444);
}
}

View file

@ -0,0 +1,80 @@
package techreborn.compat.jei.rollingMachine;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.*;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiRollingMachine;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class RollingMachineRecipeCategory extends BlankRecipeCategory<RollingMachineRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private static final int[] OUTPUT_SLOTS = { 10 };
private final IDrawable background;
private final IDrawableAnimated progress;
private final ICraftingGridHelper craftingGridHelper;
private final String title;
public RollingMachineRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiRollingMachine.texture, 29, 16, 116, 54);
title = I18n.translateToLocal("tile.techreborn.rollingmachine.name");
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiRollingMachine.texture, 176, 14, 20, 18);
progress = guiHelper.createAnimatedDrawable(progressStatic, 250, IDrawableAnimated.StartDirection.LEFT, false);
craftingGridHelper = guiHelper.createCraftingGridHelper(INPUT_SLOTS[0], OUTPUT_SLOTS[0]);
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.ROLLING_MACHINE;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void drawExtras(
@Nonnull
Minecraft minecraft) {
progress.draw(minecraft, 62, 18);
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
RollingMachineRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 3; k1++) {
int i = k1 + l * 3;
guiItemStacks.init(INPUT_SLOTS[i], true, k1 * 18, l * 18);
}
}
guiItemStacks.init(OUTPUT_SLOTS[0], false, 94, 18);
craftingGridHelper.setInputStacks(guiItemStacks, ingredients.getInputs(ItemStack.class));
craftingGridHelper.setOutput(guiItemStacks, ingredients.getOutputs(ItemStack.class).get(0));
}
}

View file

@ -0,0 +1,38 @@
package techreborn.compat.jei.rollingMachine;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class RollingMachineRecipeHandler implements IRecipeHandler<RollingMachineRecipeWrapper> {
@Nonnull
@Override
public Class<RollingMachineRecipeWrapper> getRecipeClass() {
return RollingMachineRecipeWrapper.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
RollingMachineRecipeWrapper recipe) {
return RecipeCategoryUids.ROLLING_MACHINE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
RollingMachineRecipeWrapper recipe) {
return recipe;
}
@Override
public boolean isRecipeValid(
@Nonnull
RollingMachineRecipeWrapper recipe) {
return true;
}
}

View file

@ -0,0 +1,28 @@
package techreborn.compat.jei.rollingMachine;
import mezz.jei.api.IJeiHelpers;
import net.minecraft.item.crafting.IRecipe;
import techreborn.api.RollingMachineRecipe;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
public class RollingMachineRecipeMaker {
private RollingMachineRecipeMaker() {
}
public static List<Object> getRecipes(
@Nonnull
IJeiHelpers jeiHelpers) {
List<Object> recipes = new ArrayList<>();
for (IRecipe recipe : RollingMachineRecipe.instance.getRecipeList()) {
RollingMachineRecipeWrapper recipeWrapper = RollingMachineRecipeWrapper.create(jeiHelpers, recipe);
if (recipeWrapper != null) {
recipes.add(recipeWrapper);
}
}
return recipes;
}
}

View file

@ -0,0 +1,58 @@
package techreborn.compat.jei.rollingMachine;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapedOreRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapedRecipesWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapelessOreRecipeWrapper;
import mezz.jei.plugins.vanilla.crafting.ShapelessRecipesWrapper;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class RollingMachineRecipeWrapper extends BlankRecipeWrapper implements ICraftingRecipeWrapper {
private final ICraftingRecipeWrapper baseRecipe;
public RollingMachineRecipeWrapper(ICraftingRecipeWrapper baseRecipe) {
this.baseRecipe = baseRecipe;
}
@Nullable
public static RollingMachineRecipeWrapper create(
@Nonnull
IJeiHelpers jeiHelpers, IRecipe baseRecipe) {
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
ICraftingRecipeWrapper recipeWrapper;
if (baseRecipe instanceof ShapelessRecipes) {
recipeWrapper = new ShapelessRecipesWrapper((ShapelessRecipes) baseRecipe);
} else if (baseRecipe instanceof ShapedRecipes) {
recipeWrapper = new ShapedRecipesWrapper((ShapedRecipes) baseRecipe);
} else if (baseRecipe instanceof ShapedOreRecipe) {
recipeWrapper = new ShapedOreRecipeWrapper(jeiHelpers, (ShapedOreRecipe) baseRecipe);
} else if (baseRecipe instanceof ShapelessOreRecipe) {
recipeWrapper = new ShapelessOreRecipeWrapper(jeiHelpers, (ShapelessOreRecipe) baseRecipe);
} else {
return null;
}
return new RollingMachineRecipeWrapper(recipeWrapper);
}
@Override
public void getIngredients(
@Nonnull
IIngredients ingredients) {
baseRecipe.getIngredients(ingredients);
}
}

View file

@ -0,0 +1,61 @@
package techreborn.compat.jei.scrapbox;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiCompressor;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class ScrapboxRecipeCategory extends BlankRecipeCategory<ScrapboxRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 };
private final IDrawable background;
private final String title;
public ScrapboxRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiCompressor.texture, 55, 30, 82, 26);
title = I18n.translateToLocal("jei.techreborn.scrapbox.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.SCRAPBOX;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
ScrapboxRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,50 @@
package techreborn.compat.jei.scrapbox;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.ScrapboxRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class ScrapboxRecipeHandler implements IRecipeHandler<ScrapboxRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public ScrapboxRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<ScrapboxRecipe> getRecipeClass() {
return ScrapboxRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
ScrapboxRecipe recipe) {
return RecipeCategoryUids.SCRAPBOX;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
ScrapboxRecipe recipe) {
return new ScrapboxRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
ScrapboxRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,36 @@
package techreborn.compat.jei.scrapbox;
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.ScrapboxRecipe;
import techreborn.client.gui.GuiCompressor;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class ScrapboxRecipeWrapper extends BaseRecipeWrapper<ScrapboxRecipe> {
private final IDrawableAnimated progress;
public ScrapboxRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ScrapboxRecipe 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 drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 25, 7);
}
}

View file

@ -0,0 +1,61 @@
package techreborn.compat.jei.vacuumFreezer;
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.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeCategory;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiVacuumFreezer;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import javax.annotation.Nonnull;
public class VacuumFreezerRecipeCategory extends BlankRecipeCategory<VacuumFreezerRecipeWrapper> {
private static final int[] INPUT_SLOTS = { 0 };
private static final int[] OUTPUT_SLOTS = { 1 };
private final IDrawable background;
private final String title;
public VacuumFreezerRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createDrawable(GuiVacuumFreezer.texture, 55, 30, 82, 26);
title = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
}
@Nonnull
@Override
public String getUid() {
return RecipeCategoryUids.VACUUM_FREEZER;
}
@Nonnull
@Override
public String getTitle() {
return title;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(
@Nonnull
IRecipeLayout recipeLayout,
@Nonnull
VacuumFreezerRecipeWrapper recipeWrapper,
@Nonnull
IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 0, 3);
guiItemStacks.init(OUTPUT_SLOTS[0], false, 60, 4);
RecipeUtil.setRecipeItems(recipeLayout, ingredients, INPUT_SLOTS, OUTPUT_SLOTS, null, null);
}
}

View file

@ -0,0 +1,49 @@
package techreborn.compat.jei.vacuumFreezer;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import techreborn.api.recipe.machines.VacuumFreezerRecipe;
import techreborn.compat.jei.RecipeCategoryUids;
import javax.annotation.Nonnull;
public class VacuumFreezerRecipeHandler implements IRecipeHandler<VacuumFreezerRecipe> {
@Nonnull
private final IJeiHelpers jeiHelpers;
public VacuumFreezerRecipeHandler(
@Nonnull
IJeiHelpers jeiHelpers) {
this.jeiHelpers = jeiHelpers;
}
@Nonnull
@Override
public Class<VacuumFreezerRecipe> getRecipeClass() {
return VacuumFreezerRecipe.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(
@Nonnull
VacuumFreezerRecipe recipe) {
return RecipeCategoryUids.VACUUM_FREEZER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(
@Nonnull
VacuumFreezerRecipe recipe) {
return new VacuumFreezerRecipeWrapper(jeiHelpers, recipe);
}
@Override
public boolean isRecipeValid(
@Nonnull
VacuumFreezerRecipe recipe) {
return true;
}
}

View file

@ -0,0 +1,36 @@
package techreborn.compat.jei.vacuumFreezer;
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.VacuumFreezerRecipe;
import techreborn.client.gui.GuiVacuumFreezer;
import techreborn.compat.jei.BaseRecipeWrapper;
import javax.annotation.Nonnull;
public class VacuumFreezerRecipeWrapper extends BaseRecipeWrapper<VacuumFreezerRecipe> {
private final IDrawableAnimated progress;
public VacuumFreezerRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
VacuumFreezerRecipe baseRecipe) {
super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiVacuumFreezer.texture, 176, 14, 20, 11);
int ticksPerCycle = baseRecipe.tickTime();
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle,
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
progress.draw(minecraft, 25, 7);
}
}