Jump to content

Recommended Posts

Posted

I have been trying to figure out why my fluids won't place down from my bucket items that I have created

public abstract class MilkChocolateFluid extends FlowingFluid {
    @Override
    public Fluid getFlowingFluid() {
        return ModFluids.flowingmilkchocolate;
    }

    @Override
    public Fluid getStillFluid() {
        return ModFluids.milkchocolatefluid;
    }

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

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

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

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

     @Override
     public BucketItem getFilledBucket() {
         return ModItems.MILK_CHOCOLATE_BUCKET.get();
     }

    @Override
    protected boolean canDisplace(FluidState fluidState, IBlockReader blockReader, BlockPos pos, Fluid fluid, Direction direction) {
        return direction == Direction.DOWN && !fluid.isIn((ITag<Fluid>) ModFluids.milkchocolatefluid);
    }

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

    @Override
    protected float getExplosionResistance() {
        return 100.0F;
    }

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

    @Override
    public boolean isEquivalentTo(Fluid fluidIn) {
        return fluidIn == ModFluids.milkchocolatefluid || fluidIn == ModFluids.flowingmilkchocolate;
    }
    public static class Flowing extends ChocolateFluid {

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

        @Override
        public BucketItem getFilledBucket() {
            return null;
        }

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

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

    public static class Source extends ChocolateFluid {

        @Override
        public BucketItem getFilledBucket() {
            return ModItems.MILK_CHOCOLATE_BUCKET.get();
        }

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

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

    }
}

Just in case I'll also put down my Bucket Item code

public static RegistryObject<BucketItem> CHOCOLATE_BUCKET = ITEMS.register("chocolate_bucket", () ->
            new BucketItem( () -> ModFluids.chocolatefluid, new Item.Properties().group(ChocolateItemGroup.CHOCOLATE_ITEM_GROUP)
                    .maxStackSize(1).containerItem(BUCKET)
            )
    );

It registers into the game, is there something I'm missing to connect the two?

Posted (edited)
14 hours ago, diesieben07 said:

These are not the same. Elaborate?

 

 

You should probably use ForgeFlowingFluid and you need to also have an actual block for your fluid, so it can be placed.

Oops I showed the wrong code, I have two fluids 

public static RegistryObject<BucketItem> CHOCOLATE_BUCKET = ITEMS.register("chocolate_bucket", () ->
            new BucketItem( () -> ModFluids.chocolatefluid, new Item.Properties().group(ChocolateItemGroup.CHOCOLATE_ITEM_GROUP)
                    .maxStackSize(1).containerItem(BUCKET)
            )
    );
    public static RegistryObject<BucketItem> MILK_CHOCOLATE_BUCKET = ITEMS.register("milk_chocolate_bucket", () ->
            new BucketItem( () -> ModFluids.chocolatefluid, new Item.Properties().group(ChocolateItemGroup.CHOCOLATE_ITEM_GROUP)
                    .maxStackSize(1).containerItem(BUCKET)
            )
    );

And this is the code for my fluid blocks

 public static final RegistryObject<FlowingFluidBlock> CHOCOLATE_FLUID_BLOCK = BLOCKS.register("chocolate_fluid", () ->
            new FlowingFluidBlock(() -> ModFluids.chocolatefluid, AbstractBlock.Properties.create(Material.WATER).noDrops().doesNotBlockMovement())
    );
    public static final RegistryObject<FlowingFluidBlock> MILK_CHOCOLATE_FLUID_BLOCK = BLOCKS.register("milk_chocolate_fluid", () ->
            new FlowingFluidBlock(() -> ModFluids.milkchocolatefluid, AbstractBlock.Properties.create(Material.WATER).noDrops().doesNotBlockMovement())
    );

I'll comment out my current code and give ForgeFlowingFluid a try

Edit: The code used to register my fluids

public class ModFluids {


    //Deferred register calls the block
    public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, chocolate.MODID);

    //Attaches the deferred register to the event bus
    public static void init()
    {
        FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }


    public static final ChocolateFluid.Source chocolatefluid = null;
    public static final ChocolateFluid.Flowing flowingchocolatefluid = null;

    public static final MilkChocolateFluid.Source milkchocolatefluid = null;
    public static final MilkChocolateFluid.Flowing flowingmilkchocolate = null;



}

Also, I've tried using forgeflowingfluid and got the same result. I'm genuinely perplexed by this.

Edited by tal124
Posted

I believe my problem is with my registration of the fluids and not with the fluids themselves

 

public class ModFluids extends Fluids{


    //Deferred register calls the block
    public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, chocolate.MODID);
    

    //Attaches the deferred register to the event bus
    public static void init()
    {
        FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }


    public static final FlowingFluid FLOWINGCHOCOLATEFLUID = null;
    public static final FlowingFluid CHOCOLATEFLUID = null;
    public static final FlowingFluid FLOWINGMILKCHOCOLATEFLUID = null;
    public static final FlowingFluid MILKCHOCOLATEFLUID = null;
    
    
    

I thought doing this might be helpful,  and I've looked into the code for Water fluid registration but it uses deprecated code that I'm not sure what would be used in place for forge

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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