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;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
@ -14,6 +16,9 @@ public class ContainerAesu extends RebornContainer {
TileAesu tile;
private static final EntityEquipmentSlot[] equipmentSlots = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
@ -23,11 +28,18 @@ public class ContainerAesu extends RebornContainer {
public int storedEu;
public int euChange;
public ContainerAesu(TileAesu tileaesu,
EntityPlayer player) {
public ContainerAesu(TileAesu tileaesu, EntityPlayer player) {
tile = tileaesu;
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;
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,
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
@ -79,5 +106,4 @@ public class ContainerAesu extends RebornContainer {
this.euChange = value;
}
}
}

View file

@ -1,8 +1,10 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.container.RebornContainer;
@ -15,6 +17,9 @@ public class ContainerLesu extends RebornContainer {
TileLesu tile;
private static final EntityEquipmentSlot[] equipmentSlots = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
@ -26,27 +31,45 @@ public class ContainerLesu extends RebornContainer {
public int connectedBlocks;
public double euStorage;
public ContainerLesu(TileLesu tileaesu,
EntityPlayer player) {
public ContainerLesu(TileLesu tileaesu, EntityPlayer player) {
tile = tileaesu;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
// 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;
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
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) {
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);
}
});
}
}

View file

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

View file

@ -35,7 +35,7 @@ public class GuiGrinder extends GuiContainer {
j = grinder.getProgressScaled(24);
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);

View file

@ -13,25 +13,20 @@ import java.awt.*;
public class GuiLesu extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/aesu.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
TileLesu aesu;
ContainerLesu containerLesu;
public GuiLesu(EntityPlayer player,
TileLesu tileaesu) {
public GuiLesu(EntityPlayer player, TileLesu tileaesu) {
super(new ContainerLesu(tileaesu, player));
this.xSize = 176;
this.ySize = 165;
this.ySize = 197;
aesu = tileaesu;
this.containerLesu = (ContainerLesu) this.inventorySlots;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_) {
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;
@ -39,8 +34,7 @@ public class GuiLesu extends GuiContainer {
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
int p_146979_2_) {
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
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.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(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_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 double euLastTick = 0;
private double euChange;

View file

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

View file

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