Convert AlloyFurnace and AlloySmelter
This commit is contained in:
parent
619ddb14b8
commit
8a0a133e02
9 changed files with 532 additions and 613 deletions
|
@ -6,9 +6,12 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.api.tile.IContainerLayout;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.client.container.*;
|
||||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
import techreborn.client.gui.*;
|
||||
|
@ -70,7 +73,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
@Override
|
||||
public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
|
||||
final int y, final int z) {
|
||||
RebornContainer container = null;
|
||||
final RebornContainer container = null;
|
||||
if (ID == GuiHandler.gasTurbineID || ID == GuiHandler.semifluidGeneratorID
|
||||
|| ID == GuiHandler.thermalGeneratorID || ID == GuiHandler.dieselGeneratorID) {
|
||||
return new ContainerBuilder("fluidgenerator").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
|
@ -94,8 +97,17 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == GuiHandler.blastFurnaceID) {
|
||||
return new ContainerBlastFurnace((TileBlastFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
} else if (ID == GuiHandler.alloySmelterID) {
|
||||
container = new ContainerAlloySmelter(player,
|
||||
(TileAlloySmelter) world.getTileEntity(new BlockPos(x, y, z)));
|
||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
|
||||
.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();
|
||||
} else if (ID == GuiHandler.industrialGrinderID) {
|
||||
return new ContainerIndustrialGrinder((TileIndustrialGrinder) world.getTileEntity(new BlockPos(x, y, z)),
|
||||
player);
|
||||
|
@ -120,7 +132,23 @@ public class GuiHandler implements IGuiHandler {
|
|||
} else if (ID == GuiHandler.aesuID) {
|
||||
return new ContainerAESU((TileAesu) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
} else if (ID == GuiHandler.alloyFurnaceID) {
|
||||
return new ContainerAlloyFurnace((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)), player);
|
||||
return new ContainerBuilder("alloyfurnace").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile((IInventory) world.getTileEntity(new BlockPos(x, y, z)))
|
||||
.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) world.getTileEntity(new BlockPos(x, y, z)))::getBurnTime,
|
||||
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setBurnTime)
|
||||
.syncIntegerValue(((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCookTime,
|
||||
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCookTime)
|
||||
.syncIntegerValue(
|
||||
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::getCurrentItemBurnTime,
|
||||
((TileAlloyFurnace) world.getTileEntity(new BlockPos(x, y, z)))::setCurrentItemBurnTime)
|
||||
.addInventory().create();
|
||||
} else if (ID == GuiHandler.sawMillID) {
|
||||
return new ContainerIndustrialSawmill((TileIndustrialSawmill) world.getTileEntity(new BlockPos(x, y, z)),
|
||||
player);
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.SlotFurnaceFuel;
|
||||
import reborncore.client.gui.slots.BaseSlot;
|
||||
import reborncore.client.gui.slots.SlotOutput;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.recipe.IBaseRecipeType;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.tiles.TileAlloyFurnace;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerAlloyFurnace extends RebornContainer {
|
||||
|
||||
public int tickTime;
|
||||
EntityPlayer player;
|
||||
TileAlloyFurnace tile;
|
||||
int currentItemBurnTime;
|
||||
int burnTime;
|
||||
int cookTime;
|
||||
|
||||
public ContainerAlloyFurnace(TileAlloyFurnace tileAlloyfurnace, EntityPlayer player) {
|
||||
tile = tileAlloyfurnace;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new SlotInputCustom(tileAlloyfurnace.inventory, 0, 47, 17, 0));
|
||||
this.addSlotToContainer(new SlotInputCustom(tileAlloyfurnace.inventory, 1, 65, 17, 1));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileAlloyfurnace.inventory, 2, 116, 35));
|
||||
// Fuel
|
||||
this.addSlotToContainer(new SlotFurnaceFuel(tileAlloyfurnace.inventory, 3, 56, 53));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotInputCustom extends BaseSlot {
|
||||
|
||||
int recipeSlot = 0;
|
||||
|
||||
public SlotInputCustom(IInventory inventoryIn, int index, int xPosition, int yPosition, int recipeSlot) {
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
this.recipeSlot = recipeSlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(
|
||||
@Nullable
|
||||
ItemStack stack) {
|
||||
for(IBaseRecipeType recipe : RecipeHandler.recipeList){
|
||||
if(recipe instanceof AlloySmelterRecipe){
|
||||
if(ItemUtils.isItemEqual(recipe.getInputs().get(recipeSlot), stack, true, true, true)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IContainerListener crafting) {
|
||||
super.addListener(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
|
||||
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
|
||||
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
for (int i = 0; i < this.listeners.size(); i++) {
|
||||
IContainerListener crafting = this.listeners.get(i);
|
||||
if (this.currentItemBurnTime != tile.currentItemBurnTime) {
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.currentItemBurnTime);
|
||||
}
|
||||
if (this.burnTime != tile.burnTime) {
|
||||
crafting.sendProgressBarUpdate(this, 1, tile.burnTime);
|
||||
}
|
||||
if (this.cookTime != tile.cookTime) {
|
||||
crafting.sendProgressBarUpdate(this, 2, tile.cookTime);
|
||||
}
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
super.updateProgressBar(id, value);
|
||||
if (id == 0) {
|
||||
this.currentItemBurnTime = value;
|
||||
} else if (id == 1) {
|
||||
this.burnTime = value;
|
||||
} else if (id == 2) {
|
||||
this.cookTime = value;
|
||||
}
|
||||
this.tile.currentItemBurnTime = this.currentItemBurnTime;
|
||||
this.tile.burnTime = this.burnTime;
|
||||
this.tile.cookTime = this.cookTime;
|
||||
}
|
||||
}
|
|
@ -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.SlotCharge;
|
||||
import reborncore.client.gui.slots.SlotInput;
|
||||
import reborncore.client.gui.slots.SlotOutput;
|
||||
import techreborn.api.gui.SlotUpgrade;
|
||||
import techreborn.tiles.TileAlloySmelter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerAlloySmelter extends ContainerCrafting {
|
||||
|
||||
public int tickTime;
|
||||
EntityPlayer player;
|
||||
TileAlloySmelter tile;
|
||||
|
||||
public ContainerAlloySmelter(EntityPlayer player, TileAlloySmelter tile) {
|
||||
super(tile.crafter);
|
||||
this.player = player;
|
||||
this.tile = tile;
|
||||
addPlayerSlots();
|
||||
addInventorySlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void addInventorySlots() {
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new ContainerAlloyFurnace.SlotInputCustom(tile.inventory, 0, 47, 17, 0));
|
||||
this.addSlotToContainer(new ContainerAlloyFurnace.SlotInputCustom(tile.inventory, 1, 65, 17, 1));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tile.inventory, 2, 116, 35));
|
||||
// battery
|
||||
this.addSlotToContainer(new SlotCharge(tile.inventory, 3, 56, 53));
|
||||
// upgrades
|
||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 4, 152, 8));
|
||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 5, 152, 26));
|
||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 6, 152, 44));
|
||||
this.addSlotToContainer(new SlotUpgrade(tile.inventory, 7, 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,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