Skip to content

Commit

Permalink
Don't run player loot table for spectators
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Oct 2, 2024
1 parent fb76840 commit fc9491a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 25ca370c0b19eca529fc2c980c50e899013f0897..f31eb944465e9011d8aad398eb60bafb44203ad5 100644
index 25ca370c0b19eca529fc2c980c50e899013f0897..b2c144b1526fffe03e5f76307368c2b2e9eb8c42 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -959,12 +959,14 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
}
}
+ if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
+ if (!this.isSpectator() && this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0);
this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped
items like CB does.

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a67636855f 100644
index 88ad8c124f55f48609847f36fbebafb183257bb7..48d5b128b5a4c2debafe5b79182a5b839989f0f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -976,20 +976,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
Expand All @@ -28,7 +28,7 @@ index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a6
}
}
}
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
if (!this.isSpectator() && this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - fix player loottables running when mob loot gamerule is false
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0);
- this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
Expand All @@ -37,7 +37,7 @@ index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a6
loot.addAll(this.drops);
this.drops.clear(); // SPIGOT-5188: make sure to clear
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f163cb3c75e90b96b3794a7e0c5b803268814c8c..e88c88b6f87dddda8e8e3ed215a8f2c166afa3ef 100644
index d56b1fa14efede69b0795391e94dacbbe00b745a..4980bc2d48ee3f5b326c8c029e17e453ebee8698 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2562,6 +2562,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand Down

0 comments on commit fc9491a

Please sign in to comment.