Posted April 13, 20169 yr To create Primed TNT I need to have an "Igniter" EntityTNTPrimed(World worldIn, double x, double y, double z, EntityLivingBase igniter) But what happens if I dont have an entity to associate the event with? This needs to be called within onNeighborBlockChange How would I go around this?
April 13, 20169 yr If the TNT wasn't ignited by an entity, just pass null . If you look at the doc comment or usages of EntityTNTPrimed#getTntPlacedBy (which returns the EntityLivingBase passed to the constructor), you'll see that null is a valid and expected return value. 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.
April 13, 20169 yr Other project I was working with named a paramter like that as "[ x ]OrNull" e.g. "igniterOrNull" to make it clear that it was a parameter that wouldn't throw NPE if you passed in null, as it was intended to handle such things. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 13, 20169 yr I didn't know about @Nullable. Not that I'm surprised. The thing I was talking about was a function parameter not a return value on an interface. For example, using the OP's method: public void EntityTNTPrimed(World worldIn, double x, double y, double z, EntityLivingBase igniterOrNull) {...} Is there a cleaner way of doing it there? The point I was trying to raise is "MCP could note this kind of stuff and it would be useful." (I just don't care how) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 13, 20169 yr Ah, neat. Learn something new every day. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 14, 20169 yr Poked around in C# (my Unity3D project) seeing if it had nullable parameters and it does, but for the simple types (e.g. someMethod(int? nullableIntVar){} ) but not for the complex types, as complex objects can already be assumed to be capable of being null. So the project I was working in that had a "[ x ]OrNull" parameter was justified in making the name indicate that the method could handle null values being pased vs. a "this object must not be null" method. I should note that the .NET version for Unity is garbage: 2.0, updating to a newer version is under the "research" category on the roadmap. I.e. not even on the "long term development" track yet, much less the next two releases. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.