fix player loottables running when mob loot gamerule is false

This commit is contained in:
Jake Potrebic 2022-03-22 09:50:40 -07:00
parent 58f0db0820
commit 7b3898ad66

View File

@ -188,8 +188,8 @@
+ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper + this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
+ this.bukkitPickUpLoot = true; + this.bukkitPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth(); + this.maxHealthCache = this.getMaxHealth();
+ } }
+
+ // Use method to resend items in hands in case of client desync, because the item use got cancelled. + // Use method to resend items in hands in case of client desync, because the item use got cancelled.
+ // For example, when cancelling the leash event + // For example, when cancelling the leash event
+ public void resendItemInHands() { + public void resendItemInHands() {
@ -235,9 +235,9 @@
+ } + }
+ +
+ return blockposition; + return blockposition;
} + }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) { public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) {
AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO); AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO);
@ -398,12 +398,9 @@
Logger logger = ServerPlayer.LOGGER; Logger logger = ServerPlayer.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -683,8 +836,31 @@ @@ -686,6 +839,29 @@
});
} }
}
+
+ }
+ // CraftBukkit start - World fallback code, either respawn location or global spawn + // CraftBukkit start - World fallback code, either respawn location or global spawn
+ public void spawnIn(Level world) { + public void spawnIn(Level world) {
@ -425,11 +422,12 @@
+ this.setPosRaw(position.x(), position.y(), position.z()); // Paper - don't register to chunks yet + this.setPosRaw(position.x(), position.y(), position.z()); // Paper - don't register to chunks yet
+ } + }
+ this.gameMode.setLevel((ServerLevel) world); + this.gameMode.setLevel((ServerLevel) world);
} + }
+ // CraftBukkit end + // CraftBukkit end
+
public void setExperiencePoints(int points) { public void setExperiencePoints(int points) {
float f = (float) this.getXpNeededForNextLevel(); float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f;
@@ -744,6 +920,11 @@ @@ -744,6 +920,11 @@
@Override @Override
@ -520,7 +518,7 @@
} }
float f = this.foodData.getSaturationLevel(); float f = this.foodData.getSaturationLevel();
@@ -946,19 +1151,103 @@ @@ -946,19 +1151,105 @@
} }
private void updateScoreForCriteria(ObjectiveCriteria criterion, int score) { private void updateScoreForCriteria(ObjectiveCriteria criterion, int score) {
@ -529,8 +527,8 @@
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criterion, this, (scoreaccess) -> { + this.level().getCraftServer().getScoreboardManager().forAllObjectives(criterion, this, (scoreaccess) -> {
scoreaccess.set(score); scoreaccess.set(score);
}); });
} + }
+
+ // Paper start - PlayerDeathEvent#getItemsToKeep + // Paper start - PlayerDeathEvent#getItemsToKeep
+ private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) { + private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) {
+ List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep(); + List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep();
@ -568,9 +566,9 @@
+ inv.set(i, ItemStack.EMPTY); + inv.set(i, ItemStack.EMPTY);
+ } + }
+ } + }
+ } }
+ // Paper end - PlayerDeathEvent#getItemsToKeep + // Paper end - PlayerDeathEvent#getItemsToKeep
+
@Override @Override
public void die(DamageSource damageSource) { public void die(DamageSource damageSource) {
- this.gameEvent(GameEvent.ENTITY_DIE); - this.gameEvent(GameEvent.ENTITY_DIE);
@ -592,12 +590,14 @@
+ } + }
+ } + }
+ } + }
+ if (this.shouldDropLoot() && this.serverLevel().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) + // SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
+ this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0); + this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0);
+ this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag); + this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
+ loot.addAll(this.drops); + loot.addAll(this.drops);
+ this.drops.clear(); // SPIGOT-5188: make sure to clear + this.drops.clear(); // SPIGOT-5188: make sure to clear
+ } // Paper - fix player loottables running when mob loot gamerule is false
+ +
+ Component defaultMessage = this.getCombatTracker().getDeathMessage(); + Component defaultMessage = this.getCombatTracker().getDeathMessage();
+ +
@ -628,7 +628,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true; boolean flag1 = true;
String s = ichatbasecomponent.getString(256); String s = ichatbasecomponent.getString(256);
@@ -988,12 +1277,23 @@ @@ -988,12 +1279,23 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied(); this.tellNeutralMobsThatIDied();
} }
@ -656,7 +656,7 @@
LivingEntity entityliving = this.getKillCredit(); LivingEntity entityliving = this.getKillCredit();
if (entityliving != null) { if (entityliving != null) {
@@ -1028,10 +1328,12 @@ @@ -1028,10 +1330,12 @@
public void awardKillScore(Entity entityKilled, DamageSource damageSource) { public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
if (entityKilled != this) { if (entityKilled != this) {
super.awardKillScore(entityKilled, damageSource); super.awardKillScore(entityKilled, damageSource);
@ -672,7 +672,7 @@
} else { } else {
this.awardStat(Stats.MOB_KILLS); this.awardStat(Stats.MOB_KILLS);
} }
@@ -1049,7 +1351,8 @@ @@ -1049,7 +1353,8 @@
int i = scoreboardteam.getColor().getId(); int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < criterions.length) { if (i >= 0 && i < criterions.length) {
@ -682,7 +682,7 @@
} }
} }
@@ -1062,8 +1365,8 @@ @@ -1062,8 +1367,8 @@
} else { } else {
Entity entity = source.getEntity(); Entity entity = source.getEntity();
@ -693,7 +693,7 @@
if (!this.canHarmPlayer(entityhuman)) { if (!this.canHarmPlayer(entityhuman)) {
return false; return false;
@@ -1074,8 +1377,8 @@ @@ -1074,8 +1379,8 @@
AbstractArrow entityarrow = (AbstractArrow) entity; AbstractArrow entityarrow = (AbstractArrow) entity;
Entity entity1 = entityarrow.getOwner(); Entity entity1 = entityarrow.getOwner();
@ -704,7 +704,7 @@
if (!this.canHarmPlayer(entityhuman1)) { if (!this.canHarmPlayer(entityhuman1)) {
return false; return false;
@@ -1083,38 +1386,84 @@ @@ -1083,38 +1388,84 @@
} }
} }
@ -797,7 +797,7 @@
} }
public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(ServerLevel world, BlockPos pos, float spawnAngle, boolean spawnForced, boolean alive) { public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(ServerLevel world, BlockPos pos, float spawnAngle, boolean spawnForced, boolean alive) {
@@ -1129,11 +1478,11 @@ @@ -1129,11 +1480,11 @@
} }
return optional.map((vec3d) -> { return optional.map((vec3d) -> {
@ -811,7 +811,7 @@
}); });
} else if (!spawnForced) { } else if (!spawnForced) {
return Optional.empty(); return Optional.empty();
@@ -1142,7 +1491,7 @@ @@ -1142,7 +1493,7 @@
BlockState iblockdata1 = world.getBlockState(pos.above()); BlockState iblockdata1 = world.getBlockState(pos.above());
boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1); boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1);
@ -820,7 +820,7 @@
} }
} }
@@ -1160,6 +1509,7 @@ @@ -1160,6 +1511,7 @@
@Nullable @Nullable
@Override @Override
public ServerPlayer teleport(TeleportTransition teleportTarget) { public ServerPlayer teleport(TeleportTransition teleportTarget) {
@ -828,7 +828,7 @@
if (this.isRemoved()) { if (this.isRemoved()) {
return null; return null;
} else { } else {
@@ -1169,39 +1519,78 @@ @@ -1169,39 +1521,78 @@
ServerLevel worldserver = teleportTarget.newLevel(); ServerLevel worldserver = teleportTarget.newLevel();
ServerLevel worldserver1 = this.serverLevel(); ServerLevel worldserver1 = this.serverLevel();
@ -915,7 +915,7 @@
this.connection.resetPosition(); this.connection.resetPosition();
worldserver.addDuringTeleport(this); worldserver.addDuringTeleport(this);
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@@ -1215,12 +1604,35 @@ @@ -1215,12 +1606,35 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -951,7 +951,7 @@
public void forceSetRotation(float yaw, float pitch) { public void forceSetRotation(float yaw, float pitch) {
this.connection.send(new ClientboundPlayerRotationPacket(yaw, pitch)); this.connection.send(new ClientboundPlayerRotationPacket(yaw, pitch));
} }
@@ -1228,13 +1640,21 @@ @@ -1228,13 +1642,21 @@
public void triggerDimensionChangeTriggers(ServerLevel origin) { public void triggerDimensionChangeTriggers(ServerLevel origin) {
ResourceKey<Level> resourcekey = origin.dimension(); ResourceKey<Level> resourcekey = origin.dimension();
ResourceKey<Level> resourcekey1 = this.level().dimension(); ResourceKey<Level> resourcekey1 = this.level().dimension();
@ -976,7 +976,7 @@
this.enteredNetherPosition = null; this.enteredNetherPosition = null;
} }
@@ -1251,36 +1671,63 @@ @@ -1251,36 +1673,63 @@
this.containerMenu.broadcastChanges(); this.containerMenu.broadcastChanges();
} }
@ -1055,7 +1055,7 @@
this.awardStat(Stats.SLEEP_IN_BED); this.awardStat(Stats.SLEEP_IN_BED);
CriteriaTriggers.SLEPT_IN_BED.trigger(this); CriteriaTriggers.SLEPT_IN_BED.trigger(this);
}); });
@@ -1293,9 +1740,8 @@ @@ -1293,9 +1742,8 @@
return either; return either;
} }
} }
@ -1066,7 +1066,7 @@
} }
@Override @Override
@@ -1322,13 +1768,31 @@ @@ -1322,13 +1770,31 @@
@Override @Override
public void stopSleepInBed(boolean skipSleepTimer, boolean updateSleepingPlayers) { public void stopSleepInBed(boolean skipSleepTimer, boolean updateSleepingPlayers) {
@ -1099,7 +1099,7 @@
} }
} }
@@ -1341,7 +1805,7 @@ @@ -1341,7 +1807,7 @@
@Override @Override
public boolean isInvulnerableTo(ServerLevel world, DamageSource source) { public boolean isInvulnerableTo(ServerLevel world, DamageSource source) {
@ -1108,7 +1108,7 @@
} }
@Override @Override
@@ -1387,8 +1851,9 @@ @@ -1387,8 +1853,9 @@
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front)); this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front));
} }
@ -1119,7 +1119,7 @@
} }
@Override @Override
@@ -1396,13 +1861,35 @@ @@ -1396,13 +1863,35 @@
if (factory == null) { if (factory == null) {
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -1155,7 +1155,7 @@
if (container == null) { if (container == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true); this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true);
@@ -1410,9 +1897,11 @@ @@ -1410,9 +1899,11 @@
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -1169,7 +1169,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -1425,15 +1914,26 @@ @@ -1425,15 +1916,26 @@
@Override @Override
public void openHorseInventory(AbstractHorse horse, Container inventory) { public void openHorseInventory(AbstractHorse horse, Container inventory) {
@ -1199,7 +1199,7 @@
this.initMenu(this.containerMenu); this.initMenu(this.containerMenu);
} }
@@ -1456,9 +1956,28 @@ @@ -1456,9 +1958,28 @@
@Override @Override
public void closeContainer() { public void closeContainer() {
@ -1228,7 +1228,7 @@
@Override @Override
public void doCloseContainer() { public void doCloseContainer() {
@@ -1485,19 +2004,19 @@ @@ -1485,19 +2006,19 @@
i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 100.0F); i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 100.0F);
if (i > 0) { if (i > 0) {
this.awardStat(Stats.SWIM_ONE_CM, i); this.awardStat(Stats.SWIM_ONE_CM, i);
@ -1251,7 +1251,7 @@
} }
} else if (this.onClimbable()) { } else if (this.onClimbable()) {
if (deltaY > 0.0D) { if (deltaY > 0.0D) {
@@ -1508,13 +2027,13 @@ @@ -1508,13 +2029,13 @@
if (i > 0) { if (i > 0) {
if (this.isSprinting()) { if (this.isSprinting()) {
this.awardStat(Stats.SPRINT_ONE_CM, i); this.awardStat(Stats.SPRINT_ONE_CM, i);
@ -1268,7 +1268,7 @@
} }
} }
} else if (this.isFallFlying()) { } else if (this.isFallFlying()) {
@@ -1557,7 +2076,7 @@ @@ -1557,7 +2078,7 @@
@Override @Override
public void awardStat(Stat<?> stat, int amount) { public void awardStat(Stat<?> stat, int amount) {
this.stats.increment(this, stat, amount); this.stats.increment(this, stat, amount);
@ -1277,7 +1277,7 @@
scoreaccess.add(amount); scoreaccess.add(amount);
}); });
} }
@@ -1565,7 +2084,7 @@ @@ -1565,7 +2086,7 @@
@Override @Override
public void resetStat(Stat<?> stat) { public void resetStat(Stat<?> stat) {
this.stats.setValue(this, stat, 0); this.stats.setValue(this, stat, 0);
@ -1286,7 +1286,7 @@
} }
@Override @Override
@@ -1597,9 +2116,9 @@ @@ -1597,9 +2118,9 @@
super.jumpFromGround(); super.jumpFromGround();
this.awardStat(Stats.JUMP); this.awardStat(Stats.JUMP);
if (this.isSprinting()) { if (this.isSprinting()) {
@ -1298,7 +1298,7 @@
} }
} }
@@ -1613,6 +2132,13 @@ @@ -1613,6 +2134,13 @@
public void disconnect() { public void disconnect() {
this.disconnected = true; this.disconnected = true;
this.ejectPassengers(); this.ejectPassengers();
@ -1312,7 +1312,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.stopSleepInBed(true, false); this.stopSleepInBed(true, false);
} }
@@ -1625,6 +2151,7 @@ @@ -1625,6 +2153,7 @@
public void resetSentInfo() { public void resetSentInfo() {
this.lastSentHealth = -1.0E8F; this.lastSentHealth = -1.0E8F;
@ -1320,7 +1320,7 @@
} }
@Override @Override
@@ -1661,7 +2188,7 @@ @@ -1661,7 +2190,7 @@
this.onUpdateAbilities(); this.onUpdateAbilities();
if (alive) { if (alive) {
this.getAttributes().assignBaseValues(oldPlayer.getAttributes()); this.getAttributes().assignBaseValues(oldPlayer.getAttributes());
@ -1329,7 +1329,7 @@
this.setHealth(oldPlayer.getHealth()); this.setHealth(oldPlayer.getHealth());
this.foodData = oldPlayer.foodData; this.foodData = oldPlayer.foodData;
Iterator iterator = oldPlayer.getActiveEffects().iterator(); Iterator iterator = oldPlayer.getActiveEffects().iterator();
@@ -1669,7 +2196,7 @@ @@ -1669,7 +2198,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
@ -1338,7 +1338,7 @@
} }
this.getInventory().replaceWith(oldPlayer.getInventory()); this.getInventory().replaceWith(oldPlayer.getInventory());
@@ -1680,7 +2207,7 @@ @@ -1680,7 +2209,7 @@
this.portalProcess = oldPlayer.portalProcess; this.portalProcess = oldPlayer.portalProcess;
} else { } else {
this.getAttributes().assignBaseValues(oldPlayer.getAttributes()); this.getAttributes().assignBaseValues(oldPlayer.getAttributes());
@ -1347,7 +1347,7 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || oldPlayer.isSpectator()) { if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || oldPlayer.isSpectator()) {
this.getInventory().replaceWith(oldPlayer.getInventory()); this.getInventory().replaceWith(oldPlayer.getInventory());
this.experienceLevel = oldPlayer.experienceLevel; this.experienceLevel = oldPlayer.experienceLevel;
@@ -1696,7 +2223,7 @@ @@ -1696,7 +2225,7 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -1356,7 +1356,7 @@
this.seenCredits = oldPlayer.seenCredits; this.seenCredits = oldPlayer.seenCredits;
this.enteredNetherPosition = oldPlayer.enteredNetherPosition; this.enteredNetherPosition = oldPlayer.enteredNetherPosition;
this.chunkTrackingView = oldPlayer.chunkTrackingView; this.chunkTrackingView = oldPlayer.chunkTrackingView;
@@ -1752,19 +2279,19 @@ @@ -1752,19 +2281,19 @@
} }
@Override @Override
@ -1380,7 +1380,7 @@
} }
return flag1; return flag1;
@@ -1799,10 +2326,18 @@ @@ -1799,10 +2328,18 @@
} }
public boolean setGameMode(GameType gameMode) { public boolean setGameMode(GameType gameMode) {
@ -1401,7 +1401,7 @@
} else { } else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) { if (gameMode == GameType.SPECTATOR) {
@@ -1818,7 +2353,7 @@ @@ -1818,7 +2355,7 @@
this.onUpdateAbilities(); this.onUpdateAbilities();
this.updateEffectVisibility(); this.updateEffectVisibility();
@ -1410,7 +1410,7 @@
} }
} }
@@ -1861,8 +2396,13 @@ @@ -1861,8 +2398,13 @@
} }
public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) { public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) {
@ -1425,7 +1425,7 @@
} }
} }
@@ -1878,7 +2418,36 @@ @@ -1878,7 +2420,36 @@
} }
public void updateOptions(ClientInformation clientOptions) { public void updateOptions(ClientInformation clientOptions) {
@ -1462,7 +1462,7 @@
this.requestedViewDistance = clientOptions.viewDistance(); this.requestedViewDistance = clientOptions.viewDistance();
this.chatVisibility = clientOptions.chatVisibility(); this.chatVisibility = clientOptions.chatVisibility();
this.canChatColor = clientOptions.chatColors(); this.canChatColor = clientOptions.chatColors();
@@ -1957,12 +2526,27 @@ @@ -1957,12 +2528,27 @@
this.camera = (Entity) (entity == null ? this : entity); this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) { if (entity1 != this.camera) {
@ -1491,7 +1491,7 @@
} }
if (entity != null) { if (entity != null) {
@@ -1999,11 +2583,11 @@ @@ -1999,11 +2585,11 @@
@Nullable @Nullable
public Component getTabListDisplayName() { public Component getTabListDisplayName() {
@ -1505,7 +1505,7 @@
} }
@Override @Override
@@ -2045,12 +2629,44 @@ @@ -2045,12 +2631,44 @@
this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false); this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false);
} }
@ -1552,7 +1552,7 @@
} }
this.respawnPosition = pos; this.respawnPosition = pos;
@@ -2064,6 +2680,7 @@ @@ -2064,6 +2682,7 @@
this.respawnForced = false; this.respawnForced = false;
} }
@ -1560,7 +1560,7 @@
} }
public SectionPos getLastSectionPos() { public SectionPos getLastSectionPos() {
@@ -2088,18 +2705,44 @@ @@ -2088,18 +2707,44 @@
} }
@Override @Override
@ -1609,7 +1609,7 @@
} }
this.awardStat(Stats.DROP); this.awardStat(Stats.DROP);
@@ -2115,6 +2758,11 @@ @@ -2115,6 +2760,11 @@
return null; return null;
} else { } else {
double d0 = this.getEyeY() - 0.30000001192092896D; double d0 = this.getEyeY() - 0.30000001192092896D;
@ -1621,7 +1621,7 @@
ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), stack); ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), stack);
entityitem.setPickUpDelay(40); entityitem.setPickUpDelay(40);
@@ -2166,6 +2814,16 @@ @@ -2166,6 +2816,16 @@
} }
public void loadGameTypes(@Nullable CompoundTag nbt) { public void loadGameTypes(@Nullable CompoundTag nbt) {
@ -1638,7 +1638,7 @@
this.gameMode.setGameModeForPlayer(this.calculateGameModeForNewPlayer(ServerPlayer.readPlayerMode(nbt, "playerGameType")), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType")); this.gameMode.setGameModeForPlayer(this.calculateGameModeForNewPlayer(ServerPlayer.readPlayerMode(nbt, "playerGameType")), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType"));
} }
@@ -2275,9 +2933,15 @@ @@ -2275,9 +2935,15 @@
@Override @Override
public void stopRiding() { public void stopRiding() {
@ -1655,7 +1655,7 @@
if (entity instanceof LivingEntity entityliving) { if (entity instanceof LivingEntity entityliving) {
Iterator iterator = entityliving.getActiveEffects().iterator(); Iterator iterator = entityliving.getActiveEffects().iterator();
@@ -2375,10 +3039,12 @@ @@ -2375,10 +3041,12 @@
return TicketType.ENDER_PEARL.timeout(); return TicketType.ENDER_PEARL.timeout();
} }
@ -1671,7 +1671,7 @@
} }
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) { private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
@@ -2387,4 +3053,147 @@ @@ -2387,4 +3055,147 @@
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D); return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
} }
} }