Class FluidSpriteCache

java.lang.Object
net.neoforged.neoforge.client.textures.FluidSpriteCache

public final class FluidSpriteCache extends Object
Helper class for safely accessing fluid textures on a render worker (such as in LiquidBlockRenderer) to avoid potential issues when a chunk gets re-batched while resources are being reloaded.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static net.minecraft.client.renderer.texture.TextureAtlasSprite
     
    private static Map<net.minecraft.resources.ResourceLocation,net.minecraft.client.renderer.texture.TextureAtlasSprite>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.client.renderer.texture.TextureAtlasSprite[]
    getFluidSprites(net.minecraft.world.level.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.FluidState fluid)
    Returns an array holding the still sprite, the flowing sprite and the overlay sprite (if specified, otherwise null) of the given fluid at the given position.
    static net.minecraft.client.renderer.texture.TextureAtlasSprite
    getSprite(net.minecraft.resources.ResourceLocation texture)
    Returns a specified sprite or a missing sprite texture if sprite is not found.
    static void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • textureLookup

      private static Map<net.minecraft.resources.ResourceLocation,net.minecraft.client.renderer.texture.TextureAtlasSprite> textureLookup
    • missingSprite

      private static net.minecraft.client.renderer.texture.TextureAtlasSprite missingSprite
  • Constructor Details

    • FluidSpriteCache

      private FluidSpriteCache()
  • Method Details

    • getFluidSprites

      public static net.minecraft.client.renderer.texture.TextureAtlasSprite[] getFluidSprites(net.minecraft.world.level.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.FluidState fluid)
      Returns an array holding the still sprite, the flowing sprite and the overlay sprite (if specified, otherwise null) of the given fluid at the given position.
      Returns:
      an array holding the still sprite, the flowing sprite and the overlay sprite (if specified, otherwise null) of the given fluid at the given position
    • getSprite

      public static net.minecraft.client.renderer.texture.TextureAtlasSprite getSprite(net.minecraft.resources.ResourceLocation texture)
      Returns a specified sprite or a missing sprite texture if sprite is not found.
      Returns:
      a specified sprite or a missing sprite texture if sprite is not found
    • reload

      @Internal public static void reload()