mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 06:14:46 +00:00
Improve Climate Source Circuits
This commit is contained in:
1 parent
9e21ed9670
commit
2c04d42717
6 files changed
+15
-11
No files matched your search
@@ -154,10 +154,10 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
climateSourceManager.registerModifier(new AltitudeModifier());
|
||||
climateSourceManager.registerModifier(new ClimateSourceModifier());
|
||||
|
||||
Circuits.climatiserTemperature1 = new CircuitClimateSource("climatiser.temperature.1", ClimateType.TEMPERATURE, 0.125F, 0.125F);
|
||||
Circuits.climatiserTemperature2 = new CircuitClimateSource("climatiser.temperature.2", ClimateType.TEMPERATURE, 0.25F, 0.25F);
|
||||
Circuits.climatiserHumidity1 = new CircuitClimateSource("climatiser.humidity.1", ClimateType.HUMIDITY, 0.125F, 0.125F);
|
||||
Circuits.climatiserHumidity2 = new CircuitClimateSource("climatiser.humidity.2", ClimateType.HUMIDITY, 0.25F, 0.25F);
|
||||
Circuits.climatiserTemperature1 = new CircuitClimateSource("climatiser.temperature.1", ClimateType.TEMPERATURE, 0.125F, 0.125F, 0.25F);
|
||||
Circuits.climatiserTemperature2 = new CircuitClimateSource("climatiser.temperature.2", ClimateType.TEMPERATURE, 0.25F, 0.25F, 0.5F);
|
||||
Circuits.climatiserHumidity1 = new CircuitClimateSource("climatiser.humidity.1", ClimateType.HUMIDITY, 0.125F, 0.125F, 0.25F);
|
||||
Circuits.climatiserHumidity2 = new CircuitClimateSource("climatiser.humidity.2", ClimateType.HUMIDITY, 0.25F, 0.25F, 0.5F);
|
||||
proxy.inti();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@ public interface IClimateSourceCircuitable extends IClimateSource {
|
||||
/**
|
||||
* Called by the {@link IClimateSourceOwner} if its {@link ICircuit} changes.
|
||||
*/
|
||||
void changeSourceConfig(ClimateType type, float changeChange, float rangeChange);
|
||||
void changeSourceConfig(ClimateType type, float changeChange, float rangeChange, float energyChange);
|
||||
}
|
||||
@@ -22,12 +22,14 @@ public class CircuitClimateSource extends Circuit {
|
||||
private ClimateType type;
|
||||
private float changeChange;
|
||||
private float rangeChange;
|
||||
private float energyChange;
|
||||
|
||||
public CircuitClimateSource(String uid, ClimateType type, float changeChange, float rangeChange) {
|
||||
public CircuitClimateSource(String uid, ClimateType type, float changeChange, float rangeChange, float energyChange) {
|
||||
super(uid);
|
||||
this.type = type;
|
||||
this.changeChange = changeChange;
|
||||
this.rangeChange = rangeChange;
|
||||
this.energyChange = energyChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,7 +47,7 @@ public class CircuitClimateSource extends Circuit {
|
||||
if (!(source instanceof IClimateSourceCircuitable)) {
|
||||
return;
|
||||
}
|
||||
((IClimateSourceCircuitable) source).changeSourceConfig(type, changeChange, rangeChange);
|
||||
((IClimateSourceCircuitable) source).changeSourceConfig(type, changeChange, rangeChange, energyChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +65,7 @@ public class CircuitClimateSource extends Circuit {
|
||||
if (!(source instanceof IClimateSourceCircuitable)) {
|
||||
return;
|
||||
}
|
||||
((IClimateSourceCircuitable) source).changeSourceConfig(type, -changeChange, -rangeChange);
|
||||
((IClimateSourceCircuitable) source).changeSourceConfig(type, -changeChange, -rangeChange, -energyChange);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -230,7 +230,7 @@ public abstract class ClimateSource<O extends IClimateSourceOwner> implements IC
|
||||
|
||||
@Override
|
||||
public IClimateState getState() {
|
||||
return state;
|
||||
return state.copy();
|
||||
}
|
||||
|
||||
protected void setState(IClimateState state) {
|
||||
|
||||
@@ -19,13 +19,14 @@ public abstract class ClimateSourceCircuitable<O extends IClimateSourceOwner> ex
|
||||
protected float rangeMultiplierTemperature = 1.0f;
|
||||
protected float changeMultiplierHumidity = 1.0f;
|
||||
protected float rangeMultiplierHumidity = 1.0f;
|
||||
protected float energyChange = 1.0F;
|
||||
|
||||
public ClimateSourceCircuitable(float change, float range, ClimateSourceType sourceType) {
|
||||
super(change, range, sourceType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSourceConfig(ClimateType type, float changeChange, float rangeChange) {
|
||||
public void changeSourceConfig(ClimateType type, float changeChange, float rangeChange, float energyChange) {
|
||||
if (type == ClimateType.TEMPERATURE) {
|
||||
changeMultiplierTemperature += changeChange;
|
||||
rangeMultiplierTemperature += rangeChange;
|
||||
@@ -33,6 +34,7 @@ public abstract class ClimateSourceCircuitable<O extends IClimateSourceOwner> ex
|
||||
changeMultiplierHumidity += changeChange;
|
||||
rangeMultiplierHumidity += rangeChange;
|
||||
}
|
||||
this.energyChange += energyChange;
|
||||
}
|
||||
|
||||
public float getChangeMultiplier(ClimateType type) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ClimateSourceClimatiser<O extends TileClimatiser> extends ClimateSo
|
||||
|
||||
protected float getEnergyModifier(IClimateState currentState, ClimateSourceType oppositeType) {
|
||||
float change = oppositeType.canChangeTemperature() ? currentState.getTemperature() : oppositeType.canChangeHumidity() ? currentState.getHumidity() : 0.0F;
|
||||
return 1.0F + change * Config.climateSourceEnergyModifier;
|
||||
return 1.0F + change * Config.climateSourceEnergyModifier * energyChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user