Jump to content

Recommended Posts

Posted

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.

 

 

Posted

onUpdate is a method in Entity. It takes no parameters.

 

Are you sure...? I'm pretty sure I've used parameters with it in the past. Maybe I'm misunderstanding what you mean by parameters?

Posted

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.

Posted

I was trying to use it for calling a method when a key is pressed, (or just running it in onUpdate, whatever) and I chose onUpdate because it had, in the past I think, a parameter for the player. (Whick a tickhandler does not have/support, afaik)

Posted

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.

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.