More more more more patches

This commit is contained in:
Nassim Jahnke 2023-03-14 20:24:52 +01:00
parent bdeb519d1b
commit 0e2d6d6550
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
60 changed files with 277 additions and 331 deletions

View File

@ -2178,7 +2178,7 @@ index 7efd4be91e6ff0abf087bf4d322fd6ac694b7010..531d0b0dcd499adf0d973bf336272aa1
// CraftBukkit end
this.chatVisibility = packet.chatVisibility();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 000fd11480d783eab80a93fedde48f66e6b1298b..35f4ccc9d9f5798785c039354bd4e1e946f8c92f 100644
index 000fd11480d783eab80a93fedde48f66e6b1298b..b3b6121dcfb6451d177431d51fa8a3e0975e4fbf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -187,6 +187,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
@ -2190,6 +2190,15 @@ index 000fd11480d783eab80a93fedde48f66e6b1298b..35f4ccc9d9f5798785c039354bd4e1e9
import com.mojang.datafixers.util.Pair;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
@@ -250,7 +252,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096;
private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed");
- private final Connection connection;
+ public final Connection connection; // Paper
private final MinecraftServer server;
public ServerPlayer player;
private int tickCount;
@@ -438,14 +440,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 38a45efcd2ff3cba9d2e15d7b6939c5ec873a1c5..5c60baafd997aed3168d60284dcbb2a3e002029c 100644
index 2e1f0ac59da4ce1f66a4e720c275744a28191478..ed9653e713893c273ca54f20febc4541e8d7e471 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1287,7 +1287,34 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -37,7 +37,7 @@ index 38a45efcd2ff3cba9d2e15d7b6939c5ec873a1c5..5c60baafd997aed3168d60284dcbb2a3
+ this.player.jumpFromGround();
+ } else {
+ from = event.getFrom();
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet(), false);
+ this.internalTeleport(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet());
+ return;
+ }
+ // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index efa6b34261e3f4ad0d58a0c7d85df30f33a14d62..ce70a77ec6da41b59660f5923d30eaebf24c4cc2 100644
index f8cfcecb0fc3377f750f124c8ff45be4c5bf78a1..ea04f0e1e9abf23e152070bd7ec2078e7dac2fe8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -224,10 +224,16 @@ public class CraftInventory implements Inventory {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 78ca1045257fa0771ddea44629e09cfac8f88ca3..a6989383126d52f339917905b58c2afe943b4e7d 100644
index 0c3c47bfa9af7d0780e60598b703e0d9f906ed9f..dfd87e2711e5bca09e29071375fec239e4e7538c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -391,7 +391,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 19cd680bd77196b99767b274599e9eb5ead80192..49ae203d493b1d43ee5c3623f5317499ffe55523 100644
index dd82cef26160a1794c47494c99c59eb329879b7b..d29519bd75e6e5a97b06aae86c485b49c4415fb8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3772,6 +3772,20 @@ public abstract class LivingEntity extends Entity {
@@ -3732,6 +3732,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
// Paper start
@ -30,7 +30,7 @@ index 19cd680bd77196b99767b274599e9eb5ead80192..49ae203d493b1d43ee5c3623f5317499
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 235e360df71b796a39d6c85530157097fd0c7b79..8c6592f989f982cf418690e2633bfba568f22227 100644
index a9642e95cde4dc1c3cb9da50c921171c47665536..8601639fd5dfb7ce68d6bd7803efd10438338483 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -200,6 +200,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d9a5a6719be998b9e40ab76519e4f207ee5c6bf9..c75fb5c096da9a20298ad857352298dbd5b5ef3f 100644
index 1beecfc947f52467bd10e454877bc0678fd2dc41..2d704af9491bec382e00a40fde36c6e01c8484f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2691,6 +2691,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2759,6 +2759,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers;
}

View File

@ -19,10 +19,10 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou
public net.minecraft.world.entity.LivingEntity getSoundVolume()F
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c680013d3f4 100644
index dad0368c8b55be018167bd8b113a80b7508647f1..77a74d41679e88d748d903295ac4f455e1f33b71 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -235,6 +235,10 @@ public class ServerPlayer extends Player {
@@ -240,6 +240,10 @@ public class ServerPlayer extends Player {
public int latency;
public boolean wonGame;
private int containerUpdateDelay; // Paper
@ -33,7 +33,7 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68
// CraftBukkit start
public String displayName;
@@ -823,6 +827,15 @@ public class ServerPlayer extends Player {
@@ -828,6 +832,15 @@ public class ServerPlayer extends Player {
String deathmessage = defaultMessage.getString();
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure
@ -49,7 +49,7 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@@ -968,8 +981,17 @@ public class ServerPlayer extends Player {
@@ -979,8 +992,17 @@ public class ServerPlayer extends Player {
}
}
}
@ -70,10 +70,10 @@ index 20c4ba5d00f5a40f5c7da282c9c069b365273041..4c8b1d30b82fd7a87f79983577695c68
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec 100644
index d29519bd75e6e5a97b06aae86c485b49c4415fb8..73cefc7ec582cb0fbfcff32cb9311f34ec2f31f0 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -263,6 +263,7 @@ public abstract class LivingEntity extends Entity {
@@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public Set<UUID> collidableExemptions = new HashSet<>();
public boolean bukkitPickUpLoot;
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
@ -81,7 +81,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
@Override
public float getBukkitYaw() {
@@ -1466,13 +1467,12 @@ public abstract class LivingEntity extends Entity {
@@ -1455,13 +1456,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (knockbackCancelled) this.level.broadcastEntityEvent(this, (byte) 2); // Paper - Disable explosion knockback
if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(source)) {
@ -99,7 +99,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
}
} else if (flag1) {
this.playHurtSound(source);
@@ -1624,7 +1624,7 @@ public abstract class LivingEntity extends Entity {
@@ -1613,7 +1613,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.isRemoved() && !this.dead) {
Entity entity = damageSource.getEntity();
LivingEntity entityliving = this.getKillCredit();
@ -108,7 +108,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
if (this.deathScore >= 0 && entityliving != null) {
entityliving.awardKillScore(this, this.deathScore, damageSource);
}
@@ -1636,20 +1636,53 @@ public abstract class LivingEntity extends Entity {
@@ -1625,20 +1625,53 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level.isClientSide && this.hasCustomName()) {
if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
}
@ -168,7 +168,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
}
}
@@ -1657,7 +1690,7 @@ public abstract class LivingEntity extends Entity {
@@ -1646,7 +1679,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level.isClientSide) {
boolean flag = false;
@ -177,7 +177,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
BlockPos blockposition = this.blockPosition();
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
@@ -1686,7 +1719,11 @@ public abstract class LivingEntity extends Entity {
@@ -1675,7 +1708,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@ -190,7 +190,7 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
Entity entity = source.getEntity();
int i;
@@ -1701,18 +1738,27 @@ public abstract class LivingEntity extends Entity {
@@ -1690,18 +1727,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropEquipment(); // CraftBukkit - from below
if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
this.dropFromLootTable(source, flag);
@ -220,10 +220,10 @@ index 49ae203d493b1d43ee5c3623f5317499ffe55523..24a07ef9f5cbed34d1aefccda9fe655b
// CraftBukkit start
public int getExpReward() {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 6f728231a7b326e605d6ddb8e4cd6f0f0aec820b..f61a4409ebb5ed89e5a5cfe0488498a52faa2346 100644
index e818687adf432e7ff47c8442ed2ea32d41c06b64..60d833bf8b7dcee046da9712a2dc809b05a31b42 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1036,7 +1036,13 @@ public abstract class Mob extends LivingEntity {
@@ -1065,7 +1065,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
this.spawnAtLocation(itemstack);
@ -238,10 +238,10 @@ index 6f728231a7b326e605d6ddb8e4cd6f0f0aec820b..f61a4409ebb5ed89e5a5cfe0488498a5
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index dd124ccbdc7efe0e41b3a04abddcb328cac44948..f4cfefd72704b3423392ffeb57e78c5d6410ff6f 100644
index 13061aed29649acfc52d13207aaebcd8ba339ebe..73510697455d891af6858b9a8ad8ca0c9b74880f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -705,15 +705,25 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@@ -706,15 +706,25 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
}
@Override
@ -271,7 +271,7 @@ index dd124ccbdc7efe0e41b3a04abddcb328cac44948..f4cfefd72704b3423392ffeb57e78c5d
public static boolean isPathClear(Fox fox, LivingEntity chasedEntity) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
index 65dd844b9b38730a819158e1023c4abd829b52bb..170411b42aeef69c796d1409b59c3eb69f78c710 100644
index e763421e263d9ed7a67106495fda4b74745a67fc..36f949f6a66edab8373439ff450ad34fff6bae2d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
@@ -69,11 +69,19 @@ public abstract class AbstractChestedHorse extends AbstractHorse {
@ -296,28 +296,33 @@ index 65dd844b9b38730a819158e1023c4abd829b52bb..170411b42aeef69c796d1409b59c3eb6
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b555675e5 100644
index e38cbdff34479673f1640c46d727f1a807a609c7..dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -532,9 +532,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity());
this.lastHit = i;
} else {
- this.brokenByPlayer(source);
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper
this.showBreakingParticles();
- this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event
+ if (!event.isCancelled()) this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event // Paper
}
@@ -542,8 +542,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity());
this.lastHit = i;
} else {
- this.brokenByPlayer(source);
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper
this.showBreakingParticles();
+ if (!event.isCancelled()) // Paper
this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
}
return true;
@@ -594,12 +594,12 @@ public class ArmorStand extends LivingEntity {
@@ -605,7 +606,7 @@ public class ArmorStand extends LivingEntity {
}
- private void brokenByPlayer(DamageSource damageSource) {
+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper
drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
if (this.hasCustomName()) {
@@ -613,10 +614,10 @@ public class ArmorStand extends LivingEntity {
}
drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
- this.brokenByAnything(damageSource);
+ return this.brokenByAnything(damageSource); // Paper
}
@ -327,7 +332,7 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b
this.playBrokenSound();
// this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down
@@ -621,7 +621,7 @@ public class ArmorStand extends LivingEntity {
@@ -638,7 +639,7 @@ public class ArmorStand extends LivingEntity {
this.armorItems.set(i, ItemStack.EMPTY);
}
}
@ -336,7 +341,7 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b
}
@@ -753,7 +753,8 @@ public class ArmorStand extends LivingEntity {
@@ -770,7 +771,8 @@ public class ArmorStand extends LivingEntity {
@Override
public void kill() {
@ -347,10 +352,10 @@ index f70f75867a8f03d42f240a0d007d2221269f2fdb..4edd48ce10caf31ac0136af35f19836b
this.gameEvent(GameEvent.ENTITY_DIE);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c75fb5c096da9a20298ad857352298dbd5b5ef3f..088a95b0f1574f293fe535b763c3768dbf95c9cc 100644
index 2d704af9491bec382e00a40fde36c6e01c8484f2..e3239cfb4237163389313f88496ad5e69b891c86 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2194,7 +2194,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2262,7 +2262,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void sendHealthUpdate() {
@ -367,10 +372,10 @@ index c75fb5c096da9a20298ad857352298dbd5b5ef3f..088a95b0f1574f293fe535b763c3768d
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb433a5cf8 100644
index c24e84e07f3f0d93da079ddf73e0e67b7d58fe8b..bdd4572489cd12ea19560fe82006e3fe4db29b50 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -807,9 +807,16 @@ public class CraftEventFactory {
@@ -806,9 +806,16 @@ public class CraftEventFactory {
public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List<org.bukkit.inventory.ItemStack> drops) {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
@ -387,7 +392,7 @@ index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
@@ -826,8 +833,15 @@ public class CraftEventFactory {
@@ -825,8 +832,15 @@ public class CraftEventFactory {
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure
event.setKeepInventory(keepInventory);
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
@ -403,7 +408,7 @@ index 67d820fb9aa00a3275cc3e23461864b496d738aa..6e533fdcd0671892a0e9dbfc99662feb
victim.keepLevel = event.getKeepLevel();
victim.newLevel = event.getNewLevel();
@@ -844,6 +858,31 @@ public class CraftEventFactory {
@@ -843,6 +857,31 @@ public class CraftEventFactory {
return event;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index cf47b0bed013b3242b516198ff7006aab5452d7e..00c438de76577e7b869270df16915d1ade088c9f 100644
index 58de6780b208934af9fe608c8a47978392b5f6d2..fa83827a80335ac1075f28c9acdfe7ca2ada8790 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -369,6 +369,7 @@ public final class ItemStack {
@@ -370,6 +370,7 @@ public final class ItemStack {
enuminteractionresult = InteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index 6f6358b3b24686cd8995cd71b6f7209b4227fc48..fb0784c8a4950776bd270bec3c80a8c5856c2655 100644
index f809a19afdfdb7df439e907531f54b2df1baf08c..00516a230073391b31795ec5af2aa7aa48db639a 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -174,7 +174,8 @@ public abstract class FlowingFluid extends Fluid {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f49df4f69b 100644
index b26a6354eaf2a699ab10da71afafebc807b4b06d..d3e91faee8805e88d850740fb5de9e5c8288c48b 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
@@ -133,7 +133,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@@ -129,7 +129,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@Nullable
private BlockPos getPosWithBlock(BlockPos pos, BlockGetter world) {
@ -19,7 +19,7 @@ index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f4
return pos;
} else {
BlockPos[] ablockposition = new BlockPos[]{pos.below(), pos.west(), pos.east(), pos.north(), pos.south(), pos.below().below()};
@@ -143,7 +145,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@@ -139,7 +141,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
for (int j = 0; j < i; ++j) {
BlockPos blockposition1 = ablockposition1[j];
@ -29,7 +29,7 @@ index 238c4225bbd4b12bd866603c6eb33182bc9dc89f..bd0cbf4390fc7d00b4bd5008cdf8f6f4
return blockposition1;
}
}
@@ -154,7 +157,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@@ -150,7 +153,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
@Override
protected boolean isValidTarget(LevelReader world, BlockPos pos) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 608be2b8bfff1b89855fc0bd181430d3a29a4cbb..c3d6b904f1310c93a3d5c1e5e3fab2f3476f5a48 100644
index 5338e0e1a67925da0c386735a545bb31096afbb1..029835914c3c88811684e90b29bfed83191b3b3f 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -170,9 +170,9 @@ public final class NaturalSpawner {

View File

@ -11,10 +11,10 @@ to the nearest Integer when updating its current cook time.
Modified by: Eric Su <ericsu@alumni.usc.edu>
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f0f23eadd 100644
index 4ed87cc5a46d9e10c755631a16f0e0cb388fb7f2..faa5beffb29e416f2a9af96ac66b5f88729e4705 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -76,11 +76,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -77,11 +77,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
protected NonNullList<ItemStack> items;
public int litTime;
int litDuration;
@ -28,7 +28,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
super(blockEntityType, pos, state);
@@ -127,6 +129,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -128,6 +130,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
};
this.recipesUsed = new Object2IntOpenHashMap();
this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
@ -36,7 +36,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
}
public static Map<Item, Integer> getFuel() {
@@ -279,6 +282,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -280,6 +283,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
}
@ -48,7 +48,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
}
@Override
@@ -287,6 +295,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -288,6 +296,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
nbt.putShort("BurnTime", (short) this.litTime);
nbt.putShort("CookTime", (short) this.cookingProgress);
nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime);
@ -56,7 +56,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
ContainerHelper.saveAllItems(nbt, this.items);
CompoundTag nbttagcompound1 = new CompoundTag();
@@ -358,7 +367,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -359,7 +368,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0));
CookingRecipe<?> recipe = (CookingRecipe<?>) irecipe.toBukkitRecipe();
@ -65,7 +65,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
world.getCraftServer().getPluginManager().callEvent(event);
blockEntity.cookingTotalTime = event.getTotalCookTime();
@@ -366,9 +375,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -367,9 +376,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
// CraftBukkit end
++blockEntity.cookingProgress;
@ -74,10 +74,10 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
blockEntity.cookingProgress = 0;
- blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity);
+ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, irecipe, blockEntity.items, i)) { // CraftBukkit
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), irecipe, blockEntity.items, i)) { // CraftBukkit
blockEntity.setRecipeUsed(irecipe);
}
@@ -468,9 +477,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -469,9 +478,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}
}
@ -93,7 +93,7 @@ index 8137682be60eb617738f7b257780a49182ef970c..196c99a2802c0bcaf93be287c404fc4f
public static boolean isFuel(ItemStack stack) {
return AbstractFurnaceBlockEntity.getFuel().containsKey(stack.getItem());
@@ -539,7 +552,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -540,7 +553,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}
if (slot == 0 && !flag) {

View File

@ -74,7 +74,7 @@ index 6b983e3e867bdd8cdffaf4575bbf67ad96b57ec7..66e2137f9379e885294f2b9f67f7e352
this.itemPatterns = nbt.getList("Patterns", 10);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
index 084e26de66c8204cb9aaad51bad3270228889ea3..a782994e2e53f2c4212c2d59ce740ebf00a826b0 100644
index e85022b31f2bc2783e88f5ba4c5173ac8a096c96..f1acd19432877a833f0d4339f9de4830a0f7b890 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
@@ -31,7 +31,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
@ -87,7 +87,7 @@ index 084e26de66c8204cb9aaad51bad3270228889ea3..a782994e2e53f2c4212c2d59ce740ebf
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 3a17c143de499d81109ae7d6e9fe18718139c5b7..04c2872e2a492adef5aec98289a8cf2af6611757 100644
index 05d98a0f34ffd50449fbafcf23fe7d05ca721317..34ec79a4298bff5ef6d751dc06b6439d0fa2e077 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -367,7 +367,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Honor EntityAgeable.ageLock
diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java
index 6113e05a0636cc4895bccfbf87eef306138bcd33..22ba53d9f8866327752b0c33b517adb02c50b684 100644
index ea71049ebe3d135b4ff0a7b288221e2ceccd5035..63d5913c431e4cef733240a928465d90a542e6c7 100644
--- a/src/main/java/net/minecraft/world/entity/AgeableMob.java
+++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java
@@ -84,6 +84,7 @@ public abstract class AgeableMob extends PathfinderMob {
@@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob {
}
public void ageUp(int age, boolean overGrow) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index a738b79e775a0a4abed1a05e12495d85f3de14bb..34e4d00ede62be50808a2782e54da987cc62c9af 100644
index cca08b8c6e1e15f13326a2a7e33e7f3225ad894b..50521cbd2af1c723d7caaf298fd052af905802b6 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -50,7 +50,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -51,7 +51,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);

View File

@ -9,7 +9,7 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 64d1f0ed579ef6f6f2e24e795d8dd0e1bdb5f39d..eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a 100644
index 4e1d28fbe67bc7a3d0741acd490be8db787480ae..405f36e9e115ad44bb91aad885785761786204ca 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -134,11 +134,11 @@ public abstract class BaseSpawner {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd4ad208c2 100644
index 73cefc7ec582cb0fbfcff32cb9311f34ec2f31f0..eb58b3230b46ade4403c31113d244b933b8a4a71 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -117,6 +117,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
@@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
@ -16,7 +16,7 @@ index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -3832,6 +3833,38 @@ public abstract class LivingEntity extends Entity {
@@ -3792,6 +3793,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
return level.clip(raytrace);
}
@ -56,7 +56,7 @@ index 24a07ef9f5cbed34d1aefccda9fe655b7dfef7ec..bd430a0bc14d5b1b991a0061e50223dd
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 8c6592f989f982cf418690e2633bfba568f22227..0541d68f6fc758ce5915fe906f7a44814c33b2d6 100644
index 8601639fd5dfb7ce68d6bd7803efd10438338483..b19185c16f8fecbefef697017e8dcfd249306fe3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1,5 +1,6 @@

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add sun related API
public net.minecraft.world.entity.Mob isSunBurnTick()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a6989383126d52f339917905b58c2afe943b4e7d..019bb773ced8f0a79611602906bad2366926d5ed 100644
index dfd87e2711e5bca09e29071375fec239e4e7538c..3889e880e3a8a21e38d613c552829ad998c24fd5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -678,6 +678,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -25,10 +25,10 @@ index e3983370c09e3e3445c4557fcca50dd25f29cba0..6efba52c2e5d7811ee329ed22c1c76f7
private final int searchRange;
private final int verticalSearchRange;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index ab4e8ff5fe4f53bfda1d7b152aa89e6772bc3a16..30663713e198bfe40b95c48524b71ea65f39965e 100644
index fb5af59559bc18ce2850d95ef73e5545dcab5ebc..b03c919edc33f308409ceeea0dd1064d1c6d7906 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -482,14 +482,17 @@ public class Turtle extends Animal {
@@ -487,15 +487,18 @@ public class Turtle extends Animal {
if (!this.turtle.isInWater() && this.isReachedTarget()) {
if (this.turtle.layEggCounter < 1) {
@ -44,12 +44,13 @@ index ab4e8ff5fe4f53bfda1d7b152aa89e6772bc3a16..30663713e198bfe40b95c48524b71ea6
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level, this.blockPos.above()), eggCount);
+ if (layEggEvent.callEvent() && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount())).isCancelled()) {
world.playSound((Player) null, blockposition, SoundEvents.TURTLE_LAY_EGG, SoundSource.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
- world.setBlock(this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1), 3);
+ world.setBlock(this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()), 3);
}
// CraftBukkit end
this.turtle.setHasEgg(false);
@@ -557,7 +560,7 @@ public class Turtle extends Animal {
BlockPos blockposition1 = this.blockPos.above();
- BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1);
+ BlockState iblockdata = (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()); // Paper
world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.Context.of(this.turtle, iblockdata));
@@ -566,7 +569,7 @@ public class Turtle extends Animal {
@Override
public boolean canUse() {

View File

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Caleb Bassham <caleb.bassham@gmail.com>
Date: Fri, 28 Sep 2018 02:32:19 -0500
Subject: [PATCH] Call player spectator target events and improve
implementation
Use a proper teleport for teleporting to entities in different
worlds.
Implementation improvements authored by Spottedleaf <Spottedleaf@users.noreply.github.com>
Validate that the target entity is valid and deny spectate
requests from frozen players.
Also, make sure the entity is spawned to the client before
sending the camera packet. If the entity isn't spawned clientside
when it receives the camera packet, then the client will not
spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 77a74d41679e88d748d903295ac4f455e1f33b71..87b6f0d448b9ca40ab081d55f4309a6eed8cd830 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1920,6 +1920,19 @@ public class ServerPlayer extends Player {
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event
+ if (this.camera == this) {
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
+ return;
+ }
+ } else {
+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity());
+ if (!playerStartSpectatingEntityEvent.callEvent()) {
+ return;
+ }
+ }
+ // Paper end
Level world = this.camera.getLevel();
if (world instanceof ServerLevel) {
@@ -1935,7 +1948,6 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundSetCameraPacket(this.camera));
this.connection.resetPosition();
}
-
}
@Override

View File

@ -11,10 +11,10 @@ If the projectile fails to find the shooter in the current world, check
other worlds.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index ec5fc3293097b364b5f6d8acc756aa8adde15215..a904507707475e95b6389ccc437bd234b97c10cc 100644
index 621ecd0f3cac52d3e4cecd003c67401ec7f0a6f7..a85175190c1ebb14b496a0bfe2f7136e06d0072c 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -58,6 +58,18 @@ public abstract class Projectile extends Entity {
@@ -60,6 +60,18 @@ public abstract class Projectile extends Entity implements TraceableEntity {
return this.cachedOwner;
} else if (this.ownerUUID != null && this.level instanceof ServerLevel) {
this.cachedOwner = ((ServerLevel) this.level).getEntity(this.ownerUUID);

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Add more Witch API
public net.minecraft.world.entity.monster.Witch usingTime
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 1ee8fec8f9f581fa68497ebf4f90aad9d425ec71..b7bc64818387288955d0723cd071d4203bd2f121 100644
index abbb077281eb8fc7961cf97ff23bb9822f2727f0..096546d7a97f031060bda7545aa620d522766719 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -156,21 +156,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -157,21 +157,24 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (potionregistry != null) {
@ -47,7 +47,7 @@ index 1ee8fec8f9f581fa68497ebf4f90aad9d425ec71..b7bc64818387288955d0723cd071d420
}
}
@@ -182,6 +185,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -183,6 +186,24 @@ public class Witch extends Raider implements RangedAttackMob {
super.aiStep();
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 2a3e9d3b847c155ba1d18c0711210c3e41bc3eac..1b1305f5eaf5710b72c57ab4c3953e703a23f1e0 100644
index 966eb1e2fc747965d15bb1cfc0d812d10afbf43f..f00773e05654bdeb5463f448293aac99d2208813 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -78,7 +78,7 @@ public class Drowned extends Zombie implements RangedAttackMob {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e105f791ad3 100644
index ea9831f6915301a2c68b46fe0e8c981399fb01ae..e5c17c81b0265a9854a59779983f8af0e749dd99 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -563,9 +563,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -565,9 +565,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
double d0 = entity.getX();
double d1 = entity.getY();
double d2 = entity.getZ();
@ -22,7 +22,7 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10
float f = Mth.wrapDegrees(packet.getYRot());
float f1 = Mth.wrapDegrees(packet.getXRot());
double d6 = d3 - this.vehicleFirstGoodX;
@@ -600,6 +600,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -602,6 +602,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -39,7 +39,7 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
@@ -1249,9 +1259,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1251,9 +1261,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.allowedPlayerTicks = 20; // CraftBukkit
} else {
this.awaitingTeleportTime = this.tickCount;
@ -52,13 +52,13 @@ index 23b56013e449ce4d6bd62096a20135adb87731eb..dc6a93405c4371d90ab7f5eaf11b6e10
float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot()));
float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot()));
@@ -1307,6 +1317,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1309,6 +1319,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} else {
speed = this.player.getAbilities().walkingSpeed * 10f;
}
+ // Paper start - Prevent moving into unloaded chunks
+ if (player.level.paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) {
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true);
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
+ return;
+ }
+ // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fe6a36015533d31600798a8ef882356caa147274..f2d9a475c9e7eb5a9bccdc74f1e361c440285749 100644
index 87b6f0d448b9ca40ab081d55f4309a6eed8cd830..bdc5cd6ec51ff64688c25a5a31882f5b1b6448af 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2337,6 +2337,7 @@ public class ServerPlayer extends Player {
@@ -2330,6 +2330,7 @@ public class ServerPlayer extends Player {
this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset

View File

@ -35,16 +35,14 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ }
+}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index c085ed233eb4d1f2100ec23a77447ef799ecdf1f..8120739e2a7c4c86ecb7058f08bd8179d3a943b8 100644
index 33ec55ed1f7d10a5235330ad082e7c7b54c42368..d5b37301d4e860c019105445001ed7a9a6f849bd 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -79,8 +79,8 @@ public class Util {
@@ -80,7 +80,7 @@ public class Util {
private static final int DEFAULT_MAX_THREADS = 255;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
- private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap");
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
+ private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority
+ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
@ -81,10 +79,10 @@ index c085ed233eb4d1f2100ec23a77447ef799ecdf1f..8120739e2a7c4c86ecb7058f08bd8179
return executorService;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index eef3b01d1304e06d0c9971df82af54d90676957a..2459fc1699582410b1fca4d787c6115563a575ba 100644
index 8c64c3c1e33cb289ac2eb1b55e1febf6920fd4c6..52d602fdaad361deb3b3e0ff2b99b7808e4a32cf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -317,6 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -320,6 +320,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
S s0 = serverFactory.apply(thread); // CraftBukkit - decompile error
atomicreference.set(s0);

View File

@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2459fc1699582410b1fca4d787c6115563a575ba..18ff46d66b1ffd6871fc2b16314d1b3383eb5cdd 100644
index 52d602fdaad361deb3b3e0ff2b99b7808e4a32cf..fc76ec97536e5f520b556453f7fcb7aa7572cb19 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1379,12 +1379,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1389,12 +1389,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.

View File

@ -161,7 +161,7 @@ index 0000000000000000000000000000000000000000..224d4b2cc45b0d02230a76caee9c8857
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 0cbb702641348500bf8f8ab3b3c206f70aea9738..1f73834043c2d2be17ae647589653d517db36a1b 100644
index 7d0d2cd4d34d6652eb45aa13442e1081a3a6bd56..191e8233deaa859d969d54242e297e722f3d947b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -71,13 +71,13 @@ public class CraftContainer extends AbstractContainerMenu {
@ -180,7 +180,7 @@ index 0cbb702641348500bf8f8ab3b3c206f70aea9738..1f73834043c2d2be17ae647589653d51
}
}, player, id);
}
@@ -227,6 +227,10 @@ public class CraftContainer extends AbstractContainerMenu {
@@ -232,6 +232,10 @@ public class CraftContainer extends AbstractContainerMenu {
this.lastSlots = delegate.lastSlots;
this.slots = delegate.slots;
this.remoteSlots = delegate.remoteSlots;
@ -192,7 +192,7 @@ index 0cbb702641348500bf8f8ab3b3c206f70aea9738..1f73834043c2d2be17ae647589653d51
// SPIGOT-4598 - we should still delegate the shift click handler
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index ce70a77ec6da41b59660f5923d30eaebf24c4cc2..94a71073a0d69145cf3429a2b6f646a2dc2015fd 100644
index ea04f0e1e9abf23e152070bd7ec2078e7dac2fe8..c3eff9a6734fe2d1809bbeff945c40da816bbddc 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -491,6 +491,10 @@ public class CraftInventory implements Inventory {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use Vanilla Minecart Speeds
CraftBukkit changed the values on flying speed, restore back to vanilla
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 035d5108dce46e0e6d2095d12198cd1762755ba7..39a51f97001ef08f5d2d2eefb25908a3296eec96 100644
index 29c0335116ef9bed0bcd55b0e600360b87d264cb..1e39bdb3146bcc577abc77021d7b9c9dcce51f4c 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -102,9 +102,9 @@ public abstract class AbstractMinecart extends Entity {

View File

@ -59,10 +59,10 @@ index 01a321a0c76c55b32922c94297139e85b3d4ac23..514c045883060e4a22f748176091d3b2
this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index dc6a93405c4371d90ab7f5eaf11b6e105f791ad3..e143fb922a0351f3fbf5c0c208916930a772c006 100644
index e5c17c81b0265a9854a59779983f8af0e749dd99..43304fd4aba9c5d3d31499b813c9c39934918cea 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1668,6 +1668,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1658,6 +1658,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:

View File

@ -18,10 +18,10 @@ index e202af893c7ec22bfc0b8dbeb8e1551db685d1d3..32b84c59722970218a1515e21c6454d0
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index aa1408dc26193eb133dd5ab04c2252b49ddb60b3..06272dba901fdac535ccbf7721bfd54724f5bf0f 100644
index bd2cc69ff6c15615dfedcb3c88e6bf2d36fd9370..8f6d54197401ea8722be73e4291aad34000cab58 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2632,6 +2632,16 @@ public final class CraftServer implements Server {
@@ -2630,6 +2630,16 @@ public final class CraftServer implements Server {
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
}

View File

@ -7,7 +7,7 @@ ray tracing into an unloaded chunk should be treated as a miss
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index 8a979600b49e8a11982577fb6dd79503e2521a0f..bca0838e40bc91d78e9b93df5318642d1c9f341e 100644
index 42e05380a875c52cd6e1cb337958b431a751698b..411d6c3466337c8322dbbba1a10c3e205bff3c63 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -75,7 +75,15 @@ public interface BlockGetter extends LevelHeightAccessor {

View File

@ -7,10 +7,10 @@ If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index a31820cb543f3e72e461c91b3191b56b18fb33dd..0e739c0c54eaad5ab8dddcd8294c9ccaa3697fbf 100644
index b1a9c75081f7e61212ea9395b35375e067fd7fc6..f70d81e1a779da840b636b36a913a0dca9427c94 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -149,6 +149,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -152,6 +152,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
@ -27,7 +27,7 @@ index a31820cb543f3e72e461c91b3191b56b18fb33dd..0e739c0c54eaad5ab8dddcd8294c9cca
Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause());
} else {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 00d432bd395e7f7fb6ee24e371818d13892b2f0c..5fce1177e7198d791d4ab1c64b394c5b1c145782 100644
index 42828edf81bd475b673a9d143f79c0d0711f14f5..ebee957fb048da6ffcd2a5ba2ed989ed1a6634e9 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -54,7 +54,31 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {

View File

@ -19,32 +19,11 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f2d9a475c9e7eb5a9bccdc74f1e361c440285749..4f851879aaea3b604e45c2f608edd3c2972bd038 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1366,11 +1366,13 @@ public class ServerPlayer extends Player {
}
}
- @Override
- public void stopRiding() {
+ // Paper start
+ @Override public void stopRiding() { stopRiding(false); }
+ @Override public void stopRiding(boolean suppressCancellation) {
+ // Paper end
Entity entity = this.getVehicle();
- super.stopRiding();
+ super.stopRiding(suppressCancellation); // Paper
Entity entity1 = this.getVehicle();
if (entity1 != entity && this.connection != null) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769ab01e91cb 100644
index 8663ea3cc8d5672b03b4b8345d7d970fcbc6a80b..b4929ecb7e49266b88eec433a65fd8cf049dd805 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2405,11 +2405,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2422,11 +2422,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void removeVehicle() {
@ -62,7 +41,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a
}
}
@@ -2476,7 +2481,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2490,7 +2495,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return true; // CraftBukkit
}
@ -74,7 +53,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -2486,7 +2494,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2500,7 +2508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(),
@ -83,7 +62,7 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a
);
// Suppress during worldgen
if (this.valid) {
@@ -2500,7 +2508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2514,7 +2522,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// CraftBukkit end
// Spigot start
@ -93,10 +72,10 @@ index 5116be3075c1249254524bf6a5b6bc28c61400e6..6d7632ca9b8b63be637c89b374b8769a
if (this.valid) {
Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index bd430a0bc14d5b1b991a0061e50223dd4ad208c2..3989a06970c896fedcd912eeaaca8945e3067858 100644
index eb58b3230b46ade4403c31113d244b933b8a4a71..69fbbd2745008e2d9caf6a30dd0779339e1c685b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3432,9 +3432,15 @@ public abstract class LivingEntity extends Entity {
@@ -3396,9 +3396,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void stopRiding() {
@ -114,10 +93,10 @@ index bd430a0bc14d5b1b991a0061e50223dd4ad208c2..3989a06970c896fedcd912eeaaca8945
this.dismountVehicle(entity);
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 48b18b824935ef922fe9f7e5860f923688a0ccc0..6f3d06b929e9b5c22b3090683d5eb90bc3c98421 100644
index ad000e1f7fb6b3d3ec423b6e3d44efdb46f69849..65adadd9e35f2ec6c10acd24ebf61e3cfba173e4 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1142,7 +1142,13 @@ public abstract class Player extends LivingEntity {
@@ -1141,7 +1141,13 @@ public abstract class Player extends LivingEntity {
@Override
public void removeVehicle() {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits
Puts some limits on the size of books.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e143fb922a0351f3fbf5c0c208916930a772c006..dcaa912fc785620d0458a35144becd0ae0a552d7 100644
index 43304fd4aba9c5d3d31499b813c9c39934918cea..fc36fb064dc09ea97062fcb782422821ff24940b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1116,6 +1116,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1118,6 +1118,45 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleEditBook(ServerboundEditBookPacket packet) {

View File

@ -39,10 +39,10 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl state
public net.minecraft.server.network.ServerLoginPacketListenerImpl gameProfile
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 0e739c0c54eaad5ab8dddcd8294c9ccaa3697fbf..8b1c39cc7f77ca36d0341fb68de1441cc61f19e4 100644
index f70d81e1a779da840b636b36a913a0dca9427c94..62ee5e32ac0f5d244fa55f9fe45d34cf4d2becaa 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -469,6 +469,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -487,6 +487,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
}
this.queue.clear(); // Free up packet queue.

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Enderman from loading chunks
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 4fcd5e1e0641474beeaa834adce73ba10065e34e..1d8cf9b765f9c55feeb26e4ba4aa969be142dc3f 100644
index 908ef284f17296c72009a5803dfefff13664fb1c..c8fe9126f0b6e973aae04d825613fcf67e0838d2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -509,7 +509,8 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -506,7 +506,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D);
int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D);
BlockPos blockposition = new BlockPos(i, j, k);
@ -18,7 +18,7 @@ index 4fcd5e1e0641474beeaa834adce73ba10065e34e..1d8cf9b765f9c55feeb26e4ba4aa969b
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata1 = world.getBlockState(blockposition1);
BlockState iblockdata2 = this.enderman.getCarriedBlock();
@@ -555,7 +556,8 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -552,7 +553,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D);
int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D);
BlockPos blockposition = new BlockPos(i, j, k);

View File

@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4f851879aaea3b604e45c2f608edd3c2972bd038..c0ba5e308d8ef8333eeea6217f95022cf59c76b7 100644
index bdc5cd6ec51ff64688c25a5a31882f5b1b6448af..3ff9823da9e906189f1bd4fa98838de5dcfc428a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -235,6 +235,7 @@ public class ServerPlayer extends Player {
@@ -240,6 +240,7 @@ public class ServerPlayer extends Player {
public int latency;
public boolean wonGame;
private int containerUpdateDelay; // Paper
@ -28,10 +28,10 @@ index 4f851879aaea3b604e45c2f608edd3c2972bd038..c0ba5e308d8ef8333eeea6217f95022c
public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d1d5e0deb0dd8963424db6fc7a353c4ed397bb98..bcfd6751100bcc689d6eb0669e14fa91d5c4b919 100644
index ab83fc7c8903ed4a71824c5dcc85b9764c6c5690..c291339e448cb87c42b7daf5a3c67869c7412d0b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -185,6 +185,7 @@ public abstract class PlayerList {
@@ -186,6 +186,7 @@ public abstract class PlayerList {
public void placeNewPlayer(Connection connection, ServerPlayer player) {
player.isRealPlayer = true; // Paper
@ -106,10 +106,10 @@ index 69a1852905dd4724c30ac8ab88c14251eee2c371..17b3d5de58a9ef3acc67624c46cd6bbd
public Location getLastDeathLocation() {
if (this.getData().contains("LastDeathLocation", 10)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54dbb675e02d 100644
index e3239cfb4237163389313f88496ad5e69b891c86..5fa39672210af814e078a1463d493bfb114efc66 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -176,6 +176,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -177,6 +177,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus;
private String resourcePackHash;
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
@ -117,7 +117,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db
// Paper end
public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -1806,6 +1807,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1874,6 +1875,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = firstPlayed;
}
@ -136,7 +136,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db
public void readExtraData(CompoundTag nbttagcompound) {
this.hasPlayedBefore = true;
if (nbttagcompound.contains("bukkit")) {
@@ -1828,6 +1841,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1896,6 +1909,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setExtraData(CompoundTag nbttagcompound) {
@ -145,7 +145,7 @@ index 088a95b0f1574f293fe535b763c3768dbf95c9cc..3f23d3bc3b35b48f3c8962b2622c54db
if (!nbttagcompound.contains("bukkit")) {
nbttagcompound.put("bukkit", new CompoundTag());
}
@@ -1842,6 +1857,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1910,6 +1925,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("firstPlayed", this.getFirstPlayed());
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c0ba5e308d8ef8333eeea6217f95022cf59c76b7..d6aa16ccb18e1aac0e2c59e3fb83bea87572aa7c 100644
index 3ff9823da9e906189f1bd4fa98838de5dcfc428a..8d4cddb68fd074d7a8ca4986a86d378434cb5fb5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1609,6 +1609,13 @@ public class ServerPlayer extends Player {
@@ -1585,6 +1585,13 @@ public class ServerPlayer extends Player {
public void disconnect() {
this.disconnected = true;
this.ejectPassengers();

View File

@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3f23d3bc3b35b48f3c8962b2622c54dbb675e02d..d21faa3e7a97c28e380323b503d32de5e5705d11 100644
index 5fa39672210af814e078a1463d493bfb114efc66..bb9940422a87e5d97a7c2d3ed368644074e9348c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2738,6 +2738,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2806,6 +2806,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetAttackStrengthTicker();
}

View File

@ -11,10 +11,10 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 01e8a8c36645efc9b728c6c58e12f594d619f5a5..dcbd8afb4d6fcf509bbb66788f55e83f2faa6f90 100644
index e7e069ea6b5fc20225e6fabd98e0ffb6de497ce2..d0fe8a99163c924c44983a9a575bd76714865cab 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -29,6 +29,7 @@ import net.minecraft.nbt.CompoundTag;
@@ -30,6 +30,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
@ -22,7 +22,7 @@ index 01e8a8c36645efc9b728c6c58e12f594d619f5a5..dcbd8afb4d6fcf509bbb66788f55e83f
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ServerLevel;
@@ -583,8 +584,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -589,8 +590,21 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return false;
} else {
FluidState fluid = this.getFluidState(pos);

View File

@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues
due to the shutdown logic generally being much later.
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0eb19888eb 100644
index 7f561ab6e56cd1749da8eff950080d3ae3f5e028..286dab2ed3c6b962c9702b8b10105e1456b04f7b 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -390,6 +390,24 @@ public class Commands {
@@ -396,6 +396,24 @@ public class Commands {
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
// CraftBukkit start
// Register Vanilla commands into builtRoot as before
@ -37,7 +37,7 @@ index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0e
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode();
@@ -407,7 +425,14 @@ public class Commands {
@@ -413,7 +431,14 @@ public class Commands {
for (CommandNode node : rootcommandnode.getChildren()) {
bukkit.add(node.getName());
}
@ -53,10 +53,10 @@ index 4cf76403098cc8565199b29757a29c80150bbaae..b21bcb046ec801a4cb5395034be60d0e
event.getPlayer().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 18ff46d66b1ffd6871fc2b16314d1b3383eb5cdd..038e98c708f9fac8ab6109d02b0297a1d008710c 100644
index fc76ec97536e5f520b556453f7fcb7aa7572cb19..ca2a2b1f54f06f9035be8b379fad580128811fc2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -897,6 +897,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -899,6 +899,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");

View File

@ -10,7 +10,7 @@ Adds CommandRegisteredEvent
- Allows manipulating the CommandNode to add more children/metadata for the client
diff --git a/build.gradle.kts b/build.gradle.kts
index d2b45b70f4951e44b34a67e29d008748ba84a6bf..243e40cb0e14f62e284fc272aeb0b6a1bc54ea9f 100644
index 6ca33c80c8bd4d87953103c06804fa9a0eef4f3c..b6b077262132be3b30f81a2a6c9288afbd11c358 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,6 +8,7 @@ plugins {
@ -99,10 +99,10 @@ index 65d8c7d5aab8c6afe3c5671a90ad0fbc03bedfdd..efad6dc30ff2731fdaed9c7f8d974aba
public boolean hasPermission(int level) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c9b2e0cae 100644
index 286dab2ed3c6b962c9702b8b10105e1456b04f7b..7d47e15468f59ce7bc25f692e9963a29d00117cb 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -426,6 +426,7 @@ public class Commands {
@@ -432,6 +432,7 @@ public class Commands {
bukkit.add(node.getName());
}
// Paper start - Async command map building
@ -110,7 +110,7 @@ index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode);
});
@@ -433,6 +434,7 @@ public class Commands {
@@ -439,6 +440,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building
@ -118,7 +118,7 @@ index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -451,6 +453,11 @@ public class Commands {
@@ -457,6 +459,11 @@ public class Commands {
while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
@ -131,10 +131,10 @@ index b21bcb046ec801a4cb5395034be60d0eb19888eb..2f256d0452617c8f2630f0dd8f16025c
if (commandnode2.canUse(source)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index dcaa912fc785620d0458a35144becd0ae0a552d7..8c773cfefbe14f74db455594ec833ca62d7b9e74 100644
index fc36fb064dc09ea97062fcb782422821ff24940b..773170c5443dce6e64762e4504d222a5b5bb8ae3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -828,8 +828,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -830,8 +830,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
ParseResults<CommandSourceStack> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -149,7 +149,7 @@ index dcaa912fc785620d0458a35144becd0ae0a552d7..8c773cfefbe14f74db455594ec833ca6
});
});
}
@@ -844,7 +848,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -846,7 +850,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
}
});

View File

@ -10,10 +10,10 @@ This made the Bukkit RecipeChoice API not work for Shapeless.
This reimplements vanilla logic using the same test logic as Shaped
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index dc4d3034b193562c70a929f0af9420a1e6728f13..e7c06d98532160499f2610f69de27e30a326b16f 100644
index 95eb0d2c624f196e4c4d3d4367a47af881e946a8..f4f3f3a19d3cadaef1ae1a47daa68251a983dcf2 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -84,16 +84,49 @@ public class ShapelessRecipe implements CraftingRecipe {
@@ -85,16 +85,49 @@ public class ShapelessRecipe implements CraftingRecipe {
StackedContents autorecipestackmanager = new StackedContents();
int i = 0;
@ -65,4 +65,4 @@ index dc4d3034b193562c70a929f0af9420a1e6728f13..e7c06d98532160499f2610f69de27e30
+ // Paper end
}
public ItemStack assemble(CraftingContainer inventory) {
public ItemStack assemble(CraftingContainer inventory, RegistryAccess registryManager) {

View File

@ -22,10 +22,10 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8c773cfefbe14f74db455594ec833ca62d7b9e74..461bfd99b303fcf7ce6d7ee53184605313f48b10 100644
index 773170c5443dce6e64762e4504d222a5b5bb8ae3..d754c32b1c1c0cf56a690f3b699eb24a795765e4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -296,6 +296,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -298,6 +298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private final MessageSignatureCache messageSignatureCache;
private final FutureChain chatMessageChain;
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
@ -33,7 +33,7 @@ index 8c773cfefbe14f74db455594ec833ca62d7b9e74..461bfd99b303fcf7ce6d7ee531846053
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
@@ -3182,7 +3183,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3191,7 +3192,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {

View File

@ -28,10 +28,10 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf, sandtechnology
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6f256d0cd 100644
index 62ee5e32ac0f5d244fa55f9fe45d34cf4d2becaa..184f36a137ed5e5cd20797e131801bc29449cf5c 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -116,6 +116,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -118,6 +118,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public int protocolVersion;
public java.net.InetSocketAddress virtualHost;
private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush");
@ -42,15 +42,15 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
// Paper end
public Connection(PacketFlow side) {
@@ -139,6 +143,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -141,6 +145,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
public void setProtocol(ConnectionProtocol state) {
+ protocol = state; // Paper
this.channel.attr(Connection.ATTRIBUTE_PROTOCOL).set(state);
this.channel.attr(BundlerInfo.BUNDLER_PROVIDER).set(state);
this.channel.config().setAutoRead(true);
Connection.LOGGER.debug("Enabled auto read");
@@ -217,19 +222,88 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -220,19 +225,88 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
Validate.notNull(listener, "packetListener", new Object[0]);
this.packetListener = listener;
}
@ -143,7 +143,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
}
private void sendPacket(Packet<?> packet, @Nullable PacketSendListener callbacks) {
@@ -257,6 +331,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -264,6 +338,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.setProtocol(packetState);
}
@ -159,7 +159,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
if (callbacks != null) {
@@ -275,28 +358,72 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -282,28 +365,72 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
});
}
@ -240,7 +240,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
} finally { // Paper start - add pending task queue
Runnable r;
while ((r = this.pendingTasks.poll()) != null) {
@@ -304,6 +431,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -311,6 +438,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
} // Paper end - add pending task queue
}
@ -248,7 +248,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
public void tick() {
this.flushQueue();
@@ -340,9 +468,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -347,9 +475,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
return this.address;
}
@ -271,7 +271,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
// Spigot End
if (this.channel.isOpen()) {
this.channel.close(); // We can't wait as this may be called from an event loop.
@@ -460,7 +601,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -478,7 +619,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void handleDisconnection() {
if (this.channel != null && !this.channel.isOpen()) {
if (this.disconnectionHandled) {
@ -280,7 +280,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
} else {
this.disconnectionHandled = true;
if (this.getDisconnectedReason() != null) {
@@ -468,7 +609,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -486,7 +627,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.getPacketListener() != null) {
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
}
@ -289,7 +289,7 @@ index 8b1c39cc7f77ca36d0341fb68de1441cc61f19e4..00c4c8eb0fe70931a6fab24416ddcfa6
// Paper start - Add PlayerConnectionCloseEvent
final PacketListener packetListener = this.getPacketListener();
if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl) {
@@ -508,6 +649,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -526,6 +667,18 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@Nullable
final PacketSendListener listener;
@ -333,10 +333,10 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78
return false;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 0e04532b8f1d48116eb46dcef7952bfcc0d11394..a24ef433d0c9d06b86fd612978cfd6d877036791 100644
index 776528e50a5abc0e02d9de99231fb47352aa4f43..fbf375534e2b8bd6ef052c4625764f4f8feb2ed6 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -65,10 +65,12 @@ public class ServerConnectionListener {
@@ -62,10 +62,12 @@ public class ServerConnectionListener {
final List<Connection> connections = Collections.synchronizedList(Lists.newArrayList());
// Paper start - prevent blocking on adding a new network manager while the server is ticking
private final java.util.Queue<Connection> pending = new java.util.concurrent.ConcurrentLinkedQueue<>();
@ -349,11 +349,11 @@ index 0e04532b8f1d48116eb46dcef7952bfcc0d11394..a24ef433d0c9d06b86fd612978cfd6d8
}
}
// Paper end
@@ -103,6 +105,7 @@ public class ServerConnectionListener {
@@ -100,6 +102,7 @@ public class ServerConnectionListener {
;
}
+ if (!disableFlushConsolidation) channel.pipeline().addFirst(new io.netty.handler.flush.FlushConsolidationHandler()); // Paper
channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this)).addLast("splitter", new Varint21FrameDecoder()).addLast("decoder", new PacketDecoder(PacketFlow.SERVERBOUND)).addLast("prepender", new Varint21LengthFieldPrepender()).addLast("encoder", new PacketEncoder(PacketFlow.CLIENTBOUND));
int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond();
Object object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND);
ChannelPipeline channelpipeline = channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyQueryHandler(ServerConnectionListener.this));
Connection.configureSerialization(channelpipeline, PacketFlow.SERVERBOUND);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bcfd6751100bcc689d6eb0669e14fa91d5c4b919..07a2da57a0684231a726a0aac58a9943195b3a11 100644
index c291339e448cb87c42b7daf5a3c67869c7412d0b..9905d2174582b38913752c2e86e4d610baff181d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1140,6 +1140,7 @@ public abstract class PlayerList {
@@ -1147,6 +1147,7 @@ public abstract class PlayerList {
}
public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2daa8e2e64829df838bde981a56d6e407b8ee004..04826a7684940558368e95d4cfd7f90eda057df8 100644
index e46f18e342f2e682c4d5bbac22187a171df8eb33..58c1769ea15249df950a40e2f164e2ff7aeb05bd 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1289,6 +1289,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1288,6 +1288,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true;
}
// Paper end
@ -22,10 +22,10 @@ index 2daa8e2e64829df838bde981a56d6e407b8ee004..04826a7684940558368e95d4cfd7f90e
// Paper start
if (DEBUG_ENTITIES) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 07a2da57a0684231a726a0aac58a9943195b3a11..e797d3a730939592a328efa69c61d99d862a1258 100644
index 9905d2174582b38913752c2e86e4d610baff181d..026bba5551dd77d616eb11c59575f9fea28000af 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -356,7 +356,7 @@ public abstract class PlayerList {
@@ -363,7 +363,7 @@ public abstract class PlayerList {
// CraftBukkit start
ServerLevel finalWorldServer = worldserver1;
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -35,19 +35,10 @@ index 07a2da57a0684231a726a0aac58a9943195b3a11..e797d3a730939592a328efa69c61d99d
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41800efe4e 100644
index b4929ecb7e49266b88eec433a65fd8cf049dd805..80806cd557a481ffbfa9b26e84d1ab1bcba0543f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -74,6 +74,8 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Nameable;
import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.entity.animal.AbstractFish;
+import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.Boat;
@@ -231,6 +233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -233,6 +233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
}
// Paper end
@ -55,7 +46,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
@@ -2047,6 +2050,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2061,6 +2062,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -65,7 +56,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -2192,6 +2198,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2207,6 +2211,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -80,7 +71,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41
+ if (spawnReason == null) {
+ if (spawnedViaMobSpawner) {
+ spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER;
+ } else if (this instanceof Mob && (this instanceof Animal || this instanceof AbstractFish) && !((Mob) this).removeWhenFarAway(0.0)) {
+ } else if (this instanceof Mob && (this instanceof net.minecraft.world.entity.animal.Animal || this instanceof net.minecraft.world.entity.animal.AbstractFish) && !((Mob) this).removeWhenFarAway(0.0)) {
+ if (!nbt.getBoolean("PersistenceRequired")) {
+ spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL;
+ }
@ -93,7 +84,7 @@ index 6d7632ca9b8b63be637c89b374b8769ab01e91cb..74e83b3d2e7e7c89ccba4b6aaf612f41
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a..6ba97a0b4f2cb15d5435657c8e8f5c71c6fee3db 100644
index 405f36e9e115ad44bb91aad885785761786204ca..091c72b95e3c4c3528812ace4aec64d451f25462 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -185,6 +185,7 @@ public abstract class BaseSpawner {
@ -105,10 +96,10 @@ index eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a..6ba97a0b4f2cb15d5435657c8e8f5c71
// Spigot Start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9ba0135932571c815fec15d2caccc789d3af3464..e900c64b8b07dc9cf47cc565e60df6781ca95756 100644
index dc4060aee09ec9700a9379e0536fd758c3c1eb25..13169525ce6260f6d4a0501af0f5bea284a5ba96 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1268,5 +1268,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1303,5 +1303,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean fromMobSpawner() {
return getHandle().spawnedViaMobSpawner;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6c2699e9a 100644
index 026bba5551dd77d616eb11c59575f9fea28000af..d677a05741e1df4bba2598182256758d4da09a4b 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -736,9 +736,14 @@ public abstract class PlayerList {
@@ -743,9 +743,14 @@ public abstract class PlayerList {
boolean flag2 = false;
@ -24,7 +24,7 @@ index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) {
Optional optional;
@@ -790,6 +795,7 @@ public abstract class PlayerList {
@@ -797,6 +802,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index e797d3a730939592a328efa69c61d99d862a1258..ce35bd1bf1e532ec1bf260d72299b0f6
} else {
location.setWorld(worldserver.getWorld());
}
@@ -849,6 +855,13 @@ public abstract class PlayerList {
@@ -856,6 +862,13 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 42b056d58146991b86de0690fce595716ee5455b..02bd99934066b35a3f4fd59370cdabf0640ee218 100644
index 298dff12c511e8b767d5a7ee14f94fe0745e5338..007625b1a121f1e7241f7cbfba0b1f168e8be5df 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -112,6 +112,7 @@ public class ItemEntity extends Entity {
@@ -121,6 +121,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@ -17,7 +17,7 @@ index 42b056d58146991b86de0690fce595716ee5455b..02bd99934066b35a3f4fd59370cdabf0
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
@@ -198,6 +199,7 @@ public class ItemEntity extends Entity {
@@ -207,6 +208,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;

View File

@ -1,89 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Caleb Bassham <caleb.bassham@gmail.com>
Date: Fri, 28 Sep 2018 02:32:19 -0500
Subject: [PATCH] Call player spectator target events and improve
implementation
Use a proper teleport for teleporting to entities in different
worlds.
Implementation improvements authored by Spottedleaf <Spottedleaf@users.noreply.github.com>
Validate that the target entity is valid and deny spectate
requests from frozen players.
Also, make sure the entity is spawned to the client before
sending the camera packet. If the entity isn't spawned clientside
when it receives the camera packet, then the client will not
spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4c8b1d30b82fd7a87f79983577695c680013d3f4..fe6a36015533d31600798a8ef882356caa147274 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1908,15 +1908,59 @@ public class ServerPlayer extends Player {
}
public void setCamera(@Nullable Entity entity) {
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event and improve implementation
Entity entity1 = this.getCamera();
- this.camera = (Entity) (entity == null ? this : entity);
- if (entity1 != this.camera) {
- this.connection.send(new ClientboundSetCameraPacket(this.camera));
- this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
- this.connection.resetPosition();
+ if (entity == null) {
+ entity = this;
}
+ if (entity1 == entity) return; // new spec target is the current spec target
+
+ if (entity == this) {
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
+
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
+ return;
+ }
+ } else {
+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity());
+
+ if (!playerStartSpectatingEntityEvent.callEvent()) {
+ return;
+ }
+ }
+ // Validate
+ if (entity != this) {
+ if (entity.isRemoved() || !entity.valid || entity.level == null) {
+ MinecraftServer.LOGGER.info("Blocking player " + this + " from spectating invalid entity " + entity);
+ return;
+ }
+ if (this.isImmobile()) {
+ // use debug: clients might maliciously spam this
+ MinecraftServer.LOGGER.debug("Blocking frozen player " + this + " from spectating entity " + entity);
+ return;
+ }
+ }
+
+ this.camera = entity; // only set after validating state
+
+ if (entity != this) {
+ // Make sure we're in the right place
+ this.ejectPassengers(); // teleport can fail if we have passengers...
+ this.getBukkitEntity().teleport(new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ(), this.getYRot(), this.getXRot()), TeleportCause.SPECTATE); // Correctly handle cross-world entities from api calls by using CB teleport
+
+ // Make sure we're tracking the entity before sending
+ ChunkMap.TrackedEntity tracker = ((ServerLevel)entity.level).getChunkSource().chunkMap.entityMap.get(entity.getId());
+ if (tracker != null) { // dumb plugins...
+ tracker.updatePlayer(this);
+ }
+ } else {
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
+ }
+ this.connection.send(new ClientboundSetCameraPacket(entity));
+ this.connection.resetPosition();
+ // Paper end
}
@Override