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 finding the universal bucket code to be rather opaque and spread out.  I want to simply create my own skin for a universal bucket.  Rather than the iron skin that is there, I want to use something else (because I'm adding a bucket which doesn't require iron to craft, I want to see that bucket's material on the bucket).

 

I'm sure that what I have is wrong (because I don't know how to get a variant?), but here it is anyway:

 

https://pastebin.com/hwLB2Qnf

You can't change the textures of Forge's UniversalBucket instance (those are specified in assets/forge/blockstates/dynbucket.json), but you can create and register your own instance and specify your own textures.

 

The universal bucket uses ModelDynBucket for its model, this is a dynamically-generated model that retextures itself based on the fluid contained in the ItemStack.

 

Forge uses ModelLoader.setBucketModelDefinition to set the universal bucket's model, you can do the same thing as this method but specify your own blockstates file instead of using Forge's one.

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

Thank you, kind sir.  I've been beating my head against the wall for hours looking for this.

Edited by Edowyth
Comma

  • Author

Hmm, maybe I've missed something, but it seems that you still have to create a new instance of the vanilla bucket for the universal bucket to deal with, with your own right-click functionality implemented so that you can pick up forge fluids ...  Here's what I've got:

 

https://pastebin.com/r6p37jdc

I can't right click and pick up water.  It just seems wrong to implement another bucket item for the "empty bucket" mechanics, but it seems like the universal bucket doesn't do this?  This is from the onItemRightClick of the universal bucket:

https://pastebin.com/zKy2KwFJ

 

"empty bucket shouldn't exist, do nothing since it should be handled by the bucket event"

What?  This *is* the bucket.  If it doesn't handle empty-bucket actions, then I've got to have two items (one empty, one for everything else) and implement the onItemRightClick of the empty bucket since the universal bucket can't handle it and the vanilla bucket has no idea about forge fluid handling.

Edited by Edowyth

  • Author

OK, for anyone interested in the future ... yes you have to create your own "empty bucket" instance of a bucket.

I've finally got a working generic bucket except for two things:

 

* I've not provided a bunch of models for it to mesh together, so the texture is always the same.

* When placed, liquids do not flow

 

I'll work on fixing these, then post my solutions here for posterity.

I managed to get this working with a single Item per bucket type, you can see my code here.

 

This involves overriding several UniversalBucket methods that assume that the empty and full buckets are different Items and using an IFluidHandlerItem implementation that isn't limited to the Forge/Vanilla bucket Items.

 

The model registration was already handled automatically by my existing code, so you won't see it in the linked commit. I essentially do the same thing that Forge does in ModelLoader.setBucketModelDefinition.

Edited by Choonster

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

That's far fewer overloaded methods than I had.  This is exactly what I need ... thanks so much!

 

I'm going to debug and see where I went wrong, then pare down to only the necessary overloads.  You're truly amazing, Choonster.

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.