Hopefully fixed crash

This commit is contained in:
Aidan C. Brady 2013-11-22 12:09:04 -05:00
parent df70da8bd0
commit dc925798b0
3 changed files with 248 additions and 250 deletions

View file

@ -31,7 +31,7 @@ public class IC2ItemManager implements IElectricItemManager
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) + energyToStore); energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) + energyToStore);
} }
return (int)(energyToStore*Mekanism.TO_IC2); return (int)Math.round(energyToStore*Mekanism.TO_IC2);
} }
return 0; return 0;
@ -50,7 +50,7 @@ public class IC2ItemManager implements IElectricItemManager
energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) - energyToGive); energizedItem.setEnergy(itemStack, energizedItem.getEnergy(itemStack) - energyToGive);
} }
return (int)(energyToGive*Mekanism.TO_IC2); return (int)Math.round(energyToGive*Mekanism.TO_IC2);
} }
return 0; return 0;
@ -65,7 +65,7 @@ public class IC2ItemManager implements IElectricItemManager
@Override @Override
public int getCharge(ItemStack itemStack) public int getCharge(ItemStack itemStack)
{ {
return 0; return (int)Math.round(energizedItem.getEnergy(itemStack)*Mekanism.TO_IC2);
} }
@Override @Override

View file

@ -92,7 +92,7 @@ public final class TransporterUtils
//Immature BuildCraft inv check //Immature BuildCraft inv check
if(MekanismUtils.useBuildcraft() && inventory instanceof IPowerReceptor) if(MekanismUtils.useBuildcraft() && inventory instanceof IPowerReceptor)
{ {
if(((IPowerReceptor)inventory).getPowerReceiver(forgeSide).getType() == Type.MACHINE) if(((IPowerReceptor)inventory).getPowerReceiver(forgeSide) != null && ((IPowerReceptor)inventory).getPowerReceiver(forgeSide).getType() == Type.MACHINE)
{ {
connectable[side] = true; connectable[side] = true;
continue; continue;

View file

@ -31,8 +31,6 @@ import universalelectricity.core.vector.Vector3;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.PacketDispatcher;
/** /**
* The Tesla TileEntity. * The Tesla TileEntity.
* *
@ -87,47 +85,47 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
{ {
super.updateEntity(); super.updateEntity();
boolean doPacketUpdate = this.getEnergyStored() > 0; boolean doPacketUpdate = getEnergyStored() > 0;
/** /**
* Only transfer if it is the bottom controlling Tesla tower. * Only transfer if it is the bottom controlling Tesla tower.
*/ */
if (this.isController()) if(isController())
{ {
this.produce(); produce();
if (this.ticks % (5 + this.worldObj.rand.nextInt(2)) == 0 && ((this.worldObj.isRemote && this.doTransfer) || (this.getEnergyStored() > 0 && !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)))) if(ticks % (5 + worldObj.rand.nextInt(2)) == 0 && ((worldObj.isRemote && doTransfer) || (getEnergyStored() > 0 && !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord))))
{ {
final TileEntityTesla topTesla = this.getTopTelsa(); final TileEntityTesla topTesla = getTopTelsa();
final Vector3 topTeslaVector = new Vector3(topTesla); final Vector3 topTeslaVector = new Vector3(topTesla);
/** /**
* Quantum transportation. * Quantum transportation.
*/ */
if (this.linked != null || this.isLinkedClient) if(linked != null || isLinkedClient)
{ {
if (!this.worldObj.isRemote) if(!worldObj.isRemote)
{ {
World dimWorld = MinecraftServer.getServer().worldServerForDimension(this.linkDim); World dimWorld = MinecraftServer.getServer().worldServerForDimension(linkDim);
if(dimWorld != null) if(dimWorld != null)
{ {
TileEntity transferTile = this.linked.getTileEntity(dimWorld); TileEntity transferTile = linked.getTileEntity(dimWorld);
if(transferTile instanceof TileEntityTesla && !transferTile.isInvalid()) if(transferTile instanceof TileEntityTesla && !transferTile.isInvalid())
{ {
this.transfer(((TileEntityTesla) transferTile), Math.min(this.getProvide(ForgeDirection.UNKNOWN), TRANSFER_CAP)); transfer(((TileEntityTesla)transferTile), Math.min(getProvide(ForgeDirection.UNKNOWN), TRANSFER_CAP));
if (this.zapCounter % 5 == 0 && MekanismInduction.SOUND_FXS) if(zapCounter % 5 == 0 && MekanismInduction.SOUND_FXS)
{ {
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, MekanismInduction.PREFIX + "electricshock", this.getEnergyStored() / 25, 1.3f - 0.5f * (this.dyeID / 16f)); worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, MekanismInduction.PREFIX + "electricshock", getEnergyStored() / 25, 1.3f - 0.5f * (dyeID / 16f));
} }
} }
} }
} }
else else
{ {
MekanismInduction.proxy.renderElectricShock(this.worldObj, topTeslaVector.clone().translate(0.5), topTeslaVector.clone().translate(new Vector3(0.5, Double.POSITIVE_INFINITY, 0.5)), false); MekanismInduction.proxy.renderElectricShock(worldObj, topTeslaVector.clone().translate(0.5), topTeslaVector.clone().translate(new Vector3(0.5, Double.POSITIVE_INFINITY, 0.5)), false);
} }
} }
else else
@ -137,12 +135,12 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
for(ITesla tesla : TeslaGrid.instance().get()) for(ITesla tesla : TeslaGrid.instance().get())
{ {
if (new Vector3((TileEntity) tesla).distance(new Vector3(this)) < this.getRange()) if(new Vector3((TileEntity)tesla).distance(new Vector3(this)) < getRange())
{ {
/** /**
* Make sure Tesla is not part of this tower. * Make sure Tesla is not part of this tower.
*/ */
if (!this.connectedTeslas.contains(tesla) && tesla.canReceive(this)) if(!connectedTeslas.contains(tesla) && tesla.canReceive(this))
{ {
if(tesla instanceof TileEntityTesla) if(tesla instanceof TileEntityTesla)
{ {
@ -189,14 +187,14 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
if(transferTeslaCoils.size() > 0) if(transferTeslaCoils.size() > 0)
{ {
float transferEnergy = this.getEnergyStored() / transferTeslaCoils.size(); float transferEnergy = getEnergyStored() / transferTeslaCoils.size();
int count = 0; int count = 0;
boolean sentPacket = false; boolean sentPacket = false;
for(ITesla tesla : transferTeslaCoils) for(ITesla tesla : transferTeslaCoils)
{ {
if (this.zapCounter % 5 == 0 && MekanismInduction.SOUND_FXS) if(zapCounter % 5 == 0 && MekanismInduction.SOUND_FXS)
{ {
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, MekanismInduction.PREFIX + "electricshock", this.getEnergyStored() / 25, 1.3f - 0.5f * (this.dyeID / 16f)); worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, MekanismInduction.PREFIX + "electricshock", getEnergyStored() / 25, 1.3f - 0.5f * (dyeID / 16f));
} }
Vector3 targetVector = new Vector3((TileEntity)tesla); Vector3 targetVector = new Vector3((TileEntity)tesla);
@ -208,26 +206,26 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
} }
double distance = topTeslaVector.distance(targetVector); double distance = topTeslaVector.distance(targetVector);
MekanismInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), (float) MekanismInduction.DYE_COLORS[this.dyeID].x, (float) MekanismInduction.DYE_COLORS[this.dyeID].y, MekanismInduction.proxy.renderElectricShock(worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), (float)MekanismInduction.DYE_COLORS[dyeID].x, (float)MekanismInduction.DYE_COLORS[dyeID].y,
(float) MekanismInduction.DYE_COLORS[this.dyeID].z); (float)MekanismInduction.DYE_COLORS[dyeID].z);
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP)); transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));
if(!sentPacket && transferEnergy > 0) if(!sentPacket && transferEnergy > 0)
{ {
this.sendPacket(3); sendPacket(3);
} }
if (this.attackEntities && this.zapCounter % 5 == 0) if(attackEntities && zapCounter % 5 == 0)
{ {
MovingObjectPosition mop = topTeslaVector.clone().translate(0.5).rayTraceEntities(this.worldObj, targetVector.clone().translate(0.5)); MovingObjectPosition mop = topTeslaVector.clone().translate(0.5).rayTraceEntities(worldObj, targetVector.clone().translate(0.5));
if(mop != null && mop.entityHit != null) if(mop != null && mop.entityHit != null)
{ {
if(mop.entityHit instanceof EntityLivingBase) if(mop.entityHit instanceof EntityLivingBase)
{ {
mop.entityHit.attackEntityFrom(DamageSource.magic, 4); mop.entityHit.attackEntityFrom(DamageSource.magic, 4);
MekanismInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).clone().translate(0.5), new Vector3(mop.entityHit)); MekanismInduction.proxy.renderElectricShock(worldObj, new Vector3(topTesla).clone().translate(0.5), new Vector3(mop.entityHit));
} }
} }
} }
@ -240,27 +238,27 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
} }
} }
this.zapCounter++; zapCounter++;
this.outputBlacklist.clear(); outputBlacklist.clear();
this.doTransfer = false; doTransfer = false;
} }
if (!this.worldObj.isRemote && this.getEnergyStored() > 0 != doPacketUpdate) if(!worldObj.isRemote && getEnergyStored() > 0 != doPacketUpdate)
{ {
this.sendPacket(2); sendPacket(2);
} }
} }
this.clearCache(); clearCache();
} }
private void transfer(ITesla tesla, float transferEnergy) private void transfer(ITesla tesla, float transferEnergy)
{ {
if(transferEnergy > 0) if(transferEnergy > 0)
{ {
tesla.transfer(transferEnergy * (1 - (this.worldObj.rand.nextFloat() * 0.1f)), true); tesla.transfer(transferEnergy * (1 - (worldObj.rand.nextFloat() * 0.1f)), true);
this.transfer(-transferEnergy, true); transfer(-transferEnergy, true);
} }
} }
@ -273,13 +271,13 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
@Override @Override
public boolean canReceive(TileEntity tileEntity) public boolean canReceive(TileEntity tileEntity)
{ {
return this.canReceive && !this.outputBlacklist.contains(tileEntity) && this.getRequest(ForgeDirection.UNKNOWN) > 0; return canReceive && !outputBlacklist.contains(tileEntity) && getRequest(ForgeDirection.UNKNOWN) > 0;
} }
@Override @Override
public boolean canConnect(ForgeDirection direction) public boolean canConnect(ForgeDirection direction)
{ {
return this.isController(); return isController();
} }
@Override @Override
@ -337,77 +335,77 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
switch(input.readByte()) switch(input.readByte())
{ {
case 1: case 1:
this.setEnergyStored(input.readFloat()); setEnergyStored(input.readFloat());
this.dyeID = input.readInt(); dyeID = input.readInt();
this.canReceive = input.readBoolean(); canReceive = input.readBoolean();
this.attackEntities = input.readBoolean(); attackEntities = input.readBoolean();
this.isLinkedClient = input.readBoolean(); isLinkedClient = input.readBoolean();
break; break;
case 2: case 2:
this.setEnergyStored(input.readFloat()); setEnergyStored(input.readFloat());
break; break;
case 3: case 3:
this.doTransfer = true; doTransfer = true;
} }
} }
private boolean isController() private boolean isController()
{ {
return this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord) == 0; return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0;
} }
private void clearCache() private void clearCache()
{ {
this.topCache = null; topCache = null;
this.controlCache = null; controlCache = null;
} }
@Override @Override
public float transfer(float transferEnergy, boolean doTransfer) public float transfer(float transferEnergy, boolean doTransfer)
{ {
if (isController() || this.getControllingTelsa() == this) if(isController() || getControllingTelsa() == this)
{ {
if(doTransfer) if(doTransfer)
{ {
this.receiveElectricity(transferEnergy, true); receiveElectricity(transferEnergy, true);
} }
this.sendPacket(2); sendPacket(2);
return transferEnergy; return transferEnergy;
} }
else else
{ {
if (this.getEnergyStored() > 0) if(getEnergyStored() > 0)
{ {
transferEnergy += this.getEnergyStored(); transferEnergy += getEnergyStored();
this.setEnergyStored(0); setEnergyStored(0);
} }
return this.getControllingTelsa().transfer(transferEnergy, doTransfer); return getControllingTelsa().transfer(transferEnergy, doTransfer);
} }
} }
public int getRange() public int getRange()
{ {
return Math.min(4 * (this.getHeight() - 1), 50); return Math.min(4 * (getHeight() - 1), 50);
} }
public void updatePositionStatus() public void updatePositionStatus()
{ {
boolean isTop = new Vector3(this).translate(new Vector3(0, 1, 0)).getTileEntity(this.worldObj) instanceof TileEntityTesla; boolean isTop = new Vector3(this).translate(new Vector3(0, 1, 0)).getTileEntity(worldObj) instanceof TileEntityTesla;
boolean isBottom = new Vector3(this).translate(new Vector3(0, -1, 0)).getTileEntity(this.worldObj) instanceof TileEntityTesla; boolean isBottom = new Vector3(this).translate(new Vector3(0, -1, 0)).getTileEntity(worldObj) instanceof TileEntityTesla;
if(isTop && isBottom) if(isTop && isBottom)
{ {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3); worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3);
} }
else if(isBottom) else if(isBottom)
{ {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 2, 3); worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 2, 3);
} }
else else
{ {
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 0, 3); worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3);
} }
} }
@ -418,22 +416,22 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
*/ */
public TileEntityTesla getTopTelsa() public TileEntityTesla getTopTelsa()
{ {
if (this.topCache != null) if(topCache != null)
{ {
return this.topCache; return topCache;
} }
this.connectedTeslas.clear(); connectedTeslas.clear();
Vector3 checkPosition = new Vector3(this); Vector3 checkPosition = new Vector3(this);
TileEntityTesla returnTile = this; TileEntityTesla returnTile = this;
while(true) while(true)
{ {
TileEntity t = checkPosition.getTileEntity(this.worldObj); TileEntity t = checkPosition.getTileEntity(worldObj);
if(t instanceof TileEntityTesla) if(t instanceof TileEntityTesla)
{ {
this.connectedTeslas.add((TileEntityTesla) t); connectedTeslas.add((TileEntityTesla)t);
returnTile = (TileEntityTesla)t; returnTile = (TileEntityTesla)t;
} }
else else
@ -444,7 +442,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
checkPosition.y++; checkPosition.y++;
} }
this.topCache = returnTile; topCache = returnTile;
return returnTile; return returnTile;
} }
@ -455,9 +453,9 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
*/ */
public TileEntityTesla getControllingTelsa() public TileEntityTesla getControllingTelsa()
{ {
if (this.controlCache != null) if(controlCache != null)
{ {
return this.controlCache; return controlCache;
} }
Vector3 checkPosition = new Vector3(this); Vector3 checkPosition = new Vector3(this);
@ -465,7 +463,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
while(true) while(true)
{ {
TileEntity t = checkPosition.getTileEntity(this.worldObj); TileEntity t = checkPosition.getTileEntity(worldObj);
if(t instanceof TileEntityTesla) if(t instanceof TileEntityTesla)
{ {
@ -479,7 +477,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
checkPosition.y--; checkPosition.y--;
} }
this.controlCache = returnTile; controlCache = returnTile;
return returnTile; return returnTile;
} }
@ -490,16 +488,16 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
*/ */
public int getHeight() public int getHeight()
{ {
this.connectedTeslas.clear(); connectedTeslas.clear();
int y = 0; int y = 0;
while(true) while(true)
{ {
TileEntity t = new Vector3(this).translate(new Vector3(0, y, 0)).getTileEntity(this.worldObj); TileEntity t = new Vector3(this).translate(new Vector3(0, y, 0)).getTileEntity(worldObj);
if(t instanceof TileEntityTesla) if(t instanceof TileEntityTesla)
{ {
this.connectedTeslas.add((TileEntityTesla) t); connectedTeslas.add((TileEntityTesla)t);
y++; y++;
} }
else else
@ -532,19 +530,19 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
public void setDye(int id) public void setDye(int id)
{ {
this.dyeID = id; dyeID = id;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
} }
public boolean toggleReceive() public boolean toggleReceive()
{ {
return this.canReceive = !this.canReceive; return canReceive = !canReceive;
} }
public boolean toggleEntityAttack() public boolean toggleEntityAttack()
{ {
boolean returnBool = this.attackEntities = !this.attackEntities; boolean returnBool = attackEntities = !attackEntities;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return returnBool; return returnBool;
} }
@ -555,14 +553,14 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
public void readFromNBT(NBTTagCompound nbt) public void readFromNBT(NBTTagCompound nbt)
{ {
super.readFromNBT(nbt); super.readFromNBT(nbt);
this.dyeID = nbt.getInteger("dyeID"); dyeID = nbt.getInteger("dyeID");
this.canReceive = nbt.getBoolean("canReceive"); canReceive = nbt.getBoolean("canReceive");
this.attackEntities = nbt.getBoolean("attackEntities"); attackEntities = nbt.getBoolean("attackEntities");
if(nbt.hasKey("link_x") && nbt.hasKey("link_y") && nbt.hasKey("link_z")) if(nbt.hasKey("link_x") && nbt.hasKey("link_y") && nbt.hasKey("link_z"))
{ {
this.linked = new Vector3(nbt.getInteger("link_x"), nbt.getInteger("link_y"), nbt.getInteger("link_z")); linked = new Vector3(nbt.getInteger("link_x"), nbt.getInteger("link_y"), nbt.getInteger("link_z"));
this.linkDim = nbt.getInteger("linkDim"); linkDim = nbt.getInteger("linkDim");
} }
} }
@ -573,48 +571,48 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
public void writeToNBT(NBTTagCompound nbt) public void writeToNBT(NBTTagCompound nbt)
{ {
super.writeToNBT(nbt); super.writeToNBT(nbt);
nbt.setInteger("dyeID", this.dyeID); nbt.setInteger("dyeID", dyeID);
nbt.setBoolean("canReceive", this.canReceive); nbt.setBoolean("canReceive", canReceive);
nbt.setBoolean("attackEntities", this.attackEntities); nbt.setBoolean("attackEntities", attackEntities);
if (this.linked != null) if(linked != null)
{ {
nbt.setInteger("link_x", (int) this.linked.x); nbt.setInteger("link_x", (int)linked.x);
nbt.setInteger("link_y", (int) this.linked.y); nbt.setInteger("link_y", (int)linked.y);
nbt.setInteger("link_z", (int) this.linked.z); nbt.setInteger("link_z", (int)linked.z);
nbt.setInteger("linkDim", this.linkDim); nbt.setInteger("linkDim", linkDim);
} }
} }
public void setLink(Vector3 vector3, int dimID, boolean setOpponent) public void setLink(Vector3 vector3, int dimID, boolean setOpponent)
{ {
if (!this.worldObj.isRemote) if(!worldObj.isRemote)
{ {
World otherWorld = MinecraftServer.getServer().worldServerForDimension(this.linkDim); World otherWorld = MinecraftServer.getServer().worldServerForDimension(linkDim);
if (setOpponent && this.linked != null && otherWorld != null) if(setOpponent && linked != null && otherWorld != null)
{ {
TileEntity tileEntity = this.linked.getTileEntity(otherWorld); TileEntity tileEntity = linked.getTileEntity(otherWorld);
if(tileEntity instanceof TileEntityTesla) if(tileEntity instanceof TileEntityTesla)
{ {
((TileEntityTesla) tileEntity).setLink(null, this.linkDim, false); ((TileEntityTesla)tileEntity).setLink(null, linkDim, false);
} }
} }
this.linked = vector3; linked = vector3;
this.linkDim = dimID; linkDim = dimID;
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
World newOtherWorld = MinecraftServer.getServer().worldServerForDimension(this.linkDim); World newOtherWorld = MinecraftServer.getServer().worldServerForDimension(linkDim);
if (setOpponent && newOtherWorld != null && this.linked != null) if(setOpponent && newOtherWorld != null && linked != null)
{ {
TileEntity tileEntity = this.linked.getTileEntity(newOtherWorld); TileEntity tileEntity = linked.getTileEntity(newOtherWorld);
if(tileEntity instanceof TileEntityTesla) if(tileEntity instanceof TileEntityTesla)
{ {
((TileEntityTesla) tileEntity).setLink(new Vector3(this), this.worldObj.provider.dimensionId, false); ((TileEntityTesla)tileEntity).setLink(new Vector3(this), worldObj.provider.dimensionId, false);
} }
} }
} }
@ -625,7 +623,7 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
{ {
if(direction != ForgeDirection.DOWN) if(direction != ForgeDirection.DOWN)
{ {
return this.getMaxEnergyStored() - this.getEnergyStored(); return getMaxEnergyStored() - getEnergyStored();
} }
return 0; return 0;
@ -634,9 +632,9 @@ public class TileEntityTesla extends TileEntityUniversalElectrical implements IT
@Override @Override
public float getProvide(ForgeDirection direction) public float getProvide(ForgeDirection direction)
{ {
if (this.isController() && direction == ForgeDirection.DOWN) if(isController() && direction == ForgeDirection.DOWN)
{ {
return this.getEnergyStored(); return getEnergyStored();
} }
return 0; return 0;