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
public void initGui() {
super.initGui();
ClientProxy.multiblockRenderEvent.setMultiblock(null);
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
@Override
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);
final GuiBase.Layer layer = Layer.BACKGROUND;
drawSlot(50, 27, layer);
drawSlot(50,47,layer);
drawSlot(92,36,layer);
drawSlot(110,36,layer);
drawSlot(50, 47, layer);
drawSlot(92, 36, layer);
drawSlot(110, 36, layer);
if(tile.getMutliBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
}
if (tile.getMutliBlock()) {
builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer);
}
this.builder.drawJEIButton(this, 150, 4, layer);
this.builder.drawJEIButton(this, 150, 4, layer);
}
@Override
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
final GuiBase.Layer layer = Layer.FOREGROUND;
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
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.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
if(tile.getMutliBlock()){
addHologramButton(6, 4, 212, layer);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, 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);
if (tile.getMutliBlock()) {
addHologramButton(6, 4, 212, layer);
} else {
builder.drawMultiblockMissingBar(this, layer);
addHologramButton(76, 56, 212, layer);
builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer);
}
}
public void addHologramButton(int x, int y, int id, Layer layer) {
if (id == 0)
buttonList.clear();
int factorX = 0;
int factorY = 0;
if (layer == Layer.BACKGROUND) {
factorX = guiLeft;
factorY = guiTop;
}
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
}
public void addHologramButton(int x, int y, int id, Layer layer) {
if (id == 0)
buttonList.clear();
int factorX = 0;
int factorY = 0;
if (layer == Layer.BACKGROUND) {
factorX = guiLeft;
factorY = guiTop;
}
buttonList.add(new GuiButtonHologram(id, x + factorX, y + factorY, this, layer));
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.
final Multiblock multiblock = new Multiblock();
for(int x = -1; x <= 1; x++) {
for(int y = -4; y <= -2; y++) {
for(int z = -1; z <= 1; z++) {
if(!((x == 0) && (y == -3) && (z == 0))) {
this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
}
}
}
}
@Override
public void actionPerformed(final GuiButton button) throws IOException {
super.actionPerformed(button);
if (button.id == 212) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{
// This code here makes a basic multiblock and then sets to the selected one.
final Multiblock multiblock = new Multiblock();
for (int x = -1; x <= 1; x++) {
for (int y = -4; y <= -2; y++) {
for (int z = -1; z <= 1; z++) {
if (!((x == 0) && (y == -3) && (z == 0))) {
this.addComponent(x, y, z, ModBlocks.MACHINE_CASINGS.getStateFromMeta(1), multiblock);
}
}
}
}
final MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
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());
}
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
}
}
final MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
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());
}
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
}
}
}
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);
}
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);
}
}

View file

@ -253,7 +253,7 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
registry.addRecipeClickArea(GuiAlloySmelter.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER);
registry.addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE);
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);
registry.addRecipeClickArea(GuiIndustrialElectrolyzer.class, 72, 37, 33, 14,
RecipeCategoryUids.INDUSTRIAL_ELECTROLYZER);

View file

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

View file

@ -40,15 +40,15 @@ public class ImplosionCompressorRecipeWrapper extends BaseRecipeWrapper<Implosio
private final IDrawableAnimated progress;
public ImplosionCompressorRecipeWrapper(
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ImplosionCompressorRecipe baseRecipe) {
@Nonnull
IJeiHelpers jeiHelpers,
@Nonnull
ImplosionCompressorRecipe baseRecipe) {
super(baseRecipe);
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(),
IDrawableAnimated.StartDirection.LEFT, false);
IDrawableAnimated.StartDirection.LEFT, false);
}
@Override

View file

@ -25,8 +25,6 @@
package techreborn.tiles.multiblock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.tiles.TileRollingMachine;
public class TileImplosionCompressor extends TilePowerAcceptor
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 MultiblockChecker multiblockChecker;
public RecipeCrafter crafter;
@ -162,13 +158,4 @@ public class TileImplosionCompressor extends TilePowerAcceptor
.syncEnergyValue().syncCrafterValue().addInventory().create();
}
private static class ImplosionCompressorTileContainer extends Container {
@Override
public boolean canInteractWith(final EntityPlayer entityplayer) {
return true;
}
}
}