Posted November 10, 20169 yr Hello, I'd like to change the values set in original vanilla tool materials. ... WOOD(0, 59, 2.0F, 0.0F, 15), STONE(1, 131, 4.0F, 1.0F, 5), IRON(2, 250, 6.0F, 2.0F, 14), DIAMOND(3, 1561, 8.0F, 3.0F, 10), GOLD(0, 32, 12.0F, 0.0F, 22); ... (as seen in Item.ToolMaterial) I'd like to edit maxUses, efficiency and enchantability. I can edit maxUses afterwards with Item#setMaxDamage() so that's not a big problem, but the two others are not accessible. With reflection on ItemTool.efficiencyOnProperMaterial I could change efficiency, but enchantability is a direct call to toolMaterial.getEnch..(). Only other option I can think of is creating new materials with EnumHelper, recreate all vanilla tools and use substitution, but even then if some mod (or myself if I forget) compares the material it won't work. Is there any better way for this ?
November 10, 20169 yr Author The values are taken from the material in the constructor of ItemTool. Except enchantability. protected ItemTool(float attackDamageIn, float attackSpeedIn, Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn) { <...> this.toolMaterial = materialIn; this.effectiveBlocks = effectiveBlocksIn; this.maxStackSize = 1; this.setMaxDamage(materialIn.getMaxUses()); this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial(); this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity(); <...> } The vanilla items are instanciated before preInit so it will already be too late.
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.