Jump to content

Recommended Posts

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

Posted

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.

Posted (edited)

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
Posted

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.

Posted (edited)

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.

Posted

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

×   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



×
×
  • Create New...

Important Information

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