mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-29 04:09:59 -05:00
Guard against unregistered fluid renderers
Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -116,7 +116,9 @@ public class FluidStackHooksImpl {
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) {
|
||||
if (state.getType() == Fluids.EMPTY) return null;
|
||||
TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(state.getType()).getFluidSprites(level, pos, state);
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(state.getType());
|
||||
if (handler == null) return null;
|
||||
TextureAtlasSprite[] sprites = handler.getFluidSprites(level, pos, state);
|
||||
if (sprites == null) return null;
|
||||
return sprites[0];
|
||||
}
|
||||
@@ -125,7 +127,9 @@ public class FluidStackHooksImpl {
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@NotNull FluidStack stack) {
|
||||
if (stack.getFluid() == Fluids.EMPTY) return null;
|
||||
TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid()).getFluidSprites(null, null, stack.getFluid().defaultFluidState());
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(stack.getFluid());
|
||||
if (handler == null) return null;
|
||||
TextureAtlasSprite[] sprites = handler.getFluidSprites(null, null, stack.getFluid().defaultFluidState());
|
||||
if (sprites == null) return null;
|
||||
return sprites[0];
|
||||
}
|
||||
@@ -134,7 +138,9 @@ public class FluidStackHooksImpl {
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@NotNull Fluid fluid) {
|
||||
if (fluid == Fluids.EMPTY) return null;
|
||||
TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState());
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
if (handler == null) return null;
|
||||
TextureAtlasSprite[] sprites = handler.getFluidSprites(null, null, fluid.defaultFluidState());
|
||||
if (sprites == null) return null;
|
||||
return sprites[0];
|
||||
}
|
||||
@@ -165,7 +171,9 @@ public class FluidStackHooksImpl {
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getFlowingTexture(@NotNull Fluid fluid) {
|
||||
if (fluid == Fluids.EMPTY) return null;
|
||||
TextureAtlasSprite[] sprites = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidSprites(null, null, fluid.defaultFluidState());
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
if (handler == null) return null;
|
||||
TextureAtlasSprite[] sprites = handler.getFluidSprites(null, null, fluid.defaultFluidState());
|
||||
if (sprites == null) return null;
|
||||
return sprites[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user