@@ -48,7 +48,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo
48
48
49
49
public ModelDynBucket ()
50
50
{
51
- this (null , null , null , FluidRegistry . WATER , false );
51
+ this (null , null , null , null , false );
52
52
}
53
53
54
54
public ModelDynBucket (ResourceLocation baseLocation , ResourceLocation liquidLocation , ResourceLocation coverLocation , Fluid fluid , boolean flipGas )
@@ -88,22 +88,26 @@ public IFlexibleBakedModel bake(IModelState state, VertexFormat format,
88
88
ImmutableMap <TransformType , TRSRTransformation > transformMap = IPerspectiveAwareModel .MapWrapper .getTransforms (state );
89
89
90
90
// if the fluid is a gas wi manipulate the initial state to be rotated 180° to turn it upside down
91
- if (flipGas && fluid .isGaseous ())
91
+ if (flipGas && fluid != null && fluid .isGaseous ())
92
92
{
93
93
state = new ModelStateComposition (state , TRSRTransformation .blockCenterToCorner (new TRSRTransformation (null , new Quat4f (0 , 0 , 1 , 0 ), null , null )));
94
94
}
95
95
96
96
TRSRTransformation transform = state .apply (Optional .<IModelPart >absent ()).or (TRSRTransformation .identity ());
97
- TextureAtlasSprite fluidSprite = bakedTextureGetter . apply ( fluid . getStill ()) ;
97
+ TextureAtlasSprite fluidSprite = null ;
98
98
ImmutableList .Builder <BakedQuad > builder = ImmutableList .builder ();
99
99
100
+ if (fluid != null ) {
101
+ fluidSprite = bakedTextureGetter .apply (fluid .getStill ());
102
+ }
103
+
100
104
if (baseLocation != null )
101
105
{
102
106
// build base (insidest)
103
107
IFlexibleBakedModel model = (new ItemLayerModel (ImmutableList .of (baseLocation ))).bake (state , format , bakedTextureGetter );
104
108
builder .addAll (model .getGeneralQuads ());
105
109
}
106
- if (liquidLocation != null )
110
+ if (liquidLocation != null && fluidSprite != null )
107
111
{
108
112
TextureAtlasSprite liquid = bakedTextureGetter .apply (liquidLocation );
109
113
// build liquid layer (inside)
@@ -239,7 +243,10 @@ public IBakedModel handleItemState(ItemStack stack)
239
243
240
244
// not a fluid item apparently
241
245
if (fluidStack == null )
246
+ {
247
+ // empty bucket
242
248
return this ;
249
+ }
243
250
244
251
245
252
Fluid fluid = fluidStack .getFluid ();
0 commit comments