[Bug]: Kill by player with DamageSource from DamageSourcesHelper does not give XP
GigaNybl opened this issue ยท 2 comments
Mod Loader (Required)
Fabric
Minecraft Version (Required)
1.20.1
Mod Version (Required)
8.0.7
Notes (Required)
This behavior is observed on Fabric and Forge versions of the mod
Current Behavior: When a mob is killed by the player, for instance in the case of the "Hulk Hammer" in the mod mutant monsters, the mob does not drop XP when it is killed using the right click ability.
Steps to reproduce:
- Load the puzzleslib and mutant monsters mods together in a 1.20.1 fabric instance
- Enter a world
- Enter creative mode
- Obtain the Hulk Hammer weapon
- Kill an XP rewarding mob using the Hulk Hammer right click ability
- Observe that no XP is rewarded
My testing has shown that this line is the problem: https://github.com/Fuzss/puzzleslib/blob/main/1.20/Common/src/main/java/fuzs/puzzleslib/api/entity/v1/DamageSourcesHelper.java#L41C14-L41C14
If this line in the mutant monsters mod is instead replaced with the following, then XP is rewarded as expected. The only difference is that the DamageSource constructor is called without the 4th parameter set to null.
livingEntity.hurt(new DamageSource(player.level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(ModRegistry.PLAYER_SEISMIC_WAVE_DAMAGE_TYPE), player), (float) (6 + player.getRandom().nextInt(3)));
latest.log (Optional)
No response