Posted March 13, 20214 yr 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?
March 13, 20214 yr Author 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 March 14, 20214 yr by tal124
March 14, 20214 yr Author 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.