Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm trying to make a fluid, the bucket was okay, but when you pick it up with bucket,  it's turns to a water bucket. Then I try to listen to FillBucketEvent, and using event's result to do the custom bucket. But, I found

FluidContainerRegistry.fillFluidContainer();

is not there, even FluidContainerRegistry is not exist. The changelog is not mentioned the class is removed. So I wonder how to solve it.

Enable the Universal Bucket by calling FluidRegistry.enableUniversalBucket before preInit (e.g. in a static initialiser of your @Mod class), then add your Fluid to the Universal Bucket by calling FluidRegistry.addBucketForFluid in preInit. There's no need to create your own bucket or handle any events, the Universal Bucket does it all for you.

 

You can use UniversalBucket.getFilledBucket to get a Universal Bucket filled with a Fluid (ForgeModContainer#universalBucket stores Forge's UniversalBucket instance) or create an ItemStack of a fluid container, get its IFluidHandlerItem capability and fill it with IFluidHandler#fill.

 

The FluidUtil class contains several methods for dealing with IFluidHandlers, including player interaction.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

So you mean like this?

ObjList.java
public static void register() {
  GameRegistry.register(BucketMoltenFe50C);
  FluidRegistry.addBucketForFluid(FluidLoader.fluidMoltenFe50C);
  FluidRegistry.enableUniversalBucket();
  GameRegistry.register(BlockFluidMoltenFe50C);
 }
EventHandler.java
@SubscribeEvent
 public void onFillBucket(FillBucketEvent event) {
  System.out.println("[DEBUG] SteamTech >> Listening to FillBucketEvent. If the error is cleared, disable the debug.");
  BlockPos blockpos = event.getTarget().getBlockPos();
        IBlockState blockState = event.getWorld().getBlockState(blockpos);
        Fluid fluid = FluidRegistry.lookupFluidForBlock(blockState.getBlock());
        if (fluid != null && new Integer(0).equals(blockState.getValue(BlockFluidBase.LEVEL)))
        {
            FluidStack fluidStack = new FluidStack(fluid, 1000);
            event.getWorld().setBlockToAir(blockpos);
            UniversalBucket.getFilledBucket(item, fluid);
            event.setResult(Result.ALLOW);
        }
       
 }

btw what is the "item" in EventHandler.java line 11

I think the FluidContainerRegistry is deprecated/removed, right?

PS. Don't mind the names. It's steel.

 

Edited by LeoCTH

9 minutes ago, LeoCTH said:

So you mean like this?

public static void register() {
  GameRegistry.register(BucketMoltenFe50C);
  FluidRegistry.addBucketForFluid(FluidLoader.fluidMoltenFe50C);
  FluidRegistry.enableUniversalBucket();
  GameRegistry.register(BlockFluidMoltenFe50C);
 }

I think the FluidContainerRegistry is deprecated/removed, right?

PS. Don't mind the names. It's steel.

 

 

FluidRegistry.enableUniversalBucket must be called before preInit, like I said in my post. You also don't need to create or register your own bucket Item if you're using the Universal Bucket.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author
12 minutes ago, Choonster said:

 

FluidRegistry.enableUniversalBucket must be called before preInit, like I said in my post. You also don't need to create or register your own bucket Item if you're using the Universal Bucket.

Oh okay, before? How?

 

1 minute ago, LeoCTH said:

Oh okay, before? How?

 

38 minutes ago, Choonster said:

Enable the Universal Bucket by calling FluidRegistry.enableUniversalBucket before preInit (e.g. in a static initialiser of your @Mod class)

 

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.