public void updateEntity()
{
if(Platform.isSimulating())
{
ticker++;
//It updates this thing 4 times less often
if(ticker % 16 == 0)
{
//It does this expensive check inside the brackets instead of every goddamn tick!
if(!addedToEnergyNet)
{
EnergyNet.getForWorld(worldObj).addTileEntity(this);
addedToEnergyNet = true;
}
energy-=4;
if(energy <= 0)
{
worldObj.setBlockAndMetadataWithNotify(xCoord, yCoord, zCoord, mod_IC2.blockLuminatorDark.blockID, worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
}
}
}
}
public boolean isAddedToEnergyNet()
{
return addedToEnergyNet;
}
public boolean acceptsEnergyFrom(TileEntity tileentity, Direction direction)
{
return tileentity instanceof TileEntityCable;
}
public boolean demandsEnergy()
{
return energy < getMaxWiredEnergy();
}
//I deleted the check to return excess energy here, eventually demands energy will turn off so the check isn't needed and causes a problem
public int injectEnergy(Direction direction, int i)
{
if(i > 32)
{
poof();
return 0;
}
if(i <= 0)
{
return 0;
}
if(worldObj.getBlockId(xCoord, yCoord, zCoord) == mod_IC2.blockLuminatorDark.blockID)
{
worldObj.setBlockAndMetadataWithNotify(xCoord, yCoord, zCoord, mod_IC2.blockLuminator.blockID, worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
TileEntityLuminator tileentityluminator = (TileEntityLuminator)worldObj.getBlockTileEntity(xCoord, yCoord, zCoord);
return tileentityluminator.injectEnergy(direction, i);
}
energy += i;
int j = 0;
return j;
}
public int getMaxEnergy()
{
return 10000;
}
//I added this
public int getMaxWiredEnergy()
{
return 20;
}
I also changed BlockLuminator and added this :for(int t=0; t<20; t++) { l = tileentityluminator.getMaxEnergy() - tileentityluminator.energy; if(l <= 0) { return true; } l = itembattery.getEnergyFrom(itemstack, l, 2); tileentityluminator.energy += l; }