Posted January 4, 20187 yr ..... some of you might say "use universal bucket" ..... But if I use universal bucket, it's pretty useless. So I made a custom bucket that can DRAIN, after that, it returns a normal vanilla bucket. Then, how to let the vanilla bucket accept my new fluid and return my CUSTOM bucket? PS. FillBucketEvent is not working, so maybe I need a help at this too. PPS. This is my bucket code Edited January 4, 20187 yr by LeoCTH add picture code
January 4, 20187 yr Use Event hooks from Forge. So create an EventHandler, make sure it's registered and subscribe an event like so: public static void onBucketUsed(FillBucketEvent event) { World eventWorld = event.getWorld(); BlockPos hitPos = new BlockPos(event.getTarget().hitVec); if(eventWorld.getBlockState(hitPos) == yourBlockRegistry.theliquidVariable) { event.setFilledBucket(new ItemStack(yourItemRegistry.theBucketVariable, 1)); } } Edited January 4, 20187 yr by hiotewdew Fix formatting All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 4, 20187 yr If you want to drain it just add a check to see if the item held is your full bucket and run eventWorld.setBlockState to set the block at hitVec to your liquid. Edited January 4, 20187 yr by hiotewdew grammar All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 4, 20187 yr Author 3 hours ago, hiotewdew said: If you want to drain it just add a check to see if the item held is your full bucket and run eventWorld.setBlockState to set the block at hitVec to your liquid. .... My problem is my REGISTERING process having problem... It's not working
January 4, 20187 yr Why don't you want to use the universal bucket? It's added for a reason... Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
January 4, 20187 yr You never said it wasn't working for you. Only that it's useless. You should use the universal bucket and if you run into issues, post them here. Only if you need your bucket to have custom functionality, would it make sense to make custom buckets. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
January 4, 20187 yr 15 hours ago, LeoCTH said: .... My problem is my REGISTERING process having problem... It's not working Can I have more context than this? Or are you good and used a universal bucket? All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 5, 20187 yr Author 1 hour ago, hiotewdew said: Can I have more context than this? Or are you good and used a universal bucket? I tried FluidRegistry.enableUniversalBucket in a static initializer and FluidRegistry.addBucketForFluid(myFluid) It doesn't work
January 5, 20187 yr Show me the class you register your fluid in. All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 5, 20187 yr Author 9 hours ago, larsgerrits said: You never said it wasn't working for you. Only that it's useless. You should use the universal bucket and if you run into issues, post them here. Only if you need your bucket to have custom functionality, would it make sense to make custom buckets. I said "use" + "less" = "useless" or my grammar have some problem I mean cannot (less) use .... You misunderstanding my point.
January 5, 20187 yr Author 1 minute ago, hiotewdew said: Show me the class you register your fluid in. https://github.com/LeoCTH/MFF/blob/alpha/src/main/java/com/leocthmods/mff/fluids/FluidLoader.java
January 5, 20187 yr You have to call enableUniversalBucket before the pre-initialization stage. Here's a solved thread with an explanation. All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 5, 20187 yr While you do attempt to do the above it is not correct. static { FluidRegistry.enableUniversalBucket(); } public static final String MODID = "mff"; public static final String NAME = "My Food Factory"; public static final String VERSION = "1.0.0"; public static Logger LOGGER; @Mod.Instance(MyFoodFactory.MODID) public static MyFoodFactory instance; Should be changed to this: public static final String MODID = "mff"; public static final String NAME = "My Food Factory"; public static final String VERSION = "1.0.0"; public static Logger LOGGER; @Mod.Instance(MyFoodFactory.MODID) public static MyFoodFactory instance = createInstance(); static MyFoodFactory createInstance() { FluidRegistry.enableUniversalBucket(); } Edited January 5, 20187 yr by hiotewdew fix error All Projects found here: Website Main Programmer for: Better Animals Plus, Better Animal Models Created independently: QuickHomes, ClaimIt, ClaimIt API, CloneLand, DerpCats, QuickTeleports, QuickSpawns, MCMusicPlayer, MCDevDate, [SBM] Fluid Gun, OpenScreens Work on/Contribute to: Bewitchment Commissioned for: [SBM] Breadstone, [SBM] Infinite Falling, [SBM] Dead Man's Satchel, [SBM] Handheld Piston
January 5, 20187 yr Author 4 hours ago, hiotewdew said: While you do attempt to do the above it is not correct. static { FluidRegistry.enableUniversalBucket(); } public static final String MODID = "mff"; public static final String NAME = "My Food Factory"; public static final String VERSION = "1.0.0"; public static Logger LOGGER; @Mod.Instance(MyFoodFactory.MODID) public static MyFoodFactory instance; Should be changed to this: public static final String MODID = "mff"; public static final String NAME = "My Food Factory"; public static final String VERSION = "1.0.0"; public static Logger LOGGER; @Mod.Instance(MyFoodFactory.MODID) public static MyFoodFactory instance = createInstance(); static MyFoodFactory createInstance() { FluidRegistry.enableUniversalBucket(); } .... the "static initializer block" it SUPPOSED to be like static { // TODO } in Oracle's Docs and this thread. but it's totally NOT working (the bucket can be registered with no functionality) Edited January 5, 20187 yr by LeoCTH grammar
January 5, 20187 yr The way he does the static initializer block should be fine. Universal bucket works for me and I enable it the same way. You can try by looking/using/copying my example mod here: https://github.com/jabelar/ExampleMod-1.12 Perhaps the problem has to do with the fluid, or the order in which the fluid and bucket are instantiated or registered. But your code looks like it should work. The only thing you do that is kinda weird/different than most is that you instantiate an anonymous instance of your loader classes whereas I would normally make the loader methods static. I don't think that's really a problem, but maybe it is causing trouble. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.