Interface EnvironmentController

All Known Implementing Classes:
EmptyEnvironmentController, EnvironmentControllerDecorator

@Immutable @Deprecated(forRemoval=true, since="4.4") public sealed interface EnvironmentController permits EnvironmentControllerDecorator, EmptyEnvironmentController
Deprecated, for removal: This API element is subject to removal in a future version.
Implements computations for various passive environmental effects, such as passive freezing/warming from biomes, and passive warming from heat sources (torches, campfires, etc).

The default implementation is provided by EmptyEnvironmentController which sets all values to either 0, false, or null by default, except where noted. However, if you wish you may extend (or even replace!) the functionality of the default controller by use of the EnvironmentControllerDecorator. It is best to do this through the initialize event in EnvironmentControllerInitializeEvent

See Also:
  • Method Details

    • getDecorated

      @Nullable default @Nullable EnvironmentController getDecorated()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the controller that this controller decorates. If this controller is a leaf (not a decorator), then returns null.
      Returns:
      Returns the environment controller that this controller decorates. Returns null if this decorates no controller (i.e., is a leaf)
    • getBaseValueForAttribute

      @Deprecated(since="4.3", forRemoval=true) double getBaseValueForAttribute(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.entity.LivingEntity entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the base value for one of the ThermooAttributes. If the return of this method is non-zero, then this value will be applied as an attribute modifier to the entity when the entity is created, with the addition operation. This method is called for each of the Thermoo attributes.
      Parameters:
      attribute - The attribute to get the base value for. Strictly the attributes in ThermooAttributes.
      entity - The entity to apply the attribute to.
      Returns:
      Returns the base value for the attribute to apply to the entity.
    • getLocalTemperatureChange

      @Deprecated(since="4.4") int getLocalTemperatureChange(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Deprecated.
      Computes the local temperature change from the environment at a given position in a world.
      Parameters:
      world - The world
      pos - The position in that world
      Returns:
      The passive temperature change at pos in world.
    • getEnvironmentTemperatureForPlayer

      @Deprecated(since="4.4") default int getEnvironmentTemperatureForPlayer(net.minecraft.world.entity.player.Player player, int localTemperature)
      Deprecated.
      Computes the environmental temperature change for a player, based on a local temperature computed from getLocalTemperatureChange(Level, BlockPos).

      By default, this returns the value of localTemperature, and NOT 0.

      Parameters:
      player - The player to compute the temperature change for
      localTemperature - The base local temperature
      Returns:
      Returns the passive environmental temperature change for the player this tick
    • getTemperatureEffectsChange

      @Deprecated(since="4.4") int getTemperatureEffectsChange(net.minecraft.world.entity.LivingEntity entity)
      Deprecated.
      Use the active effects in LivingEntityTemperatureTickEvents
      Computes temperature changes for LivingEntitys from heat effects. For example, being on fire or freezing in powder snow
      Parameters:
      entity - The entity to tick warmth effects for
      Returns:
      Returns the temperature change that should be applied
    • getFloorTemperature

      @Deprecated(since="4.4") int getFloorTemperature(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.level.Level world, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Gets the amount of warmth generated by a floor block state for a given entity.

      Hot floor is different from getHeatFromBlockState(BlockState), as it ONLY applies to entities stepping on the block - it does not affect the area around the block. An example implementation would be to provide warmth from Blocks.MAGMA_BLOCK, but not provide area heat.

      You can also use this for blocks that are cold to step on.

      Parameters:
      entity - The entity that is stepping on the given state
      world - The world/level where the floor is located
      state - The state of the floor. This is exactly the state at the pos in the world
      pos - The position of the world in the world
      Returns:
      Returns the heat to apply each tick to entities standing on the block state
    • getMaxWetTicks

      @Deprecated(since="4.4") default int getMaxWetTicks(Soakable soakable)
      Deprecated.
      Gets the default maximum wet ticks for the soakable.

      Important note - so that behaviour will remain consistent with previous versions, this will return 600 by default, instead of the normal 0 for this type.

      Parameters:
      soakable - The soakable to get the max wet ticks for.
      Returns:
      Returns the default maximum wet ticks for the soakable
    • getSoakChange

      @Deprecated(since="4.4") int getSoakChange(Soakable soakable)
      Deprecated.
      Gets the wetness increase for a Soakable this tick
      Parameters:
      soakable - The soakable to compute increase for
      Returns:
      Returns the soaking change for the player.
    • getHeatAtLocation

      @Deprecated(since="4.4") int getHeatAtLocation(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Calculates the passive warmth nearby heat sources at a location in a world. 'Heat sources' being things that exist in the world that produce heat around them. For example, this could include artificial light producing sources, such as torches, campfires, lit furnaces, glowstone, and more.

      This can also be negative, to indicate a cold position.

      Parameters:
      world - The world the temperature aware is in
      pos - The position to check
      Returns:
      Returns the temperature change that should be applied from nearby temperature sources.
    • applyAwareHeat

      @Deprecated(since="4.4") default int applyAwareHeat(TemperatureAware temperatureAware, int locationHeat)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Gets the heat from nearby heat sources to apply to a Temperature Aware this tick.

      By default, the temperature aware will accept all heat from nearby heat sources.

      Parameters:
      temperatureAware - The temperature aware affected.
      locationHeat - The heat at the temperature aware's location, as computed by getHeatAtLocation(Level, BlockPos)
      Returns:
      Returns locationHeat by default.
    • getHeatFromBlockState

      @Deprecated(since="4.4") int getHeatFromBlockState(net.minecraft.world.level.block.state.BlockState state)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Calculates the heat produced by a block state. May be negative, indicating a cold source.
      Parameters:
      state - The block state heat source
      Returns:
      The warmth that the state produces around it
    • isHeatSource

      @Deprecated(since="4.4") boolean isHeatSource(net.minecraft.world.level.block.state.BlockState state)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Checks if a block state is a heat source, as defined by this controller.
      Parameters:
      state - The block state to check
      Returns:
      Returns if a block state is a heat source
      See Also:
    • isColdSource

      @Deprecated(since="4.4") boolean isColdSource(net.minecraft.world.level.block.state.BlockState state)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Checks if a block state is a cold source, as defined by this controller.
      Parameters:
      state - The block state to check
      Returns:
      Returns true if a block state is a cold source
      See Also:
    • isAreaHeated

      @Deprecated(since="4.4") boolean isAreaHeated(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Deprecated.
      Use the passive effects in LivingEntityTemperatureTickEvents
      Check if a position in a world is heated
      Parameters:
      world - The world of the position
      pos - The position to check
      Returns:
      Returns if the location in the world is heated
      See Also: