use of forestry.greenhouse.api.climate.IClimateSource in project ForestryMC by ForestryMC.
the class WallBlock method onCreate.
@Override
public void onCreate() {
IClimateContainer container = provider.getClimateContainer();
for (IClimateSourceOwner sourceOwner : GreenhouseManager.climateManager.getSources(provider.getWorld(), new Position2D(pos))) {
IClimateSource source = sourceOwner.getClimateSource();
sources.add(source);
container.addClimateSource(source);
source.onAdded(container);
}
}
use of forestry.greenhouse.api.climate.IClimateSource in project ForestryMC by ForestryMC.
the class CircuitClimateSource method onRemoval.
@Override
public void onRemoval(int slot, Object tile) {
IClimateSourceOwner owner = getCircuitable(tile);
if (owner == null) {
return;
}
IClimateSource source = owner.getClimateSource();
if (!(source instanceof IClimateSourceCircuitable)) {
return;
}
((IClimateSourceCircuitable) source).changeSourceConfig(type, -changeChange, -rangeChange, -energyChange);
}
use of forestry.greenhouse.api.climate.IClimateSource in project ForestryMC by ForestryMC.
the class CircuitClimateSource method onInsertion.
@Override
public void onInsertion(int slot, Object tile) {
IClimateSourceOwner owner = getCircuitable(tile);
if (owner == null) {
return;
}
IClimateSource source = owner.getClimateSource();
if (!(source instanceof IClimateSourceCircuitable)) {
return;
}
((IClimateSourceCircuitable) source).changeSourceConfig(type, changeChange, rangeChange, energyChange);
}
use of forestry.greenhouse.api.climate.IClimateSource in project ForestryMC by ForestryMC.
the class ClimateContainer method recalculateBoundaries.
@Override
public void recalculateBoundaries() {
sizeModifier = Math.max(parent.getSize() / Config.climateSourceRange, 1.0D);
float temperatureBoundaryUp = 0.0F;
float humidityBoundaryUp = 0.0F;
float temperatureBoundaryDown = 0.0F;
float humidityBoundaryDown = 0.0F;
for (IClimateSource source : sources) {
if (source.affectClimateType(ClimateType.HUMIDITY)) {
humidityBoundaryUp += source.getBoundaryModifier(ClimateType.HUMIDITY, true);
humidityBoundaryDown += source.getBoundaryModifier(ClimateType.HUMIDITY, false);
}
if (source.affectClimateType(ClimateType.TEMPERATURE)) {
temperatureBoundaryUp += source.getBoundaryModifier(ClimateType.TEMPERATURE, true);
temperatureBoundaryDown += source.getBoundaryModifier(ClimateType.TEMPERATURE, false);
}
}
if (temperatureBoundaryUp != 0) {
temperatureBoundaryUp /= sizeModifier;
}
if (temperatureBoundaryDown != 0) {
temperatureBoundaryDown /= sizeModifier;
}
if (humidityBoundaryUp != 0) {
humidityBoundaryUp /= sizeModifier;
}
if (humidityBoundaryDown != 0) {
humidityBoundaryDown /= sizeModifier;
}
boundaryUp = parent.getDefaultClimate().add(ClimateStates.of(temperatureBoundaryUp, humidityBoundaryUp));
boundaryDown = parent.getDefaultClimate().remove(ClimateStates.of(temperatureBoundaryDown, humidityBoundaryDown));
}
use of forestry.greenhouse.api.climate.IClimateSource in project ForestryMC by ForestryMC.
the class WallBlock method onRemove.
@Override
public void onRemove() {
IClimateContainer container = provider.getClimateContainer();
Iterator<IClimateSource> iterator = sources.iterator();
while (iterator.hasNext()) {
IClimateSource source = iterator.next();
source.onRemoved(container);
container.removeClimateSource(source);
iterator.remove();
}
}
Aggregations