Convert Centrifuge
This commit is contained in:
parent
94a0616d8e
commit
60c88884a7
4 changed files with 33 additions and 89 deletions
|
@ -82,7 +82,12 @@ public class GuiHandler implements IGuiHandler {
|
||||||
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17).outputSlot(1, 80, 53)
|
.tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 17).outputSlot(1, 80, 53)
|
||||||
.fakeSlot(2, 59, 42).addInventory().create();
|
.fakeSlot(2, 59, 42).addInventory().create();
|
||||||
} else if (ID == GuiHandler.centrifugeID) {
|
} else if (ID == GuiHandler.centrifugeID) {
|
||||||
container = new ContainerCentrifuge(player, (TileCentrifuge) world.getTileEntity(new BlockPos(x, y, z)));
|
return new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||||
|
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z))).slot(0, 80, 35)
|
||||||
|
.slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35).outputSlot(4, 80, 65)
|
||||||
|
.outputSlot(5, 50, 35).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.rollingMachineID) {
|
} else if (ID == GuiHandler.rollingMachineID) {
|
||||||
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
|
return new ContainerRollingMachine((TileRollingMachine) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||||
} else if (ID == GuiHandler.blastFurnaceID) {
|
} else if (ID == GuiHandler.blastFurnaceID) {
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
package techreborn.client.container;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import reborncore.api.tile.IContainerLayout;
|
|
||||||
import reborncore.client.gui.slots.BaseSlot;
|
|
||||||
import reborncore.client.gui.slots.SlotOutput;
|
|
||||||
import techreborn.api.gui.SlotUpgrade;
|
|
||||||
import techreborn.tiles.TileCentrifuge;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ContainerCentrifuge extends ContainerCrafting {
|
|
||||||
|
|
||||||
public int tickTime;
|
|
||||||
EntityPlayer player;
|
|
||||||
TileCentrifuge tile;
|
|
||||||
|
|
||||||
public ContainerCentrifuge(EntityPlayer player, TileCentrifuge tile) {
|
|
||||||
super(tile.crafter);
|
|
||||||
this.player = player;
|
|
||||||
this.tile = tile;
|
|
||||||
addInventorySlots();
|
|
||||||
addPlayerSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void addInventorySlots() {
|
|
||||||
// input
|
|
||||||
this.addSlotToContainer(new BaseSlot(tile.inventory, 0, 80, 35));
|
|
||||||
this.addSlotToContainer(new BaseSlot(tile.inventory, 1, 50, 5));
|
|
||||||
// outputs
|
|
||||||
this.addSlotToContainer(new SlotOutput(tile.inventory, 2, 80, 5));
|
|
||||||
this.addSlotToContainer(new SlotOutput(tile.inventory, 3, 110, 35));
|
|
||||||
this.addSlotToContainer(new SlotOutput(tile.inventory, 4, 80, 65));
|
|
||||||
this.addSlotToContainer(new SlotOutput(tile.inventory, 5, 50, 35));
|
|
||||||
// battery
|
|
||||||
this.addSlotToContainer(new BaseSlot(tile.inventory, 6, 8, 51));
|
|
||||||
// upgrades
|
|
||||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 7, 152, 8));
|
|
||||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 8, 152, 26));
|
|
||||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 9, 152, 44));
|
|
||||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 10, 152, 62));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void addPlayerSlots() {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,42 +5,46 @@ 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 reborncore.common.container.RebornContainer;
|
|
||||||
import techreborn.client.container.ContainerCentrifuge;
|
import techreborn.client.container.builder.ContainerBuilder;
|
||||||
import techreborn.tiles.TileCentrifuge;
|
import techreborn.tiles.TileCentrifuge;
|
||||||
|
|
||||||
public class GuiCentrifuge extends GuiContainer {
|
public class GuiCentrifuge extends GuiContainer {
|
||||||
|
|
||||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||||
"textures/gui/industrial_centrifuge.png");
|
"textures/gui/industrial_centrifuge.png");
|
||||||
|
|
||||||
TileCentrifuge centrifuge;
|
TileCentrifuge centrifuge;
|
||||||
|
|
||||||
public GuiCentrifuge(EntityPlayer player, TileCentrifuge tileCentrifuge) {
|
public GuiCentrifuge(final EntityPlayer player, final TileCentrifuge tileCentrifuge) {
|
||||||
super(RebornContainer.createContainer(ContainerCentrifuge.class, tileCentrifuge, player));
|
super(new ContainerBuilder("centrifuge").player(player.inventory).inventory(8, 84).hotbar(8, 142).addInventory()
|
||||||
|
.tile(tileCentrifuge).slot(0, 80, 35).slot(1, 50, 5).outputSlot(2, 80, 5).outputSlot(3, 110, 35)
|
||||||
|
.outputSlot(4, 80, 65).outputSlot(5, 50, 35).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;
|
||||||
centrifuge = tileCentrifuge;
|
this.centrifuge = tileCentrifuge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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(GuiCentrifuge.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 = centrifuge.getProgressScaled(11);
|
j = this.centrifuge.getProgressScaled(11);
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
|
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
|
||||||
this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10);
|
this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10);
|
||||||
|
@ -48,20 +52,21 @@ public class GuiCentrifuge extends GuiContainer {
|
||||||
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
|
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = centrifuge.getEnergyScaled(12);
|
j = this.centrifuge.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 namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
|
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||||
String namePt2 = I18n.translateToLocal("tile.techreborn.centrifuge.name").replace(namePt1 + " ", "");
|
final String namePt1 = I18n.translateToLocal("tile.techreborn.industrialBlock.name");
|
||||||
|
final String namePt2 = I18n.translateToLocal("tile.techreborn.centrifuge.name").replace(namePt1 + " ", "");
|
||||||
this.fontRendererObj.drawString(namePt1, 98, 6, 4210752);
|
this.fontRendererObj.drawString(namePt1, 98, 6, 4210752);
|
||||||
this.fontRendererObj.drawString(namePt2, 98, 14, 4210752);
|
this.fontRendererObj.drawString(namePt2, 98, 14, 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);
|
||||||
this.fontRendererObj.drawString(centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
|
this.fontRendererObj.drawString(this.centrifuge.getProgressScaled(100) + "%", 98, this.ySize - 96 + 2, 4210752);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,8 +284,7 @@ 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(ContainerCentrifuge.class, RecipeCategoryUids.CENTRIFUGE, 0, 2, 11, 36);
|
|
||||||
recipeTransferRegistry
|
recipeTransferRegistry
|
||||||
.addRecipeTransferHandler(ContainerChemicalReactor.class, RecipeCategoryUids.CHEMICAL_REACTOR, 0, 2, 8,
|
.addRecipeTransferHandler(ContainerChemicalReactor.class, RecipeCategoryUids.CHEMICAL_REACTOR, 0, 2, 8,
|
||||||
36);
|
36);
|
||||||
|
@ -304,6 +303,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("centrifuge", RecipeCategoryUids.CENTRIFUGE, 36, 2, 0, 36));
|
||||||
recipeTransferRegistry.addRecipeTransferHandler(
|
recipeTransferRegistry.addRecipeTransferHandler(
|
||||||
new BuiltContainerTransferInfo("grinder", RecipeCategoryUids.GRINDER, 36, 1, 0, 36));
|
new BuiltContainerTransferInfo("grinder", RecipeCategoryUids.GRINDER, 36, 1, 0, 36));
|
||||||
recipeTransferRegistry.addRecipeTransferHandler(
|
recipeTransferRegistry.addRecipeTransferHandler(
|
||||||
|
|
Loading…
Reference in a new issue