Update and clean up Forge fluid render model (#4763)

This commit is contained in:
Ben Staddon authored and mezz committed 2018-07-17 20:37:20 -07:00
1 parent ab228832f2
commit 2786cd279c
14 files changed
+620 -469

No files matched your search

@@ -67,6 +67,9 @@ public class Fluid
protected final ResourceLocation still;
protected final ResourceLocation flowing;
@Nullable
protected final ResourceLocation overlay;
private SoundEvent fillSound;
private SoundEvent emptySound;
@@ -108,8 +111,6 @@ public class Fluid
/**
* This indicates if the fluid is gaseous.
*
* Useful for rendering the fluid in containers and the world.
*
* Generally this is associated with negative density fluids.
*/
protected boolean isGaseous;
@@ -140,22 +141,38 @@ public class Fluid
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing, Color color)
{
this(fluidName, still, flowing);
this(fluidName, still, flowing, null, color);
}
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay, Color color)
{
this(fluidName, still, flowing, overlay);
this.setColor(color);
}
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing, int color)
{
this(fluidName, still, flowing);
this(fluidName, still, flowing, null, color);
}
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay, int color)
{
this(fluidName, still, flowing, overlay);
this.setColor(color);
}
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing)
{
this(fluidName, still, flowing, (ResourceLocation) null);
}
public Fluid(String fluidName, ResourceLocation still, ResourceLocation flowing, @Nullable ResourceLocation overlay)
{
this.fluidName = fluidName.toLowerCase(Locale.ENGLISH);
this.unlocalizedName = fluidName;
this.still = still;
this.flowing = flowing;
this.overlay = overlay;
}
public Fluid setUnlocalizedName(String unlocalizedName)
@@ -253,6 +270,16 @@ public class Fluid
return block != null;
}
public final boolean isLighterThanAir()
{
int density = this.density;
if (block instanceof BlockFluidBase)
{
density = ((BlockFluidBase) block).getDensity();
}
return density <= 0;
}
/**
* Determines if this fluid should vaporize in dimensions where water vaporizes when placed.
* To preserve the intentions of vanilla, fluids that can turn lava into obsidian should vaporize.
@@ -360,6 +387,12 @@ public class Fluid
return flowing;
}
@Nullable
public ResourceLocation getOverlay()
{
return overlay;
}
public SoundEvent getFillSound()
{
if(fillSound == null)