mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Added value clamping to the ventCarbonDioxide function on the Zirnox, also no longer writes the value before correcting if it's negative.
This commit is contained in:
parent
b7d416cd8a
commit
fa0f3cb0ed
@ -516,11 +516,9 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IC
|
|||||||
@Callback(direct = true)
|
@Callback(direct = true)
|
||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] ventCarbonDioxide(Context context, Arguments args) {
|
public Object[] ventCarbonDioxide(Context context, Arguments args) {
|
||||||
int ventAmount = args.optInteger(0, 1000); // Get how much CO2 to vent in mB (1000mB default)
|
int ventAmount = Math.max(Math.min(args.optInteger(0, 1000), carbonDioxide.getMaxFill()), 0); // Get how much CO2 to vent in mB (1000mB default), clamp between 0 and carbonDioxide's max fill.
|
||||||
int fill = this.carbonDioxide.getFill();
|
int fill = this.carbonDioxide.getFill();
|
||||||
this.carbonDioxide.setFill(fill - ventAmount);
|
this.carbonDioxide.setFill(Math.max(fill - ventAmount, 0)); // Make sure it isn't a negative number.
|
||||||
if(this.carbonDioxide.getFill() < 0)
|
|
||||||
this.carbonDioxide.setFill(0);
|
|
||||||
return new Object[] {};
|
return new Object[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user