Sawmill changes & fixes.

This commit is contained in:
Dragon2488 2016-07-24 01:10:37 +07:00
parent 06fad2264f
commit 0011553cf7
16 changed files with 462 additions and 700 deletions

View file

@ -11,7 +11,6 @@ public class RecipeCategoryUids
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 INDUSTRIAL_SAWMILL = "TechReborn.IndustrialSawmill";
public static final String ROLLING_MACHINE = "TechReborn.RollingMachine";
public static final String VACUUM_FREEZER = "TechReborn.VacuumFreezer";
public static final String GRINDER = "TechReborn.Grinder";

View file

@ -40,8 +40,6 @@ import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipe
import techreborn.compat.jei.industrialElectrolyzer.IndustrialElectrolyzerRecipeHandler;
import techreborn.compat.jei.industrialGrinder.IndustrialGrinderRecipeCategory;
import techreborn.compat.jei.industrialGrinder.IndustrialGrinderRecipeHandler;
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeCategory;
import techreborn.compat.jei.industrialSawmill.IndustrialSawmillRecipeHandler;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeCategory;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeHandler;
import techreborn.compat.jei.rollingMachine.RollingMachineRecipeMaker;
@ -126,7 +124,7 @@ import java.util.List;
new CentrifugeRecipeCategory(guiHelper), new ChemicalReactorRecipeCategory(guiHelper),
new FusionReactorRecipeCategory(guiHelper), new IndustrialGrinderRecipeCategory(guiHelper),
new ImplosionCompressorRecipeCategory(guiHelper), new IndustrialElectrolyzerRecipeCategory(guiHelper),
new IndustrialSawmillRecipeCategory(guiHelper), new RollingMachineRecipeCategory(guiHelper),
new RollingMachineRecipeCategory(guiHelper),
new VacuumFreezerRecipeCategory(guiHelper), new GrinderRecipeCategory(guiHelper),
new ExtractorRecipeCategory(guiHelper), new CompressorRecipeCategory(guiHelper), new ScrapboxRecipeCategory(guiHelper));
@ -135,7 +133,7 @@ import java.util.List;
new CentrifugeRecipeHandler(jeiHelpers), new ChemicalReactorRecipeHandler(jeiHelpers),
new FusionReactorRecipeHandler(), new IndustrialGrinderRecipeHandler(jeiHelpers),
new ImplosionCompressorRecipeHandler(jeiHelpers), new IndustrialElectrolyzerRecipeHandler(jeiHelpers),
new IndustrialSawmillRecipeHandler(jeiHelpers), new RollingMachineRecipeHandler(),
new RollingMachineRecipeHandler(),
new VacuumFreezerRecipeHandler(jeiHelpers), new GrinderRecipeHandler(jeiHelpers),
new ExtractorRecipeHandler(jeiHelpers), new CompressorRecipeHandler(jeiHelpers),
new ScrapboxRecipeHandler(jeiHelpers));
@ -186,7 +184,6 @@ import java.util.List;
RecipeCategoryUids.IMPLOSION_COMPRESSOR);
registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14,
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);
registry.addRecipeClickArea(GuiIndustrialSawmill.class, 55, 36, 24, 16, RecipeCategoryUids.INDUSTRIAL_SAWMILL);
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);
@ -215,8 +212,6 @@ import java.util.List;
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.IndustrialGrinder),
RecipeCategoryUids.INDUSTRIAL_GRINDER);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.industrialSawmill),
RecipeCategoryUids.INDUSTRIAL_SAWMILL);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModBlocks.RollingMachine),
RecipeCategoryUids.ROLLING_MACHINE);
registry.addRecipeCategoryCraftingItem(new ItemStack(ModItems.scrapBox), RecipeCategoryUids.SCRAPBOX);
@ -247,9 +242,6 @@ import java.util.List;
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);
recipeTransferRegistry
.addRecipeTransferHandler(ContainerRollingMachine.class, RecipeCategoryUids.ROLLING_MACHINE, 0, 9, 11,
36);

View file

@ -1,86 +0,0 @@
package techreborn.compat.jei.industrialSawmill;
import javax.annotation.Nonnull;
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.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.gui.GuiIndustrialSawmill;
import techreborn.compat.jei.RecipeCategoryUids;
import techreborn.compat.jei.RecipeUtil;
import techreborn.tiles.TileIndustrialSawmill;
public class IndustrialSawmillRecipeCategory extends BlankRecipeCategory
{
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 = I18n.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(@Nonnull Minecraft minecraft)
{
blankArea.draw(minecraft, 31, 51);
}
@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, true, tankOverlay);
if (recipeWrapper instanceof IndustrialSawmillRecipeWrapper)
{
IndustrialSawmillRecipeWrapper recipe = (IndustrialSawmillRecipeWrapper) recipeWrapper;
RecipeUtil.setRecipeItems(recipeLayout, recipe, INPUT_SLOTS, OUTPUT_SLOTS, INPUT_TANKS, null);
}
}
}

View file

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

View file

@ -1,59 +0,0 @@
package techreborn.compat.jei.industrialSawmill;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.gui.IDrawableAnimated;
import mezz.jei.api.gui.IDrawableStatic;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fluids.FluidStack;
import techreborn.api.recipe.machines.IndustrialSawmillRecipe;
import techreborn.client.gui.GuiIndustrialSawmill;
import techreborn.compat.jei.BaseRecipeWrapper;
public class IndustrialSawmillRecipeWrapper extends BaseRecipeWrapper<IndustrialSawmillRecipe>
{
private final IDrawableAnimated progress;
public IndustrialSawmillRecipeWrapper(@Nonnull IJeiHelpers jeiHelpers, @Nonnull IndustrialSawmillRecipe baseRecipe)
{
super(baseRecipe);
IGuiHelper guiHelper = 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
@Nonnull
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);
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);
}
}