Jump to content

1.12.2 onBlockActivated and extends of Block


frakier

Recommended Posts

I've run into a few methods that have been removed/missing like onBlockActivated
From minecraft classes that extend the Block class such as...
BlockTorch
BlockBush
Just for examples.

I'm kind of new to this so I figured I would ask what I am missing
before I drop back to the block class and reinvent the wheel.
Should I wait for 1.12.2 to mature more?
Thanks
 

Link to comment
Share on other sites

Sorry, I had gotten into a brain loop and had started assuming based on experience from other work I'm doing that the code was there in 1.10. I had convinced myself that somewhere between 1.10 and 1.12 that the method was removed. If I had thought to look back at 1.10 source I would have realized my mistake. I even had the 1.10 source open in a window.

Thanks for the jolt, knocked me out of that endless loop. I've been running around in for hours.

Edited by frakier
Link to comment
Share on other sites

Apparently some people use it when they are not overriding anything. Or maybe I'm just misunderstanding. Like I said still learning.

In this case the author had a customTorch class that extends BlockTorch [a minecraft class] which of course extends Block [a minecraft class].

@Override was used on the onBlockActivated method in customTorch and of course as you say BlockTorch does not have the onBlockActivated method but Block does.

Most of what I have done has been fairly simple up to now and I have used @Override only when.. well overriding a method int a direct parent class.

Figured I need to go learn more on the subject.

Link to comment
Share on other sites

 

2 minutes ago, diesieben07 said:

Here is your mistake. Overriding takes place whether the method comes from a direct superclass or a superclass "further up".

I see that now.  Makes sense. Believe it or not I have programmed in other languages switching to Java has been a bit different, when I quit getting in my own way I'll have it. I've already setup forge and source for mods from off-line, made simple changes and compiled jar files. This is mostly just a weekend hobby I'm trying to learn and I learn better by example, matching examples from real world [and current forge] to tutorials on-line is interesting to say the least.
Thanks for the help.

Link to comment
Share on other sites

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.