Jump to content

Making single vanilla items have lower max durability (maybe using enchantment)


KoadMaster

Recommended Posts

So, in general, I am trying to make something that increases the rate at which am vanilla item runs out of durability. My first thought was to somehow decrease the max durability of only the particular item that the player has (I don't want to make all items of that type have less durability, only the ones that are debuffed). However, this is either really hard, or I am missing something simple. Therefor I thought that it would certainly be possible to make a new enchantment that works essentially the same way as unbreaking, but with the opposite effect (it would remove durability instead of preserve it). I am pretty sure forge has event hooks that could be used to accomplish this, bt I have essentially no knowledge of how to use them. Any help would be appreciated.

-Thank You-

Link to comment
Share on other sites

Durability is stored inside ItemStack of given Item instance (there is only one Item). That data is stack's itemDamage and can be accessed from reference.

 

Stack you can get from player.inventory#something (you should find right method).

Accessing it can be done when you are crafting or inside any method/event that has Player/ ItemStack reference.

 

Tell me - when do you want your faster-degradation debuff applied? On item crafting or in ench table or maybe by some itdk.. spell?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Well, actually it is a furnace like device that repairs tools, however, I want it to give the tool a stacking debuff that will cause it to break faster, therefor making it unrepairble at a certain point (that I have not determined yet). Generally speaking, I worked on it quite a bit since posting and have something that "works" it checks for the NBTT tag called repairCost (used in the anvil) and uses it to keep track of the amount of times it has been repaired, and then simply sets that duration of the item repaired to be less each time. However, I realize that it is probably not the greatest way to go about things as it does potentially cause some incompatibility with the anvil (which in some ways is ok, but if Icould avoid it that would probably be better). So the trouble I have is actually setting a stacking debuff on an item that can be referenced by the repairing process. As far as your last line, I was thinking it would be coolest if it just broke faster while still looking like it was full, but I think just making it set the current durability to less is simpler and perhaps more user friendly. So basically I want the durability to go down in a crafting type situation, but I have figured out how to do that.

Link to comment
Share on other sites

ItemStack has 3 props:

Item reference it uses, damage and NBT.

 

Trying to improve your system will bring you probably nothing since this: (ItemStack)

public boolean isItemStackDamageable()
    {
        return this.item.getMaxDamage(this) <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable");
    }

It's hardcoded for only one type of special effect (unbreakable).

 

You can't set maxDamage for one item since it's stored inside Item instance.

 

What you can do is only and only add new NBT or use "repairCost" to affect price/maxRepairValue. Still - it will never work well with anvil, not without ASM or replacing whole Anvil with your own CustomAnvil that will be able to read your system.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I am thinking along the same lines, currently is does work, and having it so that repairing it with my method makes it more expensive to repair on an anvil does sort of make sense (though it is likely that if someone tried to use my repair method on an object that had been repaired in the anvil before hand the object would likely just break, due to how I have it coded, but I guess that is fine). In general, I think I will just be using what I have, hopefully in the future it can be improved, but it works fine enough now. Thank you for you help :)

Link to comment
Share on other sites

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.