Convert AlloyFurnace and AlloySmelter
This commit is contained in:
parent
619ddb14b8
commit
8a0a133e02
9 changed files with 532 additions and 613 deletions
|
@ -5,39 +5,55 @@ 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.ContainerAlloyFurnace;
|
||||
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.tiles.TileAlloyFurnace;
|
||||
|
||||
public class GuiAlloyFurnace extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/alloy_furnace.png");
|
||||
"textures/gui/alloy_furnace.png");
|
||||
|
||||
TileAlloyFurnace alloyfurnace;
|
||||
|
||||
ContainerAlloyFurnace containerAlloyFurnace;
|
||||
|
||||
public GuiAlloyFurnace(EntityPlayer player, TileAlloyFurnace tileAlloyFurnace) {
|
||||
super(new ContainerAlloyFurnace(tileAlloyFurnace, player));
|
||||
public GuiAlloyFurnace(final EntityPlayer player, final TileAlloyFurnace tileAlloyFurnace) {
|
||||
super(new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(tileAlloyFurnace)
|
||||
.filterSlot(0, 47, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
|
||||
.filterSlot(1, 65, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
|
||||
.outputSlot(2, 116, 35).fuelSlot(3, 56, 53)
|
||||
.syncIntegerValue(tileAlloyFurnace::getBurnTime, tileAlloyFurnace::setBurnTime)
|
||||
.syncIntegerValue(tileAlloyFurnace::getCookTime, tileAlloyFurnace::setCookTime)
|
||||
.syncIntegerValue(tileAlloyFurnace::getCurrentItemBurnTime, tileAlloyFurnace::setCurrentItemBurnTime)
|
||||
.addInventory().create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.alloyfurnace = tileAlloyFurnace;
|
||||
this.containerAlloyFurnace = (ContainerAlloyFurnace) this.inventorySlots;
|
||||
}
|
||||
|
||||
@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(GuiAlloyFurnace.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);
|
||||
|
||||
if (this.alloyfurnace.isBurning()) {
|
||||
|
@ -48,12 +64,12 @@ public class GuiAlloyFurnace extends GuiContainer {
|
|||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.alloyfurnace.name");
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.alloyfurnace.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,57 +5,74 @@ 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 reborncore.common.container.RebornContainer;
|
||||
import techreborn.client.container.ContainerAlloySmelter;
|
||||
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.tiles.TileAlloySmelter;
|
||||
|
||||
public class GuiAlloySmelter extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/electric_alloy_furnace.png");
|
||||
"textures/gui/electric_alloy_furnace.png");
|
||||
|
||||
TileAlloySmelter alloysmelter;
|
||||
|
||||
public GuiAlloySmelter(EntityPlayer player, TileAlloySmelter tilealloysmelter) {
|
||||
super(RebornContainer.createContainer(ContainerAlloySmelter.class, tilealloysmelter, player));
|
||||
public GuiAlloySmelter(final EntityPlayer player, final TileAlloySmelter tilealloysmelter) {
|
||||
super(new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(tilealloysmelter)
|
||||
.filterSlot(0, 47, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(0), stack, true, true, true)))
|
||||
.filterSlot(1, 65, 17,
|
||||
stack -> RecipeHandler.recipeList.stream()
|
||||
.anyMatch(recipe -> recipe instanceof AlloySmelterRecipe
|
||||
&& ItemUtils.isItemEqual(recipe.getInputs().get(1), stack, true, true, true)))
|
||||
.outputSlot(2, 116, 35).energySlot(3, 56, 53).upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26)
|
||||
.upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
alloysmelter = tilealloysmelter;
|
||||
this.alloysmelter = tilealloysmelter;
|
||||
}
|
||||
|
||||
@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(GuiAlloySmelter.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 = alloysmelter.getProgressScaled(24);
|
||||
j = this.alloysmelter.getProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = alloysmelter.getEnergyScaled(12);
|
||||
j = this.alloysmelter.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 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.alloysmelter.name");
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = I18n.translateToLocal("tile.techreborn.alloysmelter.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,51 +12,51 @@ import techreborn.tiles.TileScrapboxinator;
|
|||
|
||||
public class GuiScrapboxinator extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/scrapboxinator.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/scrapboxinator.png");
|
||||
|
||||
TileScrapboxinator tile;
|
||||
TileScrapboxinator tile;
|
||||
|
||||
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
|
||||
super(new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(scrapboxinator)
|
||||
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
|
||||
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
|
||||
.syncEnergyValue().syncIntegerValue(scrapboxinator::getProgress, scrapboxinator::setProgress)
|
||||
.addInventory().create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = scrapboxinator;
|
||||
}
|
||||
public GuiScrapboxinator(final EntityPlayer player, final TileScrapboxinator scrapboxinator) {
|
||||
super(new ContainerBuilder("scrapboxinator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(scrapboxinator)
|
||||
.filterSlot(0, 56, 34, stack -> stack.getItem() == ModItems.SCRAP_BOX).outputSlot(1, 116, 34)
|
||||
.upgradeSlot(2, 152, 8).upgradeSlot(3, 152, 26).upgradeSlot(4, 152, 44).upgradeSlot(5, 152, 62)
|
||||
.syncEnergyValue().syncIntegerValue(scrapboxinator::getProgress, scrapboxinator::setProgress)
|
||||
.addInventory().create());
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
this.tile = scrapboxinator;
|
||||
}
|
||||
|
||||
@Override
|
||||
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(GuiScrapboxinator.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);
|
||||
@Override
|
||||
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(GuiScrapboxinator.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;
|
||||
int j = 0;
|
||||
|
||||
j = this.tile.gaugeProgressScaled(24);
|
||||
// System.out.println(compressor.gaugeProgressScaled(10));
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||
}
|
||||
j = this.tile.gaugeProgressScaled(24);
|
||||
// System.out.println(compressor.gaugeProgressScaled(10));
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = this.tile.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
j = this.tile.getEnergyScaled(12);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2,
|
||||
4210752);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(final int p_146979_1_, final int p_146979_2_) {
|
||||
final String name = net.minecraft.util.text.translation.I18n.translateToLocal("tile.techreborn.scrapboxinator.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2,
|
||||
4210752);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue