fuck, whatever

This commit is contained in:
Boblet 2024-07-15 14:29:53 +02:00
parent f8465b5071
commit 02c9582b21
2 changed files with 16 additions and 16 deletions

View File

@ -22,8 +22,8 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
public long power; public long power;
public final long maxPower = 5_000_000; public final long maxPower = 5_000_000;
public static long heInput = 1; public static long heInput = 5;
public static long rfOutput = 5; public static long rfOutput = 1;
public static double inputDecay = 0.05; public static double inputDecay = 0.05;
public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000); public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000);
@ -32,8 +32,8 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
long rfCreated = Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), power / rfOutput * heInput); long rfCreated = Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), power / heInput * rfOutput);
this.power -= rfCreated * rfOutput / heInput; this.power -= rfCreated * heInput / rfOutput;
this.storage.setEnergyStored((int) (storage.getEnergyStored() + rfCreated)); this.storage.setEnergyStored((int) (storage.getEnergyStored() + rfCreated));
if(power > 0) this.power *= (1D - inputDecay); if(power > 0) this.power *= (1D - inputDecay);
if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
@ -91,15 +91,15 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
@Override @Override
public void readIfPresent(JsonObject obj) { public void readIfPresent(JsonObject obj) {
heInput = IConfigurableMachine.grab(obj, "L:HEUsed", heInput); heInput = IConfigurableMachine.grab(obj, "L:HE_Used", heInput);
rfOutput = IConfigurableMachine.grab(obj, "L:RFCreated", rfOutput); rfOutput = IConfigurableMachine.grab(obj, "L:RF_Created", rfOutput);
inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay); inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay);
} }
@Override @Override
public void writeConfig(JsonWriter writer) throws IOException { public void writeConfig(JsonWriter writer) throws IOException {
writer.name("L:HEUsed").value(heInput); writer.name("L:HE_Used").value(heInput);
writer.name("L:RFCreated").value(rfOutput); writer.name("L:RF_Created").value(rfOutput);
writer.name("D:inputDecay").value(inputDecay); writer.name("D:inputDecay").value(inputDecay);
} }
} }

View File

@ -17,8 +17,8 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
public long power; public long power;
public final long maxPower = 5_000_000; public final long maxPower = 5_000_000;
public static long rfInput = 5; public static long rfInput = 1;
public static long heOutput = 1; public static long heOutput = 5;
public static double inputDecay = 0.05; public static double inputDecay = 0.05;
public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000); public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000);
@ -28,9 +28,9 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
long rfCreated = Math.min(storage.getEnergyStored(), (maxPower - power) * heOutput / rfInput); long rfCreated = Math.min(storage.getEnergyStored(), (maxPower - power) * rfInput / heOutput);
storage.setEnergyStored((int) (storage.getEnergyStored() - rfCreated)); storage.setEnergyStored((int) (storage.getEnergyStored() - rfCreated));
power += rfCreated * rfInput / heOutput; power += rfCreated * heOutput / rfInput;
if(storage.getEnergyStored() > 0) storage.extractEnergy((int) Math.ceil(storage.getEnergyStored() * inputDecay), false); if(storage.getEnergyStored() > 0) storage.extractEnergy((int) Math.ceil(storage.getEnergyStored() * inputDecay), false);
if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
@ -73,15 +73,15 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
@Override @Override
public void readIfPresent(JsonObject obj) { public void readIfPresent(JsonObject obj) {
rfInput = IConfigurableMachine.grab(obj, "L:RFUsed", rfInput); rfInput = IConfigurableMachine.grab(obj, "L:RF_Used", rfInput);
heOutput = IConfigurableMachine.grab(obj, "L:HECreated", heOutput); heOutput = IConfigurableMachine.grab(obj, "L:HE_Created", heOutput);
inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay); inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay);
} }
@Override @Override
public void writeConfig(JsonWriter writer) throws IOException { public void writeConfig(JsonWriter writer) throws IOException {
writer.name("L:RFUsed").value(rfInput); writer.name("L:RF_Used").value(rfInput);
writer.name("L:HECreated").value(heOutput); writer.name("L:HE_Created").value(heOutput);
writer.name("D:inputDecay").value(inputDecay); writer.name("D:inputDecay").value(inputDecay);
} }
} }