mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-18 19:29:29 +00:00
fixed weird behavior of GUIs due to short Overflows
fixed Aqua Infused Gen not working underwater did some changes to the reflected gens, still don't work.
This commit is contained in:
1 parent
d229201b90
commit
63f04556e2
13 files changed
+119
-202
No files matched your search
@@ -17,23 +17,35 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockReflectedGen
|
||||
extends BlockBaseContainer
|
||||
{
|
||||
private int subtypes;
|
||||
private static int overalltypes = TileEntityReflexionGen.L.size();
|
||||
public static short Set;
|
||||
private int[] posInList;
|
||||
|
||||
public BlockReflectedGen(String name, short Set)
|
||||
{
|
||||
super(name, Material.iron, soundTypeMetal, 16, 4.0F);
|
||||
this.Set = Set;
|
||||
if (Set * 16 < TileEntityReflexionGen.L.size()) {
|
||||
this.subtypes = 16;
|
||||
} else {
|
||||
this.subtypes = (-(TileEntityReflexionGen.L.size() - Set * 16));
|
||||
this.subtypes = 16;
|
||||
|
||||
if ((Set*16) > overalltypes)
|
||||
subtypes= ((Set-1)*16)+overalltypes-((Set-1)*16);
|
||||
|
||||
posInList= new int[subtypes];
|
||||
if ((Set*16) < overalltypes)
|
||||
for (int i=0; i<subtypes;++i) {
|
||||
posInList[i]=(Set*16)+i;
|
||||
}
|
||||
else if ((Set*16) > overalltypes)
|
||||
for (int i=0; i<subtypes;++i) {
|
||||
posInList[i]=((Set-1)*16)+overalltypes-((Set-1)*16)+i;
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -62,10 +74,7 @@ public class BlockReflectedGen
|
||||
|
||||
public TileEntity createTileEntity(World world, int meta)
|
||||
{
|
||||
if (meta + Set * 16 < TileEntityReflexionGen.L.size()) {
|
||||
return TileEntityReflexionGen.Gens[(meta + 16 * Set)];
|
||||
}
|
||||
return TileEntityReflexionGen.Gens[(meta + 16 * (Set - 1))];
|
||||
return TileEntityReflexionGen.Gens[posInList[meta]];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -37,11 +37,11 @@ public class GuiGenerator extends GuiContainer {
|
||||
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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage) + "/" + (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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage/1000) + "/" + (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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage/1000000) + "/" + (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
|
||||
|
||||
@@ -77,12 +77,12 @@ public class GuiSolar extends GuiContainer {
|
||||
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)
|
||||
if (this.tileentity.mp_storage > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
if (this.tileentity.generating>0)
|
||||
if (this.tileentity.generating>9)
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 20, 11, 14);
|
||||
}
|
||||
|
||||
@@ -91,19 +91,22 @@ public class GuiSolar extends GuiContainer {
|
||||
{
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
|
||||
if(!color.equals("Terra"))
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, 6618118);
|
||||
else
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, cColor);
|
||||
|
||||
String storageString = I18n.format("emt.Storage", 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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage) + "/" + (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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage/1000) + "/" + (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);
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage/1000000) + "/" + (this.tileentity.maxstorage/1000000000) +"GEU", 36, 22, 0);
|
||||
if(this.tileentity.isActive)
|
||||
if (Double.toString(this.tileentity.generating).length()>5)
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating).substring(0, 4)+" EU/t", 36, 35, 0);
|
||||
|
||||
@@ -12,37 +12,19 @@ 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);
|
||||
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating/400));
|
||||
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
|
||||
icrafting.sendProgressBarUpdate(this, 2, (short) this.tileentity.mpshownstroage);
|
||||
}
|
||||
|
||||
public void detectAndSendChanges()
|
||||
@@ -52,81 +34,35 @@ public class ConainerGenerator
|
||||
{
|
||||
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);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating/400));
|
||||
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
|
||||
icrafting.sendProgressBarUpdate(this, 2, (short) (this.tileentity.storage/1000));
|
||||
}
|
||||
|
||||
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;
|
||||
this.tileentity.generating = (((int)j)*400);
|
||||
}
|
||||
if (i == 1) {
|
||||
if (j<this.tileentity.maxstorage)
|
||||
this.tileentity.storage = j;
|
||||
else
|
||||
this.tileentity.storage=this.tileentity.maxstorage;
|
||||
this.tileentity.fuel=((byte) j);
|
||||
}
|
||||
if (i == 2) {
|
||||
this.tileentity.fuel=j;
|
||||
this.tileentity.mpshownstroage=(short) 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;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -5,121 +5,68 @@ 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.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerSolars
|
||||
extends Container
|
||||
{
|
||||
private TileEntitySolarBase tileentity;
|
||||
public int storage;
|
||||
|
||||
public ContainerSolars(InventoryPlayer inventoryplayer, TileEntitySolarBase tileentity)
|
||||
{
|
||||
this.storage = 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);
|
||||
{
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) this.tileentity.generating);
|
||||
icrafting.sendProgressBarUpdate(this, 1, (short) this.tileentity.mp_storage);
|
||||
}
|
||||
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
float help = (float) (this.tileentity.generating*1000);
|
||||
super.detectAndSendChanges();
|
||||
short help = 0;
|
||||
if (this.tileentity.generating < 326D && this.tileentity.generating > 9D)
|
||||
help = (short) (this.tileentity.generating*100*-1);
|
||||
else
|
||||
help = (short) (this.tileentity.generating);
|
||||
|
||||
for (int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
icrafting.sendProgressBarUpdate(this, 0, (int) help);
|
||||
icrafting.sendProgressBarUpdate(this, 1, this.tileentity.storage);
|
||||
icrafting.sendProgressBarUpdate(this, 0, help);
|
||||
icrafting.sendProgressBarUpdate(this, 1, (short) (this.tileentity.energySource.getEnergyStored()/1000));
|
||||
}
|
||||
this.tileentity.storage = ((int)this.tileentity.energySource.getEnergyStored());
|
||||
}
|
||||
|
||||
public void updateProgressBar(int i, int j)
|
||||
{
|
||||
|
||||
if (i == 0) {
|
||||
float help = (float)j;
|
||||
this.tileentity.generating = help/1000;
|
||||
if (j < 0) {
|
||||
double help= j;
|
||||
help=help/100*-1;
|
||||
this.tileentity.generating = help;
|
||||
}
|
||||
else
|
||||
this.tileentity.generating=j;
|
||||
}
|
||||
if (i == 1) {
|
||||
if (j<this.tileentity.maxstorage)
|
||||
this.tileentity.storage = j;
|
||||
else
|
||||
this.tileentity.storage=(int) this.tileentity.maxstorage;
|
||||
this.tileentity.mp_storage = (short) (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;
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package emt.init;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import emt.block.BlockReflectedGen;
|
||||
import emt.tile.generator.TileEntityBaseGenerator;
|
||||
import emt.tile.generator.TileEntityReflexionGen;
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,12 +20,12 @@ public class EMTAutogeneratedGens
|
||||
sets = (short)(sets + 1);
|
||||
}
|
||||
BRG = new BlockReflectedGen[sets];
|
||||
for (short i = 0; i < sets; i = (short)(i + 1)) {
|
||||
BRG[i] = new BlockReflectedGen("EGenerator", i);
|
||||
}
|
||||
for (int i = 0; i < TileEntityReflexionGen.L.size(); i++) {
|
||||
GameRegistry.registerTileEntity(TileEntityReflexionGen.GensS[i], "tileentity" + TileEntityReflexionGen.L.get(i));
|
||||
for (short i = 0; i < sets; ++i) {
|
||||
BRG[i] = new BlockReflectedGen("EGenerator.Set." + Short.toString(i), i);
|
||||
}
|
||||
// for (int i = 0; i < TileEntityReflexionGen.L.size(); i++) {
|
||||
GameRegistry.registerTileEntity(TileEntityBaseGenerator.class, "TileEntityBaseGenerator");// + TileEntityReflexionGen.L.get(i));
|
||||
//}
|
||||
for (short i = 0; i < sets; i = (short)(i + 1)) {
|
||||
GameRegistry.registerBlock(BRG[i], "EGenerator.Set." + Short.toString(i));
|
||||
}
|
||||
|
||||
@@ -44,13 +44,15 @@ public class TileEntityBaseGenerator
|
||||
public boolean isActive = false;
|
||||
public int tier;
|
||||
public int storage;
|
||||
public short mpshownstroage;
|
||||
public int maxstorage;
|
||||
public int maxfuel;
|
||||
public int fuel;
|
||||
public int refuel;
|
||||
public byte maxfuel;
|
||||
public byte fuel;
|
||||
public byte refuel;
|
||||
public long timer = 0L;
|
||||
public boolean dead = true;
|
||||
public byte color;
|
||||
private boolean side;
|
||||
|
||||
public TileEntityBaseGenerator(Aspect aspect)
|
||||
{
|
||||
@@ -68,8 +70,12 @@ public class TileEntityBaseGenerator
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
|
||||
this.side = !this.worldObj.isRemote ? FMLCommonHandler.instance().getEffectiveSide().isServer() : FMLCommonHandler.instance().getSide().isServer();
|
||||
this.dead = false;
|
||||
this.timer =+ 1L;
|
||||
this.timer += 1L;
|
||||
if (this.timer <= Long.MAX_VALUE-1)
|
||||
this.timer = 0L;
|
||||
storeFuel();
|
||||
fillfrompipe();
|
||||
createEnergy();
|
||||
@@ -133,7 +139,7 @@ public class TileEntityBaseGenerator
|
||||
if (this.storage + this.generating / 20.0D / 20.0D < this.maxstorage)
|
||||
{
|
||||
this.isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer())
|
||||
if (side)
|
||||
{
|
||||
this.energySource.addEnergy(this.generating / 20.0D / 20.0D);
|
||||
this.storage = ((int)this.energySource.getEnergyStored());
|
||||
@@ -152,7 +158,7 @@ public class TileEntityBaseGenerator
|
||||
else if ((this.storage + this.generating / 20.0D / 20.0D > this.maxstorage) && (this.storage != this.maxstorage))
|
||||
{
|
||||
this.isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer())
|
||||
if (side)
|
||||
{
|
||||
this.energySource.setEnergyStored(this.maxstorage);
|
||||
this.storage = this.maxstorage;
|
||||
@@ -189,8 +195,8 @@ public class TileEntityBaseGenerator
|
||||
if (tag.getInteger("storage") > this.storage) {
|
||||
this.storage = tag.getInteger("storage");
|
||||
}
|
||||
if (tag.getInteger("fuel") > this.fuel) {
|
||||
this.fuel = tag.getInteger("fuel");
|
||||
if (tag.getByte("fuel") > this.fuel) {
|
||||
this.fuel = tag.getByte("fuel");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +251,7 @@ public class TileEntityBaseGenerator
|
||||
|
||||
public int gaugeEnergyScaled(int i)
|
||||
{
|
||||
return this.storage * i / this.maxstorage;
|
||||
return this.mpshownstroage * 1000 * i / this.maxstorage;
|
||||
}
|
||||
|
||||
public int gaugeFuelScaled(int i)
|
||||
@@ -536,12 +542,12 @@ public class TileEntityBaseGenerator
|
||||
|
||||
public boolean isServerSide()
|
||||
{
|
||||
return FMLCommonHandler.instance().getEffectiveSide().isServer();
|
||||
return !worldObj.isRemote;
|
||||
}
|
||||
|
||||
public boolean isClientSide()
|
||||
{
|
||||
return FMLCommonHandler.instance().getEffectiveSide().isClient();
|
||||
return worldObj.isRemote;
|
||||
}
|
||||
|
||||
public int getRandomNumber(int aRange)
|
||||
|
||||
@@ -39,10 +39,12 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IInve
|
||||
public long timer = 0L;
|
||||
public boolean dead = true;
|
||||
public double generating;
|
||||
public short mp_storage=0;
|
||||
public byte color = (-1);
|
||||
public int storage;
|
||||
public long maxstorage=0;
|
||||
public boolean isActive=false;
|
||||
protected boolean side;
|
||||
|
||||
public TileEntitySolarBase() {
|
||||
this.tick = 10;
|
||||
@@ -51,6 +53,7 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IInve
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
this.side = !this.worldObj.isRemote ? FMLCommonHandler.instance().getEffectiveSide().isServer() : FMLCommonHandler.instance().getSide().isServer();
|
||||
this.dead = false;
|
||||
this.timer =+ 1L;
|
||||
inputintoGTnet();
|
||||
@@ -72,12 +75,15 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IInve
|
||||
public void createEnergy() {
|
||||
if (theSunIsVisible) {
|
||||
isActive=true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (side) {
|
||||
this.energySource.addEnergy(this.output*calc_multi());
|
||||
this.generating=output*calc_multi();
|
||||
}
|
||||
}
|
||||
else isActive=false;
|
||||
else {
|
||||
isActive=false;
|
||||
this.generating=0;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSunState() {
|
||||
@@ -148,7 +154,7 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IInve
|
||||
public void closeInventory() {}
|
||||
|
||||
public int gaugeEnergyScaled(int i){
|
||||
return (int) (this.storage * i / (int) this.maxstorage);
|
||||
return (int) (this.mp_storage*1000*i / (int) this.maxstorage);
|
||||
}
|
||||
|
||||
|
||||
@@ -363,12 +369,12 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IInve
|
||||
|
||||
public boolean isServerSide()
|
||||
{
|
||||
return FMLCommonHandler.instance().getEffectiveSide().isServer();
|
||||
return side;
|
||||
}
|
||||
|
||||
public boolean isClientSide()
|
||||
{
|
||||
return FMLCommonHandler.instance().getEffectiveSide().isClient();
|
||||
return side;
|
||||
}
|
||||
|
||||
public int getRandomNumber(int aRange)
|
||||
|
||||
@@ -21,11 +21,14 @@ public class TileEntityDarkSolar extends TileEntitySolarBase {
|
||||
public void createEnergy() {
|
||||
if ((this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) && (!this.worldObj.isRaining()) && (!this.worldObj.isThundering())) {
|
||||
isActive=true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (side) {
|
||||
this.generating=output*calc_multi();
|
||||
this.energySource.addEnergy(this.output*calc_multi());
|
||||
}
|
||||
} else isActive = false;
|
||||
}else {
|
||||
isActive = false;
|
||||
this.generating=0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,12 +24,15 @@ public class TileEntityFireSolar extends TileEntitySolarBase {
|
||||
boolean ignis = ((this.worldObj.provider.dimensionId == (-1)) || (theSunIsVisible));
|
||||
if(ignis) {
|
||||
this.isActive=true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (side) {
|
||||
this.generating=output*calc_multi();
|
||||
this.energySource.addEnergy(this.output*calc_multi());
|
||||
}
|
||||
}
|
||||
else this.isActive=false;
|
||||
else {
|
||||
isActive = false;
|
||||
this.generating=0;
|
||||
}
|
||||
/*if (!ignis && VisNetHandler.drainVis(worldObj, xCoord, yCoord, zCoord, Aspect.FIRE, 10)>=10) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
energySource.addEnergy(15F);
|
||||
|
||||
@@ -21,11 +21,14 @@ public class TileEntityOrderSolar extends TileEntitySolarBase {
|
||||
public void createEnergy() {
|
||||
if ((this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) && (!this.worldObj.isRaining()) && (!this.worldObj.isThundering())) {
|
||||
isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (side) {
|
||||
this.energySource.addEnergy(this.output*calc_multi());
|
||||
this.generating=output*calc_multi();
|
||||
}
|
||||
}else isActive = false;
|
||||
}else {
|
||||
isActive = false;
|
||||
this.generating=0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,9 +20,9 @@ public class TileEntityWaterSolar extends TileEntitySolarBase {
|
||||
|
||||
@Override
|
||||
public void createEnergy() {
|
||||
if (theSunIsVisible || (this.worldObj.isRaining() && this.worldObj.isDaytime()) || this.worldObj.isThundering()){
|
||||
if (theSunIsVisible || this.calc_multi()>1F && this.worldObj.isDaytime() || this.calc_multi() == 6F ){
|
||||
isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
if (super.side) {
|
||||
this.generating=output*calc_multi();
|
||||
energySource.addEnergy(output*calc_multi());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user