diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index bf5f1ef6c..f3b20e3a8 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -121,8 +121,11 @@ public class GuiHandler implements IGuiHandler { return new ContainerIndustrialSawmill((TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)), player); } else if (ID == GuiHandler.chemicalReactorID) { - return new ContainerChemicalReactor((TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)), - player); + return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142) + .addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 70, 21) + .slot(1, 90, 21).outputSlot(2, 80, 51).energySlot(6, 8, 51).upgradeSlot(7, 152, 8) + .upgradeSlot(8, 152, 26).upgradeSlot(9, 152, 44).upgradeSlot(10, 152, 62).syncEnergyValue() + .syncCrafterValue().addInventory().create(); } else if (ID == GuiHandler.manuelID) { return null; } else if (ID == GuiHandler.destructoPackID) { diff --git a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java b/src/main/java/techreborn/client/container/ContainerChemicalReactor.java deleted file mode 100644 index babf78760..000000000 --- a/src/main/java/techreborn/client/container/ContainerChemicalReactor.java +++ /dev/null @@ -1,51 +0,0 @@ -package techreborn.client.container; - -import net.minecraft.entity.player.EntityPlayer; -import reborncore.client.gui.slots.BaseSlot; -import reborncore.client.gui.slots.SlotOutput; -import techreborn.api.gui.SlotUpgrade; -import techreborn.tiles.TileChemicalReactor; - -public class ContainerChemicalReactor extends ContainerCrafting { - - public int tickTime; - EntityPlayer player; - TileChemicalReactor tile; - - public ContainerChemicalReactor(TileChemicalReactor tilechemicalReactor, EntityPlayer player) { - super(tilechemicalReactor.crafter); - tile = tilechemicalReactor; - this.player = player; - - // input - this.addSlotToContainer(new BaseSlot(tilechemicalReactor.inventory, 0, 70, 21)); - this.addSlotToContainer(new BaseSlot(tilechemicalReactor.inventory, 1, 90, 21)); - // outputs - this.addSlotToContainer(new SlotOutput(tilechemicalReactor.inventory, 2, 80, 51)); - // battery - this.addSlotToContainer(new BaseSlot(tilechemicalReactor.inventory, 3, 8, 51)); - // upgrades - this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 4, 152, 8)); - this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 5, 152, 26)); - this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 6, 152, 44)); - this.addSlotToContainer(new SlotUpgrade(tilechemicalReactor.inventory, 7, 152, 62)); - - int i; - - for (i = 0; i < 3; ++i) { - for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new BaseSlot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return true; - } - -} diff --git a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java index 08c58a1a6..e316d4f77 100644 --- a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java +++ b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java @@ -5,59 +5,62 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.translation.I18n; -import techreborn.client.container.ContainerChemicalReactor; + +import techreborn.client.container.builder.ContainerBuilder; import techreborn.tiles.TileChemicalReactor; public class GuiChemicalReactor extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation("techreborn", - "textures/gui/chemical_reactor.png"); + "textures/gui/chemical_reactor.png"); TileChemicalReactor chemicalReactor; - ContainerChemicalReactor containerChemicalReactor; - public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) { - super(new ContainerChemicalReactor(tilechemicalReactor, player)); - containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots; + public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor tilechemicalReactor) { + super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142) + .addInventory().tile(tilechemicalReactor).slot(0, 70, 21).slot(1, 90, 21).outputSlot(2, 80, 51) + .energySlot(6, 8, 51).upgradeSlot(7, 152, 8).upgradeSlot(8, 152, 26).upgradeSlot(9, 152, 44) + .upgradeSlot(10, 152, 62).syncEnergyValue().syncCrafterValue().addInventory().create()); this.xSize = 176; this.ySize = 167; - chemicalReactor = tilechemicalReactor; + this.chemicalReactor = tilechemicalReactor; } @Override public void initGui() { - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; + final int k = (this.width - this.xSize) / 2; + final int l = (this.height - this.ySize) / 2; super.initGui(); } @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + protected void drawGuiContainerBackgroundLayer(final float p_146976_1_, final int p_146976_2_, final int p_146976_3_) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(texture); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; + this.mc.getTextureManager().bindTexture(GuiChemicalReactor.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); int j = 0; - j = chemicalReactor.getProgressScaled(11); + j = this.chemicalReactor.getProgressScaled(11); if (j > 0) { this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); } - j = chemicalReactor.getEnergyScaled(12); + j = this.chemicalReactor.getEnergyScaled(12); if (j > 0) { this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); } } - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.name"); + @Override + protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) { + final String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.name"); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, - 4210752); + 4210752); this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, - this.ySize - 96 + 2, 4210752); + this.ySize - 96 + 2, 4210752); } } diff --git a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java index af53eb4da..568ecd002 100644 --- a/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java +++ b/src/main/java/techreborn/compat/jei/TechRebornJeiPlugin.java @@ -284,10 +284,6 @@ public class TechRebornJeiPlugin extends BlankModPlugin { 8, 36); recipeTransferRegistry .addRecipeTransferHandler(ContainerBlastFurnace.class, RecipeCategoryUids.BLAST_FURNACE, 0, 2, 4, 36); - - recipeTransferRegistry - .addRecipeTransferHandler(ContainerChemicalReactor.class, RecipeCategoryUids.CHEMICAL_REACTOR, 0, 2, 8, - 36); recipeTransferRegistry .addRecipeTransferHandler(ContainerFusionReactor.class, RecipeCategoryUids.FUSION_REACTOR, 0, 2, 3, 36); recipeTransferRegistry @@ -303,6 +299,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin { recipeTransferRegistry .addRecipeTransferHandler(ContainerVacuumFreezer.class, RecipeCategoryUids.VACUUM_FREEZER, 0, 1, 2, 36); + recipeTransferRegistry.addRecipeTransferHandler( + new BuiltContainerTransferInfo("chemicalreactor", RecipeCategoryUids.CHEMICAL_REACTOR, 36, 2, 0, 36)); recipeTransferRegistry.addRecipeTransferHandler( new BuiltContainerTransferInfo("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36)); recipeTransferRegistry.addRecipeTransferHandler(