Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

 

 

  • 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?

  • Author

So I'm just supposed to do

 

@Override
public void onUpdate() {
   


}

         

I think I'm misinterpreting you.

 

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.

  • 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)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.