Jump to content

Recommended Posts

Posted

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?

Posted
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.

Posted

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.

Posted

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/

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.