Implement fluid overlay texture rendering for custom fluids.

This commit is contained in:
David Quintana committed 2020-02-02 23:02:56 +01:00
1 parent d86f58a0df
commit a901d80dd5
4 files changed
+39 -7

No files matched your search

@@ -525,9 +525,11 @@ public class ForgeHooksClient
@SuppressWarnings("deprecation")
public static TextureAtlasSprite[] getFluidSprites(ILightReader world, BlockPos pos, IFluidState fluidStateIn)
{
ResourceLocation overlayTexture = fluidStateIn.getFluid().getAttributes().getOverlayTexture();
return new TextureAtlasSprite[] {
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getStillTexture(world, pos)),
Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(fluidStateIn.getFluid().getAttributes().getFlowingTexture(world, pos)),
overlayTexture == null ? null : Minecraft.getInstance().func_228015_a_(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(overlayTexture),
};
}
@@ -52,6 +52,7 @@ public class NewFluidTest
public static final ResourceLocation FLUID_STILL = new ResourceLocation("minecraft:block/brown_mushroom_block");
public static final ResourceLocation FLUID_FLOWING = new ResourceLocation("minecraft:block/mushroom_stem");
public static final ResourceLocation FLUID_OVERLAY = new ResourceLocation("minecraft:block/obsidian");
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID);
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID);
@@ -72,7 +73,7 @@ public class NewFluidTest
);
public static final ForgeFlowingFluid.Properties test_fluid_properties =
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).color(0x3F1080FF))
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).overlay(FLUID_OVERLAY).color(0x3F1080FF))
.bucket(test_fluid_bucket).block(test_fluid_block);
public NewFluidTest()