Permalink
Browse files

Power system refactoring

  • Loading branch information...
Ri5ux committed Dec 18, 2017
1 parent 49ff8cd commit 256e35ba2224ffd15bdef7c5dc69b81a9246c76f
@@ -18,15 +18,15 @@
protected double thresholdVoltage;
protected double resistance;
protected double boost;
protected int srcHertz;
protected int updateFrequency;
protected boolean isSrc;
public TileEntityElectrical(boolean isSource)
{
this.isSrc = isSource;
this.thresholdVoltage = 110;
this.srcVoltage = 120;
this.srcHertz = 50;
this.updateFrequency = 50;
/** 1000 / 50Hz = 20 Ticks **/
this.resistance = 0.1;
this.boost = 0;
@@ -158,17 +158,17 @@ public void setBoost(double boost)
/**
* @return The rate at which this source component will update its voltage.
*/
public int getSourceHertz()
public int getUpdateFrequency()
{
return srcHertz;
return updateFrequency;
}
/**
* @param hertz - The rate at which this source component should update its voltage.
* @param freq - The rate at which this source component should update its voltage.
*/
public void setSourceHertz(int hertz)
public void setUpdateFrequency(int freq)
{
this.srcHertz = hertz;
this.updateFrequency = freq;
}
/**
@@ -18,7 +18,7 @@ public void update()
{
if (this.world.getWorldTime() < 12300 || this.world.getWorldTime() > 23850)
{
if (this.getWorld().getWorldTime() % (1000 / this.getSourceHertz()) == 0)
if (this.getWorld().getWorldTime() % (1000 / this.getUpdateFrequency()) == 0)
{
this.setVoltage(120);
}

0 comments on commit 256e35b

Please sign in to comment.