mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
parent
a10a11badf
commit
5d09499f61
2 changed files with 20 additions and 2 deletions
|
@ -58,7 +58,7 @@ public class WorldData extends WorldSavedData{
|
|||
}
|
||||
else{
|
||||
data = (WorldData)savedData;
|
||||
ModUtil.LOGGER.info("Successfully loaded WorldData.");
|
||||
ModUtil.LOGGER.info("Successfully loaded WorldData!");
|
||||
}
|
||||
|
||||
//TODO Remove this part as well
|
||||
|
@ -95,7 +95,7 @@ public class WorldData extends WorldSavedData{
|
|||
}
|
||||
else{
|
||||
data = new WorldData(DATA_TAG);
|
||||
ModUtil.LOGGER.info("Created temporary WorldData to cache data on the client.");
|
||||
ModUtil.LOGGER.info("Created temporary WorldData to cache data on the client!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||
public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISharingEnergyProvider{
|
||||
|
||||
private int lastEnergyStored;
|
||||
private int lastCompare;
|
||||
|
||||
public TileEntityBatteryBox(){
|
||||
super(1, "batteryBox");
|
||||
|
@ -88,12 +89,29 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh
|
|||
currStorage = storage.getEnergyStored();
|
||||
}
|
||||
|
||||
if(this.lastCompare != this.getComparatorStrength()){
|
||||
this.lastCompare = this.getComparatorStrength();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
if(this.lastEnergyStored != currStorage && this.sendUpdateWithInterval()){
|
||||
this.lastEnergyStored = currStorage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorStrength(){
|
||||
IEnergyStorage storage = this.getEnergyStorage(null);
|
||||
if(storage != null){
|
||||
float calc = ((float)storage.getEnergyStored()/(float)storage.getMaxEnergyStored())*15F;
|
||||
return (int)calc;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean respondsToPulses(){
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue