Posted January 24, 201510 yr 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.
January 24, 201510 yr Author 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?
January 24, 201510 yr Author So I'm just supposed to do @Override public void onUpdate() { } I think I'm misinterpreting you.
January 24, 201510 yr 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.
January 24, 201510 yr Author 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)
January 24, 201510 yr 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.