Skip to content

Commit dad870e

Browse files
committed
Merge pull request MinecraftForge#2375 from bonii-xx/dynbucket
Default bucket model is empty, allow bucket model without fluid.
2 parents 38531a5 + 2857b71 commit dad870e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/net/minecraftforge/client/model/ModelDynBucket.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableMo
4848

4949
public ModelDynBucket()
5050
{
51-
this(null, null, null, FluidRegistry.WATER, false);
51+
this(null, null, null, null, false);
5252
}
5353

5454
public ModelDynBucket(ResourceLocation baseLocation, ResourceLocation liquidLocation, ResourceLocation coverLocation, Fluid fluid, boolean flipGas)
@@ -88,22 +88,26 @@ public IFlexibleBakedModel bake(IModelState state, VertexFormat format,
8888
ImmutableMap<TransformType, TRSRTransformation> transformMap = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
8989

9090
// 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())
9292
{
9393
state = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null)));
9494
}
9595

9696
TRSRTransformation transform = state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity());
97-
TextureAtlasSprite fluidSprite = bakedTextureGetter.apply(fluid.getStill());
97+
TextureAtlasSprite fluidSprite = null;
9898
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
9999

100+
if(fluid != null) {
101+
fluidSprite = bakedTextureGetter.apply(fluid.getStill());
102+
}
103+
100104
if (baseLocation != null)
101105
{
102106
// build base (insidest)
103107
IFlexibleBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter);
104108
builder.addAll(model.getGeneralQuads());
105109
}
106-
if (liquidLocation != null)
110+
if (liquidLocation != null && fluidSprite != null)
107111
{
108112
TextureAtlasSprite liquid = bakedTextureGetter.apply(liquidLocation);
109113
// build liquid layer (inside)
@@ -239,7 +243,10 @@ public IBakedModel handleItemState(ItemStack stack)
239243

240244
// not a fluid item apparently
241245
if (fluidStack == null)
246+
{
247+
// empty bucket
242248
return this;
249+
}
243250

244251

245252
Fluid fluid = fluidStack.getFluid();

0 commit comments

Comments
 (0)