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

Hey every one I'm currently working on my custom Harry Potter mod and I'm trying to change my spell system, what I'm trying to do and need help with is making a method/function in an item that every time a statement is true it adds +1 to an int, the int will then be used in the onItemRightClick to determine which spell is selected. Also if when the int hit like for example 40 it would start from 0 again Any help is appreciated

  • Author

I'll try to see if it works for me and if it works my life will be so much easier, thank you

  • Author

You should probably use the item damage for this. It's a value that is attached to every ItemStack.

 

The only problem I'm having with this is, that i can't find a method that works so when the player is sneaking the item damage changes

  • Author

To make it so that each item damage value does a different thing, and sneaking in general

If I'm reading this correctly, you want to increment some integer every time a certain condition is true.

 

If the condition is that the player is sneaking, then it's quite difficult to do inside the item class itself. You'd have to use an event handler and check for a sneaking event. This is how you would do this for most conditions.

 

It will be much easier if the condition is that the player uses the item while sneaking. Then you can add the relevant code to the onItemRightClick() method using an if statement to check for the conditions.

 

Switching to another topic, n = (n + 1) % 40; will increment n and loop back to 0 once n reaches 40. (n will be from 0 to 39.)

 

 

 

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.