Interface EnvironmentTickContext<T extends TemperatureAware & Soakable>

Type Parameters:
T - The temperature aware type
All Known Implementing Classes:
EnvironmentTickContextImpl

@NonExtendable public interface EnvironmentTickContext<T extends TemperatureAware & Soakable>
Context objects for general temperature ticking events on temperature awares and soakables
  • Method Summary

    Modifier and Type
    Method
    Description
    The temperature aware/soakable being ticked
    net.minecraft.component.ComponentMap
    The current environment components at the world and position.
    @NotNull net.minecraft.util.math.BlockPos
    pos()
    The block position of the affected temperature aware/soakable.
    @NotNull net.minecraft.server.world.ServerWorld
    The server world of the affected temperature aware/soakable
  • Method Details

    • affected

      @NotNull T affected()
      The temperature aware/soakable being ticked
    • world

      @NotNull @NotNull net.minecraft.server.world.ServerWorld world()
      The server world of the affected temperature aware/soakable
    • pos

      @NotNull @NotNull net.minecraft.util.math.BlockPos pos()
      The block position of the affected temperature aware/soakable. This should be preferred over using methods such as Entity.getBlockPos() since it can correct for being slightly sunk into blocks like mud or soul sand by taking the block position that is slightly above their actual position.
    • components

      net.minecraft.component.ComponentMap components()
      The current environment components at the world and position.

      No key is guaranteed to be mapped to a value, be sure to always check the result or use ComponentsAccess.getOrDefault(ComponentType, Object).

      Environment components are only looked up for players by default, for all other entity types this map is empty.

      Returns:
      Returns an environment component map