Jump to content

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


Recommended Posts

Posted

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-

Posted

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.

Posted

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.

Posted

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.

Posted

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

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

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