3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Dieser Commit ist enthalten in:
Bjarne Koll 2024-10-22 23:30:51 +02:00
Ursprung 9e92fed7a2
Commit f1649d702b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62
49 geänderte Dateien mit 229 neuen und 238 gelöschten Zeilen

Datei anzeigen

@ -11,15 +11,19 @@ This disables that by not saving the thrower when the chunk is unloaded.
This is mainly useful for survival servers that do not allow freeform teleporting. This is mainly useful for survival servers that do not allow freeform teleporting.
Note: Currently removed as enderpearls are ticked as long as their owner is online in 1.21.2.
Might be worth to re-add once an option to disable the above vanilla mechanic is added, to
fully prevent enderpearl travel exploits.
== AT == == AT ==
public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile cachedOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID public net.minecraft.world.entity.projectile.Projectile ownerUUID
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index d728afbe1d6882f1ace4ead9d87f4b7d2af43ba2..7c6b094de5e29cb2663e8a7072a27d7adbceb4b2 100644 index 21c3d771a3dd921767c2cba1e11583d015879ca9..332d378979925f1197f4218919442688a4c47c23 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2111,6 +2111,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2194,6 +2194,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public void onTickingEnd(Entity entity) { public void onTickingEnd(Entity entity) {
ServerLevel.this.entityTickList.remove(entity); ServerLevel.this.entityTickList.remove(entity);
@ -33,13 +37,13 @@ index d728afbe1d6882f1ace4ead9d87f4b7d2af43ba2..7c6b094de5e29cb2663e8a7072a27d7a
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java 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 add45e6e95688649ba4b8d67747f763a261da51e..a39de724848d6dc796dd99dde5206f20e513fd18 100644 index fed01aea47090b990939becde837add6c36bf418..a1840bb4a3307492f80f93c4433eec3be7f862f1 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -108,6 +108,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { @@ -116,6 +116,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
protected void readAdditionalSaveData(CompoundTag nbt) {
if (nbt.hasUUID("Owner")) { if (nbt.hasUUID("Owner")) {
this.ownerUUID = nbt.getUUID("Owner"); this.setOwnerThroughUUID(nbt.getUUID("Owner"));
this.cachedOwner = null;
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit + if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Block player logins during server shutdown
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index e65c582635317b9f8a1af4e6f6a5fb916f73cc35..0c2137dda44f2341bffe0928dc77be8ca6371bc9 100644 index 80ac468321a9ccb3486e97b3448dd3fccd8e766e..ca4c054f17a79bfe0f4f49783a13e30eb0f3e2ff 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -102,6 +102,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -102,6 +102,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 85d8c4865b65792b99f812b579d7c23823d76e52..0e800e3aeeec84f5f7ed0a391c9b66ae5689bd40 100644 index b1b26e7c0f66f0697bcfe9eb045d45f31cd9ab06..99794276626d26849150d4956abbbc2296543907 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -402,6 +402,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -405,6 +405,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void inactiveTick() { } public void inactiveTick() { }
// Spigot end // Spigot end
protected int numCollisions = 0; // Paper - Cap entity collisions protected int numCollisions = 0; // Paper - Cap entity collisions
@ -16,7 +16,7 @@ index 85d8c4865b65792b99f812b579d7c23823d76e52..0e800e3aeeec84f5f7ed0a391c9b66ae
// Paper start - Entity origin API // Paper start - Entity origin API
@javax.annotation.Nullable @javax.annotation.Nullable
private org.bukkit.util.Vector origin; private org.bukkit.util.Vector origin;
@@ -2259,6 +2260,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -2375,6 +2376,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
} }
@ -27,7 +27,7 @@ index 85d8c4865b65792b99f812b579d7c23823d76e52..0e800e3aeeec84f5f7ed0a391c9b66ae
// Paper end // Paper end
return nbttagcompound; return nbttagcompound;
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -2399,6 +2404,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -2516,6 +2521,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.originWorld = originWorld; this.originWorld = originWorld;
origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
} }
@ -37,7 +37,7 @@ index 85d8c4865b65792b99f812b579d7c23823d76e52..0e800e3aeeec84f5f7ed0a391c9b66ae
} catch (Throwable throwable) { } 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 diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index aa54237205989f619ac6a3faa2e4285427b9e31d..43d399e1a0ba2fb0541f851a28032fa60fc01b33 100644 index 7b918001d36a8f14ed0d3ee4d6783588f48eb78f..e424c23c22809a307175b5dcc7f7b0084464493f 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -176,6 +176,7 @@ public abstract class BaseSpawner { @@ -176,6 +176,7 @@ public abstract class BaseSpawner {
@ -49,7 +49,7 @@ index aa54237205989f619ac6a3faa2e4285427b9e31d..43d399e1a0ba2fb0541f851a28032fa6
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
continue; continue;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
index 55d63de57ec740fc4ea5faa3db9a092b8e4fed95..c3f6522a7dc0777c5b3fa2bac63a8901f96d9f38 100644 index 28c8b8cd2ad0a368f7856a407d91742978490728..f0163b7fa8b27823db9df5b8d2b6adcb63023164 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java --- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java +++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
@@ -230,6 +230,7 @@ public final class TrialSpawner { @@ -230,6 +230,7 @@ public final class TrialSpawner {
@ -61,10 +61,10 @@ index 55d63de57ec740fc4ea5faa3db9a092b8e4fed95..c3f6522a7dc0777c5b3fa2bac63a8901
if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, pos).isCancelled()) {
return Optional.empty(); return Optional.empty();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index df6da730134da754d0ff23bd1b57c82486b9ab73..69b5946625a53a1351ffc4bdf61c6874949bbeae 100644 index 0bec53dc1be4aa997be9f03bc3cde30d22cc8160..0480fbeffd19011d3cd63021225f376c464b480c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1010,4 +1010,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1011,4 +1011,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return originVector.toLocation(world); return originVector.toLocation(world);
} }
// Paper end - entity origin API // Paper end - entity origin API

Datei anzeigen

@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations. to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index e2daeeba1bacbb5c5ca2aa922fa67b02cd050755..07df02997d95275cbf26ab9b76eb587da7117d37 100644 index 5d7e6b61102a6244c5426917c4ff280fa9e12cf1..91010267b8c4df582415a8f7cd7386723b556cc0 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -223,4 +223,12 @@ public final class CraftItemFactory implements ItemFactory { @@ -226,4 +226,12 @@ public final class CraftItemFactory implements ItemFactory {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName()); return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName());
} }
// Paper end - Adventure // Paper end - Adventure

Datei anzeigen

@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar. You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 07df02997d95275cbf26ab9b76eb587da7117d37..fd0df053cd5e8802991e665185e7f90f8001d80c 100644 index 91010267b8c4df582415a8f7cd7386723b556cc0..685aa3c35dc593b1d923a31967649b468df8a238 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -231,4 +231,19 @@ public final class CraftItemFactory implements ItemFactory { @@ -234,4 +234,19 @@ public final class CraftItemFactory implements ItemFactory {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
} }
// Paper end - ensure server conversions API // Paper end - ensure server conversions API

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d5f17d7e3b56ca87ec9070b69265ce098de61f69..c08ffdbc9afb2fe7abbf5567dc1fb1e2bcb01b96 100644 index 0a63e32b4e51500dd808ad2360d0521bf9632180..61687b2dce3964afc588e792cf765717b6d066dc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -624,9 +624,9 @@ public abstract class PlayerList { @@ -591,9 +591,9 @@ public abstract class PlayerList {
// return chatmessage; // return chatmessage;
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
@ -21,7 +21,7 @@ index d5f17d7e3b56ca87ec9070b69265ce098de61f69..c08ffdbc9afb2fe7abbf5567dc1fb1e2
} else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) {
IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
@@ -993,7 +993,25 @@ public abstract class PlayerList { @@ -962,7 +962,25 @@ public abstract class PlayerList {
} }
public boolean isWhiteListed(GameProfile profile) { public boolean isWhiteListed(GameProfile profile) {

Datei anzeigen

@ -9,10 +9,10 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa
and to provide some level of hint without being disruptive. and to provide some level of hint without being disruptive.
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
index 8f1992188f7fd9e735569e099b36a7eafed47aae..061c89b985dafc79c808dd5f0e296b9fbac2fdfc 100644 index 9abd1dea58ffc612114d5fd8e8944d4aa8c68236..4840893082cbcd9b00f79149df1a7805af279dcb 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -43,7 +43,7 @@ public class Bootstrap { @@ -44,7 +44,7 @@ public class Bootstrap {
public static void bootStrap() { public static void bootStrap() {
if (!Bootstrap.isBootstrapped) { if (!Bootstrap.isBootstrapped) {
// CraftBukkit start // CraftBukkit start
@ -21,7 +21,7 @@ index 8f1992188f7fd9e735569e099b36a7eafed47aae..061c89b985dafc79c808dd5f0e296b9f
switch (name) { switch (name) {
case "DispenserRegistry": case "DispenserRegistry":
break; break;
@@ -57,7 +57,7 @@ public class Bootstrap { @@ -58,7 +58,7 @@ public class Bootstrap {
System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***"); System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***");
System.err.println("**********************************************************************"); System.err.println("**********************************************************************");
break; break;
@ -31,12 +31,12 @@ index 8f1992188f7fd9e735569e099b36a7eafed47aae..061c89b985dafc79c808dd5f0e296b9f
Bootstrap.isBootstrapped = true; Bootstrap.isBootstrapped = true;
Instant instant = Instant.now(); Instant instant = Instant.now();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a41674e0965a13acd2ec2fcc431a2baa26fc4361..bcc9d3b1503b1be1841c9ab40e879a1cbb0549f2 100644 index fc9e56427dc04a6ef7286bf027fef6b7ff0bac0c..1efb42f7ad357f9b4185dea79106ccd38c9f5325 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -249,10 +249,12 @@ public class Main { @@ -249,10 +249,12 @@ public class Main {
Calendar deadline = Calendar.getInstance(); Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -28); deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit + // Paper start - This is some stupid bullshit

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] LivingEntity#setKiller
public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5ba4105356e4a4808293e86c679d08a3c4cdd245..7a01569f62b3b27a9eb6def0e2ec72e1d392258d 100644 index 6bb32e4eab357c5f67a3daafa2de035b0d125635..452fe788152f7c38ab4b6c627e3ba37da3d9b9d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -407,6 +407,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -417,6 +417,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity(); return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity();
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash
diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
index 695f057d05d6651860d8d15be5a2b48a18a35d22..97f4cc522706ec5914672aa4fdfbc35edc94aeb6 100644 index d97bc15010a488839e0c063a9ae4a725d4d2b9e9..0554ee499c452db6c1e6852f5022b1f197adb024 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java
@@ -133,7 +133,7 @@ public class Ocelot extends Animal { @@ -132,7 +132,7 @@ public class Ocelot extends Animal {
@Override @Override
public boolean removeWhenFarAway(double distanceSquared) { public boolean removeWhenFarAway(double distanceSquared) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 43d399e1a0ba2fb0541f851a28032fa60fc01b33..31fe2faf9137ac8b1acca9a5ffc5bbcc8aab16c1 100644 index e424c23c22809a307175b5dcc7f7b0084464493f..6c29e55239fdcf8df3b9dc012aa80cebcd3a837a 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -177,6 +177,7 @@ public abstract class BaseSpawner { @@ -177,6 +177,7 @@ public abstract class BaseSpawner {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0c2137dda44f2341bffe0928dc77be8ca6371bc9..0d995abe33f41b96823d3e5a51e33f3dcb11d564 100644 index ca4c054f17a79bfe0f4f49783a13e30eb0f3e2ff..f489ac450dd0275805d0cc8616050f0331f4c39a 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -308,7 +308,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -308,7 +308,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

Datei anzeigen

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 44cc60d92c6e83ecfa2c232b59986968d0161672..7906e163f8d03ba39480526d0293ad48534f11bf 100644 index 2cc5663878a7c0f4b4d5f4b9a0f69de2326bf415..73d9451f4419dfe47620aed0edc7bd386a2c87da 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1199,7 +1199,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1201,7 +1201,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
boolean flag1 = d7 > 0.0D; boolean flag1 = d7 > 0.0D;
if (this.player.onGround() && !packet.isOnGround() && flag1) { if (this.player.onGround() && !packet.isOnGround() && flag1) {

Datei anzeigen

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients. random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 5f3b3f03936cfe23ed792c57d342a9932ea2e962..5e5e669f564c6130d1dea004ae8810939954da98 100644 index 04ada45eabd5a6c752c320cdff1a65c7ac83eb22..6fd8204a8d66d26c3011d197c004398d320dc469 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -122,14 +122,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -129,14 +129,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) { public void handleKeepAlive(ServerboundKeepAlivePacket packet) {

Datei anzeigen

@ -90,10 +90,10 @@ index 7ae4279768b70a4fdc8f4438898871a17c8fe402..582bbb376c75ab5bf737f3015ce8ad45
private void beginLogin(ClientIntentionPacket packet, boolean transfer) { private void beginLogin(ClientIntentionPacket packet, boolean transfer) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 258808bcb6f853c5679476305074823a7bb8b379..d099b898208392f380eb9ccd49bf84d54c194e67 100644 index 5085da38a278d8f978e19a5b8df7a8e3d087d753..0b18ef707349c086cd670b3c145144eda64df3fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -336,6 +336,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -337,6 +337,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().transferCookieConnection.sendPacket(new ClientboundTransferPacket(host, port)); this.getHandle().transferCookieConnection.sendPacket(new ClientboundTransferPacket(host, port));
} }

Datei anzeigen

@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer. at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 5e5e669f564c6130d1dea004ae8810939954da98..9b1df397e1d2d8ca04b34012808be2110526f401 100644 index 6fd8204a8d66d26c3011d197c004398d320dc469..b36528ad18c8603994c6a821b19b99581717b44c 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -74,7 +74,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -75,7 +75,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
protected final MinecraftServer server; protected final MinecraftServer server;
public final Connection connection; // Paper public final Connection connection; // Paper
private final boolean transferred; private final boolean transferred;
@ -29,7 +29,7 @@ index 5e5e669f564c6130d1dea004ae8810939954da98..9b1df397e1d2d8ca04b34012808be211
private boolean keepAlivePending; private boolean keepAlivePending;
private long keepAliveChallenge; private long keepAliveChallenge;
private long closedListenerTime; private long closedListenerTime;
@@ -82,6 +82,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -83,6 +83,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private int latency; private int latency;
private volatile boolean suspendFlushingOnServerThread = false; private volatile boolean suspendFlushingOnServerThread = false;
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
@ -37,10 +37,10 @@ index 5e5e669f564c6130d1dea004ae8810939954da98..9b1df397e1d2d8ca04b34012808be211
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver; this.server = minecraftserver;
@@ -232,18 +233,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -239,18 +240,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
protected void keepConnectionAlive() { protected void keepConnectionAlive() {
this.server.getProfiler().push("keepAlive"); Profiler.get().push("keepAlive");
- long i = Util.getMillis(); - long i = Util.getMillis();
+ // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + // This should effectively place the keepalive handling back to "as it was" before 1.12.2
@ -64,5 +64,5 @@ index 5e5e669f564c6130d1dea004ae8810939954da98..9b1df397e1d2d8ca04b34012808be211
} }
+ // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings + // Paper end - give clients a longer time to respond to pings as per pre 1.12.2 timings
this.server.getProfiler().pop(); Profiler.get().pop();
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 362d75522aaa721e9fb1d12a149d0efec1ac17b1..34654395536ea022848db3d9f0291512081fc558 100644 index 357c71409af5f67a0a6aaa0cb08fd93a4a4f99de..1cc11284b0e155ea41c198641b3644028adda97d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1257,7 +1257,7 @@ public abstract class Player extends LivingEntity { @@ -1227,7 +1227,7 @@ public abstract class Player extends LivingEntity {
boolean flag1; boolean flag1;
if (this.isSprinting() && flag) { if (this.isSprinting() && flag) {
@ -18,7 +18,7 @@ index 362d75522aaa721e9fb1d12a149d0efec1ac17b1..34654395536ea022848db3d9f0291512
flag1 = true; flag1 = true;
} else { } else {
flag1 = false; flag1 = false;
@@ -1338,7 +1338,7 @@ public abstract class Player extends LivingEntity { @@ -1308,7 +1308,7 @@ public abstract class Player extends LivingEntity {
} }
} }
@ -27,7 +27,7 @@ index 362d75522aaa721e9fb1d12a149d0efec1ac17b1..34654395536ea022848db3d9f0291512
this.sweepAttack(); this.sweepAttack();
} }
@@ -1366,15 +1366,15 @@ public abstract class Player extends LivingEntity { @@ -1336,15 +1336,15 @@ public abstract class Player extends LivingEntity {
} }
if (flag2) { if (flag2) {
@ -46,7 +46,7 @@ index 362d75522aaa721e9fb1d12a149d0efec1ac17b1..34654395536ea022848db3d9f0291512
} }
} }
@@ -1430,7 +1430,7 @@ public abstract class Player extends LivingEntity { @@ -1400,7 +1400,7 @@ public abstract class Player extends LivingEntity {
this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
} else { } else {
@ -55,7 +55,7 @@ index 362d75522aaa721e9fb1d12a149d0efec1ac17b1..34654395536ea022848db3d9f0291512
// CraftBukkit start - resync on cancelled event // CraftBukkit start - resync on cancelled event
if (this instanceof ServerPlayer) { if (this instanceof ServerPlayer) {
((ServerPlayer) this).getBukkitEntity().updateInventory(); ((ServerPlayer) this).getBukkitEntity().updateInventory();
@@ -1825,6 +1825,14 @@ public abstract class Player extends LivingEntity { @@ -1784,6 +1784,14 @@ public abstract class Player extends LivingEntity {
public int getXpNeededForNextLevel() { public int getXpNeededForNextLevel() {
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
} }

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 021c72410c7580d659bfaa1e327fae3727acabd2..7a7c404778757e6778305c9f8334a4fba1f466a6 100644 index f2f8fbc8a8cf32bcba0ad7ac9b6cdd75468e062a..76b71af07a311bc415b36f517afab31505a14483 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3168,6 +3168,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3285,6 +3285,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemstack2 = this.getItemBySlot(enumitemslot);
if (this.equipmentHasChanged(itemstack1, itemstack2)) { itemstack = this.getItemBySlot(enumitemslot);
if (this.equipmentHasChanged(itemstack2, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent + // Paper start - PlayerArmorChangeEvent
+ if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) { + if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1); + final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1);

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0d995abe33f41b96823d3e5a51e33f3dcb11d564..bfda68254b39f301ba2d3d70beeb35317d262c43 100644 index f489ac450dd0275805d0cc8616050f0331f4c39a..c5737e1c8cb82f282bab2e6b7b6c26aa077801f3 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -109,7 +109,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -109,7 +109,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: Block entity unload lag spike
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 4fcbea7b8b12be10157da0c1f35c06e47c0334ad..ab511f4c056f07aa79aab7b662073bb8db4b1526 100644 index b34663ba24a0925c7fe65b354f4029c51ecc3bd1..106f4dd7f49d3b81a9bc08cd034cccac90042f84 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -726,6 +726,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -728,6 +728,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
boolean flag = this.tickRateManager().runsNormally(); boolean flag = this.tickRateManager().runsNormally();
int tilesThisCycle = 0; int tilesThisCycle = 0;
@ -17,7 +17,7 @@ index 4fcbea7b8b12be10157da0c1f35c06e47c0334ad..ab511f4c056f07aa79aab7b662073bb8
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
@@ -734,12 +736,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -736,12 +738,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity.isRemoved()) { if (tickingblockentity.isRemoved()) {
// Spigot start // Spigot start
tilesThisCycle--; tilesThisCycle--;

Datei anzeigen

@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled. information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index ab511f4c056f07aa79aab7b662073bb8db4b1526..27e2718124aad69546c1d9adb9c8e69fa4a43ca7 100644 index 106f4dd7f49d3b81a9bc08cd034cccac90042f84..c628524274110bcad175472dbcb82e6c62476a12 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -150,7 +150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -151,7 +151,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710 public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710
public boolean captureBlockStates = false; public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false; public boolean captureTreeGeneration = false;
@ -49,7 +49,7 @@ index ab511f4c056f07aa79aab7b662073bb8db4b1526..27e2718124aad69546c1d9adb9c8e69f
this.capturedBlockStates.put(pos.immutable(), blockstate); this.capturedBlockStates.put(pos.immutable(), blockstate);
captured = true; captured = true;
} }
@@ -606,7 +607,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -608,7 +609,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (this.captureTreeGeneration) { if (this.captureTreeGeneration) {

Datei anzeigen

@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index d6ad310d3b472c40c128cfb459171d9f48e50915..48bee70ba4188a4a55beb6584224b0f23784dd88 100644 index 4536632687e71b02d5945cac3816b72ac540935e..46a831f86b512f4228be8ccee40fb0f7bf0d6df6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -59,6 +59,7 @@ public abstract class BlockEntity { @@ -59,6 +59,7 @@ public abstract class BlockEntity {
@ -27,13 +27,13 @@ index d6ad310d3b472c40c128cfb459171d9f48e50915..48bee70ba4188a4a55beb6584224b0f2
@@ -92,7 +93,7 @@ public abstract class BlockEntity { @@ -92,7 +93,7 @@ public abstract class BlockEntity {
// CraftBukkit start - read container // CraftBukkit start - read container
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registries) {
- this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY); - this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY);
+ this.persistentDataContainer.clear(); // Paper - clear instead of init + this.persistentDataContainer.clear(); // Paper - clear instead of init
net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues"); net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
if (persistentDataTag instanceof CompoundTag) { if (persistentDataTag instanceof CompoundTag) {
@@ -379,8 +380,15 @@ public abstract class BlockEntity { @@ -380,8 +381,15 @@ public abstract class BlockEntity {
// CraftBukkit start - add method // CraftBukkit start - add method
public InventoryHolder getOwner() { public InventoryHolder getOwner() {
@ -51,7 +51,7 @@ index d6ad310d3b472c40c128cfb459171d9f48e50915..48bee70ba4188a4a55beb6584224b0f2
return null; return null;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index a1c1a101aa424e74309f6f4c0a53a6a8db5df441..013298c424025cd88f15d61e50d196f70fa4c58b 100644 index c9b1167b15990235e72d68ba6d1d2f0385eb5755..e163ff416f19766132d73fff2c8eb7f3f098f8c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -328,6 +328,13 @@ public class CraftBlock implements Block { @@ -328,6 +328,13 @@ public class CraftBlock implements Block {
@ -114,10 +114,10 @@ index 483a89ba477506ae108f680e586b37c142119696..80418a05d53516d2c539383aa9994099
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index 0173a8eac2153d889536e48970f967040490e4b7..83ac5fc6cbbd249b5865ab203b150f53f01c9f05 100644 index b849ed6eefbc73a86d4dd823bbc5bbb2321c330f..1a8dcde39a252a45046866349b848d79e1b13260 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -387,15 +387,30 @@ public final class CraftBlockStates { @@ -393,15 +393,30 @@ public final class CraftBlockStates {
} }
public static BlockState getBlockState(Block block) { public static BlockState getBlockState(Block block) {

Datei anzeigen

@ -16,10 +16,10 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent
Co-authored-by: Aikar <aikar@aikar.co> Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 87f56f9c14e3a827d0afc03591bfce8cbf61e307..6cdbd0281e38d7107f239e6e052c08e4ab12b552 100644 index 73d9451f4419dfe47620aed0edc7bd386a2c87da..0cce81cb61665b2dbd445fa9a0fcfeb42ce3be2c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -711,21 +711,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -714,21 +714,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
@ -32,7 +32,7 @@ index 87f56f9c14e3a827d0afc03591bfce8cbf61e307..6cdbd0281e38d7107f239e6e052c08e4
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async + // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start // CraftBukkit start
if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { if (!this.chatSpamThrottler.isIncrementAndUnderThreshold(1, 500) && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
this.disconnect(Component.translatable("disconnect.spam")); this.disconnect(Component.translatable("disconnect.spam"));
return; return;
} }
@ -80,10 +80,10 @@ index 87f56f9c14e3a827d0afc03591bfce8cbf61e307..6cdbd0281e38d7107f239e6e052c08e4
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 31f87ce0865dd7560cd9ba634855a1defdc80df2..39e3730eae983c20522b97fcd547823cd192cb2d 100644 index fa6284ebe3bdbf97b40a2ab61ba94062cdcf045e..367ecbb023ddfbadb92aa4351ff601a3ed58a358 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2294,7 +2294,7 @@ public final class CraftServer implements Server { @@ -2298,7 +2298,7 @@ public final class CraftServer implements Server {
offers = this.tabCompleteChat(player, message); offers = this.tabCompleteChat(player, message);
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb Allows plugins to cancel a player picking up an experience orb
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 0330a62a6a0060d2a96de191db68774588fc7ae5..2d438cd3e69503fdc45a706f25c219af6f7a5db3 100644 index b9160ebca0d11dbbf96da5f0f5810d302cfcea9a..74a0bebbf829fdb2bbae87100c4e2523c34f95a0 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -322,7 +322,7 @@ public class ExperienceOrb extends Entity { @@ -326,7 +326,7 @@ public class ExperienceOrb extends Entity {
@Override @Override
public void playerTouch(Player player) { public void playerTouch(Player player) {
if (player instanceof ServerPlayer entityplayer) { if (player instanceof ServerPlayer entityplayer) {

Datei anzeigen

@ -14,10 +14,10 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I
public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f53504221e660bfe86220a8cc1ae28750794f0cf..93550342c6f181b7622f5d649cd3e5075a464e55 100644 index 0b18ef707349c086cd670b3c145144eda64df3fd..18c0f0550cd6b41fa394e36ee5eb9ee48138dc0b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1638,7 +1638,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1651,7 +1651,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
@Override @Override

Datei anzeigen

@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 84ea1974445fc7be80ed474d8a2133b58ee4c8fe..aa3155bb57c09895d13914b46c77de78a90f250a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1100,7 +1100,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
- double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D;
+ final int finalChunkRange = chunkRange; // Paper for lambda below
+ //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
+ double blockRange = 16384.0D; // Paper
// Spigot end
Iterator iterator = this.playerMap.getAllPlayers().iterator();
@@ -1112,6 +1114,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
entityplayer = (ServerPlayer) iterator.next();
+ // Paper start - PlayerNaturallySpawnCreaturesEvent
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
+ blockRange = 16384.0D;
+ if (reducedRange) {
+ event = entityplayer.playerNaturallySpawnedEvent;
+ if (event == null || event.isCancelled()) return false;
+ blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ }
+ // Paper end - PlayerNaturallySpawnCreaturesEvent
} while (!this.playerIsCloseEnoughForSpawning(entityplayer, chunkcoordintpair, blockRange)); // Spigot
return true;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index a29598ae54d5d20740a105f81bcaec2a152fe4ba..3bbc7aa52a2ee797d6033684e73d6b307c2fadcc 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -521,6 +521,15 @@ public class ServerChunkCache extends ChunkSource {
List list1;
if (flag && (this.spawnEnemies || this.spawnFriendlies)) {
+ // Paper start - PlayerNaturallySpawnCreaturesEvent
+ int chunkRange = level.spigotConfig.mobSpawnRange;
+ chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
+ chunkRange = Math.min(chunkRange, 8);
+ for (ServerPlayer entityPlayer : this.level.players()) {
+ entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
+ entityPlayer.playerNaturallySpawnedEvent.callEvent();
+ }
+ // Paper end - PlayerNaturallySpawnCreaturesEvent
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
list1 = NaturalSpawner.getFilteredSpawningCategories(spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b99bd43bf5185bed21fad7dac31baf1a30bdd1fe..98aeafcc51e23a7534c8d57e4db0eb58abb3f30b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -314,6 +314,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
public boolean isRealPlayer; // Paper
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);

Datei anzeigen

@ -15,23 +15,23 @@ instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917 See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java
index 3f2cad4c9c0400bf93932cb7f7219c2185fc7370..5c8e36ea8287029b1789719c687bac1a2c4c3a69 100644 index e139ed6bc6f2dd07fe546588b31309ba30ed9755..34c3bf85473b3ad89355ebc21b68c59b3c683b84 100644
--- a/src/main/java/net/minecraft/util/SpawnUtil.java --- a/src/main/java/net/minecraft/util/SpawnUtil.java
+++ b/src/main/java/net/minecraft/util/SpawnUtil.java +++ b/src/main/java/net/minecraft/util/SpawnUtil.java
@@ -21,10 +21,10 @@ public class SpawnUtil { @@ -22,10 +22,10 @@ public class SpawnUtil {
public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entityType, MobSpawnType reason, ServerLevel world, BlockPos pos, int tries, int horizontalRange, int verticalRange, SpawnUtil.Strategy requirements) { public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entityType, EntitySpawnReason reason, ServerLevel world, BlockPos pos, int tries, int horizontalRange, int verticalRange, SpawnUtil.Strategy requirements) {
// CraftBukkit start // CraftBukkit start
- return SpawnUtil.trySpawnMob(entityType, reason, world, pos, tries, horizontalRange, verticalRange, requirements, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); - return SpawnUtil.trySpawnMob(entityType, reason, world, pos, tries, horizontalRange, verticalRange, requirements, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
+ return SpawnUtil.trySpawnMob(entityType, reason, world, pos, tries, horizontalRange, verticalRange, requirements, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT, null); // Paper + return SpawnUtil.trySpawnMob(entityType, reason, world, pos, tries, horizontalRange, verticalRange, requirements, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT, null); // Paper
} }
- public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entitytypes, MobSpawnType enummobspawn, ServerLevel worldserver, BlockPos blockposition, int i, int j, int k, SpawnUtil.Strategy spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { - public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entitytypes, EntitySpawnReason entityspawnreason, ServerLevel worldserver, BlockPos blockposition, int i, int j, int k, SpawnUtil.Strategy spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entitytypes, MobSpawnType enummobspawn, ServerLevel worldserver, BlockPos blockposition, int i, int j, int k, SpawnUtil.Strategy spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason, @javax.annotation.Nullable Runnable onAbort) { // Paper + public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entitytypes, EntitySpawnReason entityspawnreason, ServerLevel worldserver, BlockPos blockposition, int i, int j, int k, SpawnUtil.Strategy spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason, @javax.annotation.Nullable Runnable onAbort) { // Paper - pre creature spawn event
// CraftBukkit end // CraftBukkit end
BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable();
@@ -34,6 +34,22 @@ public class SpawnUtil { @@ -35,6 +35,22 @@ public class SpawnUtil {
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1); blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) { if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
@ -51,16 +51,16 @@ index 3f2cad4c9c0400bf93932cb7f7219c2185fc7370..5c8e36ea8287029b1789719c687bac1a
+ break; + break;
+ } + }
+ // Paper end - PreCreatureSpawnEvent + // Paper end - PreCreatureSpawnEvent
T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, entityspawnreason, false, false); // CraftBukkit - decompile error
if (t0 != null) { if (t0 != null) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 474f020371bb9e5fd2c5b22e44d7902977c4fc18..69a661f01e43d17262fd2845dde5528416bbe456 100644 index 0782b2b58ed30d4ef2598e4b89f338a94a62bbe5..7fb2155b8d320f8871556083aef9ed8e1e91e6e7 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -430,6 +430,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -507,6 +507,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@Nullable @Nullable
public T spawn(ServerLevel worldserver, @Nullable Consumer<T> consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { public T spawn(ServerLevel worldserver, @Nullable Consumer<T> consumer, BlockPos blockposition, EntitySpawnReason entityspawnreason, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
// CraftBukkit end // CraftBukkit end
+ // Paper start - PreCreatureSpawnEvent + // Paper start - PreCreatureSpawnEvent
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
@ -72,28 +72,28 @@ index 474f020371bb9e5fd2c5b22e44d7902977c4fc18..69a661f01e43d17262fd2845dde55284
+ return null; + return null;
+ } + }
+ // Paper end - PreCreatureSpawnEvent + // Paper end - PreCreatureSpawnEvent
T t0 = this.create(worldserver, consumer, blockposition, enummobspawn, flag, flag1); T t0 = this.create(worldserver, consumer, blockposition, entityspawnreason, flag, flag1);
if (t0 != null) { if (t0 != null) {
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 79fdc8284f57a4f11e1954936ad574f7b8df5435..e23674dd5db3c429efd3b7c71fe36b420494c03a 100644 index 83bb48891d03534468d61cf7683438b3efb131cf..82ed0ce824e84ea09ea963caa61fbb75f6ce6fe7 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -970,7 +970,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -944,7 +944,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}).limit(5L).collect(Collectors.toList()); }).limit(5L).toList();
if (list1.size() >= requiredCount) { if (list1.size() >= requiredCount) {
- if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit - if (!SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
+ if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, MobSpawnType.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE, () -> {GolemSensor.golemDetected(this);}).isPresent()) { // CraftBukkit // Paper - Set Golem Last Seen to stop it from spawning another one + if (SpawnUtil.trySpawnMob(EntityType.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, world, this.blockPosition(), 10, 8, 6, SpawnUtil.Strategy.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE, () -> {GolemSensor.golemDetected(this);}).isPresent()) { // CraftBukkit // Paper - Set Golem Last Seen to stop it from spawning another one
list.forEach(GolemSensor::golemDetected); list.forEach(GolemSensor::golemDetected);
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 31fe2faf9137ac8b1acca9a5ffc5bbcc8aab16c1..d13abdcc7a54bdecf853c883911ef535733610b4 100644 index 6c29e55239fdcf8df3b9dc012aa80cebcd3a837a..bb3f3bec350dda43dbf5eda0a8c8057a413694b2 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -132,6 +132,20 @@ public abstract class BaseSpawner { @@ -132,6 +132,20 @@ public abstract class BaseSpawner {
} else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, EntitySpawnReason.SPAWNER, blockposition1, world.getRandom())) {
continue; continue;
} }
+ // Paper start - PreCreatureSpawnEvent + // Paper start - PreCreatureSpawnEvent
@ -111,13 +111,13 @@ index 31fe2faf9137ac8b1acca9a5ffc5bbcc8aab16c1..d13abdcc7a54bdecf853c883911ef535
+ } + }
+ // Paper end - PreCreatureSpawnEvent + // Paper end - PreCreatureSpawnEvent
Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> { Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, EntitySpawnReason.SPAWNER, (entity1) -> {
entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot()); entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot());
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 6324689f52363f19501143c1649f0885684cb796..bce78beaadbfd0e400457bd14bcf6538be702879 100644 index 400166ad0199dd4b96684904ef4748cdb72381bb..0b41149ae134084cef4016241ce923dac0349846 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -208,7 +208,13 @@ public final class NaturalSpawner { @@ -230,7 +230,13 @@ public final class NaturalSpawner {
j1 = biomesettingsmobs_c.minCount + world.random.nextInt(1 + biomesettingsmobs_c.maxCount - biomesettingsmobs_c.minCount); j1 = biomesettingsmobs_c.minCount + world.random.nextInt(1 + biomesettingsmobs_c.maxCount - biomesettingsmobs_c.minCount);
} }
@ -132,7 +132,7 @@ index 6324689f52363f19501143c1649f0885684cb796..bce78beaadbfd0e400457bd14bcf6538
Mob entityinsentient = NaturalSpawner.getMobForSpawn(world, biomesettingsmobs_c.type); Mob entityinsentient = NaturalSpawner.getMobForSpawn(world, biomesettingsmobs_c.type);
if (entityinsentient == null) { if (entityinsentient == null) {
@@ -256,10 +262,31 @@ public final class NaturalSpawner { @@ -278,10 +284,31 @@ public final class NaturalSpawner {
return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos)); return squaredDistance <= 576.0D ? false : (world.getSharedSpawnPos().closerToCenterThan(new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D), 24.0D) ? false : Objects.equals(new ChunkPos(pos), chunk.getPos()) || world.isNaturalSpawningAllowed((BlockPos) pos));
} }
@ -148,7 +148,7 @@ index 6324689f52363f19501143c1649f0885684cb796..bce78beaadbfd0e400457bd14bcf6538
+ // Paper end - PreCreatureSpawnEvent + // Paper end - PreCreatureSpawnEvent
EntityType<?> entitytypes = spawnEntry.type; EntityType<?> entitytypes = spawnEntry.type;
- return entitytypes.getCategory() == MobCategory.MISC ? false : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? false : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)))) : false)); - return entitytypes.getCategory() == MobCategory.MISC ? false : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? false : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, EntitySpawnReason.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)))) : false));
+ // Paper start - PreCreatureSpawnEvent + // Paper start - PreCreatureSpawnEvent
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ io.papermc.paper.util.MCUtil.toLocation(world, pos), + io.papermc.paper.util.MCUtil.toLocation(world, pos),
@ -162,7 +162,7 @@ index 6324689f52363f19501143c1649f0885684cb796..bce78beaadbfd0e400457bd14bcf6538
+ } + }
+ // Paper end - PreCreatureSpawnEvent + // Paper end - PreCreatureSpawnEvent
+ +
+ return entitytypes.getCategory() == MobCategory.MISC ? PreSpawnStatus.FAIL : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? PreSpawnStatus.FAIL : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? PreSpawnStatus.FAIL : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? PreSpawnStatus.FAIL : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)) ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL)) : PreSpawnStatus.FAIL)); // Paper - PreCreatureSpawnEvent + return entitytypes.getCategory() == MobCategory.MISC ? PreSpawnStatus.FAIL : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? PreSpawnStatus.FAIL : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? PreSpawnStatus.FAIL : (!SpawnPlacements.checkSpawnRules(entitytypes, world, EntitySpawnReason.NATURAL, pos, world.random) ? PreSpawnStatus.FAIL : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)) ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL)) : PreSpawnStatus.FAIL)); // Paper - PreCreatureSpawnEvent
} }
@Nullable @Nullable

Datei anzeigen

@ -59,7 +59,7 @@ index d8ed3404e8c3c61b2daff110ef32ef890a77a461..78863e72239a0f3535bc85758479da84
return new ResolvableProfile(gameProfile); return new ResolvableProfile(gameProfile);
}) : SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(profile -> { }) : SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(profile -> {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index c278caa030ceccec8e2721068848a34be513de88..26e92e208ddd3122da6d44767b8841d7a8b90d98 100644 index 4b7176779c455a876419a497a8178163a68553fc..43ddf23db92c7bfd29da4ab79538fc9a5765232e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -41,7 +41,7 @@ public class SkullBlockEntity extends BlockEntity { @@ -41,7 +41,7 @@ public class SkullBlockEntity extends BlockEntity {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 81bef7427478fe911e81f024102654d8d540dbb7..4c85abf29441645039b6a554a50e1d3274229de6 100644 index 18a700ffb88f0c60beb2ba4d6e3554ef762a9455..0542b61053ed7039e54856eab86ba5842403e4fc 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -225,6 +225,12 @@ public class PlayerAdvancements { @@ -225,6 +225,12 @@ public class PlayerAdvancements {

Datei anzeigen

@ -13,7 +13,7 @@ starting point for future additions in this area.
Fixes GH-559 Fixes GH-559
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
index eef3517833ff5c0cf41b89973ebc972b8ed31e0f..c9fbc01be0b0e7fd1cafb091d06496f4ba1e7c2c 100644 index 7e3199567f25cc65046ba7374fe1a83fd2e5b191..4f5568707d725195ee19b65274454fec8bf99d64 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemMetas.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -23,7 +23,7 @@ index eef3517833ff5c0cf41b89973ebc972b8ed31e0f..c9fbc01be0b0e7fd1cafb091d06496f4
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.world.item.BannerItem; import net.minecraft.world.item.BannerItem;
@@ -102,7 +103,7 @@ public final class CraftItemMetas { @@ -103,7 +104,7 @@ public final class CraftItemMetas {
item -> new CraftMetaSpawnEgg(item.getComponentsPatch()), item -> new CraftMetaSpawnEgg(item.getComponentsPatch()),
(type, meta) -> meta instanceof CraftMetaSpawnEgg spawnEgg ? spawnEgg : new CraftMetaSpawnEgg(meta)); (type, meta) -> meta instanceof CraftMetaSpawnEgg spawnEgg ? spawnEgg : new CraftMetaSpawnEgg(meta));

Datei anzeigen

@ -10,10 +10,10 @@ Flower pots are also not updated on the client when interaction is cancelled, th
also resolves this. also resolves this.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 2fab84c5e2dc4de39281956390588a9a71d02f68..a5b0efd6142075ca1ecb604afbc1d0162199e7a4 100644 index 73b6aa34ad2579d79f388c5660cdfbef41a769f2..4c8189a2a7edea824545a24dccb376b8eceac001 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -519,7 +519,11 @@ public class ServerPlayerGameMode { @@ -525,7 +525,11 @@ public class ServerPlayerGameMode {
// send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc) // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above())); player.connection.send(new ClientboundBlockUpdatePacket(world, blockposition.above()));

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Toggleable player crits
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 34654395536ea022848db3d9f0291512081fc558..3f0425f6c1a8d5ad4df9d837490c09e175d0df4b 100644 index 1cc11284b0e155ea41c198641b3644028adda97d..35cb06706e1584cd6d25aa68ff5c9b40a5768e03 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1266,6 +1266,7 @@ public abstract class Player extends LivingEntity { @@ -1236,6 +1236,7 @@ public abstract class Player extends LivingEntity {
f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource); f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource);
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting(); boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();

Datei anzeigen

@ -170,7 +170,7 @@ index 0000000000000000000000000000000000000000..30a19d10869f73d67b794e8e4c035bc5
+ +
+} +}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5d03477919ce892f6dfb4b2304c03733e10e3721..cc0968182ab597892dbae8dd9b3e803fb62b7065 100644 index 835bbd873ec04954024ae8649e6bc9a4557b11c5..6abcb987109c01d012c70c4c3b411f91b7630bb4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server; @@ -3,6 +3,9 @@ package net.minecraft.server;
@ -183,7 +183,7 @@ index 5d03477919ce892f6dfb4b2304c03733e10e3721..cc0968182ab597892dbae8dd9b3e803f
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -1515,7 +1518,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1591,7 +1594,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) { if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of()); return new ServerStatus.Players(i, list.size(), List.of());
} else { } else {

Datei anzeigen

@ -7,7 +7,7 @@ Co-authored-by: Connor Linfoot <connorlinfoot@me.com>
Co-authored-by: MCMDEV <john-m.1@gmx.de> Co-authored-by: MCMDEV <john-m.1@gmx.de>
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index bfda68254b39f301ba2d3d70beeb35317d262c43..30e55f693b963496b85afa32da9c15cacb738836 100644 index c5737e1c8cb82f282bab2e6b7b6c26aa077801f3..4a62c1abc6f3c48bbda40325b4ce46632db3f28d 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -191,7 +191,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -191,7 +191,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

Datei anzeigen

@ -8,21 +8,8 @@ This can be useful for changing name or skins after a player has logged in.
== AT == == AT ==
public-f net.minecraft.world.entity.player.Player gameProfile public-f net.minecraft.world.entity.player.Player gameProfile
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6cdbd0281e38d7107f239e6e052c08e4ab12b552..0073c6c5433be3193a01257a26c7035e544f37dd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1472,7 +1472,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
}
- private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
+ public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper
// CraftBukkit start
if (Float.isNaN(f)) {
f = 0;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 30e55f693b963496b85afa32da9c15cacb738836..636b8aef2348fa4cfe63a9b7d77a64b14dc7a42c 100644 index 4a62c1abc6f3c48bbda40325b4ce46632db3f28d..bab8c53041afb9606db55923e5466eab25640226 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -341,11 +341,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -341,11 +341,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -40,10 +27,10 @@ index 30e55f693b963496b85afa32da9c15cacb738836..636b8aef2348fa4cfe63a9b7d77a64b1
playerName = gameprofile.getName(); playerName = gameprofile.getName();
uniqueId = gameprofile.getId(); uniqueId = gameprofile.getId();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c08ffdbc9afb2fe7abbf5567dc1fb1e2bcb01b96..3ee00025eb9d936b9780b25fdc25d144acc496cd 100644 index 61687b2dce3964afc588e792cf765717b6d066dc..95b9341859ba6da6945faebf8430a044cc1ee828 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -831,10 +831,16 @@ public abstract class PlayerList { @@ -800,10 +800,16 @@ public abstract class PlayerList {
} }
public void sendPlayerPermissionLevel(ServerPlayer player) { public void sendPlayerPermissionLevel(ServerPlayer player) {
@ -77,10 +64,10 @@ index 818df09e9245b5d89b4180b1eaa51470b7539341..f6b2ca92fd3510a76cbf56d0ea55aa6c
public Server getServer() { public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2adefba5205 100644 index 18c0f0550cd6b41fa394e36ee5eb9ee48138dc0b..356681047e34b577f51a4f90ebc8892cb1e6eaa8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -249,11 +249,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -250,11 +250,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.server.getPlayer(this.getUniqueId()) != null; return this.server.getPlayer(this.getUniqueId()) != null;
} }
@ -92,7 +79,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
@Override @Override
public InetSocketAddress getAddress() { public InetSocketAddress getAddress() {
if (this.getHandle().connection.protocol() == null) return null; if (this.getHandle().connection.protocol() == null) return null;
@@ -1792,8 +1787,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1805,8 +1800,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private void untrackAndHideEntity(org.bukkit.entity.Entity entity) { private void untrackAndHideEntity(org.bukkit.entity.Entity entity) {
// Remove this entity from the hidden player's EntityTrackerEntry // Remove this entity from the hidden player's EntityTrackerEntry
@ -109,7 +96,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
if (entry != null) { if (entry != null) {
entry.removePlayer(this.getHandle()); entry.removePlayer(this.getHandle());
@@ -1806,8 +1808,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1819,8 +1821,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID()))); this.getHandle().connection.send(new ClientboundPlayerInfoRemovePacket(List.of(otherPlayer.getUUID())));
} }
} }
@ -118,7 +105,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
} }
void resetAndHideEntity(org.bukkit.entity.Entity entity) { void resetAndHideEntity(org.bukkit.entity.Entity entity) {
@@ -1872,12 +1872,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1885,12 +1885,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
private void trackAndShowEntity(org.bukkit.entity.Entity entity) { private void trackAndShowEntity(org.bukkit.entity.Entity entity) {
@ -144,7 +131,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
} }
ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId());
@@ -1887,6 +1900,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1900,6 +1913,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity)); this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
} }
@ -184,7 +171,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
void resetAndShowEntity(org.bukkit.entity.Entity entity) { void resetAndShowEntity(org.bukkit.entity.Entity entity) {
// SPIGOT-7312: Can't show/hide self // SPIGOT-7312: Can't show/hide self
@@ -1898,6 +1944,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1911,6 +1957,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity); this.trackAndShowEntity(entity);
} }
} }
@ -203,7 +190,7 @@ index 8521f728088d16ecbaa0119983a9f12a649ac847..9136feac48244dc68bff92b52643f2ad
+ ServerLevel worldserver = handle.serverLevel(); + ServerLevel worldserver = handle.serverLevel();
+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(handle.createCommonSpawnInfo(worldserver), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA)); + connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(handle.createCommonSpawnInfo(worldserver), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA));
+ handle.onUpdateAbilities(); + handle.onUpdateAbilities();
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet()); + connection.internalTeleport(net.minecraft.world.entity.PositionMoveRotation.of(this.getHandle()), java.util.Collections.emptySet());
+ net.minecraft.server.players.PlayerList playerList = handle.server.getPlayerList(); + net.minecraft.server.players.PlayerList playerList = handle.server.getPlayerList();
+ playerList.sendPlayerPermissionLevel(handle, false); + playerList.sendPlayerPermissionLevel(handle, false);
+ playerList.sendLevelInfo(handle, worldserver); + playerList.sendLevelInfo(handle, worldserver);

Datei anzeigen

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 39e3730eae983c20522b97fcd547823cd192cb2d..a94b972e328d2eff635de95847dc622c3a58fd9f 100644 index 367ecbb023ddfbadb92aa4351ff601a3ed58a358..b4f8482dd92f33111600ae64834abefbda9e696d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1888,6 +1888,25 @@ public final class CraftServer implements Server { @@ -1892,6 +1892,25 @@ public final class CraftServer implements Server {
return recipients.size(); return recipients.size();
} }

Datei anzeigen

@ -32,7 +32,7 @@ operations are decoupled from the sync tasks queue.
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d71913619fc0 index 0000000000000000000000000000000000000000..0ca279fb71d39c81b1f608e0ee9ba3e498d55fa3
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
@@ -0,0 +1,122 @@ @@ -0,0 +1,122 @@
@ -106,8 +106,8 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719
+ } + }
+ +
+ @Override + @Override
+ public void mainThreadHeartbeat(int currentTick) { + public void mainThreadHeartbeat() {
+ this.currentTick = currentTick; + this.currentTick++;
+ this.management.execute(() -> this.runTasks(currentTick)); + this.management.execute(() -> this.runTasks(currentTick));
+ } + }
+ +
@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index f1145585eed18be0aa5c795a50589103fdc9cc2f..02835e4f0a0b262af27acff0939c981cae728db4 100644 index 0e7f402a7b841c5f6f5a4b699b7bb3d9f46b1af6..fd5a058dd802599598a64467cf25f08329df9e99 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -76,7 +76,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -76,7 +76,7 @@ public class CraftScheduler implements BukkitScheduler {
@ -303,29 +303,29 @@ index f1145585eed18be0aa5c795a50589103fdc9cc2f..02835e4f0a0b262af27acff0939c981c
return pending; return pending;
} }
@@ -399,6 +452,11 @@ public class CraftScheduler implements BukkitScheduler { @@ -400,6 +453,11 @@ public class CraftScheduler implements BukkitScheduler {
* This method is designed to never block or wait for locks; an immediate execution of all current tasks.
*/ */
public void mainThreadHeartbeat(final int currentTick) { public void mainThreadHeartbeat() {
this.currentTick++;
+ // Paper start + // Paper start
+ if (!this.isAsyncScheduler) { + if (!this.isAsyncScheduler) {
+ this.asyncScheduler.mainThreadHeartbeat(currentTick); + this.asyncScheduler.mainThreadHeartbeat();
+ } + }
+ // Paper end + // Paper end
this.currentTick = currentTick;
final List<CraftTask> temp = this.temp; final List<CraftTask> temp = this.temp;
this.parsePending(); this.parsePending();
while (this.isReady(this.currentTick)) {
@@ -434,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -434,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending(); this.parsePending();
} else { } else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper // this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper - this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper + task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
// We don't need to parse pending // We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
} }
@@ -453,7 +511,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -453,7 +511,7 @@ public class CraftScheduler implements BukkitScheduler {
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper //this.debugHead = this.debugHead.getNextHead(this.currentTick); // Paper
} }
- private void addTask(final CraftTask task) { - private void addTask(final CraftTask task) {

Datei anzeigen

@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk. provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 422c25577a0d95b31b5528fad8fc9b3ae97fa7f0..4e5dba1da323f12d77a36635c9227b1239856254 100644 index 356681047e34b577f51a4f90ebc8892cb1e6eaa8..e7477aaad01c26e56e3d5e90bd403311deae8d59 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -209,6 +209,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -210,6 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private CraftWorldBorder clientWorldBorder = null; private CraftWorldBorder clientWorldBorder = null;
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener(); private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
@ -20,7 +20,7 @@ index 422c25577a0d95b31b5528fad8fc9b3ae97fa7f0..4e5dba1da323f12d77a36635c9227b12
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -2269,7 +2270,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2282,7 +2283,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void addChannel(String channel) { public void addChannel(String channel) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add openSign method to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index f0efea03165039525a98dc30c34d876972d9fe71..e59fee587c2d90df5a6aa7a3df0eefc0cb5165ac 100644 index 768a6e3f5d75d37ae114ffcf2b090fe9de769381..6d4e0a90c70f7a66450cbb18ebec1d7bf9200af2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -630,6 +630,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -654,6 +654,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
} }
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities. If the sprint interruption is disabled players continue sprinting when they attack entities.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 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 3f0425f6c1a8d5ad4df9d837490c09e175d0df4b..00fecf255214d87837867b8743cc8f161ebfcb4c 100644 index 35cb06706e1584cd6d25aa68ff5c9b40a5768e03..605f043bb132b21ff263ba7ab31a0f468a912d13 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1307,7 +1307,11 @@ public abstract class Player extends LivingEntity { @@ -1277,7 +1277,11 @@ public abstract class Player extends LivingEntity {
} }
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));

Datei anzeigen

@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example. You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java 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 bbe024a88d0feeb02a5cc4248f4bcdd3a06daf04..51e9988685b1a9a3d4d2effec63560b0ae9e8d3a 100644 index a6c9ca2928216ed89f69c1d140590d3368b354d6..d7145b3a19402a03d0af02822ffcb0ef07eaa663 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -121,6 +121,12 @@ public class EnderMan extends Monster implements NeutralMob { @@ -121,6 +121,12 @@ public class EnderMan extends Monster implements NeutralMob {
@ -24,18 +24,18 @@ index bbe024a88d0feeb02a5cc4248f4bcdd3a06daf04..51e9988685b1a9a3d4d2effec63560b0
@Override @Override
public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) { public boolean setTarget(LivingEntity entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setTarget(entityliving, reason, fireEvent)) { if (!super.setTarget(entityliving, reason, fireEvent)) {
@@ -270,7 +276,7 @@ public class EnderMan extends Monster implements NeutralMob { @@ -257,7 +263,7 @@ public class EnderMan extends Monster implements NeutralMob {
if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) { if (world.isDay() && this.tickCount >= this.targetChangeTime + 600) {
float f = this.getLightLevelDependentMagicValue(); float f = this.getLightLevelDependentMagicValue();
- if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { - if (f > 0.5F && world.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper - EndermanEscapeEvent + if (f > 0.5F && world.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper - EndermanEscapeEvent
this.setTarget((LivingEntity) null); this.setTarget((LivingEntity) null);
this.teleport(); this.teleport();
} }
@@ -396,11 +402,13 @@ public class EnderMan extends Monster implements NeutralMob { @@ -383,11 +389,13 @@ public class EnderMan extends Monster implements NeutralMob {
} else { } else {
flag1 = flag && this.hurtWithCleanWater(source, (ThrownPotion) source.getDirectEntity(), amount); flag1 = flag && this.hurtWithCleanWater(world, source, (ThrownPotion) source.getDirectEntity(), amount);
+ if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent + if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - EndermanEscapeEvent
for (int i = 0; i < 64; ++i) { for (int i = 0; i < 64; ++i) {
@ -47,10 +47,10 @@ index bbe024a88d0feeb02a5cc4248f4bcdd3a06daf04..51e9988685b1a9a3d4d2effec63560b0
return flag1; return flag1;
} }
@@ -625,7 +633,7 @@ public class EnderMan extends Monster implements NeutralMob { @@ -612,7 +620,7 @@ public class EnderMan extends Monster implements NeutralMob {
} else { } else {
if (this.target != null && !this.enderman.isPassenger()) { if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isLookingAtMe((Player) this.target)) { if (this.enderman.isBeingStaredBy((Player) this.target)) {
- if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D) { - if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D) {
+ if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper - EndermanEscapeEvent + if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.enderman.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper - EndermanEscapeEvent
this.enderman.teleport(); this.enderman.teleport();

Datei anzeigen

@ -1,73 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d60c70d59d0a6ef21224c597c9015cb3f51dabb8..63bcd7698fdb86366441dacedbb616771f6b1a3d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1037,7 +1037,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
- double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D;
+ final int finalChunkRange = chunkRange; // Paper for lambda below
+ //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
+ double blockRange = 16384.0D; // Paper
// Spigot end
if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) {
return false;
@@ -1052,6 +1054,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
entityplayer = (ServerPlayer) iterator.next();
+ // Paper start - PlayerNaturallySpawnCreaturesEvent
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
+ blockRange = 16384.0D;
+ if (reducedRange) {
+ event = entityplayer.playerNaturallySpawnedEvent;
+ if (event == null || event.isCancelled()) return false;
+ blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
+ }
+ // Paper end - PlayerNaturallySpawnCreaturesEvent
} while (!this.playerIsCloseEnoughForSpawning(entityplayer, chunkcoordintpair, blockRange)); // Spigot
return true;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index e0c8b89767087cba34fc3c3809db4c386dacb193..a939bad7da9c852827a2d67d9ace5d0df4911a31 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -461,6 +461,15 @@ public class ServerChunkCache extends ChunkSource {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
Util.shuffle(list, this.level.random);
+ // Paper start - PlayerNaturallySpawnCreaturesEvent
+ int chunkRange = level.spigotConfig.mobSpawnRange;
+ chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
+ chunkRange = Math.min(chunkRange, 8);
+ for (ServerPlayer entityPlayer : this.level.players()) {
+ entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
+ entityPlayer.playerNaturallySpawnedEvent.callEvent();
+ }
+ // Paper end - PlayerNaturallySpawnCreaturesEvent
int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
Iterator iterator1 = list.iterator();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a049a54ee70839706787f8de661ca6e6b1f54071..db72318d822b876eb937f0f0f7f2b2139fb77df7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -286,6 +286,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
public boolean isRealPlayer; // Paper
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);