Posted December 18, 20159 yr Just wondering why the instance method block.isAir (as an example from many methods) takes parameters in the method call, when the instance of the class already has the required properties. I've just looked at the de-obfuscated source code of net.minecraft.block.Block and as I suspected the parameters are unused. There appear to be other examples in this class, and I'm sure I've seen it in other classes too. It would make sense to require the parameters if it were a static method, but myself being an experienced software developer that's fairly new to Minecraft Forge modding, I'm just trying to understand if there's some history or a reason why it's like this?
December 18, 20159 yr Block#isAir is a method added by Forge. Presumably it takes parameters so mods can base the result on some property of the location (e.g. blockstate/metadata, TileEntity value, per-world or per-level values). 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.
December 18, 20159 yr In other words, isAir is like an abstract method whose parameters are there to be used when child classes override it. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
December 18, 20159 yr I think JeffryFisher's answer is the main reason. I also suspect that some parameters are just left-over from some coding change. I'm sure you have experience of coding a method thinking you'll need certain parameters, then later you revise your code and eventually some parameters become unused. Or maybe that is just me... Check out my tutorials here: http://jabelarminecraft.blogspot.com/
December 18, 20159 yr We don't control the code the modders write. We don't control the code the mojang writes. Modders wanted more information for this and other methods in block, Forge added that information. Remember that Blocks only have ONE instance, so no, the world and position are not available to the blocks. Hence the addition. That's the entire point of Forge. We have to keep compatibility with vanilla, so we have to keep the old methods and call them as well. Stop trying to apply a overarching cohesive single design to Minecraft. It's simply not there. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
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.