EIMs now properly store their energy in cells after destruction and extract energy from cells after creation

This commit is contained in:
Aidan C. Brady 2015-03-03 18:36:10 -05:00
parent 9260414177
commit a18b42beee
3 changed files with 11 additions and 7 deletions

View file

@ -73,7 +73,7 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
}
@Override
protected void onStructureCreated(SynchronizedMatrixData structure, int origX, int origY, int origZ, int xmin, int xmax, int ymin, int ymax, int zmin, int zmax)
protected void onFormed()
{
for(Coord4D coord : innerNodes)
{
@ -81,14 +81,15 @@ public class MatrixUpdateProtocol extends UpdateProtocol<SynchronizedMatrixData>
if(tile instanceof TileEntityInductionCell)
{
structure.cells.add(coord);
structure.storageCap += ((TileEntityInductionCell)tile).tier.MAX_ELECTRICITY;
structure.electricityStored += ((TileEntityInductionCell)tile).getEnergy();
structureFound.cells.add(coord);
structureFound.storageCap += ((TileEntityInductionCell)tile).tier.MAX_ELECTRICITY;
structureFound.electricityStored += ((TileEntityInductionCell)tile).getEnergy();
((TileEntityInductionCell)tile).setEnergy(0);
}
else if(tile instanceof TileEntityInductionProvider)
{
structure.providers.add(coord);
structure.outputCap += ((TileEntityInductionProvider)tile).tier.OUTPUT;
structureFound.providers.add(coord);
structureFound.outputCap += ((TileEntityInductionProvider)tile).tier.OUTPUT;
}
}
}

View file

@ -30,6 +30,8 @@ public abstract class SynchronizedData<T extends SynchronizedData<T>>
public Coord4D minLocation;
public Coord4D maxLocation;
public boolean destroyed;
public ItemStack[] getInventory()
{
return null;

View file

@ -452,9 +452,10 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
else {
for(TileEntityMultiblock<T> tileEntity : iteratedNodes)
{
if(tileEntity.structure != null)
if(tileEntity.structure != null && !tileEntity.structure.destroyed)
{
onStructureDestroyed(tileEntity.structure);
tileEntity.structure.destroyed = true;
}
tileEntity.structure = null;