fix identation + remove unused import + fix jei button on ImplosionCompressor

This commit is contained in:
alexpic57 2017-09-08 13:58:27 +02:00
parent e4b5d3378a
commit 1d873c2d33
5 changed files with 77 additions and 90 deletions

View file

@ -57,86 +57,86 @@ public class GuiImplosionCompressor extends GuiBase {
@Override @Override
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
ClientProxy.multiblockRenderEvent.setMultiblock(null); ClientProxy.multiblockRenderEvent.setMultiblock(null);
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
final GuiBase.Layer layer = Layer.BACKGROUND; final GuiBase.Layer layer = Layer.BACKGROUND;
drawSlot(50, 27, layer); drawSlot(50, 27, layer);
drawSlot(50,47,layer); drawSlot(50, 47, layer);
drawSlot(92,36,layer); drawSlot(92, 36, layer);
drawSlot(110,36,layer); drawSlot(110, 36, layer);
if(tile.getMutliBlock()) { if (tile.getMutliBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
} }
this.builder.drawJEIButton(this, 150, 4, layer); this.builder.drawJEIButton(this, 150, 4, layer);
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY); super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = Layer.FOREGROUND; final GuiBase.Layer layer = Layer.FOREGROUND;
this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 71, 40, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer);
this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
if(tile.getMutliBlock()){ if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer); addHologramButton(6, 4, 212, layer);
} else { } else {
builder.drawMultiblockMissingBar(this, layer); builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer); addHologramButton(76, 56, 212, layer);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
} }
} }
public void addHologramButton(int x, int y, int id, Layer layer) { public void addHologramButton(int x, int y, int id, Layer layer) {
if (id == 0) if (id == 0)
buttonList.clear(); buttonList.clear();
int factorX = 0; int factorX = 0;
int factorY = 0; int factorY = 0;
if (layer == Layer.BACKGROUND) { if (layer == Layer.BACKGROUND) {
factorX = guiLeft; factorX = guiLeft;
factorY = guiTop; factorY = guiTop;
} }
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer)); buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
} }
@Override @Override
public void actionPerformed(final GuiButton button) throws IOException { public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button); super.actionPerformed(button);
if (button.id == 212) { if (button.id == 212) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{ {
// This code here makes a basic multiblock and then sets to the selected one. // This code here makes a basic multiblock and then sets to the selected one.
final Multiblock multiblock = new Multiblock(); final Multiblock multiblock = new Multiblock();
for(int x = -1; x <= 1; x++) { for (int x = -1; x <= 1; x++) {
for(int y = -4; y <= -2; y++) { for (int y = -4; y <= -2; y++) {
for(int z = -1; z <= 1; z++) { for (int z = -1; z <= 1; z++) {
if(!((x == 0) && (y == -3) && (z == 0))) { if (!((x == 0) && (y == -3) && (z == 0))) {
this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock); this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
} }
} }
} }
} }
final MultiblockSet set = new MultiblockSet(multiblock); final MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set); ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld()); ClientProxy.multiblockRenderEvent.parent = new Location(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld());
MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ()); MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY(), this.tile.getPos().getZ());
} }
} else { } else {
ClientProxy.multiblockRenderEvent.setMultiblock(null); ClientProxy.multiblockRenderEvent.setMultiblock(null);
} }
} }
} }
public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) { public void addComponent(final int x, final int y, final int z, final IBlockState blockState, final Multiblock multiblock) {
multiblock.addComponent(new BlockPos(x, y, z), blockState); multiblock.addComponent(new BlockPos(x, y, z), blockState);
} }
} }

View file

@ -253,7 +253,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
registry.addRecipeClickArea(GuiAlloySmelter.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER); registry.addRecipeClickArea(GuiAlloySmelter.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE); registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE);
registry.addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR); registry.addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR);
registry.addRecipeClickArea(GuiImplosionCompressor.class, 60, 37, 24, 15, registry.addRecipeClickArea(GuiImplosionCompressor.class, 150, 4, 20, 12,
RecipeCategoryUids.IMPLOSION_COMPRESSOR); RecipeCategoryUids.IMPLOSION_COMPRESSOR);
registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14, registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14,
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER); RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);

View file

@ -40,9 +40,9 @@ import techreborn.lib.ModInfo;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<ImplosionCompressorRecipeWrapper> { public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<ImplosionCompressorRecipeWrapper> {
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png"); public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png");
private static final int[] INPUT_SLOTS = { 0, 1 }; private static final int[] INPUT_SLOTS = {0, 1};
private static final int[] OUTPUT_SLOTS = { 2, 3 }; private static final int[] OUTPUT_SLOTS = {2, 3};
private final IDrawable background; private final IDrawable background;
private final String title; private final String title;
@ -77,12 +77,12 @@ public class ImplosionCompressorRecipeCategory extends BlankRecipeCategory<Implo
@Override @Override
public void setRecipe( public void setRecipe(
@Nonnull @Nonnull
IRecipeLayout recipeLayout, IRecipeLayout recipeLayout,
@Nonnull @Nonnull
ImplosionCompressorRecipeWrapper recipeWrapper, ImplosionCompressorRecipeWrapper recipeWrapper,
@Nonnull @Nonnull
IIngredients ingredients) { IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(INPUT_SLOTS[0], true, 21, 2); guiItemStacks.init(INPUT_SLOTS[0], true, 21, 2);
guiItemStacks.init(INPUT_SLOTS[1], true, 21, 22); guiItemStacks.init(INPUT_SLOTS[1], true, 21, 22);

View file

@ -40,15 +40,15 @@ public class ImplosionCompressorRecipeWrapper extends BaseRecipeWrapper<Implosio
private final IDrawableAnimated progress; private final IDrawableAnimated progress;
public ImplosionCompressorRecipeWrapper( public ImplosionCompressorRecipeWrapper(
@Nonnull @Nonnull
IJeiHelpers jeiHelpers, IJeiHelpers jeiHelpers,
@Nonnull @Nonnull
ImplosionCompressorRecipe baseRecipe) { ImplosionCompressorRecipe baseRecipe) {
super(baseRecipe); super(baseRecipe);
IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10); IDrawableStatic progressStatic = guiHelper.createDrawable(TRBuilder.GUI_SHEET, 100, 151, 16, 10);
this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(), this.progress = guiHelper.createAnimatedDrawable(progressStatic, baseRecipe.tickTime(),
IDrawableAnimated.StartDirection.LEFT, false); IDrawableAnimated.StartDirection.LEFT, false);
} }
@Override @Override

View file

@ -25,8 +25,6 @@
package techreborn.tiles.multiblock; package techreborn.tiles.multiblock;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -42,12 +40,10 @@ import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer; import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder; import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.tiles.TileRollingMachine;
public class TileImplosionCompressor extends TilePowerAcceptor public class TileImplosionCompressor extends TilePowerAcceptor
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider { implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
public final InventoryCrafting craftMatrix = new InventoryCrafting(new ImplosionCompressorTileContainer(), 3, 3);
public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this); public Inventory inventory = new Inventory(4, "TileImplosionCompressor", 64, this);
public MultiblockChecker multiblockChecker; public MultiblockChecker multiblockChecker;
public RecipeCrafter crafter; public RecipeCrafter crafter;
@ -162,13 +158,4 @@ public class TileImplosionCompressor extends TilePowerAcceptor
.syncEnergyValue().syncCrafterValue().addInventory().create(); .syncEnergyValue().syncCrafterValue().addInventory().create();
} }
private static class ImplosionCompressorTileContainer extends Container {
@Override
public boolean canInteractWith(final EntityPlayer entityplayer) {
return true;
}
}
} }