Multiblock fixes (compressor, freezer, grinder), grinder recipes fixes, freezer JEI recipe show fix.
This commit is contained in:
parent
0011553cf7
commit
b42b5274b5
31 changed files with 1162 additions and 1175 deletions
|
@ -14,7 +14,7 @@ import techreborn.tiles.fusionReactor.TileEntityFusionController;
|
|||
import techreborn.tiles.generator.*;
|
||||
import techreborn.tiles.idsu.TileIDSU;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
import techreborn.tiles.multiblock.TileIndustrialSawmill;
|
||||
import techreborn.tiles.multiblock.*;
|
||||
import techreborn.tiles.storage.TileBatBox;
|
||||
import techreborn.tiles.storage.TileMFE;
|
||||
import techreborn.tiles.storage.TileMFSU;
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.IContainerListener;
|
||||
import reborncore.client.gui.BaseSlot;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.multiblock.TileBlastFurnace;
|
||||
|
||||
public class ContainerBlastFurnace extends ContainerCrafting
|
||||
{
|
||||
|
|
|
@ -16,7 +16,6 @@ public abstract class ContainerCrafting extends RebornContainer
|
|||
int currentNeededTicks = 0;
|
||||
int energy;
|
||||
|
||||
@Deprecated
|
||||
public ContainerCrafting(RecipeCrafter crafter)
|
||||
{
|
||||
this();
|
||||
|
|
|
@ -6,7 +6,7 @@ import reborncore.client.gui.BaseSlot;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileImplosionCompressor;
|
||||
import techreborn.tiles.multiblock.TileImplosionCompressor;
|
||||
|
||||
public class ContainerImplosionCompressor extends ContainerCrafting
|
||||
{
|
||||
|
|
|
@ -6,82 +6,44 @@ import reborncore.client.gui.BaseSlot;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
import techreborn.tiles.multiblock.TileIndustrialGrinder;
|
||||
|
||||
public class ContainerIndustrialGrinder extends ContainerCrafting
|
||||
{
|
||||
public class ContainerIndustrialGrinder extends ContainerCrafting {
|
||||
|
||||
public int connectionStatus;
|
||||
EntityPlayer player;
|
||||
TileIndustrialGrinder tile;
|
||||
EntityPlayer player;
|
||||
TileIndustrialGrinder tile;
|
||||
|
||||
public ContainerIndustrialGrinder(TileIndustrialGrinder tileGrinder, EntityPlayer player)
|
||||
{
|
||||
super(tileGrinder.crafter);
|
||||
tile = tileGrinder;
|
||||
this.player = player;
|
||||
public ContainerIndustrialGrinder(TileIndustrialGrinder tileGrinder, EntityPlayer player) {
|
||||
super(tileGrinder.crafter);
|
||||
tile = tileGrinder;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 0, 32, 26));
|
||||
this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 1, 32, 44));
|
||||
// input
|
||||
this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 0, 32, 26));
|
||||
this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 1, 32, 44));
|
||||
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 2, 77, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 3, 95, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 4, 113, 35));
|
||||
this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 5, 131, 35));
|
||||
|
||||
int i;
|
||||
for (int 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 < 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 (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer p_75145_1_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.listeners.size(); i++)
|
||||
{
|
||||
IContainerListener IContainerListener = this.listeners.get(i);
|
||||
if (this.connectionStatus != tile.connectionStatus)
|
||||
{
|
||||
IContainerListener.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IContainerListener crafting)
|
||||
{
|
||||
super.addListener(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 10, tile.connectionStatus);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value)
|
||||
{
|
||||
if (id == 10)
|
||||
{
|
||||
this.connectionStatus = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,78 +6,38 @@ import reborncore.client.gui.BaseSlot;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
import techreborn.tiles.multiblock.TileVacuumFreezer;
|
||||
|
||||
public class ContainerVacuumFreezer extends ContainerCrafting
|
||||
{
|
||||
public class ContainerVacuumFreezer extends ContainerCrafting {
|
||||
|
||||
public int tickTime;
|
||||
public int machineStatus;
|
||||
EntityPlayer player;
|
||||
TileVacuumFreezer tile;
|
||||
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter, EntityPlayer player)
|
||||
{
|
||||
super(tileAlloysmelter.crafter);
|
||||
tile = tileAlloysmelter;
|
||||
this.player = player;
|
||||
EntityPlayer player;
|
||||
TileVacuumFreezer tile;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new BaseSlot(tileAlloysmelter.inventory, 0, 56, 34));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
|
||||
public ContainerVacuumFreezer(TileVacuumFreezer tileAlloysmelter, EntityPlayer player) {
|
||||
super(tileAlloysmelter.crafter);
|
||||
tile = tileAlloysmelter;
|
||||
this.player = player;
|
||||
|
||||
int i;
|
||||
// input
|
||||
this.addSlotToContainer(new BaseSlot(tileAlloysmelter.inventory, 0, 56, 34));
|
||||
// outputs
|
||||
this.addSlotToContainer(new SlotOutput(tileAlloysmelter.inventory, 1, 116, 35));
|
||||
|
||||
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 (int 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));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new BaseSlot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.listeners.size(); i++)
|
||||
{
|
||||
IContainerListener IContainerListener = this.listeners.get(i);
|
||||
if (this.machineStatus != tile.multiBlockStatus)
|
||||
{
|
||||
IContainerListener.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(IContainerListener crafting)
|
||||
{
|
||||
super.addListener(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 3, tile.multiBlockStatus);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value)
|
||||
{
|
||||
super.updateProgressBar(id, value);
|
||||
if (id == 3)
|
||||
{
|
||||
machineStatus = value;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import reborncore.common.multiblock.CoordTriplet;
|
|||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.proxies.ClientProxy;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.multiblock.TileBlastFurnace;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
|
|
@ -6,72 +6,60 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import techreborn.client.container.ContainerImplosionCompressor;
|
||||
import techreborn.tiles.TileImplosionCompressor;
|
||||
import techreborn.tiles.multiblock.TileImplosionCompressor;
|
||||
|
||||
public class GuiImplosionCompressor extends GuiContainer
|
||||
{
|
||||
public class GuiImplosionCompressor extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/implosion_compressor.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/implosion_compressor.png");
|
||||
|
||||
TileImplosionCompressor compresser;
|
||||
ContainerImplosionCompressor containerImplosionCompressor;
|
||||
TileImplosionCompressor compresser;
|
||||
ContainerImplosionCompressor containerImplosionCompressor;
|
||||
|
||||
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser)
|
||||
{
|
||||
super(new ContainerImplosionCompressor(tilecompresser, player));
|
||||
containerImplosionCompressor = (ContainerImplosionCompressor) this.inventorySlots;
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
compresser = tilecompresser;
|
||||
}
|
||||
public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser) {
|
||||
super(new ContainerImplosionCompressor(tilecompresser, player));
|
||||
containerImplosionCompressor = (ContainerImplosionCompressor) this.inventorySlots;
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
compresser = tilecompresser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
super.initGui();
|
||||
}
|
||||
@Override
|
||||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
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_)
|
||||
{
|
||||
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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, 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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (containerImplosionCompressor.multIBlockState == 0)
|
||||
{
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||
l + 52 + 12 - 0, -1);
|
||||
}
|
||||
if (containerImplosionCompressor.multIBlockState == 0) {
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
j = compresser.getProgressScaled(24);
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 60, l + 37, 176, 14, j + 1, 16);
|
||||
}
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
int j = compresser.getProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 61, l + 37, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
j = (int)(compresser.getEnergy() * 12f / compresser.getMaxPower());
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
j = (int) (compresser.getEnergy() * 12f / compresser.getMaxPower());
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 14, 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.implosioncompressor.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.implosioncompressor.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,95 +2,95 @@ package techreborn.client.gui;
|
|||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import techreborn.client.container.ContainerIndustrialGrinder;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
import techreborn.tiles.multiblock.TileIndustrialGrinder;
|
||||
|
||||
public class GuiIndustrialGrinder extends GuiContainer
|
||||
{
|
||||
public class GuiIndustrialGrinder extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/industrial_grinder.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/industrial_grinder.png");
|
||||
|
||||
TileIndustrialGrinder grinder;
|
||||
ContainerIndustrialGrinder containerGrinder;
|
||||
TileIndustrialGrinder grinder;
|
||||
ContainerIndustrialGrinder containerGrinder;
|
||||
|
||||
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder)
|
||||
{
|
||||
super(new ContainerIndustrialGrinder(tilegrinder, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
grinder = tilegrinder;
|
||||
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
public GuiIndustrialGrinder(EntityPlayer player, TileIndustrialGrinder tilegrinder) {
|
||||
super(new ContainerIndustrialGrinder(tilegrinder, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
grinder = tilegrinder;
|
||||
containerGrinder = (ContainerIndustrialGrinder) this.inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
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_)
|
||||
{
|
||||
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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, 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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int j = 0;
|
||||
if (containerGrinder.connectionStatus == 0)
|
||||
{
|
||||
// GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - j, 114, 10);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||
l + 52 + 12 - j, -1);
|
||||
}
|
||||
j = grinder.getProgressScaled(24);
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
|
||||
}
|
||||
int progress = grinder.getProgressScaled(24);
|
||||
if (progress > 0) {
|
||||
this.drawTexturedModalRect(k + 50, l + 35, 176, 14, progress + 1, 16);
|
||||
}
|
||||
|
||||
j = (int)(grinder.getEnergy() * 12f / grinder.getMaxPower());
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
int energy = (int) (grinder.getEnergy() * 12f / grinder.getMaxPower());
|
||||
if (energy > 0) {
|
||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - energy, 176, 12 - energy, 14, energy + 2);
|
||||
}
|
||||
|
||||
if(!grinder.tank.isEmpty()) {
|
||||
drawFluid(grinder.tank.getFluid(), k + 11, l + 66, 12, 47, grinder.tank.getCapacity());
|
||||
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(k + 14, l + 24, 179, 88, 9, 37);
|
||||
}
|
||||
|
||||
// TODO 1.8 nope
|
||||
// if (grinder.tank.getFluidAmount() != 0) {
|
||||
// IIcon fluidIcon = grinder.tank.getFluid().getFluid().getIcon();
|
||||
// if (fluidIcon != null) {
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
|
||||
//
|
||||
// this.mc.renderEngine
|
||||
// .bindTexture(TextureMap.locationBlocksTexture);
|
||||
// int liquidHeight = grinder.tank.getFluidAmount() * 47
|
||||
// / grinder.tank.getCapacity();
|
||||
// GuiUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
|
||||
// - liquidHeight, 12.0D, liquidHeight, this.zLevel);
|
||||
//
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
//
|
||||
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (!grinder.getMutliBlock()) {
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
String name = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawFluid(FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
|
||||
mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
ResourceLocation still = fluid.getFluid().getStill(fluid);
|
||||
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(still.toString());
|
||||
|
||||
int drawHeight = (int) ((fluid.amount / (maxCapacity * 1F)) * height);
|
||||
int iconHeight = sprite.getIconHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
int iteration = 0;
|
||||
while(offsetHeight != 0) {
|
||||
int curHeight = offsetHeight < iconHeight ? offsetHeight : iconHeight;
|
||||
drawTexturedModalRect(x, y - offsetHeight, sprite, width, curHeight);
|
||||
offsetHeight -= curHeight;
|
||||
iteration++;
|
||||
if(iteration > 50) break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.industrialgrinder.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,123 +1,55 @@
|
|||
package techreborn.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
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.client.gui.GuiUtil;
|
||||
import reborncore.client.multiblock.MultiblockSet;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.multiblock.CoordTriplet;
|
||||
import techreborn.client.ClientMultiBlocks;
|
||||
import techreborn.client.container.ContainerVacuumFreezer;
|
||||
import techreborn.proxies.ClientProxy;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
import techreborn.tiles.multiblock.TileVacuumFreezer;
|
||||
|
||||
public class GuiVacuumFreezer extends GuiContainer
|
||||
{
|
||||
public class GuiVacuumFreezer extends GuiContainer {
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
||||
"textures/gui/vacuum_freezer.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/vacuum_freezer.png");
|
||||
|
||||
TileVacuumFreezer crafter;
|
||||
ContainerVacuumFreezer containerVacuumFreezer;
|
||||
TileVacuumFreezer crafter;
|
||||
|
||||
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter)
|
||||
{
|
||||
super(new ContainerVacuumFreezer(tilealloysmelter, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
crafter = tilealloysmelter;
|
||||
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
|
||||
}
|
||||
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer freezer) {
|
||||
super(new ContainerVacuumFreezer(freezer, player));
|
||||
this.xSize = 176;
|
||||
this.ySize = 167;
|
||||
crafter = freezer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
|
||||
buttonList.add(button);
|
||||
super.initGui();
|
||||
CoordTriplet coordinates = new CoordTriplet(crafter.getPos().getX(), crafter.getPos().getY() - 5,
|
||||
crafter.getPos().getZ());
|
||||
if (coordinates.equals(ClientProxy.multiblockRenderEvent.anchor))
|
||||
{
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
button.displayString = "B";
|
||||
} else
|
||||
{
|
||||
button.displayString = "A";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, 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.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
int j = crafter.getProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 80, l + 37, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
j = (int) (crafter.getEnergy() * 12f / crafter.getMaxPower());
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
|
||||
j = crafter.getProgressScaled(24);
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
|
||||
}
|
||||
if (!crafter.getMultiBlock()) {
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38, l + 52 + 12, -1);
|
||||
}
|
||||
|
||||
j = (int)(crafter.getEnergy() * 12f / crafter.getMaxPower());
|
||||
if (j > 0)
|
||||
{
|
||||
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (containerVacuumFreezer.machineStatus == 0)
|
||||
{
|
||||
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
||||
l + 52 + 12 - 0, -1);
|
||||
}
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) throws IOException
|
||||
{
|
||||
super.actionPerformed(button);
|
||||
if (button.id == 212)
|
||||
{
|
||||
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null)
|
||||
{
|
||||
{// This code here makes a basic multiblock and then sets to the
|
||||
// selected one.
|
||||
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(),
|
||||
crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorld());
|
||||
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(crafter.getPos().getX(),
|
||||
crafter.getPos().getY() - 5, crafter.getPos().getZ());
|
||||
}
|
||||
button.displayString = "A";
|
||||
} else
|
||||
{
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
button.displayString = "B";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
76
src/main/java/techreborn/client/gui/widget/GuiWidget.java
Normal file
76
src/main/java/techreborn/client/gui/widget/GuiWidget.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
package techreborn.client.gui.widget;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.util.text.translation.LanguageMap;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class GuiWidget<T extends Container> extends GuiContainer {
|
||||
|
||||
public static final LanguageMap translate = ObfuscationReflectionHelper.getPrivateValue(LanguageMap.class, null, 2);
|
||||
|
||||
private final ArrayList<Widget> widgets = new ArrayList<>();
|
||||
private final ResourceLocation background;
|
||||
|
||||
public GuiWidget(T inventorySlotsIn, ResourceLocation background, int xSize, int ySize) {
|
||||
super(inventorySlotsIn);
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
public T getContainer() {
|
||||
return (T) inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
widgets.clear();
|
||||
initWidgets();
|
||||
}
|
||||
|
||||
public void addWidget(Widget widget) {
|
||||
widgets.add(widget);
|
||||
}
|
||||
|
||||
public void removeWidget(Widget widget) {
|
||||
widgets.remove(widget);
|
||||
}
|
||||
|
||||
|
||||
public abstract void initWidgets();
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(background);
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
int x = (this.width - this.xSize) / 2;
|
||||
int y = (this.height - this.ySize) / 2;
|
||||
String name = translate.translateKey("tile.techreborn.industrialgrinder.name");
|
||||
|
||||
fontRendererObj.drawString(name, xSize / 2 - fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
fontRendererObj.drawString(translate.translateKey("container.inventory"), 8, ySize - 94, 4210752);
|
||||
|
||||
for(Widget widget : widgets)
|
||||
widget.drawWidget(this, x, y, mouseX, mouseY);
|
||||
}
|
||||
|
||||
public FontRenderer getFontRenderer() {
|
||||
return fontRendererObj;
|
||||
}
|
||||
|
||||
}
|
49
src/main/java/techreborn/client/gui/widget/Widget.java
Normal file
49
src/main/java/techreborn/client/gui/widget/Widget.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package techreborn.client.gui.widget;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import techreborn.client.gui.widget.tooltip.ToolTip;
|
||||
|
||||
public abstract class Widget {
|
||||
|
||||
private final int x, y;
|
||||
protected final int width, height;
|
||||
|
||||
private ToolTip toolTip;
|
||||
|
||||
public Widget(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public ToolTip getToolTip() {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
public void setToolTip(ToolTip toolTip) {
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
public final void drawWidget(GuiWidget gui, int cornerX, int cornerY, int mouseX, int mouseY) {
|
||||
int drawX = cornerX + x;
|
||||
int drawY = cornerY + y;
|
||||
if(toolTip != null && drawX > mouseX && drawY > mouseY &&
|
||||
drawX + width < mouseX && drawY + height < mouseY) {
|
||||
toolTip.draw(gui.getFontRenderer(), mouseX, mouseY);
|
||||
}
|
||||
draw(gui, drawX, drawY);
|
||||
}
|
||||
|
||||
protected abstract void draw(GuiScreen guiScreen, int x, int y);
|
||||
protected abstract void mouseClick(GuiWidget guiWidget, int mouseX, int mouseY);
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package techreborn.client.gui.widget.tooltip;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ToolTip {
|
||||
|
||||
protected ArrayList<ToolTipLine> lines = new ArrayList<>();
|
||||
|
||||
public ToolTip(String... textLines) {
|
||||
for(String text : textLines)
|
||||
lines.add(new ToolTipLine(text));
|
||||
}
|
||||
|
||||
public ToolTip(ToolTipLine... toolTipLines) {
|
||||
Collections.addAll(lines, toolTipLines);
|
||||
}
|
||||
|
||||
public ToolTip(int linesSize) {
|
||||
for(int i = 0; i < linesSize; i++)
|
||||
lines.add(new ToolTipLine());
|
||||
}
|
||||
|
||||
public void addLine(ToolTipLine toolTipLine) {
|
||||
lines.add(toolTipLine);
|
||||
}
|
||||
|
||||
public void removeLine(int index) {
|
||||
lines.remove(index);
|
||||
}
|
||||
|
||||
public ToolTipLine getLine(int index) {
|
||||
return lines.get(index);
|
||||
}
|
||||
|
||||
public ArrayList<ToolTipLine> getLines() {
|
||||
return lines;
|
||||
}
|
||||
|
||||
protected void refresh() {}
|
||||
|
||||
public void draw(FontRenderer font, int mouseX, int mouseY) {
|
||||
refresh();
|
||||
int maxLineLength = 0;
|
||||
int textX = mouseX + 3;
|
||||
int textY = mouseY + 3;
|
||||
for(ToolTipLine toolTipLine : lines) {
|
||||
toolTipLine.draw(font, textX, textY);
|
||||
textY += (font.FONT_HEIGHT + 3);
|
||||
int lineWidth = toolTipLine.getWidth(font);
|
||||
if(lineWidth > maxLineLength)
|
||||
maxLineLength = lineWidth;
|
||||
}
|
||||
GuiUtil.drawTooltipBox(mouseX, mouseY, maxLineLength, textY + 3);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package techreborn.client.gui.widget.tooltip;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class ToolTipLine {
|
||||
|
||||
private String line;
|
||||
private int color;
|
||||
private boolean shadowed;
|
||||
|
||||
public ToolTipLine(String line, int color, boolean shadowed) {
|
||||
this.line = line;
|
||||
this.color = color;
|
||||
this.shadowed = shadowed;
|
||||
}
|
||||
|
||||
public ToolTipLine(String line, int color) {
|
||||
this(line, color, false);
|
||||
}
|
||||
|
||||
public ToolTipLine(String line, boolean shadowed) {
|
||||
this(line, 0xFFFFFF, shadowed);
|
||||
}
|
||||
|
||||
public ToolTipLine(String line) {
|
||||
this(line, 0xFFFFFF, false);
|
||||
}
|
||||
|
||||
public ToolTipLine() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public String getLine() {
|
||||
return line;
|
||||
}
|
||||
|
||||
public void setLine(String line) {
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public boolean isShadowed() {
|
||||
return shadowed;
|
||||
}
|
||||
|
||||
public void setShadowed(boolean shadowed) {
|
||||
this.shadowed = shadowed;
|
||||
}
|
||||
|
||||
public int getWidth(FontRenderer fontRenderer) {
|
||||
return fontRenderer.getStringWidth(getLine());
|
||||
}
|
||||
|
||||
public void draw(FontRenderer fontRenderer, int x, int y) {
|
||||
fontRenderer.drawString(getLine(), x, y, color, isShadowed());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ToolTipLine that = (ToolTipLine) o;
|
||||
return color == that.color &&
|
||||
shadowed == that.shadowed &&
|
||||
line.equals(that.line);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = line.hashCode();
|
||||
result = 31 * result + color;
|
||||
result = 31 * result + (shadowed ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue