mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28: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{
|
else{
|
||||||
data = (WorldData)savedData;
|
data = (WorldData)savedData;
|
||||||
ModUtil.LOGGER.info("Successfully loaded WorldData.");
|
ModUtil.LOGGER.info("Successfully loaded WorldData!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Remove this part as well
|
//TODO Remove this part as well
|
||||||
|
@ -95,7 +95,7 @@ public class WorldData extends WorldSavedData{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
data = new WorldData(DATA_TAG);
|
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{
|
public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISharingEnergyProvider{
|
||||||
|
|
||||||
private int lastEnergyStored;
|
private int lastEnergyStored;
|
||||||
|
private int lastCompare;
|
||||||
|
|
||||||
public TileEntityBatteryBox(){
|
public TileEntityBatteryBox(){
|
||||||
super(1, "batteryBox");
|
super(1, "batteryBox");
|
||||||
|
@ -88,12 +89,29 @@ public class TileEntityBatteryBox extends TileEntityInventoryBase implements ISh
|
||||||
currStorage = storage.getEnergyStored();
|
currStorage = storage.getEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.lastCompare != this.getComparatorStrength()){
|
||||||
|
this.lastCompare = this.getComparatorStrength();
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
if(this.lastEnergyStored != currStorage && this.sendUpdateWithInterval()){
|
if(this.lastEnergyStored != currStorage && this.sendUpdateWithInterval()){
|
||||||
this.lastEnergyStored = currStorage;
|
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
|
@Override
|
||||||
public boolean respondsToPulses(){
|
public boolean respondsToPulses(){
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue