Removed useless power modules methods
This commit is contained in:
@@ -4,6 +4,7 @@ import java.io.DataInput;
|
|||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**A class that represents compartmentalized tile entity state.*/
|
||||||
public abstract class BlockModule{
|
public abstract class BlockModule{
|
||||||
public abstract void write(DataOutput stream) throws IOException;
|
public abstract void write(DataOutput stream) throws IOException;
|
||||||
|
|
||||||
|
|||||||
@@ -9,26 +9,9 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class PowerModule extends BlockModule{
|
public class PowerModule extends BlockModule{
|
||||||
public float amount;
|
public float amount;
|
||||||
public float capacity = 10f;
|
|
||||||
public float voltage = 0.0001f;
|
|
||||||
public PowerGraph graph = new PowerGraph();
|
public PowerGraph graph = new PowerGraph();
|
||||||
public IntArray links = new IntArray();
|
public IntArray links = new IntArray();
|
||||||
|
|
||||||
public boolean acceptsPower(){
|
|
||||||
return amount + 0.001f <= capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float addPower(float add){
|
|
||||||
if(add < voltage){
|
|
||||||
return add;
|
|
||||||
}
|
|
||||||
|
|
||||||
float canAccept = Math.min(capacity - amount, add);
|
|
||||||
amount += canAccept;
|
|
||||||
|
|
||||||
return canAccept;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutput stream) throws IOException{
|
public void write(DataOutput stream) throws IOException{
|
||||||
stream.writeFloat(amount);
|
stream.writeFloat(amount);
|
||||||
|
|||||||
Reference in New Issue
Block a user