Convert ChemicalReactor
This commit is contained in:
parent
60c88884a7
commit
35329cdc4a
4 changed files with 29 additions and 76 deletions
|
@ -121,8 +121,11 @@ public class GuiHandler implements IGuiHandler {
|
||||||
return new ContainerIndustrialSawmill((TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)),
|
return new ContainerIndustrialSawmill((TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)),
|
||||||
player);
|
player);
|
||||||
} else if (ID == GuiHandler.chemicalReactorID) {
|
} else if (ID == GuiHandler.chemicalReactorID) {
|
||||||
return new ContainerChemicalReactor((TileChemicalReactor) world.getTileEntity(new BlockPos(x, y, z)),
|
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
player);
|
.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) {
|
} else if (ID == GuiHandler.manuelID) {
|
||||||
return null;
|
return null;
|
||||||
} else if (ID == GuiHandler.destructoPackID) {
|
} else if (ID == GuiHandler.destructoPackID) {
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,59 +5,62 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import techreborn.client.container.ContainerChemicalReactor;
|
|
||||||
|
import techreborn.client.container.builder.ContainerBuilder;
|
||||||
import techreborn.tiles.TileChemicalReactor;
|
import techreborn.tiles.TileChemicalReactor;
|
||||||
|
|
||||||
public class GuiChemicalReactor extends GuiContainer {
|
public class GuiChemicalReactor extends GuiContainer {
|
||||||
|
|
||||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||||
"textures/gui/chemical_reactor.png");
|
"textures/gui/chemical_reactor.png");
|
||||||
|
|
||||||
TileChemicalReactor chemicalReactor;
|
TileChemicalReactor chemicalReactor;
|
||||||
ContainerChemicalReactor containerChemicalReactor;
|
|
||||||
|
|
||||||
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
|
public GuiChemicalReactor(final EntityPlayer player, final TileChemicalReactor tilechemicalReactor) {
|
||||||
super(new ContainerChemicalReactor(tilechemicalReactor, player));
|
super(new ContainerBuilder("chemicalreactor").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
containerChemicalReactor = (ContainerChemicalReactor) this.inventorySlots;
|
.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.xSize = 176;
|
||||||
this.ySize = 167;
|
this.ySize = 167;
|
||||||
chemicalReactor = tilechemicalReactor;
|
this.chemicalReactor = tilechemicalReactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
int k = (this.width - this.xSize) / 2;
|
final int k = (this.width - this.xSize) / 2;
|
||||||
int l = (this.height - this.ySize) / 2;
|
final int l = (this.height - this.ySize) / 2;
|
||||||
super.initGui();
|
super.initGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
this.mc.getTextureManager().bindTexture(texture);
|
this.mc.getTextureManager().bindTexture(GuiChemicalReactor.texture);
|
||||||
int k = (this.width - this.xSize) / 2;
|
final int k = (this.width - this.xSize) / 2;
|
||||||
int l = (this.height - this.ySize) / 2;
|
final int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
j = chemicalReactor.getProgressScaled(11);
|
j = this.chemicalReactor.getProgressScaled(11);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = chemicalReactor.getEnergyScaled(12);
|
j = this.chemicalReactor.getEnergyScaled(12);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
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_) {
|
@Override
|
||||||
String name = I18n.translateToLocal("tile.techreborn.chemicalreactor.name");
|
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,
|
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.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||||
this.ySize - 96 + 2, 4210752);
|
this.ySize - 96 + 2, 4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,10 +284,6 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
||||||
8, 36);
|
8, 36);
|
||||||
recipeTransferRegistry
|
recipeTransferRegistry
|
||||||
.addRecipeTransferHandler(ContainerBlastFurnace.class, RecipeCategoryUids.BLAST_FURNACE, 0, 2, 4, 36);
|
.addRecipeTransferHandler(ContainerBlastFurnace.class, RecipeCategoryUids.BLAST_FURNACE, 0, 2, 4, 36);
|
||||||
|
|
||||||
recipeTransferRegistry
|
|
||||||
.addRecipeTransferHandler(ContainerChemicalReactor.class, RecipeCategoryUids.CHEMICAL_REACTOR, 0, 2, 8,
|
|
||||||
36);
|
|
||||||
recipeTransferRegistry
|
recipeTransferRegistry
|
||||||
.addRecipeTransferHandler(ContainerFusionReactor.class, RecipeCategoryUids.FUSION_REACTOR, 0, 2, 3, 36);
|
.addRecipeTransferHandler(ContainerFusionReactor.class, RecipeCategoryUids.FUSION_REACTOR, 0, 2, 3, 36);
|
||||||
recipeTransferRegistry
|
recipeTransferRegistry
|
||||||
|
@ -303,6 +299,8 @@ public class TechRebornJeiPlugin extends BlankModPlugin {
|
||||||
recipeTransferRegistry
|
recipeTransferRegistry
|
||||||
.addRecipeTransferHandler(ContainerVacuumFreezer.class, RecipeCategoryUids.VACUUM_FREEZER, 0, 1, 2, 36);
|
.addRecipeTransferHandler(ContainerVacuumFreezer.class, RecipeCategoryUids.VACUUM_FREEZER, 0, 1, 2, 36);
|
||||||
|
|
||||||
|
recipeTransferRegistry.addRecipeTransferHandler(
|
||||||
|
new BuiltContainerTransferInfo("chemicalreactor", RecipeCategoryUids.CHEMICAL_REACTOR, 36, 2, 0, 36));
|
||||||
recipeTransferRegistry.addRecipeTransferHandler(
|
recipeTransferRegistry.addRecipeTransferHandler(
|
||||||
new BuiltContainerTransferInfo("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36));
|
new BuiltContainerTransferInfo("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36));
|
||||||
recipeTransferRegistry.addRecipeTransferHandler(
|
recipeTransferRegistry.addRecipeTransferHandler(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue