Search in sources :

Example 1 with IClimateSourceOwner

use of forestry.greenhouse.api.climate.IClimateSourceOwner in project ForestryMC by ForestryMC.

the class ClimateSourceWorldManager method removeSource.

public void removeSource(IClimateSourceOwner owner) {
    BlockPos pos = owner.getCoordinates();
    Position2D position = new Position2D(pos);
    Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k -> new HashMap<>());
    positionedOwners.remove(pos.getY());
}
Also used : IClimateSourceOwner(forestry.greenhouse.api.climate.IClimateSourceOwner) Position2D(forestry.greenhouse.api.greenhouse.Position2D) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with IClimateSourceOwner

use of forestry.greenhouse.api.climate.IClimateSourceOwner in project ForestryMC by ForestryMC.

the class ClimateSourceWorldManager method addSource.

public void addSource(IClimateSourceOwner owner) {
    BlockPos pos = owner.getCoordinates();
    Position2D position = new Position2D(pos);
    Map<Integer, IClimateSourceOwner> positionedOwners = owners.computeIfAbsent(position, k -> new HashMap<>());
    positionedOwners.put(pos.getY(), owner);
}
Also used : IClimateSourceOwner(forestry.greenhouse.api.climate.IClimateSourceOwner) Position2D(forestry.greenhouse.api.greenhouse.Position2D) BlockPos(net.minecraft.util.math.BlockPos)

Example 3 with IClimateSourceOwner

use of forestry.greenhouse.api.climate.IClimateSourceOwner 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);
    }
}
Also used : IClimateSourceOwner(forestry.greenhouse.api.climate.IClimateSourceOwner) IClimateContainer(forestry.greenhouse.api.climate.IClimateContainer) Position2D(forestry.greenhouse.api.greenhouse.Position2D) IClimateSource(forestry.greenhouse.api.climate.IClimateSource)

Example 4 with IClimateSourceOwner

use of forestry.greenhouse.api.climate.IClimateSourceOwner 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);
}
Also used : IClimateSourceOwner(forestry.greenhouse.api.climate.IClimateSourceOwner) IClimateSource(forestry.greenhouse.api.climate.IClimateSource) IClimateSourceCircuitable(forestry.greenhouse.api.climate.IClimateSourceCircuitable)

Example 5 with IClimateSourceOwner

use of forestry.greenhouse.api.climate.IClimateSourceOwner 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);
}
Also used : IClimateSourceOwner(forestry.greenhouse.api.climate.IClimateSourceOwner) IClimateSource(forestry.greenhouse.api.climate.IClimateSource) IClimateSourceCircuitable(forestry.greenhouse.api.climate.IClimateSourceCircuitable)

Aggregations

IClimateSourceOwner (forestry.greenhouse.api.climate.IClimateSourceOwner)5 IClimateSource (forestry.greenhouse.api.climate.IClimateSource)3 Position2D (forestry.greenhouse.api.greenhouse.Position2D)3 IClimateSourceCircuitable (forestry.greenhouse.api.climate.IClimateSourceCircuitable)2 BlockPos (net.minecraft.util.math.BlockPos)2 IClimateContainer (forestry.greenhouse.api.climate.IClimateContainer)1