mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 21:09:49 +00:00
Essentia gen rework (#6)
+Added GUI for Essentia Gens +Added Essentia Pipe Support for Essentia Gens +Added Tooltip for Essentia Gens +Added CFG for Essentia Gen EU Storage +Added Lucrum Gen with Infusion Recipe, Thaumonomicon Entry etc. +Updated ru_RU.lang (ty Cinobi) +Added WiP de_DE.lang +Removed unused .java +Added Essentia Storage for Essentia Gens +Rescaled Ticktime for Essentia Gens to 20Ticks(was 30Tick before) +Version number increase
This commit is contained in:
1 parent
a97a032210
commit
9a1a1bbf3f
27 files changed
+1071
-55
No files matched your search
@@ -0,0 +1,75 @@
|
||||
package emt.client.gui;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.client.gui.container.ConainerGenerator;
|
||||
import emt.tile.generator.TileEntityBaseGenerator;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiGenerator extends GuiContainer {
|
||||
|
||||
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/generator.png");
|
||||
|
||||
TileEntityBaseGenerator tileentity;
|
||||
private boolean allowUserInput;
|
||||
private int xSize;
|
||||
private int ySize;
|
||||
|
||||
public GuiGenerator(InventoryPlayer invPlayer, TileEntityBaseGenerator entity) {
|
||||
super(new ConainerGenerator(invPlayer, entity));
|
||||
this.tileentity = entity;
|
||||
this.allowUserInput = false;
|
||||
this.xSize = 194;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, nmPos, 7, 6618118);
|
||||
|
||||
String storageString = I18n.format("emt.Storage", new Object[0]);
|
||||
String fuel=I18n.format("emt.Fuel", new Object[0]);
|
||||
if (this.tileentity.maxstorage<1000)
|
||||
this.fontRendererObj.drawString(storageString + this.tileentity.storage + "/" + this.tileentity.maxstorage +"EU", 36, 22, 0);
|
||||
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.storage/1000) + "/" + (this.tileentity.maxstorage/1000) +"kEU", 36, 22, 0);
|
||||
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.storage/1000000) + "/" + (this.tileentity.maxstorage/1000000) +"MEU", 36, 22, 0);
|
||||
else if (1000000000 <= this.tileentity.maxstorage)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.storage/1000000000) + "/" + (this.tileentity.maxstorage/1000000000) +"GEU", 36, 22, 0);
|
||||
if(this.tileentity.isActive)
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating/20/20)+" EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+"0 EU/t",36, 35, 0);
|
||||
this.fontRendererObj.drawString(fuel+": "+Integer.toString(this.tileentity.fuel),36,48,0);
|
||||
this.fontRendererObj.drawString(fuel+"/t: "+Integer.toString((this.tileentity.fuel*20*20)-this.tileentity.tick),36,63,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
|
||||
int h = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
|
||||
if (this.tileentity.storage > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
|
||||
if (this.tileentity.fuel > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeFuelScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 0, l, 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package emt.client.gui.container;
|
||||
|
||||
import emt.tile.generator.TileEntityBaseGenerator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ConainerGenerator
|
||||
extends Container
|
||||
{
|
||||
private TileEntityBaseGenerator tileentity;
|
||||
public int storage;
|
||||
public int fuel;
|
||||
public int generating;
|
||||
|
||||
public ConainerGenerator(InventoryPlayer inventoryplayer, TileEntityBaseGenerator tileentity)
|
||||
{
|
||||
this.storage = 0;
|
||||
this.fuel = 0;
|
||||
this.tileentity = tileentity;
|
||||
/* for (int j = 0; j < 4; j++) {
|
||||
addSlotToContainer(new Slot(this.tileentity, j, 17 + j * 18, 59));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int k = 0; k < 9; k++) {
|
||||
addSlotToContainer(new Slot(inventoryplayer, k + i * 9 + 9, 17 + k * 18, 86 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventoryplayer, j, 17 + j * 18, 144));
|
||||
}
|
||||
|
||||
addSlotToContainer(new Slot(this.tileentity, 5, 17 + 7 * 18, 59));*/
|
||||
}
|
||||
|
||||
public void addCraftingToCrafters(ICrafting icrafting)
|
||||
{
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (int) this.tileentity.generating);
|
||||
icrafting.sendProgressBarUpdate(this, 1, this.tileentity.storage);
|
||||
icrafting.sendProgressBarUpdate(this, 2, this.tileentity.fuel);
|
||||
}
|
||||
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
icrafting.sendProgressBarUpdate(this, 0, (int) this.tileentity.generating);
|
||||
icrafting.sendProgressBarUpdate(this, 1, this.tileentity.storage);
|
||||
icrafting.sendProgressBarUpdate(this, 2, this.tileentity.fuel);
|
||||
}
|
||||
|
||||
this.generating = (int) this.tileentity.generating;
|
||||
this.tileentity.storage = ((int)this.tileentity.energySource.getEnergyStored());
|
||||
}
|
||||
|
||||
public void updateProgressBar(int i, int j)
|
||||
{
|
||||
if (i == 0) {
|
||||
this.tileentity.generating = j;
|
||||
}
|
||||
if (i == 1) {
|
||||
if (j<this.tileentity.maxstorage)
|
||||
this.tileentity.storage = j;
|
||||
else
|
||||
this.tileentity.storage=this.tileentity.maxstorage;
|
||||
}
|
||||
if (i == 2) {
|
||||
this.tileentity.fuel=j;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
int slot = par2;
|
||||
ItemStack stack = null;
|
||||
|
||||
Slot slotObject = (Slot)this.inventorySlots.get(par2);
|
||||
if ((slotObject != null) && (slotObject.getHasStack()))
|
||||
{
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
if ((slot >= 0) && (slot <= 3))
|
||||
{
|
||||
if (!mergeItemStack(stackInSlot, 4, 40, true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if ((slot >= 4) && (slot < 31))
|
||||
{
|
||||
if (!mergeItemStack(stackInSlot, 0, 4, false)) {
|
||||
if (!mergeItemStack(stackInSlot, 31, 40, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((slot >= 31) && (slot < 39))
|
||||
{
|
||||
if (!mergeItemStack(stackInSlot, 0, 30, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!mergeItemStack(stackInSlot, 0, 30, false)) {
|
||||
return null;
|
||||
}
|
||||
if (stackInSlot.stackSize == 0) {
|
||||
slotObject.putStack(null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
if (stack.stackSize != stackInSlot.stackSize) {
|
||||
slotObject.onPickupFromSlot(par1EntityPlayer, stackInSlot);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user