Puzzles Lib [Forge & Fabric]

Puzzles Lib [Forge & Fabric]

77M Downloads

[Bug]: Kill by player with DamageSource from DamageSourcesHelper does not give XP

GigaNybl opened this issue ยท 2 comments

commented

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:

  1. Load the puzzleslib and mutant monsters mods together in a 1.20.1 fabric instance
  2. Enter a world
  3. Enter creative mode
  4. Obtain the Hulk Hammer weapon
  5. Kill an XP rewarding mob using the Hulk Hammer right click ability
  6. 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

commented

Fixed now in v8.1.14.

commented

Thanks for doing all the digging! Fixed indev, will be part of the next release.