Posted August 27, 20178 yr 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
August 27, 20178 yr 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.
August 27, 20178 yr Author Thank you, kind sir. I've been beating my head against the wall for hours looking for this. Edited August 27, 20178 yr by Edowyth Comma
August 27, 20178 yr 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 August 27, 20178 yr by Edowyth
August 27, 20178 yr 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.
August 27, 20178 yr 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 August 27, 20178 yr 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.
August 27, 20178 yr 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.