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:
bartimaeusnek committed 2018-07-21 20:23:27 +02:00
1 parent d229201b90
commit 63f04556e2
13 files changed
+119 -202

No files matched your search

@@ -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());
}