Imagine Breaker doesn't work with Corail Tombstone Sanctified
TheFlame52 opened this issue ยท 7 comments
The Imagine Breaker doesn't work when using a weapon enchanted with Corail Tombstone Sanctified enchantment. Maybe it's the wrong damage type?
due to the nature of the damage type system, it work works with vanilla basic player_attack or mob_attack damage types
@lcy0x1 If it's to wrap the player damageType, it may be better to change nothing about my mod.
https://github.com/Minecraft-LightLand/L2Hostility/blob/main/src/main/java/dev/xkmc/l2hostility/events/LHAttackListener.java#L132-L139
https://github.com/Minecraft-LightLand/L2DamageTracker/blob/main/src/main/java/dev/xkmc/l2damagetracker/contents/attack/CreateSourceEvent.java#L80-L110
Even through i only read between the lines of the code, Holy damage already bypasses cooldown and it might be better not to change it to "bypass magic" as it already bypasses "armor" but, up to you to decide if it's worth it).
@lcy0x1 If you want, you can handle the DamageSource "tombstone:holy" as a player_attack, like Mace Smash is a player attack (in recent versions of mc, items can have a custom DamageSource).
In 1.21.5:
Item.class
@Nullable
public DamageSource getDamageSource(LivingEntity entity) {
return null;
}Player.class
public void attack(Entity target) {
if (!net.neoforged.neoforge.common.CommonHooks.onPlayerAttackTarget(this, target)) return;
if (target.isAttackable()) {
if (!target.skipAttackInteraction(this)) {
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
ItemStack itemstack = this.getWeaponItem();
DamageSource damagesource = Optional.ofNullable(itemstack.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this));I create variants of vanilla damage types with same message id but different tags. Maybe I should add a tag for controlling which damage tags to be counted as player melee attack
@lcy0x1 If you add a damageType tag, keep me informed so i could add my damageType to your tag (but the holy damage can be "player" or "mob" attack depending the creature having the enchantment on its weapon).
Note that i don't know what is "Imagine Breaker" and why it requires a "player_attack" (1.21.5 has a tag for "player_attack" but it's only used for 2 others tags about "cause_panic" and "can_break_armor_stand").
I feel like to fully implement this system there needs to be a better damage type system where one should be able to add facets to a damage source, adding or removing tags. I will try to work on this
By default I'm not touching the damage type when some other mods already changed (hence the incompatibility). I was trying to hack into damage source to make it appear to have some extra tags, but the proposal was deemed unstable by NeoForge team and I think it's better to leave it as it is for now.