Posted August 1, 201411 yr 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
August 1, 201411 yr Author I'll try to see if it works for me and if it works my life will be so much easier, thank you
August 1, 201411 yr 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
August 1, 201411 yr Author To make it so that each item damage value does a different thing, and sneaking in general
August 1, 201411 yr 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.) GitHub|Recipe API Proposal
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.