Posted May 23, 201411 yr So I have created a liquid and I'm creating a bucket for it, however, the fluid container registry line is throwing a null pointer exception. Troncraft.java: https://gist.github.com/anonymous/c6006d69a773edea63e5 Crash Report: https://gist.github.com/anonymous/fc4f35a84df9bab4d088 This line in particular is the one having the issue: FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("liquidEnergy", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(liquidEnergyBucket), new ItemStack(Items.bucket)); When I comment this line out, everything works fine, bucket functions normally. I figured this line was there to reqister how many mB it is and some other properties, so I need it correct? Every parameter appears to me to not be null, but obviously that's not the case, could someone help me figure this out? Again, it's not affecting the buckets functionality, I just figured this line was important since it was in the tutorial.
May 24, 201411 yr Try putting a breakpoint at that line, so you can see the null value so that you can search deeper as why that's null, and how to solve it. 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/
May 24, 201411 yr You cannot call getFluidStack() on an unregistered fluid. You must call FluidRegistry#registerFluid(Fluid f) before that, or you will get a null. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 24, 201411 yr Author You cannot call getFluidStack() on an unregistered fluid. You must call FluidRegistry#registerFluid(Fluid f) before that, or you will get a null. But I did register a fluid. This is the second line of my preint: FluidRegistry.registerFluid(liquidEnergy); Which I do before I call the getFluidStack. Does the name parameter need to be the localized or unlocalized name of my fluid? EDIT: I did some experimenting and figured it out! I needed to do liquidEnergy.getName() for the string name parameter.
May 24, 201411 yr No, the real issue is you need to register (and retrieve) your fluid with an all lowercase name, as that is how the key is stored. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 24, 201411 yr Author I mean, is doing it the way I have right now going to cause problems in the future?
May 24, 201411 yr I mean, is doing it the way I have right now going to cause problems in the future? Not knowing when to use the proper case is always a source of problems in programming. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 25, 201411 yr Author Ok, the case issue makes sense, staying consistent and what not with standards. However, is there anything wrong with using fluid.getName() instead of "fluidname"?
May 25, 201411 yr Ok, the case issue makes sense, staying consistent and what not with standards. However, is there anything wrong with using fluid.getName() instead of "fluidname"? Nothing wrong with doing it that way. Whatever works. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
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.