ArmorRemoveHandler interface of RC not working properly in 1.19.1+
loleq2105 opened this issue ยท 1 comments
Describe the bug
The onRemoved method provided by the ArmorRemoveHandler interface of RebornCore is executed not only when the player removes an armor item that implements it, but also each time the item's NBT data is modified.
Steps to Reproduce
Steps to reproduce the behavior:
- Create an armor item that implements the ArmorRemoveHandler.
- Code the item so that it's able to modify the NBT data of its itemstacks in any way.
- Add a print or log statement directly in the onRemoved function.
- Observe how the onRemoved function fires off not only when the player takes off your armor item, but also on every occasion that its NBT data is modified.
You can prove that this holds true to the only armor of TR that implements this interface - the quantum suit. Given I suck at debugging, I wrote this mixin:
@Pseudo
@Mixin(targets = "techreborn.items.armor.QuantumSuitItem")
public class QuantumSuitMixin extends TRArmourItem {
public QuantumSuitMixin(ArmorMaterial material, EquipmentSlot slot, Settings settings) {
super(material, slot, settings);
}
@Inject(at = @At("TAIL"), method = "onRemoved", cancellable = false)
public void onRemoved(PlayerEntity playerEntity, CallbackInfo ci) {
System.out.println("Quantum Armour removed!");
}
}
With this in place, the terminal gets flooded whilst and action that consumes energy on a per tick basis is performed.
Here's a recording with the mixin in action :
Screenshots
NA
Environment (please complete the following information with the version):
- Minecraft: 1.19.2, but the same holds for 1.19.3 and likely 1.19.1
- Mod Loader: fabric 0.14.13
- Farbic API 0.72.0+1.19.2
- Tech reborn: 5.4.0
Logs
NA
Additional context
Add any other context about the problem here.