From a6df9441ecaa02668f44132594baa00fce81a807 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Mon, 29 Jan 2018 18:17:32 +0300 Subject: [PATCH] Updated reactor GUI. Closes #1422 --- .../techreborn/client/ClientMultiBlocks.java | 2 + .../client/gui/GuiFusionReactor.java | 167 ++++--- .../compat/jei/TechRebornJeiPlugin.java | 2 +- .../FusionReactorRecipeCategory.java | 13 +- .../TileFusionControlComputer.java | 441 ++++++++++-------- 5 files changed, 325 insertions(+), 300 deletions(-) diff --git a/src/main/java/techreborn/client/ClientMultiBlocks.java b/src/main/java/techreborn/client/ClientMultiBlocks.java index e6faf81e2..02e054fbd 100644 --- a/src/main/java/techreborn/client/ClientMultiBlocks.java +++ b/src/main/java/techreborn/client/ClientMultiBlocks.java @@ -42,6 +42,7 @@ public class ClientMultiBlocks { checkMachine(); } + @Deprecated public static void checkCoils() { if ((isCoil(3, 0, 1)) && (isCoil(3, 0, 0)) && (isCoil(3, 0, 0 - 1)) && (isCoil(0 - 3, 0, 1)) && (isCoil(0 - 3, 0, 0)) && (isCoil(0 - 3, 0, 0 - 1)) && (isCoil(2, 0, 2)) && (isCoil(2, 0, 1)) @@ -52,6 +53,7 @@ public class ClientMultiBlocks { } } + @Deprecated private static boolean isCoil(int x, int y, int z) { reactor.addComponent(new BlockPos(x, y, z), ModBlocks.FUSION_COIL.getDefaultState()); return true; diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index eea92e1ad..1b6a4bcbc 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -24,123 +24,116 @@ package techreborn.client.gui; +import java.io.IOException; + +import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; -import net.minecraft.client.resources.I18n; +import reborncore.client.multiblock.Multiblock; import reborncore.client.multiblock.MultiblockRenderEvent; import reborncore.client.multiblock.MultiblockSet; -import reborncore.common.powerSystem.PowerSystem; -import techreborn.client.ClientMultiBlocks; +import techreborn.client.gui.widget.GuiButtonHologram; +import techreborn.init.ModBlocks; import techreborn.proxies.ClientProxy; import techreborn.tiles.fusionReactor.TileFusionControlComputer; -import java.io.IOException; - -public class GuiFusionReactor extends GuiContainer { - - public static final ResourceLocation texture = new ResourceLocation("techreborn", - "textures/gui/fusion_reactor.png"); - +public class GuiFusionReactor extends GuiBase { TileFusionControlComputer tile; - public GuiFusionReactor(final EntityPlayer player, final TileFusionControlComputer fusion) { - super(fusion.createContainer(player)); - this.tile = fusion; + public GuiFusionReactor(final EntityPlayer player, final TileFusionControlComputer tile) { + super(player, tile, tile.createContainer(player)); + this.tile = tile; } - + @Override - protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) { - final String name = I18n.format("tile.techreborn:fusion_control_computer.name"); - this.fontRenderer.drawString(name, 87, 6, 4210752); - this.fontRenderer.drawString(I18n.format("container.inventory", new Object[0]), 8, - this.ySize - 96 + 2, 4210752); + protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) { + super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); + final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND; - this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(this.tile.getEnergy()), 11, 8, - 16448255); - this.fontRenderer.drawString("Coils: " + (this.tile.getCoilStatus() == 1 ? "Yes" : "No"), 11, 16, - 16448255); - if (this.tile.getNeededPower() > 1 && this.tile.getCrafingTickTime() < 1) - this.fontRenderer.drawString("Start: " - + this.percentage(this.tile.getNeededPower(), (int) this.tile.getEnergy()) - + "%", 11, 24, 16448255); + this.drawSlot(34, 47, layer); + this.drawSlot(126, 47, layer); + this.drawOutputSlot(80, 47, layer); + this.builder.drawJEIButton(this, 150, 4, layer); } - + @Override - public void initGui() { - final int k = (this.width - this.xSize) / 2; - final int l = (this.height - this.ySize) / 2; - final GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, ""); - this.buttonList.add(button); - super.initGui(); - final BlockPos coordinates = new BlockPos( - this.tile.getPos().getX() - - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2, - this.tile.getPos().getY() - 1, this.tile.getPos().getZ() - - EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2); - if (coordinates.equals(MultiblockRenderEvent.anchor)) { - ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "B"; + protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { + super.drawGuiContainerForegroundLayer(mouseX, mouseY); + final GuiBase.Layer layer = GuiBase.Layer.FOREGROUND; + + this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 55, 51, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + this.builder.drawProgressBar(this, this.tile.getProgressScaled(100), 100, 105, 51, mouseX, mouseY, TRBuilder.ProgressDirection.LEFT, layer); + this.builder.drawMultiEnergyBar(this, 9, 19, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer); + if (tile.checkCoils()) { + addHologramButton(6, 4, 212, layer); + builder.drawHologramButton(this, 6, 4, mouseX, mouseY, layer); } else { - button.displayString = "A"; + builder.drawMultiblockMissingBar(this, layer); + addHologramButton(76, 56, 212, layer); + builder.drawHologramButton(this, 76, 56, mouseX, mouseY, layer); } } - - @Override - protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, - final int p_146976_3_) { - this.drawDefaultBackground(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(GuiFusionReactor.texture); - final int k = (this.width - this.xSize) / 2; - final int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - this.drawTexturedModalRect(k + 88, l + 36, 176, 0, 14, 14); - - // progressBar - this.drawTexturedModalRect(k + 111, l + 34, 176, 14, this.tile.getProgressScaled(), 16); - + + 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 int percentage(final int MaxValue, final int CurrentValue) { - if (CurrentValue == 0) - return 0; - return (int) (CurrentValue * 100.0f / MaxValue); - } - + @Override public void actionPerformed(final GuiButton button) throws IOException { super.actionPerformed(button); - if (button.id == 212) { + if (button.id == 212 && !GuiBase.showSlotConfig) { if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) { - // This code here makes a basic multiblock and then sets to - // theselected one. - final MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor); + // This code here makes a basic multiblock and then sets to the selected one. + final Multiblock multiblock = new Multiblock(); + IBlockState coil = ModBlocks.FUSION_COIL.getDefaultState(); + + this.addComponent(3, 0, 1, coil, multiblock); + this.addComponent(3, 0, 0, coil, multiblock); + this.addComponent(3, 0, -1, coil, multiblock); + this.addComponent(-3, 0, 1, coil, multiblock); + this.addComponent(-3, 0, 0, coil, multiblock); + this.addComponent(-3, 0, -1, coil, multiblock); + this.addComponent(2, 0, 2, coil, multiblock); + this.addComponent(2, 0, 1, coil, multiblock); + this.addComponent(2, 0, -1, coil, multiblock); + this.addComponent(2, 0, -2, coil, multiblock); + this.addComponent(-2, 0, 2, coil, multiblock); + this.addComponent(-2, 0, 1, coil, multiblock); + this.addComponent(-2, 0, -1, coil, multiblock); + this.addComponent(-2, 0, -2, coil, multiblock); + this.addComponent(1, 0, 3, coil, multiblock); + this.addComponent(1, 0, 2, coil, multiblock); + this.addComponent(1, 0, -2, coil, multiblock); + this.addComponent(1, 0, -3, coil, multiblock); + this.addComponent(-1, 0, 3, coil, multiblock); + this.addComponent(-1, 0, 2, coil, multiblock); + this.addComponent(-1, 0, -2, coil, multiblock); + this.addComponent(-1, 0, -3, coil, multiblock); + this.addComponent(0, 0, 3, coil, multiblock); + this.addComponent(0, 0, -3, coil, multiblock); + + final MultiblockSet set = new MultiblockSet(multiblock); ClientProxy.multiblockRenderEvent.setMultiblock(set); ClientProxy.multiblockRenderEvent.parent = this.tile.getPos(); -// new Location(this.fusionController.getPos().getX(), -// this.fusionController.getPos().getY(), this.fusionController.getPos().getZ(), -// this.fusionController.getWorld()); - MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), - this.tile.getPos().getY() - 1, this.tile.getPos().getZ()); - - button.displayString = "A"; + MultiblockRenderEvent.anchor = new BlockPos(this.tile.getPos().getX(), this.tile.getPos().getY() - 1, + this.tile.getPos().getZ()); } else { ClientProxy.multiblockRenderEvent.setMultiblock(null); - button.displayString = "B"; } } } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - this.renderHoveredToolTip(mouseX, mouseY); + + 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); } } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index 0493e5ab3..416f7bf50 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -311,12 +311,12 @@ public class TechRebornJeiPlugin implements IModPlugin { addRecipeClickArea(GuiPlasmaGenerator.class, 150, 4, 18, 18, EFluidGenerator.PLASMA.getRecipeID()); addRecipeClickArea(GuiDistillationTower.class, 150, 4, 18, 18, RecipeCategoryUids.DISTILLATION_TOWER); addRecipeClickArea(GuiScrapboxinator.class, 150, 4, 18, 18, RecipeCategoryUids.SCRAPBOX); + addRecipeClickArea(GuiFusionReactor.class, 150, 4, 18, 18, RecipeCategoryUids.FUSION_REACTOR); //OLD ONES addRecipeClickArea(GuiAlloyFurnace.class, 80, 35, 26, 20, RecipeCategoryUids.ALLOY_SMELTER, VanillaRecipeCategoryUid.FUEL); addRecipeClickArea(GuiAssemblingMachine.class, 85, 34, 24, 20, RecipeCategoryUids.ASSEMBLING_MACHINE); - addRecipeClickArea(GuiFusionReactor.class, 111, 34, 27, 19, RecipeCategoryUids.FUSION_REACTOR); addRecipeClickArea(GuiRollingMachine.class, 89, 32, 26, 25, RecipeCategoryUids.ROLLING_MACHINE); addRecipeClickArea(GuiIronFurnace.class, 78, 36, 24, 16, VanillaRecipeCategoryUid.SMELTING, VanillaRecipeCategoryUid.FUEL); diff --git a/src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java b/src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java index 708348a7c..812f155c3 100644 --- a/src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java +++ b/src/main/java/techreborn/compat/jei/fusionReactor/FusionReactorRecipeCategory.java @@ -31,8 +31,8 @@ import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeCategory; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.translation.I18n; -import techreborn.client.gui.GuiFusionReactor; import techreborn.compat.jei.RecipeCategoryUids; import techreborn.lib.ModInfo; @@ -40,7 +40,8 @@ import javax.annotation.Nonnull; @SuppressWarnings("deprecation") public class FusionReactorRecipeCategory implements IRecipeCategory { - + + public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/jei.png"); private static final int inputSlotTop = 0; private static final int inputSlotBottom = 1; private static final int outputSlot = 2; @@ -51,7 +52,7 @@ public class FusionReactorRecipeCategory implements IRecipeCategory 0) { + // Waste power if it has no where to go + this.addEnergy(this.currentRecipe.getEuTick()); + } else { // Power user + if (this.canUseEnergy(this.currentRecipe.getEuTick() * -1)) { + this.setEnergy(this.getEnergy() - this.currentRecipe.getEuTick() * -1); + } + } + } else if (this.crafingTickTime >= this.finalTickTime) { + if (this.canFitStack(this.currentRecipe.getOutput(), this.outputStackSlot, true)) { + if (this.getStackInSlot(this.outputStackSlot).isEmpty()) { + this.setInventorySlotContents(this.outputStackSlot, this.currentRecipe.getOutput().copy()); + } else { + this.decrStackSize(this.outputStackSlot, -this.currentRecipe.getOutput().getCount()); + } + this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount()); + if (!this.currentRecipe.getBottomInput().isEmpty()) { + this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount()); + } + if (this.validateReactorRecipe(this.currentRecipe)) { + this.crafingTickTime = 0; + } else { + this.resetCrafter(); + } + } + } + this.markDirty(); + } + + if (this.inventory.hasChanged) { + this.inventory.hasChanged = false; + } } @Override @@ -117,16 +315,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo @Override public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) { super.writeToNBT(tagCompound); - - if (this.crafingTickTime == -1) { - this.crafingTickTime = 0; - } - if (this.finalTickTime == -1) { - this.finalTickTime = 0; - } - if (this.neededPower == -1) { - this.neededPower = 0; - } tagCompound.setInteger("crafingTickTime", this.crafingTickTime); tagCompound.setInteger("finalTickTime", this.finalTickTime); tagCompound.setInteger("neededPower", this.neededPower); @@ -134,190 +322,56 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo return tagCompound; } - public boolean checkCoils() { - if (this.isCoil(this.getPos().getX() + 3, this.getPos().getY(), this.getPos().getZ() + 1) - && this.isCoil(this.getPos().getX() + 3, this.getPos().getY(), this.getPos().getZ()) - && this.isCoil(this.getPos().getX() + 3, this.getPos().getY(), this.getPos().getZ() - 1) - && this.isCoil(this.getPos().getX() - 3, this.getPos().getY(), this.getPos().getZ() + 1) - && this.isCoil(this.getPos().getX() - 3, this.getPos().getY(), this.getPos().getZ()) - && this.isCoil(this.getPos().getX() - 3, this.getPos().getY(), this.getPos().getZ() - 1) - && this.isCoil(this.getPos().getX() + 2, this.getPos().getY(), this.getPos().getZ() + 2) - && this.isCoil(this.getPos().getX() + 2, this.getPos().getY(), this.getPos().getZ() + 1) - && this.isCoil(this.getPos().getX() + 2, this.getPos().getY(), this.getPos().getZ() - 1) - && this.isCoil(this.getPos().getX() + 2, this.getPos().getY(), this.getPos().getZ() - 2) - && this.isCoil(this.getPos().getX() - 2, this.getPos().getY(), this.getPos().getZ() + 2) - && this.isCoil(this.getPos().getX() - 2, this.getPos().getY(), this.getPos().getZ() + 1) - && this.isCoil(this.getPos().getX() - 2, this.getPos().getY(), this.getPos().getZ() - 1) - && this.isCoil(this.getPos().getX() - 2, this.getPos().getY(), this.getPos().getZ() - 2) - && this.isCoil(this.getPos().getX() + 1, this.getPos().getY(), this.getPos().getZ() + 3) - && this.isCoil(this.getPos().getX() + 1, this.getPos().getY(), this.getPos().getZ() + 2) - && this.isCoil(this.getPos().getX() + 1, this.getPos().getY(), this.getPos().getZ() - 2) - && this.isCoil(this.getPos().getX() + 1, this.getPos().getY(), this.getPos().getZ() - 3) - && this.isCoil(this.getPos().getX() - 1, this.getPos().getY(), this.getPos().getZ() + 3) - && this.isCoil(this.getPos().getX() - 1, this.getPos().getY(), this.getPos().getZ() + 2) - && this.isCoil(this.getPos().getX() - 1, this.getPos().getY(), this.getPos().getZ() - 2) - && this.isCoil(this.getPos().getX() - 1, this.getPos().getY(), this.getPos().getZ() - 3) - && this.isCoil(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ() + 3) - && this.isCoil(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ() - 3)) { - this.coilStatus = 1; - return true; - } - this.coilStatus = 0; - return false; - } - - private boolean isCoil(final int x, final int y, final int z) { - return this.world.getBlockState(new BlockPos(x, y, z)).getBlock() == ModBlocks.FUSION_COIL; - } - + // TileLegacyMachineBase @Override public void onLoad() { super.onLoad(); this.checkCoils(); - } - - @Override - public void update() { - super.update(); - // TODO improve this code a lot - - if (this.world.isRemote) { - return; - } - - if (this.world.getTotalWorldTime() % 20 == 0) { - this.checkCoils(); - } - - if (this.coilStatus == 0) { - this.resetCrafter(); - return; - } - - if (this.currentRecipe == null && this.inventory.hasChanged){ - this.crafingTickTime = 0; - for (final FusionReactorRecipe reactorRecipe : FusionReactorRecipeHelper.reactorRecipes) { - if (this.validateRecipe(reactorRecipe)){ - this.currentRecipe = reactorRecipe; - this.finalTickTime = this.currentRecipe.getTickTime(); - this.neededPower = (int) this.currentRecipe.getStartEU(); - break; - } - } - } - else { - if (this.inventory.hasChanged) { - if (!this.validateRecipe(this.currentRecipe)) { - this.resetCrafter(); - return; - } - } - } - - if (this.currentRecipe != null) { - if (!this.hasStartedCrafting) { - // Ignition! - if (this.canUseEnergy(this.currentRecipe.getStartEU())) { - this.useEnergy(this.currentRecipe.getStartEU()); - this.hasStartedCrafting = true; - } - } - if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) { - this.crafingTickTime++; - // Power gen - if (this.currentRecipe.getEuTick() > 0) { - // Waste power if it has no where to go - this.addEnergy(this.currentRecipe.getEuTick()); - } else { // Power user - if (this.canUseEnergy(this.currentRecipe.getEuTick() * -1)) { - this.setEnergy(this.getEnergy() - this.currentRecipe.getEuTick() * -1); - } - } - } else if (this.crafingTickTime >= this.finalTickTime) { - if (this.canFitStack(this.currentRecipe.getOutput(), this.outputStackSlot, true)) { - if (this.getStackInSlot(this.outputStackSlot).isEmpty()) { - this.setInventorySlotContents(this.outputStackSlot, this.currentRecipe.getOutput().copy()); - } else { - this.decrStackSize(this.outputStackSlot, -this.currentRecipe.getOutput().getCount()); - } - this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount()); - if (!this.currentRecipe.getBottomInput().isEmpty()) { - this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount()); - } - if (this.validateRecipe(this.currentRecipe)){ - this.crafingTickTime = 0; - } - else { - this.resetCrafter(); - } - } - } - this.markDirty(); - } - - if (this.inventory.hasChanged) { - this.inventory.hasChanged = false; - } } - private boolean validateRecipe(FusionReactorRecipe recipe) { - if (ItemUtils.isItemEqual(this.getStackInSlot(this.topStackSlot), recipe.getTopInput(), true, true, true)) { - if (recipe.getBottomInput() != null) { - if (!ItemUtils.isItemEqual(this.getStackInSlot(this.bottomStackSlot), recipe.getBottomInput(), true, true, - true)) { - return false; - } - } - if (this.canFitStack(recipe.getOutput(), this.outputStackSlot, true)) { - return true; - } - } + @Override + public boolean canBeUpgraded() { return false; } - private void resetCrafter() { - this.currentRecipe = null; - this.crafingTickTime = -1; - this.finalTickTime = -1; - this.neededPower = -1; - this.hasStartedCrafting = false; - } - - public boolean canFitStack(final ItemStack stack, final int slot, final boolean oreDic) {// Checks to see if it can fit the stack - if (stack.isEmpty()) { - return true; - } - if (this.inventory.getStackInSlot(slot).isEmpty()) { - return true; - } - if (ItemUtils.isItemEqual(this.inventory.getStackInSlot(slot), stack, true, true, oreDic)) { - if (stack.getCount() + this.inventory.getStackInSlot(slot).getCount() <= stack.getMaxStackSize()) { - return true; - } - } - return false; - } + // @Override + // public String getName() { + // return null; + // } + // + // @Override + // public boolean hasCustomName() { + // return false; + // } + // + // @Override + // public ITextComponent getDisplayName() { + // return null; + // } + // IToolDrop @Override - public String getName() { - return null; - } - - @Override - public boolean hasCustomName() { - return false; - } - - @Override - public ITextComponent getDisplayName() { - return null; + public ItemStack getToolDrop(EntityPlayer p0) { + return new ItemStack(ModBlocks.FUSION_CONTROL_COMPUTER, 1); } + // IInventoryProvider @Override public Inventory getInventory() { return this.inventory; } + // IContainerProvider + @Override + public BuiltContainer createContainer(final EntityPlayer player) { + return new ContainerBuilder("fusionreactor").player(player.inventory).inventory().hotbar() + .addInventory().tile(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).syncEnergyValue() + .syncIntegerValue(this::getCoilStatus, this::setCoilStatus) + .syncIntegerValue(this::getCrafingTickTime, this::setCrafingTickTime) + .syncIntegerValue(this::getFinalTickTime, this::setFinalTickTime) + .syncIntegerValue(this::getNeededPower, this::setNeededPower).addInventory().create(this); + } + public int getCoilStatus() { return this.coilStatus; } @@ -349,29 +403,4 @@ public class TileFusionControlComputer extends TilePowerAcceptor implements IToo public void setNeededPower(final int neededPower) { this.neededPower = neededPower; } - - public int getProgressScaled() { - return Math.max(0, Math.min(24, (this.getCrafingTickTime() > 0 ? 1 : 0) - + this.getCrafingTickTime() * 24 / (this.finalTickTime < 1 ? 1 : this.finalTickTime))); - } - - @Override - public BuiltContainer createContainer(final EntityPlayer player) { - return new ContainerBuilder("fusionreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142) - .addInventory().tile(this).slot(0, 88, 17).slot(1, 88, 53).outputSlot(2, 148, 35).syncEnergyValue() - .syncIntegerValue(this::getCoilStatus, this::setCoilStatus) - .syncIntegerValue(this::getCrafingTickTime, this::setCrafingTickTime) - .syncIntegerValue(this::getFinalTickTime, this::setFinalTickTime) - .syncIntegerValue(this::getNeededPower, this::setNeededPower).addInventory().create(this); - } - - @Override - public ItemStack getToolDrop(EntityPlayer p0) { - return new ItemStack(ModBlocks.FUSION_CONTROL_COMPUTER, 1); - } - - @Override - public boolean canBeUpgraded() { - return false; - } }