This commit is contained in:
gigabit101 2016-03-23 23:31:40 +00:00
parent 1a580bb1d1
commit 710f9c04e7
8 changed files with 76 additions and 40 deletions

View file

@ -1,8 +1,10 @@
package techreborn.client.container; package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer; import reborncore.common.container.RebornContainer;
@ -13,6 +15,9 @@ public class ContainerAesu extends RebornContainer {
EntityPlayer player; EntityPlayer player;
TileAesu tile; TileAesu tile;
private static final EntityEquipmentSlot[] equipmentSlots = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
@Override @Override
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
@ -23,11 +28,18 @@ public class ContainerAesu extends RebornContainer {
public int storedEu; public int storedEu;
public int euChange; public int euChange;
public ContainerAesu(TileAesu tileaesu, public ContainerAesu(TileAesu tileaesu, EntityPlayer player) {
EntityPlayer player) {
tile = tileaesu; tile = tileaesu;
this.player = player; this.player = player;
// charge
this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 152, 42));
this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 152, 58));
this.addSlotToContainer(new Slot(tileaesu.inventory, 2, 152, 78));
//Battery
this.addSlotToContainer(new Slot(tileaesu.inventory, 3, 143, 5));
int i; int i;
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
@ -41,6 +53,21 @@ public class ContainerAesu extends RebornContainer {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
173)); 173));
} }
for (int k = 0; k < 4; k++)
{
final EntityEquipmentSlot slot = equipmentSlots[k];
addSlotToContainer(new Slot(player.inventory, player.inventory.getSizeInventory() - 2 - k, 134, 42 + k * 18)
{
@Override
public int getSlotStackLimit() { return 1; }
@Override
public boolean isItemValid(ItemStack stack)
{
return stack != null && stack.getItem().isValidArmor(stack, slot, player);
}
});
}
} }
@Override @Override
@ -79,5 +106,4 @@ public class ContainerAesu extends RebornContainer {
this.euChange = value; this.euChange = value;
} }
} }
} }

View file

@ -1,8 +1,10 @@
package techreborn.client.container; package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer; import reborncore.common.container.RebornContainer;
@ -14,6 +16,9 @@ public class ContainerLesu extends RebornContainer {
EntityPlayer player; EntityPlayer player;
TileLesu tile; TileLesu tile;
private static final EntityEquipmentSlot[] equipmentSlots = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
@Override @Override
public boolean canInteractWith(EntityPlayer player) { public boolean canInteractWith(EntityPlayer player) {
@ -26,28 +31,46 @@ public class ContainerLesu extends RebornContainer {
public int connectedBlocks; public int connectedBlocks;
public double euStorage; public double euStorage;
public ContainerLesu(TileLesu tileaesu, public ContainerLesu(TileLesu tileaesu, EntityPlayer player) {
EntityPlayer player) {
tile = tileaesu; tile = tileaesu;
this.player = player; this.player = player;
// input // charge
this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23)); this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 152, 42));
this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59)); this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 152, 58));
this.addSlotToContainer(new Slot(tileaesu.inventory, 2, 152, 78));
//Battery
this.addSlotToContainer(new Slot(tileaesu.inventory, 3, 143, 5));
int i; int i;
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) { for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 this.addSlotToContainer(new Slot(player.inventory, j + i * 9
+ 9, 8 + j * 18, 84 + i * 18)); + 9, 8 + j * 18, 115 + i * 18));
} }
} }
for (i = 0; i < 9; ++i) { for (i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142)); 173));
} }
for (int k = 0; k < 4; k++)
{
final EntityEquipmentSlot slot = equipmentSlots[k];
addSlotToContainer(new Slot(player.inventory, player.inventory.getSizeInventory() - 2 - k, 134, 42 + k * 18)
{
@Override
public int getSlotStackLimit() { return 1; }
@Override
public boolean isItemValid(ItemStack stack)
{
return stack != null && stack.getItem().isValidArmor(stack, slot, player);
}
});
}
} }
@Override @Override

View file

@ -17,15 +17,11 @@ import java.io.IOException;
public class GuiAesu extends GuiContainer { public class GuiAesu extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation( private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
"techreborn", "textures/gui/aesu.png");
TileAesu aesu; TileAesu aesu;
ContainerAesu containerAesu; ContainerAesu containerAesu;
public GuiAesu(EntityPlayer player, public GuiAesu(EntityPlayer player, TileAesu tileaesu) {
TileAesu tileaesu) {
super(new ContainerAesu(tileaesu, player)); super(new ContainerAesu(tileaesu, player));
this.xSize = 176; this.xSize = 176;
this.ySize = 197; this.ySize = 197;
@ -39,15 +35,14 @@ public class GuiAesu extends GuiContainer {
this.buttonList.clear(); this.buttonList.clear();
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 128, l + 5, 15, 15, "++")); this.buttonList.add(new GuiButton(0, k + 117, l + 20, 15, 15, "++"));
this.buttonList.add(new GuiButton(1, k + 128, l + 5 + 20, 15, 15, "+")); this.buttonList.add(new GuiButton(1, k + 117, l + 20 + 20, 15, 15, "+"));
this.buttonList.add(new GuiButton(2, k + 128, l + 5 + (20 * 2), 15, 15, "-")); this.buttonList.add(new GuiButton(2, k + 117, l + 20 + (20 * 2), 15, 15, "-"));
this.buttonList.add(new GuiButton(3, k + 128, l + 5 + (20 * 3), 15, 15, "--")); this.buttonList.add(new GuiButton(3, k + 117, l + 20 + (20 * 3), 15, 15, "--"));
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
int p_146976_2_, 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(texture);
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
@ -55,8 +50,7 @@ public class GuiAesu extends GuiContainer {
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
int p_146979_2_) {
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10, Color.WHITE.getRGB()); this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.aesu.name"), 40, 10, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euOut) + " /tick", 10, 20, Color.WHITE.getRGB()); this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.euOut) + " /tick", 10, 20, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.storedEu) + " ", 10, 30, Color.WHITE.getRGB()); this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerAesu.storedEu) + " ", 10, 30, Color.WHITE.getRGB());

View file

@ -35,7 +35,7 @@ public class GuiGrinder extends GuiContainer {
j = grinder.getProgressScaled(24); j = grinder.getProgressScaled(24);
if (j > 0) { if (j > 0) {
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16); this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
} }
j = grinder.getEnergyScaled(12); j = grinder.getEnergyScaled(12);

View file

@ -13,25 +13,20 @@ import java.awt.*;
public class GuiLesu extends GuiContainer { public class GuiLesu extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation( private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
"techreborn", "textures/gui/aesu.png");
TileLesu aesu; TileLesu aesu;
ContainerLesu containerLesu; ContainerLesu containerLesu;
public GuiLesu(EntityPlayer player, public GuiLesu(EntityPlayer player, TileLesu tileaesu) {
TileLesu tileaesu) {
super(new ContainerLesu(tileaesu, player)); super(new ContainerLesu(tileaesu, player));
this.xSize = 176; this.xSize = 176;
this.ySize = 165; this.ySize = 197;
aesu = tileaesu; aesu = tileaesu;
this.containerLesu = (ContainerLesu) this.inventorySlots; this.containerLesu = (ContainerLesu) this.inventorySlots;
} }
@Override @Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
int p_146976_2_, 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(texture);
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
@ -39,8 +34,7 @@ public class GuiLesu extends GuiContainer {
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
int p_146979_2_) {
this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10, Color.WHITE.getRGB()); this.fontRendererObj.drawString(I18n.translateToLocal("tile.techreborn.lesu.name"), 40, 10, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euOut) + "/t", 10, 20, Color.WHITE.getRGB()); this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euOut) + "/t", 10, 20, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.storedEu), 10, 30, Color.WHITE.getRGB()); this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.storedEu), 10, 30, Color.WHITE.getRGB());
@ -48,5 +42,4 @@ public class GuiLesu extends GuiContainer {
this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB()); this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB());
this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euStorage) + " max", 10, 60, Color.WHITE.getRGB()); this.fontRendererObj.drawString(PowerSystem.getLocaliszedPower(containerLesu.euStorage) + " max", 10, 60, Color.WHITE.getRGB());
} }
} }

View file

@ -15,7 +15,7 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
public static final int MAX_OUTPUT = ConfigTechReborn.aesuMaxOutput; public static final int MAX_OUTPUT = ConfigTechReborn.aesuMaxOutput;
public static final int MAX_STORAGE = ConfigTechReborn.aesuMaxStorage; public static final int MAX_STORAGE = ConfigTechReborn.aesuMaxStorage;
public Inventory inventory = new Inventory(2, "TileAesu", 64, this); public Inventory inventory = new Inventory(4, "TileAesu", 64, this);
private int OUTPUT = 64; //The current output private int OUTPUT = 64; //The current output
private double euLastTick = 0; private double euLastTick = 0;
private double euChange; private double euChange;

View file

@ -211,7 +211,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
@Override @Override
public double getMaxPower() { public double getMaxPower() {
return 10000; return 1000;
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public class TileLesu extends TilePowerAcceptor {//TODO wrench
private int output; private int output;
private int maxStorage; private int maxStorage;
public Inventory inventory = new Inventory(2, "TileAesu", 64, this); public Inventory inventory = new Inventory(4, "TileAesu", 64, this);
public TileLesu() { public TileLesu() {
super(5); super(5);