Jump to content

[1.18.2] how to create my own fluid overlay


18o4

Recommended Posts

IIneS16.pngcPcBx2I.png

the images above show fluid overlays for lava and water.

below is my current code for my own fluid:

Spoiler
package me.minioof.minimod.fluid;

import me.minioof.minimod.block.ModBlocks;
import me.minioof.minimod.fluid.custom.OrangeJuice;
import me.minioof.minimod.item.ModItems;
import me.minioof.minimod.minimod;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class ModFluids {
    public static final ResourceLocation WATER_STILL_RL = new ResourceLocation("block/water_still");
    public static final ResourceLocation WATER_FLOWING_RL = new ResourceLocation("block/water_flow");
    public static final ResourceLocation WATER_OVERLAY_RL = new ResourceLocation("block/water_overlay");

    public static final DeferredRegister<Fluid> FLUIDS
            = DeferredRegister.create(ForgeRegistries.FLUIDS, minimod.MOD_ID);

    public static final RegistryObject<FlowingFluid> ORANGE_JUICE_FLUID
            = FLUIDS.register("orange_juice", () -> new OrangeJuice.Source(ModFluids.ORANGE_JUICE_PROPERTIES));

    public static final RegistryObject<FlowingFluid> ORANGE_JUICE_FLOWING
            = FLUIDS.register("orange_juice_flowing", () -> new OrangeJuice.Flowing(ModFluids.ORANGE_JUICE_PROPERTIES));


    public static final ForgeFlowingFluid.Properties ORANGE_JUICE_PROPERTIES = new ForgeFlowingFluid.Properties(
            () -> ORANGE_JUICE_FLUID.get(), () -> ORANGE_JUICE_FLOWING.get(), FluidAttributes.builder(WATER_STILL_RL, WATER_FLOWING_RL)
            .density(15).luminosity(2).viscosity(5).sound(SoundEvents.HONEY_DRINK).overlay(WATER_OVERLAY_RL)
            .color(0xbfffa12c)).slopeFindDistance(3).levelDecreasePerBlock(3)
            .block(() -> ModFluids.ORANGE_JUICE_BLOCK.get()).bucket(() -> ModItems.ORANGE_JUICE_BUCKET.get());

    public static final RegistryObject<LiquidBlock> ORANGE_JUICE_BLOCK = ModBlocks.BLOCKS.register("orange_juice",
            () -> new LiquidBlock(() -> ModFluids.ORANGE_JUICE_FLUID.get(), BlockBehaviour.Properties.of(Material.WATER)
                    .noCollission().strength(100f).noDrops()));


    public static void register(IEventBus eventBus) {
        FLUIDS.register(eventBus);
    }
}

 

How can i make my own fluid overlay? I would like it to recolor stuff, like water, and have high fog level like lava.

Thanks.

Link to comment
Share on other sites

Forge added support for this in 1.19 (search for rendering) - https://github.com/MinecraftForge/MinecraftForge/issues/8608

I don't think there is anything for this in 1.18.2, but somebody might correct me? 

  • Thanks 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.