mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix Climate Sources
This commit is contained in:
1 parent
199200cb01
commit
f4d0979bb1
6 files changed
+28
-28
No files matched your search
@@ -27,7 +27,7 @@ import forestry.greenhouse.api.greenhouse.GreenhouseManager;
|
||||
|
||||
public abstract class ClimateSource<O extends IClimateSourceOwner> implements IClimateSource {
|
||||
|
||||
protected final float range;
|
||||
protected final float boundModifier;
|
||||
protected final ClimateSourceType sourceType;
|
||||
protected O owner;
|
||||
private IClimateState state;
|
||||
@@ -38,13 +38,13 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
protected boolean addedToManager;
|
||||
protected boolean isActive;
|
||||
|
||||
public ClimateSource(float change, float range, ClimateSourceType sourceType) {
|
||||
public ClimateSource(float change, float boundModifier, ClimateSourceType sourceType) {
|
||||
this.change = change;
|
||||
this.range = range;
|
||||
this.boundModifier = boundModifier;
|
||||
this.sourceType = sourceType;
|
||||
this.temperatureMode = ClimateSourceMode.NONE;
|
||||
this.humidityMode = ClimateSourceMode.NONE;
|
||||
this.state = ClimateStates.INSTANCE.absent();
|
||||
this.state = ClimateStates.extendedZero();
|
||||
}
|
||||
|
||||
public void setHumidityMode(ClimateSourceMode humidityMode) {
|
||||
@@ -63,22 +63,22 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
public float getBoundaryModifier(ClimateType type, boolean boundaryUp) {
|
||||
if(type == ClimateType.HUMIDITY){
|
||||
if(humidityMode == ClimateSourceMode.POSITIVE && boundaryUp){
|
||||
return getRange(ClimateType.HUMIDITY);
|
||||
return getBoundModifier(ClimateType.HUMIDITY);
|
||||
}else if(humidityMode == ClimateSourceMode.NEGATIVE && !boundaryUp){
|
||||
return getRange(ClimateType.HUMIDITY);
|
||||
return getBoundModifier(ClimateType.HUMIDITY);
|
||||
}
|
||||
}else {
|
||||
if(temperatureMode == ClimateSourceMode.POSITIVE && boundaryUp){
|
||||
return getRange(ClimateType.TEMPERATURE);
|
||||
return getBoundModifier(ClimateType.TEMPERATURE);
|
||||
}else if(temperatureMode == ClimateSourceMode.NEGATIVE && !boundaryUp){
|
||||
return getRange(ClimateType.TEMPERATURE);
|
||||
return getBoundModifier(ClimateType.TEMPERATURE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected float getRange(ClimateType type){
|
||||
return range;
|
||||
|
||||
protected float getBoundModifier(ClimateType type) {
|
||||
return boundModifier;
|
||||
}
|
||||
|
||||
protected float getChange(ClimateType type) {
|
||||
|
||||
@@ -21,8 +21,8 @@ public abstract class ClimateSourceCircuitable<O extends IClimateSourceOwner> ex
|
||||
protected float rangeMultiplierHumidity = 1.0f;
|
||||
protected float energyChange = 1.0F;
|
||||
|
||||
public ClimateSourceCircuitable(float change, float range, ClimateSourceType sourceType) {
|
||||
super(change, range, sourceType);
|
||||
public ClimateSourceCircuitable(float change, float boundModifier, ClimateSourceType sourceType) {
|
||||
super(change, boundModifier, sourceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,14 +48,14 @@ public abstract class ClimateSourceCircuitable<O extends IClimateSourceOwner> ex
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getRange(ClimateType type) {
|
||||
protected float getBoundModifier(ClimateType type) {
|
||||
float rangeMultiplier;
|
||||
if (type == ClimateType.TEMPERATURE) {
|
||||
rangeMultiplier = rangeMultiplierTemperature;
|
||||
} else {
|
||||
rangeMultiplier = rangeMultiplierHumidity;
|
||||
}
|
||||
return super.getRange(type) * rangeMultiplier;
|
||||
return super.getBoundModifier(type) * rangeMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,8 +26,8 @@ public class ClimateSourceClimatiser<O extends TileClimatiser> extends ClimateSo
|
||||
|
||||
protected static final int ENERGY_PER_OPERATION = 75;
|
||||
|
||||
public ClimateSourceClimatiser(ClimateSourceType type, float change, float range) {
|
||||
super(change, range, type);
|
||||
public ClimateSourceClimatiser(ClimateSourceType type, float change, float boundModifier) {
|
||||
super(change, boundModifier, type);
|
||||
if (type.canChangeTemperature()) {
|
||||
setTemperatureMode(change > 0 ? ClimateSourceMode.POSITIVE : ClimateSourceMode.NEGATIVE);
|
||||
} else {
|
||||
|
||||
@@ -25,8 +25,8 @@ public class ClimateSourceHygroregulator extends ClimateSourceCircuitable<TileHy
|
||||
|
||||
private HygroregulatorRecipe currentRecipe;
|
||||
|
||||
public ClimateSourceHygroregulator(float range) {
|
||||
super(0.0F, range, ClimateSourceType.BOTH);
|
||||
public ClimateSourceHygroregulator(float boundModifier) {
|
||||
super(0.0F, boundModifier, ClimateSourceType.BOTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,10 +51,10 @@ import forestry.greenhouse.network.packets.PacketCamouflageSelectionServer;
|
||||
|
||||
public class TileClimatiser extends TileForestry implements IActivatable, IStreamableGui, IClimateSourceOwner, ICamouflagedTile, ICamouflageHandler, ISocketable {
|
||||
|
||||
public static final ClimatiserDefinition HEATER = new ClimatiserDefinition(0.075F, 5F, ClimateSourceType.TEMPERATURE);
|
||||
public static final ClimatiserDefinition FAN = new ClimatiserDefinition(-0.075F, 5F, ClimateSourceType.TEMPERATURE);
|
||||
public static final ClimatiserDefinition HUMIDIFIER = new ClimatiserDefinition(0.075F, 5F, ClimateSourceType.HUMIDITY);
|
||||
public static final ClimatiserDefinition DEHUMIDIFIER = new ClimatiserDefinition(-0.075F, 5F, ClimateSourceType.HUMIDITY);
|
||||
public static final ClimatiserDefinition HEATER = new ClimatiserDefinition(0.075F, 2.5F, ClimateSourceType.TEMPERATURE);
|
||||
public static final ClimatiserDefinition FAN = new ClimatiserDefinition(-0.075F, 2.5F, ClimateSourceType.TEMPERATURE);
|
||||
public static final ClimatiserDefinition HUMIDIFIER = new ClimatiserDefinition(0.075F, 2.5F, ClimateSourceType.HUMIDITY);
|
||||
public static final ClimatiserDefinition DEHUMIDIFIER = new ClimatiserDefinition(-0.075F, 2.5F, ClimateSourceType.HUMIDITY);
|
||||
|
||||
private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets");
|
||||
private final ClimateSource source;
|
||||
@@ -62,7 +62,7 @@ public class TileClimatiser extends TileForestry implements IActivatable, IStrea
|
||||
private boolean active;
|
||||
|
||||
public TileClimatiser(ClimatiserDefinition definition) {
|
||||
this(definition.change, definition.range, definition.type);
|
||||
this(definition.change, definition.boundModifier, definition.type);
|
||||
}
|
||||
|
||||
protected TileClimatiser(float change, float range, ClimateSourceType type) {
|
||||
@@ -276,12 +276,12 @@ public class TileClimatiser extends TileForestry implements IActivatable, IStrea
|
||||
}
|
||||
|
||||
public static class ClimatiserDefinition {
|
||||
float change, range;
|
||||
float change, boundModifier;
|
||||
ClimateSourceType type;
|
||||
|
||||
public ClimatiserDefinition(float change, float range, ClimateSourceType type) {
|
||||
public ClimatiserDefinition(float change, float boundModifier, ClimateSourceType type) {
|
||||
this.change = change;
|
||||
this.range = range;
|
||||
this.boundModifier = boundModifier;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TileHygroregulator extends TileClimatiser implements ILiquidTankTil
|
||||
private final FilteredTank liquidTank;
|
||||
|
||||
public TileHygroregulator() {
|
||||
super(new ClimateSourceHygroregulator(5F));
|
||||
super(new ClimateSourceHygroregulator(2.5F));
|
||||
|
||||
setInternalInventory(new InventoryHygroregulator(this));
|
||||
|
||||
|
||||
Reference in new issue
Block a user