Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How to onUpdate


Nightstag
 Share

Recommended Posts

So I'm attempting to use the onUpdate method, which, of course, requires @Override. However, I get an error stating that I need to override or implement a supertype method. So, of course, I type

 

super.onUpdate(itemstack, world, player, par1, par2);

 

I then get another error, stating that this method (onUpdate(ItemStack, Entity, int, boolean)) is undefined for the type object. Am I using the wrong parameters, or do I need to implement something else? Thanks.

 

 

Link to comment
Share on other sites

That is exacly what onUpdate() is for.

 

You override it in your sub-class put whatever relevant code you want (that will launch every tick) and ofc call super.onUpdate() to execute normal Entity lifespan-actions.

 

Maybe you mistaken it with something else (item methods? maybe events?). What are you trying to do?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

onUpdate() is an inside method for Entities, Tiles and Items.

 

What you are looking for is a PlayerTickEvent or more globally TickEvent (Server and/or Client).

Look them up and learn how to use events. (google)

 

In your case is will be Client side PlayerTickEvent that will check for KeyBinding.isPressed(). Remember bindings are CLIENT ONLY, you will need packets to interact with any kind of server side data.

1.7.10 is no longer supported by forge, you are on your own.

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

 Share



×
×
  • Create New...

Important Information

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