Fix experience & improvements to block events (#8067)

This is a lot but basically adds a method to disable the dropping of experience and drops experience by default.
This way things that require XP to be dropped manually (via modification), they can drop XP themselves when needed but without touching anywhere else that may drop xp.

It should be noted this causes breakNaturally() to now drop experience.
This commit is contained in:
Owen1212055
2024-01-04 15:18:59 -05:00
parent 635ece80cf
commit 9940519717
6 changed files with 144 additions and 21 deletions

View File

@@ -299,14 +299,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void popExperience(ServerLevel world, BlockPos pos, int size) {
+ // Paper start - add player parameter
+ // Paper start - add entity parameter
+ popExperience(world, pos, size, null);
+ }
+ public void popExperience(ServerLevel world, BlockPos pos, int size, net.minecraft.server.level.ServerPlayer player) {
+ // Paper end - add player parameter
+ public void popExperience(ServerLevel world, BlockPos pos, int size, net.minecraft.world.entity.Entity entity) {
+ // Paper end - add entity parameter
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
- ExperienceOrb.award(world, Vec3.atCenterOf(pos), size);
+ ExperienceOrb.award(world, Vec3.atCenterOf(pos), size, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player); // Paper
+ ExperienceOrb.award(world, Vec3.atCenterOf(pos), size, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, entity); // Paper
}
}