CraftTweaker

CraftTweaker

151M Downloads

[Feature request] In-place item damage modification for entity equipment slots

nihiltres opened this issue ยท 1 comments

commented

Feature request name
In-place item damage modification for entity equipment slots.

Feature request description
Since ItemStack CraftTweakerMC.getItemStack(IItemStack item) calls a .copy() method in its return, it's difficult to modify the damage of an item rather than set a modified item stack to that slot; a way to damage an item "directly" would be helpful. Something like void IEntityLivingBase.damageItemInSlot(IEntityEquipmentSlot slot, int amount, IEntity damager) would be ideal and probably fairly straightforward to implement.

Feature request reason
I'm trying to make a Terrasteel material for Tinker's Construct/Construct's Armory using those and ContentTweaker. One of the properties of Botania's base Terrasteel armour is that it repairs itself over time if mana is available. In armour tick functions, the IItemStack of the armour is provided, but since it's a copy, it can't affect the damage of the original through the otherwise intuitive void IItemStack.damageItem(int, IEntity) method.

I can use void IEntityLivingBase.setItemToSlot(IEntityEquipmentSlot, IItemStack) to put the modified stack in place, but for armour this counts as equipping new armour, which has undesirable side effects like triggering armour-equip sound effects (very bad if you want to heal/damage the item 20 times a second!) and onArmorEquip handlers. That's ugly.

Feature request dependencies
This feature shouldn't need anything external to be implemented. It's primarily useful for event handlers and is obviously most useful for applications involving Construct's Armory, especially its ContentTweaker support.

commented

This won't be a thing in 1.12, should be a thing in 1.14