Interface EnvironmentController
- All Known Implementing Classes:
EmptyEnvironmentController,EnvironmentControllerDecorator
The default implementation is provided by EmptyEnvironmentController which sets all values to either 0, false,
or null by default. 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
-
Method Summary
Modifier and TypeMethodDescriptiondoublegetBaseValueForAttribute(net.minecraft.entity.attribute.EntityAttribute attribute, net.minecraft.entity.LivingEntity entity) Gets the base value for one of theThermooAttributes.default @Nullable EnvironmentControllerGets the controller that this controller decorates.intgetEnvironmentTemperatureForPlayer(net.minecraft.entity.player.PlayerEntity player, int localTemperature) Computes the environmental temperature change for a player, based on a local temperature computed fromgetLocalTemperatureChange(World, BlockPos)intgetFloorTemperature(net.minecraft.entity.LivingEntity entity, net.minecraft.world.World world, net.minecraft.block.BlockState state, net.minecraft.util.math.BlockPos pos) Gets the amount of warmth generated by a floor block state for a given entity.intgetHeatAtLocation(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Calculates the passive warmth nearby heat sources at a location in a world.intgetHeatFromBlockState(net.minecraft.block.BlockState state) Calculates the heat produced by a block state.intgetLocalTemperatureChange(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Computes the local temperature change from the environment at a given position in a world.default intgetMaxWetTicks(Soakable soakable) Gets the default maximum wet ticks for thesoakable.intgetSoakChange(Soakable soakable) Gets the wetness increase for aSoakablethis tickintgetTemperatureEffectsChange(net.minecraft.entity.LivingEntity entity) Computes temperature changes forLivingEntitys from heat effects.booleanisAreaHeated(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Check if a position in a world is heatedbooleanisColdSource(net.minecraft.block.BlockState state) Checks if a block state is a cold source, as defined by this controller.booleanisHeatSource(net.minecraft.block.BlockState state) Checks if a block state is a heat source, as defined by this controller.
-
Method Details
-
getDecorated
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
double getBaseValueForAttribute(net.minecraft.entity.attribute.EntityAttribute attribute, net.minecraft.entity.LivingEntity entity) Gets the base value for one of theThermooAttributes. If the return of this method is non-zero, then this value will be applied as an attribute modifier to theentitywhen 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 inThermooAttributes.entity- The entity to apply the attribute to.- Returns:
- Returns the base value for the attribute to apply to the entity.
-
getLocalTemperatureChange
int getLocalTemperatureChange(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Computes the local temperature change from the environment at a given position in a world.- Parameters:
world- The worldpos- The position in that world- Returns:
- The passive temperature change at
posinworld.
-
getEnvironmentTemperatureForPlayer
int getEnvironmentTemperatureForPlayer(net.minecraft.entity.player.PlayerEntity player, int localTemperature) Computes the environmental temperature change for a player, based on a local temperature computed fromgetLocalTemperatureChange(World, BlockPos)- Parameters:
player- The player to compute the temperature change forlocalTemperature- The base local temperature- Returns:
- Returns the passive environmental temperature change for the player this tick
-
getTemperatureEffectsChange
int getTemperatureEffectsChange(net.minecraft.entity.LivingEntity entity) Computes temperature changes forLivingEntitys 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
int getFloorTemperature(net.minecraft.entity.LivingEntity entity, net.minecraft.world.World world, net.minecraft.block.BlockState state, net.minecraft.util.math.BlockPos pos) 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 fromBlocks.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 givenstateworld- The world/level where the floor is locatedstate- The state of the floor. This is exactly the state at theposin theworldpos- The position of the world in the world- Returns:
- Returns the heat to apply each tick to entities standing on the block state
-
getMaxWetTicks
Gets the default maximum wet ticks for thesoakable. Important note - so that behaviour will remain consistent with previous versions, this will return600by default, instead of the normal0for this type.- Parameters:
soakable- The soakable to get the max wet ticks for.- Returns:
- Returns the default maximum wet ticks for the
soakable
-
getSoakChange
Gets the wetness increase for aSoakablethis tick- Parameters:
soakable- The soakable to compute increase for- Returns:
- Returns the soaking change for the player.
-
getHeatAtLocation
int getHeatAtLocation(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) 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 inpos- The position to check- Returns:
- Returns the temperature change that should be applied from nearby temperature sources.
-
getHeatFromBlockState
int getHeatFromBlockState(net.minecraft.block.BlockState state) 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
boolean isHeatSource(net.minecraft.block.BlockState state) 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
boolean isColdSource(net.minecraft.block.BlockState state) 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
boolean isAreaHeated(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Check if a position in a world is heated- Parameters:
world- The world of the positionpos- The position to check- Returns:
- Returns if the location in the world is heated
- See Also:
-