diff --git a/src/main/java/com/altnoir/poopsky/PoopSky.java b/src/main/java/com/altnoir/poopsky/PoopSky.java index a19b125..7767e25 100644 --- a/src/main/java/com/altnoir/poopsky/PoopSky.java +++ b/src/main/java/com/altnoir/poopsky/PoopSky.java @@ -22,6 +22,7 @@ import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderers; +import net.minecraft.resources.ResourceLocation; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; @@ -33,9 +34,12 @@ import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent; +import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; import net.neoforged.neoforge.event.server.ServerStartingEvent; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; @Mod(PoopSky.MOD_ID) @@ -124,5 +128,25 @@ public static void onRegisterBlockColors(RegisterColorHandlersEvent.Block event) public static void onRegisterFluidRenderTypes(net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent event) { event.registerRenderBuffer(RenderType.translucent()); } + + @SubscribeEvent + public static void registerClientExtensions(RegisterClientExtensionsEvent event) { + event.registerFluidType(new IClientFluidTypeExtensions() { + @Override + public @NotNull ResourceLocation getStillTexture() { + return PSFluidTypes.POOP_STILL_TEXTURE; + } + + @Override + public @NotNull ResourceLocation getFlowingTexture() { + return PSFluidTypes.POOP_FLOWING_TEXTURE; + } + + @Override + public ResourceLocation getOverlayTexture() { + return PSFluidTypes.POOP_OVERLAY_TEXTURE; + } + }, PSFluidTypes.POOP_FLUID_TYPE.get()); + } } } \ No newline at end of file diff --git a/src/main/java/com/altnoir/poopsky/fluid/PSFluidTypes.java b/src/main/java/com/altnoir/poopsky/fluid/PSFluidTypes.java index ac3f297..6b0dad9 100644 --- a/src/main/java/com/altnoir/poopsky/fluid/PSFluidTypes.java +++ b/src/main/java/com/altnoir/poopsky/fluid/PSFluidTypes.java @@ -1,6 +1,7 @@ package com.altnoir.poopsky.fluid; import com.altnoir.poopsky.PoopSky; +import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.neoforged.neoforge.common.SoundActions; import net.neoforged.neoforge.fluids.FluidType; @@ -9,28 +10,24 @@ import java.util.function.Supplier; -public class PSFluidTypes extends FluidType { +public class PSFluidTypes { public static final DeferredRegister FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, PoopSky.MOD_ID); - public static final Supplier POOP_FLUID_TYPE = FLUID_TYPES.register("poop", () -> new FluidType(FluidType.Properties.create() - .descriptionId("block.poopsky.poop_liquid") - .fallDistanceModifier(0F) - .canExtinguish(true) - .canConvertToSource(true) - .supportsBoating(true) - .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL_LAVA) - .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY_LAVA) - .density(3000) - .viscosity(6000) - .lightLevel(1) - )); + public static final ResourceLocation POOP_STILL_TEXTURE = ResourceLocation.fromNamespaceAndPath(PoopSky.MOD_ID, "block/poop_liquid"); + public static final ResourceLocation POOP_FLOWING_TEXTURE = ResourceLocation.fromNamespaceAndPath(PoopSky.MOD_ID, "block/poop_liquid_flowing"); + public static final ResourceLocation POOP_OVERLAY_TEXTURE = ResourceLocation.fromNamespaceAndPath(PoopSky.MOD_ID, "block/poop_liquid"); - /** - * Default constructor. - * - * @param properties the general properties of the fluid type - */ - public PSFluidTypes(Properties properties) { - super(properties); - } + public static final Supplier POOP_FLUID_TYPE = FLUID_TYPES.register("poop", + () -> new FluidType(FluidType.Properties.create() + .descriptionId("block.poopsky.poop_liquid") + .fallDistanceModifier(0F) + .canExtinguish(true) + .canConvertToSource(true) + .supportsBoating(true) + .sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL_LAVA) + .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY_LAVA) + .density(3000) + .viscosity(6000) + .lightLevel(1) + )); } \ No newline at end of file diff --git a/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png b/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png new file mode 100644 index 0000000..8ce5bcc Binary files /dev/null and b/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png differ diff --git a/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png.mcmeta b/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png.mcmeta new file mode 100644 index 0000000..125504f --- /dev/null +++ b/src/main/resources/assets/poopsky/textures/block/poop_liquid_flowing.png.mcmeta @@ -0,0 +1,12 @@ +{ + "animation": + { + "height": 16, + "width": 16, + "frametime": 4, + "frames": + [ + 0,1,2,3,4,5,6 + ] + } +}