Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Modded 1.16 fluid has no physics


Recommended Posts

I have modded a fluid into the game, but it does not push entities like water does, nor does it allow the player to float in it. I have tried adding .density(1) and .viscosity(1) in the fluid attributes builder, but it did nothing. There is also nothing in the water class that shows how the player can float in it.

My Class:

package com.nulldev.modbase.blocks;

import com.nulldev.modbase.ModBase;
import com.nulldev.modbase.util.CustomFluids;
import com.nulldev.modbase.util.RegistryHandler;
import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.WaterFluid;
import net.minecraft.item.Item;
import net.minecraft.state.StateContainer;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fml.RegistryObject;

public abstract class RedWater extends FlowingFluid {

    @Override
    public Fluid getFlowingFluid() {
        return CustomFluids.flowingRedWater;
    }

    @Override
    public Fluid getStillFluid() {
        return CustomFluids.redWater;
    }

    @Override
    protected boolean canSourcesMultiply() {
        return false;
    }

    @Override
    protected void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) {

    }

    @Override
    protected int getSlopeFindDistance(IWorldReader worldIn) {
        return 1;
    }

    @Override
    protected int getLevelDecreasePerBlock(IWorldReader worldIn) {
        return 1;
    }

    @Override
    public Item getFilledBucket() {
        return RegistryHandler.RED_WATER_BUCKET.get();
    }

    @Override
    protected boolean canDisplace(FluidState p_215665_1_, IBlockReader p_215665_2_, BlockPos p_215665_3_, Fluid p_215665_4_, Direction p_215665_5_) {
        return true;
    }

    @Override
    public int getTickRate(IWorldReader p_205569_1_) {
        return 5;
    }

    @Override
    protected float getExplosionResistance() {
        return 100;
    }

    @Override
    protected BlockState getBlockState(FluidState state) {
        return RegistryHandler.RED_WATER.get().getDefaultState().with(FlowingFluidBlock.LEVEL, Integer.valueOf(getLevelFromState(state)));
    }

    @Override
    public boolean isEquivalentTo(Fluid fluidIn) {
        return fluidIn == CustomFluids.redWater || fluidIn == CustomFluids.flowingRedWater;
    }

    @Override
    protected FluidAttributes createAttributes() {
        return FluidAttributes.builder(RegistryHandler.location("blocks/red_water_still"), RegistryHandler.location("blocks/red_water_flowing"))
                .translationKey("block." + ModBase.MODID + ".red_water")
                .density(1)
                .viscosity(2)
                .build(this);
    }

    public static class Flowing extends RedWater {

        @Override
        protected void fillStateContainer(StateContainer.Builder<Fluid, FluidState> builder) {
            super.fillStateContainer(builder);
            builder.add(LEVEL_1_8);
        }

        @Override
        public boolean isSource(FluidState state) {
            return false;
        }

        @Override
        public int getLevel(FluidState state) {
            return state.get(RedWater.LEVEL_1_8);
        }
    }

    public static class Source extends RedWater {

        @Override
        public boolean isSource(FluidState state) {
            return true;
        }

        @Override
        public int getLevel(FluidState state) {
            return 8;
        }
    }
}

I had seen another post that said to put this in data/minecraft/tags/fluids:

{
  "replace": false,
  "values": [
    "tso_blocksdrawing:still_red_water",
    "tso_blocksdrawing:flowing_red_water"
  ]
}

but that produced this error when I tried loading the world:

Couldn't load fluid tag minecraft:water as it is missing following references: tso_blocksdrawing:still_red_water (from main),tso_blocksdrawing:flowing_red_water (from main)

 

Link to post
Share on other sites
4 minutes ago, brok4d said:

do you have the .mcmeta files along with the textures?

No. I have been trying to get the fluid working before I make those. Do I need the mcmeta for the physics to work?

Link to post
Share on other sites

Well, you should have it, since that's why you get the error, the .png files and the .mcmeta files since the .mcmeta files are for animation if I'm not mistaken.

This is what the .mcmeta have.

{
    "animation":
    {
        "frametime": 4
    }
}
Edited by brok4d
Link to post
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.

Guest
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.



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • This is a core issue in vanilla that has existed since its inception. They way that Items are rendered, is that the edge strip is generated by the CPU, by guessing where the GPU will place the pixels of the forward facing texture. Then the main texture is applied as one quad over top of it. The small white you see is where rounding errors happen and the CPU/GPU are disagreeing. There is no way to fix it beyond building a full model {not cheating like vanilla does and using one quad for the front of the item} This happens in every Minecraft version Modded or not, it varies based on Texture, CPU/GPU combo, and many other things.  
    • I believe this is the log you're asking for, but correct me if i'm wrong. This is from the "latest" txt in the log folder that forge creates after running the jar. Thanks for the help btw!
    • Ok so apparently this bug only seems to happen in 1.16 and up... it's not present in any versions below those specific ones... but apparently, there seems to be an issue with texture stitching in the forge 1.16.4 version 35.1.37, or for that matter any 1.16+ forge version... I have an Intel Iris 1536 MB graphics card and a 2.6 GHz Dual-Core Intel Core i5 processor, and it may need to be updated, an un-updated driver might be the cause of the texture issue, I don't really know, but it seems to be on forge's end more than anything. I'll include an image showing the texture issue if that helps. Also, can someone look into this please? Note: Open the images in a new tab and zoom in ( CMD + on mac, CTRL + on Windows) to see the white lines/gaps in more detail.https://imgur.com/a/INB6g4c
    • Hello everyone!   I'm working on a tree model visualizer object, that can draw a tree dynamically to the screen regardless of how many nodes or subtrees there are. The user can move the display with dragging, and here comes the problem I have. I need every object that is outside of the object to be hidden, like on the advancement screen in vanilla, however, no matter how hard I looked at the vanilla code, I wasn't being able to figure out a way to do this. Right now, my objects are visible outside of the object. That is what I don't want to happen How would I be able to make this happen? Any help is appreciated!
    • sorry i will talk in english. there is the debug.log of server and the client debug.log debug.log
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.