mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
SPIGOT-5071: Player loot tables not triggered
This commit is contained in:
parent
f424222672
commit
f2757f95b3
@ -135,13 +135,13 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -166,8 +257,34 @@
|
||||
@@ -166,7 +257,33 @@
|
||||
}
|
||||
|
||||
nbttagcompound.set("recipeBook", this.recipeBook.save());
|
||||
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
+ super.spawnIn(world);
|
||||
@ -164,12 +164,11 @@
|
||||
+ }
|
||||
+ this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
|
||||
+ this.playerInteractManager.a((WorldServer) world);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -221,6 +338,11 @@
|
||||
|
||||
@Override
|
||||
@ -231,7 +230,7 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -351,9 +490,40 @@
|
||||
@@ -351,9 +490,46 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
|
||||
@ -248,10 +247,16 @@
|
||||
+ loot.add(CraftItemStack.asCraftMirror(item));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (flag) {
|
||||
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
|
||||
+ // SPIGOT-5071: manually add player loot tables
|
||||
+ this.a(damagesource, this.lastDamageByPlayerTime > 0);
|
||||
+ for (org.bukkit.inventory.ItemStack item : this.drops) {
|
||||
+ loot.add(item);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
+
|
||||
+ String deathmessage = defaultMessage.getString();
|
||||
@ -274,7 +279,7 @@
|
||||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -384,11 +554,16 @@
|
||||
@@ -384,11 +560,16 @@
|
||||
}
|
||||
|
||||
this.releaseShoulderEntities();
|
||||
@ -294,7 +299,7 @@
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -431,10 +606,12 @@
|
||||
@@ -431,10 +612,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@ -309,7 +314,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -452,7 +629,8 @@
|
||||
@@ -452,7 +635,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@ -319,7 +324,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,16 +674,26 @@
|
||||
@@ -496,16 +680,26 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@ -349,7 +354,7 @@
|
||||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
@@ -518,10 +706,12 @@
|
||||
@@ -518,10 +712,12 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.server.getWorldServer(dimensionmanager1);
|
||||
|
||||
@ -363,7 +368,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, worlddata.getType(), this.playerInteractManager.getGameMode()));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
@@ -529,6 +719,8 @@
|
||||
@@ -529,6 +725,8 @@
|
||||
playerlist.d(this);
|
||||
worldserver.removePlayer(this);
|
||||
this.dead = false;
|
||||
@ -372,7 +377,7 @@
|
||||
double d0 = this.locX;
|
||||
double d1 = this.locY;
|
||||
double d2 = this.locZ;
|
||||
@@ -538,6 +730,7 @@
|
||||
@@ -538,6 +736,7 @@
|
||||
float f2 = f1;
|
||||
|
||||
worldserver.getMethodProfiler().enter("moving");
|
||||
@ -380,7 +385,7 @@
|
||||
if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
|
||||
this.cu = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
d0 /= 8.0D;
|
||||
@@ -555,6 +748,52 @@
|
||||
@@ -555,6 +754,52 @@
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
@ -433,7 +438,7 @@
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
worldserver.getMethodProfiler().exit();
|
||||
worldserver.getMethodProfiler().enter("placing");
|
||||
@@ -566,12 +805,13 @@
|
||||
@@ -566,12 +811,13 @@
|
||||
d0 = MathHelper.a(d0, d4, d6);
|
||||
d2 = MathHelper.a(d2, d5, d7);
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
@ -448,7 +453,7 @@
|
||||
|
||||
for (int l = -2; l <= 2; ++l) {
|
||||
for (int i1 = -2; i1 <= 2; ++i1) {
|
||||
@@ -581,11 +821,20 @@
|
||||
@@ -581,11 +827,20 @@
|
||||
int i2 = k + i1 * 0 - l * 1;
|
||||
boolean flag2 = j1 < 0;
|
||||
|
||||
@ -470,7 +475,7 @@
|
||||
this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
|
||||
this.setMot(Vec3D.a);
|
||||
} else if (!worldserver1.getTravelAgent().a(this, f2)) {
|
||||
@@ -614,11 +863,16 @@
|
||||
@@ -614,11 +869,16 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@ -488,7 +493,7 @@
|
||||
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
|
||||
DimensionManager dimensionmanager1 = this.world.worldProvider.getDimensionManager();
|
||||
|
||||
@@ -655,9 +909,16 @@
|
||||
@@ -655,9 +915,16 @@
|
||||
this.activeContainer.c();
|
||||
}
|
||||
|
||||
@ -507,7 +512,7 @@
|
||||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.q.a(this);
|
||||
});
|
||||
@@ -665,6 +926,7 @@
|
||||
@@ -665,6 +932,7 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1, boolean flag2) {
|
||||
@ -515,7 +520,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -752,8 +1014,9 @@
|
||||
@@ -752,8 +1020,9 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@ -526,7 +531,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -768,6 +1031,17 @@
|
||||
@@ -768,6 +1037,17 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||
|
||||
@ -544,7 +549,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
@@ -775,9 +1049,11 @@
|
||||
@@ -775,9 +1055,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@ -558,7 +563,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -790,13 +1066,24 @@
|
||||
@@ -790,13 +1072,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@ -585,7 +590,7 @@
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
@@ -841,6 +1128,11 @@
|
||||
@@ -841,6 +1134,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
@ -597,7 +602,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -850,6 +1142,7 @@
|
||||
@@ -850,6 +1148,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@ -605,7 +610,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
}
|
||||
@@ -884,7 +1177,7 @@
|
||||
@@ -884,7 +1183,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.serverStatisticManager.b(this, statistic, i);
|
||||
@ -614,7 +619,7 @@
|
||||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -892,7 +1185,7 @@
|
||||
@@ -892,7 +1191,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||
@ -623,25 +628,24 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -941,8 +1234,17 @@
|
||||
@@ -941,7 +1240,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
+ this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - Support multi-line messages
|
||||
+ public void sendMessage(IChatBaseComponent[] ichatbasecomponent) {
|
||||
+ for (IChatBaseComponent component : ichatbasecomponent) {
|
||||
+ this.sendMessage(component);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT));
|
||||
@@ -996,12 +1298,14 @@
|
||||
@@ -996,12 +1304,14 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@ -657,7 +661,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1063,6 +1367,18 @@
|
||||
@@ -1063,6 +1373,18 @@
|
||||
|
||||
@Override
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@ -676,7 +680,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -1113,6 +1429,17 @@
|
||||
@@ -1113,6 +1435,17 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@ -694,7 +698,7 @@
|
||||
this.locale = packetplayinsettings.b();
|
||||
this.ck = packetplayinsettings.d();
|
||||
this.cl = packetplayinsettings.e();
|
||||
@@ -1149,13 +1476,13 @@
|
||||
@@ -1149,13 +1482,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||
} else {
|
||||
@ -710,7 +714,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1179,7 +1506,7 @@
|
||||
@@ -1179,7 +1512,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
@ -719,7 +723,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1208,7 +1535,7 @@
|
||||
@@ -1208,7 +1541,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@ -728,7 +732,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1226,21 +1553,33 @@
|
||||
@@ -1226,21 +1559,33 @@
|
||||
}
|
||||
|
||||
public void J() {
|
||||
@ -762,7 +766,7 @@
|
||||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1263,6 +1602,9 @@
|
||||
@@ -1263,6 +1608,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
@ -772,7 +776,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1314,4 +1656,144 @@
|
||||
@@ -1314,4 +1662,144 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user