Add industrial sawmill recipes
This commit is contained in:
parent
123042a069
commit
ad0b45cd2a
7 changed files with 173 additions and 4 deletions
|
@ -11,7 +11,7 @@ import techreborn.tiles.TileIndustrialSawmill;
|
|||
|
||||
public class GuiIndustrialSawmill extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
public static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/industrial_sawmill.png");
|
||||
|
||||
TileIndustrialSawmill sawmill;
|
||||
|
|
|
@ -13,4 +13,5 @@ public class RecipeCategoryUids {
|
|||
public static final String GRINDER = "TechReborn.Grinder";
|
||||
public static final String IMPLOSION_COMPRESSOR = "TechReborn.ImplosionCompressor";
|
||||
public static final String INDUSTRIAL_ELECTROLYZER = "TechReborn.IndustrialElectrolyzer";
|
||||
public static final String INDUSTRIAL_SAWMILL = "TechReborn.IndustrialSawmill";
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import techreborn.client.container.ContainerFusionReactor;
|
|||
import techreborn.client.container.ContainerGrinder;
|
||||
import techreborn.client.container.ContainerImplosionCompressor;
|
||||
import techreborn.client.container.ContainerIndustrialElectrolyzer;
|
||||
import techreborn.client.container.ContainerIndustrialSawmill;
|
||||
import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeCategory;
|
||||
import techreborn.compat.jei.alloySmelter.AlloySmelterRecipeHandler;
|
||||
import techreborn.compat.jei.assemblingMachine.AssemblingMachineRecipeCategory;
|
||||
|
@ -46,6 +47,8 @@ import techreborn.compat.jei.implosionCompressor.ImplosionCompressorRecipeCatego
|
|||
import techreborn.compat.jei.implosionCompressor.ImplosionCompressorRecipeHandler;
|
||||
import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipeCategory;
|
||||
import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipeHandler;
|
||||
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeCategory;
|
||||
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeHandler;
|
||||
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class TechRebornJeiPlugin implements IModPlugin {
|
||||
|
@ -79,7 +82,8 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
new FusionReactorRecipeCategory(guiHelper),
|
||||
new GrinderRecipeCategory(guiHelper),
|
||||
new ImplosionCompressorRecipeCategory(guiHelper),
|
||||
new IndustrialElectrolyzerRecipeCategory(guiHelper)
|
||||
new IndustrialElectrolyzerRecipeCategory(guiHelper),
|
||||
new IndustrialSawmillRecipeCategory(guiHelper)
|
||||
);
|
||||
|
||||
registry.addRecipeHandlers(
|
||||
|
@ -91,7 +95,8 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
new FusionReactorRecipeHandler(),
|
||||
new GrinderRecipeHandler(),
|
||||
new ImplosionCompressorRecipeHandler(),
|
||||
new IndustrialElectrolyzerRecipeHandler()
|
||||
new IndustrialElectrolyzerRecipeHandler(),
|
||||
new IndustrialSawmillRecipeHandler()
|
||||
);
|
||||
|
||||
registry.addRecipes(RecipeHandler.recipeList);
|
||||
|
@ -113,6 +118,7 @@ public class TechRebornJeiPlugin implements IModPlugin {
|
|||
recipeTransferRegistry.addRecipeTransferHandler(ContainerGrinder.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(ContainerIndustrialSawmill.class, RecipeCategoryUids.INDUSTRIAL_SAWMILL, 0, 2, 5, 36);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package techreborn.compat.jei.industrialSawmill;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
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.recipe.IRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import techreborn.client.gui.GuiIndustrialSawmill;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
import techreborn.compat.jei.RecipeUtil;
|
||||
import techreborn.tiles.TileIndustrialSawmill;
|
||||
|
||||
public class IndustrialSawmillRecipeCategory implements IRecipeCategory {
|
||||
private static final int[] INPUT_SLOTS = {0, 1};
|
||||
private static final int[] OUTPUT_SLOTS = {2, 3, 4};
|
||||
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 IndustrialSawmillRecipeCategory(IGuiHelper guiHelper) {
|
||||
background = guiHelper.createDrawable(GuiIndustrialSawmill.texture, 7, 15, 141, 55);
|
||||
blankArea = guiHelper.createDrawable(GuiIndustrialSawmill.texture, 50, 45, 6, 6);
|
||||
tankOverlay = guiHelper.createDrawable(GuiIndustrialSawmill.texture, 176, 83, 12, 47);
|
||||
title = StatCollector.translateToLocal("tile.techreborn.industrialsawmill.name");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUid() {
|
||||
return RecipeCategoryUids.INDUSTRIAL_SAWMILL;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IDrawable getBackground() {
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(Minecraft minecraft) {
|
||||
blankArea.draw(minecraft, 31, 51);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(Minecraft minecraft) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
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, 76, 19);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[1], false, 94, 19);
|
||||
guiItemStacks.init(OUTPUT_SLOTS[2], false, 112, 19);
|
||||
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
guiFluidStacks.init(INPUT_TANKS[0], true, 4, 4, 12, 47, TileIndustrialSawmill.TANK_CAPACITY, tankOverlay);
|
||||
|
||||
if (recipeWrapper instanceof IndustrialSawmillRecipeWrapper) {
|
||||
IndustrialSawmillRecipeWrapper recipe = (IndustrialSawmillRecipeWrapper) recipeWrapper;
|
||||
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package techreborn.compat.jei.industrialSawmill;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.compat.jei.RecipeCategoryUids;
|
||||
|
||||
public class IndustrialSawmillRecipeHandler implements IRecipeHandler<IndustrialSawmillRecipe> {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<IndustrialSawmillRecipe> getRecipeClass() {
|
||||
return IndustrialSawmillRecipe.class;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getRecipeCategoryUid() {
|
||||
return RecipeCategoryUids.INDUSTRIAL_SAWMILL;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IRecipeWrapper getRecipeWrapper(@Nonnull IndustrialSawmillRecipe recipe) {
|
||||
return new IndustrialSawmillRecipeWrapper(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull IndustrialSawmillRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package techreborn.compat.jei.industrialSawmill;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
|
||||
import techreborn.client.gui.GuiIndustrialSawmill;
|
||||
import techreborn.compat.jei.BaseRecipeWrapper;
|
||||
import techreborn.compat.jei.TechRebornJeiPlugin;
|
||||
|
||||
public class IndustrialSawmillRecipeWrapper extends BaseRecipeWrapper<IndustrialSawmillRecipe> {
|
||||
private final IDrawableAnimated progress;
|
||||
|
||||
public IndustrialSawmillRecipeWrapper(IndustrialSawmillRecipe baseRecipe) {
|
||||
super(baseRecipe);
|
||||
IGuiHelper guiHelper = TechRebornJeiPlugin.jeiHelpers.getGuiHelper();
|
||||
IDrawableStatic progressStatic = guiHelper.createDrawable(GuiIndustrialSawmill.texture, 176, 14, 20, 12);
|
||||
|
||||
int ticksPerCycle = baseRecipe.tickTime();
|
||||
this.progress = guiHelper.createAnimatedDrawable(progressStatic, ticksPerCycle, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
if (baseRecipe.fluidStack != null) {
|
||||
return Collections.singletonList(baseRecipe.fluidStack);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) {
|
||||
super.drawAnimations(minecraft, recipeWidth, recipeHeight);
|
||||
progress.draw(minecraft, 49, 23);
|
||||
}
|
||||
}
|
|
@ -24,10 +24,11 @@ import techreborn.lib.Reference;
|
|||
import techreborn.powerSystem.TilePowerAcceptor;
|
||||
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventory, ISidedInventory, IListInfoProvider {
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(5, "TileIndustrialSawmill", 64, this);
|
||||
public Tank tank = new Tank("TileSawmill", 16000, this);
|
||||
public Tank tank = new Tank("TileSawmill", TANK_CAPACITY, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileIndustrialSawmill() {
|
||||
|
|
Loading…
Reference in a new issue