Search in sources :

Example 1 with PacketUpdateClimate

use of forestry.core.network.packets.PacketUpdateClimate in project ForestryMC by ForestryMC.

the class ClimateContainer method updateClimate.

@Override
public void updateClimate(int ticks) {
    if (ticks % getTickDelay() == 0) {
        IClimateState oldState = state.copy(ClimateStateType.DEFAULT);
        state = parent.getDefaultClimate().copy(ClimateStateType.EXTENDED);
        for (IClimateModifier modifier : GreenhouseClimateManager.getInstance().getModifiers()) {
            state = modifier.modifyTarget(this, state, oldState, modifierData).copy(ClimateStateType.EXTENDED);
        }
        if (!state.equals(oldState)) {
            BlockPos coordinates = parent.getCoordinates();
            NetworkUtil.sendNetworkPacket(new PacketUpdateClimate(coordinates, this), coordinates, parent.getWorldObj());
        }
    }
}
Also used : IClimateModifier(forestry.greenhouse.api.climate.IClimateModifier) PacketUpdateClimate(forestry.core.network.packets.PacketUpdateClimate) IClimateState(forestry.api.climate.IClimateState) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

IClimateState (forestry.api.climate.IClimateState)1 PacketUpdateClimate (forestry.core.network.packets.PacketUpdateClimate)1 IClimateModifier (forestry.greenhouse.api.climate.IClimateModifier)1 BlockPos (net.minecraft.util.math.BlockPos)1