3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00

[ci skip] Add more identifying patch comments, merge related patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-19 12:30:04 +01:00
Ursprung 106c67a811
Commit cc693ce82b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
396 geänderte Dateien mit 383 neuen und 431 gelöschten Zeilen

Datei anzeigen

@ -9,11 +9,14 @@ type and we are not using its capabilities.
Set thread priorities so main thread has above normal priority over
server threads
Allow usage of a single thread executor by not using ForkJoin so single core CPU's.
Allow usage of a single thread executor by not using ForkJoin so single core CPU's
and reduce worldgen thread worker count for low core count CPUs.
== AT ==
public net.minecraft.Util onThreadException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/io/papermc/paper/util/ServerWorkerThread.java b/src/main/java/io/papermc/paper/util/ServerWorkerThread.java
new file mode 100644
index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dece7f2501b
@ -35,7 +38,7 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ }
+}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index aa52b271bd556a29f774fde375b713d0d187521b..8188febd6f1039a31619b42af23df18afd2e985c 100644
index aa52b271bd556a29f774fde375b713d0d187521b..90f5e7d36719dc9b464dd6ba0335da035bab29d3 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -86,7 +86,7 @@ public class Util {
@ -47,18 +50,27 @@ index aa52b271bd556a29f774fde375b713d0d187521b..8188febd6f1039a31619b42af23df18a
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
@@ -152,15 +152,18 @@ public class Util {
@@ -152,15 +152,27 @@ public class Util {
return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now());
}
- private static ExecutorService makeExecutor(String name) {
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads());
+ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority
+ // Paper start - use simpler thread pool that allows 1 thread
+ int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 1));
+ // Paper start - use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
+ int cpus = Runtime.getRuntime().availableProcessors() / 2;
+ int i;
+ if (cpus <= 4) {
+ i = cpus <= 2 ? 1 : 2;
+ } else if (cpus <= 8) {
+ // [5, 8]
+ i = Math.max(3, cpus - 2);
+ } else {
+ i = cpus * 2 / 3;
+ }
+ i = Math.min(8, i);
+ i = Integer.getInteger("Paper.WorkerThreadCount", i);
ExecutorService executorService;
+
if (i <= 0) {
executorService = MoreExecutors.newDirectExecutorService();
} else {
@ -71,7 +83,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..8188febd6f1039a31619b42af23df18a
@Override
protected void onTermination(Throwable throwable) {
if (throwable != null) {
@@ -176,6 +179,7 @@ public class Util {
@@ -176,6 +188,7 @@ public class Util {
return forkJoinWorkerThread;
}, Util::onThreadException, true);
}
@ -80,7 +92,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..8188febd6f1039a31619b42af23df18a
return executorService;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 06d9cafeeedb3020c5e2313d32c6fe9285f99925..eac560bf8af3c7c28ed5eed61ef352f52d823cef 100644
index 79a7f64edcfc750bf2753b5b20e4c2ae322e01ab..7a12c0f5a6cb205e8ae7667b9334efe1999e2a6a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -1,11 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 10 May 2020 22:12:46 -0400
Subject: [PATCH] Ensure Entity AABB's are never invalid
Subject: [PATCH] Ensure Entity position and AABB are never invalid
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a1d990aa2e79af9e1ff078892cdb38a382f21da7..a1172531baf637915a65fbdee8ca08f08034811d 100644
index a1d990aa2e79af9e1ff078892cdb38a382f21da7..e1ce61dcadf325633ed809eef92fc07bac4cbf05 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -728,8 +728,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -14,33 +15,51 @@ index a1d990aa2e79af9e1ff078892cdb38a382f21da7..a1172531baf637915a65fbdee8ca08f0
public void setPos(double x, double y, double z) {
- this.setPosRaw(x, y, z);
- this.setBoundingBox(this.makeBoundingBox());
+ this.setPosRaw(x, y, z, true); // Paper - force bounding box update
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
+ this.setPosRaw(x, y, z, true); // Paper - Block invalid positions and bounding box; force update
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - Block invalid positions and bounding box; move into setPosRaw
}
protected AABB makeBoundingBox() {
@@ -4244,6 +4244,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4243,7 +4243,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
}
+ // Paper start - Block invalid positions and bounding box
+ public static boolean checkPosition(Entity entity, double newX, double newY, double newZ) {
+ if (Double.isFinite(newX) && Double.isFinite(newY) && Double.isFinite(newZ)) {
+ return true;
+ }
+
+ String entityInfo;
+ try {
+ entityInfo = entity.toString();
+ } catch (Exception ex) {
+ entityInfo = "[Entity info unavailable] ";
+ }
+ LOGGER.error("New entity position is invalid! Tried to set invalid position ({},{},{}) for entity {} located at {}, entity info: {}", newX, newY, newZ, entity.getClass().getName(), entity.position, entityInfo, new Throwable());
+ return false;
+ }
public final void setPosRaw(double x, double y, double z) {
+ // Paper start
+ this.setPosRaw(x, y, z, false);
+ }
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
+ // Paper end
+ if (!checkPosition(this, x, y, z)) {
+ return;
+ }
+ // Paper end - Block invalid positions and bounding box
// Paper start - rewrite chunk system
if (this.updatingSectionStatus) {
LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable());
@@ -4267,6 +4272,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4267,6 +4289,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.levelCallback.onMove();
}
+ // Paper start - never allow AABB to become desynced from position
+ // Paper start - Block invalid positions and bounding box; don't allow desync of pos and AABB
+ // hanging has its own special logic
+ if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (forceBoundingBoxUpdate || this.position.x != x || this.position.y != y || this.position.z != z)) {
+ this.setBoundingBox(this.makeBoundingBox());
+ }
+ // Paper end
+ // Paper end - Block invalid positions and bounding box
}
public void checkDespawn() {}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ec224193e9ca7734fe533d5cfc0e316d5eed2adb..03eee2a591a533ec9930a262ffd4af2023a07c91 100644
index 1f245a40358309f2e71f473af6df8e71739e8082..2b8706dfccd263c2843dd8661a260536134ad3f8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4493,4 +4493,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4510,4 +4510,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
void accept(Entity entity, double x, double y, double z);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 03eee2a591a533ec9930a262ffd4af2023a07c91..4a1245fb3ad821ee997b35f180390a07bc871982 100644
index 2b8706dfccd263c2843dd8661a260536134ad3f8..cdfc00e4bee78fc7ac7dc9f52301f16cd7846698 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4498,5 +4498,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4515,5 +4515,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}

Datei anzeigen

@ -28,10 +28,10 @@ index 05ac41e136da43284fb24a6b698ebd36318278fb..33d9131e9c75ef23cd637f5d6c39a270
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 82eb980dd463c423b2b30a3149166a227608bb96..5436949cd928303cf80b606c747f386f0189f774 100644
index 02b102b2d3e8e8ca9d0c95d3a44a56a88bee3b18..3a8572ded5c9bdf621a8c16123707da9ceb70d54 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4269,6 +4269,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4286,6 +4286,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return;
}
// Paper end - rewrite chunk system

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c598247bd8cf65f33845502107277518f7260d4d..8db434d01f2771a94cd4c4a662ea0482b2a02307 100644
index c598247bd8cf65f33845502107277518f7260d4d..80df6afacee92b205949322c9ccfba6f37af0279 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3373,6 +3373,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -33,7 +33,7 @@ index c598247bd8cf65f33845502107277518f7260d4d..8db434d01f2771a94cd4c4a662ea0482
+ pitch = event.getTo().getPitch();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
+ }
+ // Paper end
+ // Paper end - Call EntityPortalExitEvent
if (worldserver == this.level) {
// SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
@ -43,8 +43,8 @@ index c598247bd8cf65f33845502107277518f7260d4d..8db434d01f2771a94cd4c4a662ea0482
entity.restoreFrom(this);
- entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
- entity.setDeltaMovement(shapedetectorshape.speed);
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - use EntityPortalExitEvent values
+ entity.setDeltaMovement(velocity); // Paper - use EntityPortalExitEvent values
+ entity.moveTo(position.x, position.y, position.z, yaw, pitch); // Paper - EntityPortalExitEvent
+ entity.setDeltaMovement(velocity); // Paper - EntityPortalExitEvent
// CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
if (this.inWorld) {
worldserver.addDuringTeleport(entity);

Datei anzeigen

@ -7,18 +7,18 @@ Subject: [PATCH] Add methods to find targets for lightning strikes
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dbfd4a642e862f46a8b4fd1f3fc52c13ecf74284..1629a94a272f34d395b6be8f16944b9a8837d195 100644
index dbfd4a642e862f46a8b4fd1f3fc52c13ecf74284..1e67fd45b4449b46992cb0617db22e74ce517b4d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -998,6 +998,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
protected BlockPos findLightningTargetAround(BlockPos pos) {
+ // Paper start
+ // Paper start - Add methods to find targets for lightning strikes
+ return this.findLightningTargetAround(pos, false);
+ }
+ public BlockPos findLightningTargetAround(BlockPos pos, boolean returnNullWhenNoTarget) {
+ // Paper end
+ // Paper end - Add methods to find targets for lightning strikes
BlockPos blockposition1 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, pos);
Optional<BlockPos> optional = this.findLightningRod(blockposition1);
@ -26,19 +26,19 @@ index dbfd4a642e862f46a8b4fd1f3fc52c13ecf74284..1629a94a272f34d395b6be8f16944b9a
if (!list.isEmpty()) {
return ((LivingEntity) list.get(this.random.nextInt(list.size()))).blockPosition();
} else {
+ if (returnNullWhenNoTarget) return null; // Paper
+ if (returnNullWhenNoTarget) return null; // Paper - Add methods to find targets for lightning strikes
if (blockposition1.getY() == this.getMinBuildHeight() - 1) {
blockposition1 = blockposition1.above(2);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a920936018a2e05ea72d68a83e6debb3807df353..095fa9e4c4d367a3cdd343ca71bef7a6564759be 100644
index a920936018a2e05ea72d68a83e6debb3807df353..59ca5a224561f59bf1f44e11db9bc323ac2f6d71 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -701,6 +701,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (LightningStrike) lightning.getBukkitEntity();
}
+ // Paper start
+ // Paper start - Add methods to find targets for lightning strikes
+ @Override
+ public Location findLightningRod(Location location) {
+ return this.world.findLightningRod(io.papermc.paper.util.MCUtil.toBlockPosition(location))
@ -53,7 +53,7 @@ index a920936018a2e05ea72d68a83e6debb3807df353..095fa9e4c4d367a3cdd343ca71bef7a6
+ final BlockPos pos = this.world.findLightningTargetAround(io.papermc.paper.util.MCUtil.toBlockPosition(location), true);
+ return pos == null ? null : io.papermc.paper.util.MCUtil.toLocation(this.world, pos);
+ }
+ // Paper end
+ // Paper end - Add methods to find targets for lightning strikes
+
@Override
public boolean generateTree(Location loc, TreeType type) {

Datei anzeigen

@ -84,26 +84,26 @@ index 0000000000000000000000000000000000000000..adac21ce6db3ff7a56dbcd6bffc02143
+ }
+}
diff --git a/src/main/java/net/minecraft/advancements/DisplayInfo.java b/src/main/java/net/minecraft/advancements/DisplayInfo.java
index d357deb8a9e1d4043f5fb3302b957b20ffc0cc32..d83acd5eac3d7d1893b1b97ab0b0764c06da016b 100644
index d357deb8a9e1d4043f5fb3302b957b20ffc0cc32..54298a80bd86ae8c2bdbfc69d381173aea2f1410 100644
--- a/src/main/java/net/minecraft/advancements/DisplayInfo.java
+++ b/src/main/java/net/minecraft/advancements/DisplayInfo.java
@@ -24,6 +24,7 @@ public class DisplayInfo {
private final boolean hidden;
private float x;
private float y;
+ public final io.papermc.paper.advancement.AdvancementDisplay paper = new io.papermc.paper.advancement.PaperAdvancementDisplay(this); // Paper
+ public final io.papermc.paper.advancement.AdvancementDisplay paper = new io.papermc.paper.advancement.PaperAdvancementDisplay(this); // Paper - Add more advancement API
public DisplayInfo(ItemStack icon, Component title, Component description, Optional<ResourceLocation> background, AdvancementType frame, boolean showToast, boolean announceToChat, boolean hidden) {
this.title = title;
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
index 52baf818579a6841b77ff80e42f4f1b9f635ea08..bd640e0d8d796ee114ff787def7e07edbeffc0a5 100644
index 52baf818579a6841b77ff80e42f4f1b9f635ea08..8dfaca2efa0b0bdc97b75aaa83158a2e46361e4e 100644
--- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
+++ b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java
@@ -29,12 +29,47 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement {
return Collections.unmodifiableCollection(this.handle.value().criteria().keySet());
}
+ // Paper start
+ // Paper start - Add more advancement API
@Override
- public AdvancementDisplay getDisplay() {
- if (this.handle.value().display().isEmpty()) {
@ -149,7 +149,7 @@ index 52baf818579a6841b77ff80e42f4f1b9f635ea08..bd640e0d8d796ee114ff787def7e07ed
+ final net.minecraft.advancements.AdvancementNode advancementNode = net.minecraft.server.MinecraftServer.getServer().getAdvancements().tree().get(this.handle);
+ return java.util.Objects.requireNonNull(advancementNode, "could not find internal advancement node for advancement " + this.handle.id()).root().holder().toBukkit();
}
+ // Paper end
+ // Paper end - Add more advancement API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java
index 8ca86852319d7463f60832bc98b825b0b4325995..62ada73302c6b3ce3fb2dcc8c31a1d9c0ac4fd09 100644

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add ItemFactory#getSpawnEgg API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 12f90520e4d6d5fcea0c2f8e19dad9102970cd99..2dc5cdf72034f27cf9c61ce979a7018f169bb786 100644
index 12f90520e4d6d5fcea0c2f8e19dad9102970cd99..ef0c6e04a89704688f7b5461b27c0036abbf647d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -564,4 +564,19 @@ public final class CraftItemFactory implements ItemFactory {
@ -26,7 +26,7 @@ index 12f90520e4d6d5fcea0c2f8e19dad9102970cd99..2dc5cdf72034f27cf9c61ce979a7018f
+ net.minecraft.world.item.SpawnEggItem eggItem = net.minecraft.world.item.SpawnEggItem.byId(nmsType);
+ return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
+ }
+ // Paper end
+ // Paper end - old getSpawnEgg API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 6d6a7abe1aa39a2e4ecf3ac5f55b1f227e1a9db9..010014c06fcea7d603160928f124f54d6e5e63d8 100644

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add critical damage API
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index df8c88bfa749e02f633350446101dcce05db7ac1..1a0f86b5a632469942e33c237c247d2d1dee4a3d 100644
index df8c88bfa749e02f633350446101dcce05db7ac1..ed1277fad60992344b94f8a939febaca3edd9702 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -191,4 +191,18 @@ public class DamageSource {
@ -25,10 +25,10 @@ index df8c88bfa749e02f633350446101dcce05db7ac1..1a0f86b5a632469942e33c237c247d2d
+ this.critical = critical;
+ return this;
+ }
+ // Paper end
+ // Paper end - add critical damage API
}
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 e77a2d3a321313e8476068d895dfb39cb152f7e6..9193e0fb5c2a545907c084322b548722312a5583 100644
index e77a2d3a321313e8476068d895dfb39cb152f7e6..21a02cab65506a3746ddc709d92c6fde244446eb 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1263,7 +1263,7 @@ public abstract class Player extends LivingEntity {
@ -36,7 +36,7 @@ index e77a2d3a321313e8476068d895dfb39cb152f7e6..9193e0fb5c2a545907c084322b548722
}
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API - conflict on change
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API; diff on change
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Fix issues with mob conversion
diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
index e88af2dcc0f7fc5190654e2640f67d706e6c8c81..8b818a7cb835512c4bd2ea9641d4bfd904150332 100644
index e88af2dcc0f7fc5190654e2640f67d706e6c8c81..92974452d8f63fde8524cfac305ee2ef5212f840 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
@@ -90,10 +90,15 @@ public class Skeleton extends AbstractSkeleton {
@ -13,47 +13,47 @@ index e88af2dcc0f7fc5190654e2640f67d706e6c8c81..8b818a7cb835512c4bd2ea9641d4bfd9
protected void doFreezeConversion() {
- this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
+ Stray stray = this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons // Paper - track result of conversion
+ Stray stray = this.convertTo(EntityType.STRAY, true, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons // Paper - Fix issues with mob conversion
if (!this.isSilent()) {
this.level().levelEvent((Player) null, 1048, this.blockPosition(), 0);
}
+ // Paper start - reset conversion time to prevent event spam
+ // Paper start - Fix issues with mob conversion; reset conversion time to prevent event spam
+ if (stray == null) {
+ this.conversionTime = 300;
+ }
+ // Paper end
+ // Paper end - Fix issues with mob conversion
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 7bcd5498c734873b74bee503992ec4806ae61df7..4257f2282152aee09533c9a2e53018d3e49effa4 100644
index 7bcd5498c734873b74bee503992ec4806ae61df7..01a2016ac82807d28ffe407b7dbb74bdbcde503e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -241,6 +241,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
if (zoglin != null) {
zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));
}
+ // Paper start - reset to prevent event spam
+ // Paper start - Fix issues with mob conversion; reset to prevent event spam
+ else {
+ this.timeInOverworld = 0;
+ }
+ // Paper end
+ // Paper end - Fix issues with mob conversion
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
index 22c8d6233be5e4f7fb4f03176e83dbee02256b1f..4384cbf9c53b220128cd278f126466b143fab2f2 100644
index 22c8d6233be5e4f7fb4f03176e83dbee02256b1f..c575a86ca5c1bbdd6d2faf6e4a609af8ba03cab6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
@@ -120,6 +120,11 @@ public abstract class AbstractPiglin extends Monster {
if (entitypigzombie != null) {
entitypigzombie.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));
}
+ // Paper start - reset to prevent event spam
+ // Paper start - Fix issues with mob conversion; reset to prevent event spam
+ else {
+ this.timeInOverworld = 0;
+ }
+ // Paper end
+ // Paper end - Fix issues with mob conversion
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Goat ram API
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index 52f3f679568955b632a60d44de687c6db0e2b38a..3ec2f590dfe9410f1a9d2afb530eebfcce917798 100644
index 52f3f679568955b632a60d44de687c6db0e2b38a..ee1b2c1fec4b76a821e1d52fbb07e1f302b2efa1 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -392,4 +392,15 @@ public class Goat extends Animal {
@ -22,7 +22,7 @@ index 52f3f679568955b632a60d44de687c6db0e2b38a..3ec2f590dfe9410f1a9d2afb530eebfc
+ brain.eraseMemory(MemoryModuleType.TEMPTING_PLAYER);
+ brain.setActiveActivityIfPossible(net.minecraft.world.entity.schedule.Activity.RAM);
+ }
+ // Paper end
+ // Paper end - Goat ram API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java
index 65fcb36e849da6949c123a6f3672b485036f368e..2c21de478bff9cdf13ba46cd041831d54c11e924 100644

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8db434d01f2771a94cd4c4a662ea0482b2a02307..58aa16888666f81ba688037bff61d149a03767af 100644
index 80df6afacee92b205949322c9ccfba6f37af0279..024b993b1fb709297fb495a5fd8224484c48c8b6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2159,6 +2159,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -22,7 +22,7 @@ index 8db434d01f2771a94cd4c4a662ea0482b2a02307..58aa16888666f81ba688037bff61d149
+ this.passengers = ImmutableList.copyOf(pass);
+ return result;
+ }
+ // Paper end
+ // Paper end - Entity serialization api
public boolean save(CompoundTag nbt) {
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
}

Datei anzeigen

@ -10,48 +10,48 @@ requirement, as well as for namespaced vanilla commands.
public-f com.mojang.brigadier.tree.CommandNode requirement
diff --git a/src/main/java/com/mojang/brigadier/builder/ArgumentBuilder.java b/src/main/java/com/mojang/brigadier/builder/ArgumentBuilder.java
index 899008b2980d13f1be6280cd8cb959c53a29bebf..f875507241ac6769545e91cd3285232b75b892f0 100644
index 899008b2980d13f1be6280cd8cb959c53a29bebf..d5f7da3502575f6847f3c22ab0e942848a7c6031 100644
--- a/src/main/java/com/mojang/brigadier/builder/ArgumentBuilder.java
+++ b/src/main/java/com/mojang/brigadier/builder/ArgumentBuilder.java
@@ -14,9 +14,17 @@ import java.util.Collections;
import java.util.function.Predicate;
public abstract class ArgumentBuilder<S, T extends ArgumentBuilder<S, T>> {
+ // Paper start
+ // Paper start - Vanilla command permission fixes
+ private static final Predicate<Object> DEFAULT_REQUIREMENT = s -> true;
+
+ @SuppressWarnings("unchecked")
+ public static <S> Predicate<S> defaultRequirement() {
+ return (Predicate<S>) DEFAULT_REQUIREMENT;
+ }
+ // Paper end
+ // Paper end - Vanilla command permission fixes
private final RootCommandNode<S> arguments = new RootCommandNode<>();
private Command<S> command;
- private Predicate<S> requirement = s -> true;
+ private Predicate<S> requirement = defaultRequirement(); // Paper
+ private Predicate<S> requirement = defaultRequirement(); // Paper - Vanilla command permission fixes
private CommandNode<S> target;
private RedirectModifier<S> modifier = null;
private boolean forks;
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 3b3fa067ee5a95d52645147c2d9d1e43d7a789b6..bc0f9bf88de8f79f8e2aa2261d5a8bdc9dd1f53a 100644
index 3b3fa067ee5a95d52645147c2d9d1e43d7a789b6..9a01905bdbf0b721a129984d71c5745fa5e3c8a5 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -257,6 +257,13 @@ public class Commands {
}
this.vanillaCommandNodes.addAll(this.dispatcher.getRoot().getChildren()); // Paper
+ // Paper start
+ // Paper start - Vanilla command permission fixes
+ for (final CommandNode<CommandSourceStack> node : this.dispatcher.getRoot().getChildren()) {
+ if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.<CommandSourceStack>defaultRequirement()) {
+ node.requirement = stack -> stack.source == CommandSource.NULL || stack.getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(node));
+ }
+ }
+ // Paper end
+ // Paper end - Vanilla command permission fixes
// CraftBukkit start
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index 5e6645e16b185aaa6f719055ddbf670b8741fead..f4961a0f360a39124544cbe0adbd94eeeef32ab5 100644
index 5e6645e16b185aaa6f719055ddbf670b8741fead..bda9a0b99184adce28bb7851612ed7f4e324826d 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -86,7 +86,23 @@ public final class VanillaCommandWrapper extends BukkitCommand {
@ -59,7 +59,7 @@ index 5e6645e16b185aaa6f719055ddbf670b8741fead..f4961a0f360a39124544cbe0adbd94ee
public static String getPermission(CommandNode<CommandSourceStack> vanillaCommand) {
- return "minecraft.command." + ((vanillaCommand.getRedirect() == null) ? vanillaCommand.getName() : vanillaCommand.getRedirect().getName());
+ // Paper start
+ // Paper start - Vanilla command permission fixes
+ final String commandName;
+ if (vanillaCommand.getRedirect() == null) {
+ commandName = vanillaCommand.getName();
@ -75,7 +75,7 @@ index 5e6645e16b185aaa6f719055ddbf670b8741fead..f4961a0f360a39124544cbe0adbd94ee
+ return maybeNamespaced.substring(prefix.length());
+ }
+ return maybeNamespaced;
+ // Paper end
+ // Paper end - Vanilla command permission fixes
}
private String toDispatcher(String[] args, String name) {

Datei anzeigen

@ -9,7 +9,7 @@ chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1629a94a272f34d395b6be8f16944b9a8837d195..ce74bfb123427c5459c03c3c8f85445077c329c7 100644
index 1e67fd45b4449b46992cb0617db22e74ce517b4d..dfbec0bd98f58f7e01d0f45f2ab2c433f9094cc3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1578,9 +1578,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -23,7 +23,7 @@ index 1629a94a272f34d395b6be8f16944b9a8837d195..ce74bfb123427c5459c03c3c8f854450
- h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity)h).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
}
+ // Paper end
+ // Paper end - this area looks like it can load chunks, change the behavior
}
}
// Spigot End
@ -51,7 +51,7 @@ index 9f7c149d3ad1175d55ec02e295ee43bc571c3280..87fdc78409fb16c961c04a5551980a8a
@Override
public void doCloseContainer() {
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 9193e0fb5c2a545907c084322b548722312a5583..bce494bb7bc1ce20809ac7d355f04aa7aad78308 100644
index 21a02cab65506a3746ddc709d92c6fde244446eb..6018717ea7ff9d3947e48aacd3dbedc075a8376e 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -508,6 +508,11 @@ public abstract class Player extends LivingEntity {

Datei anzeigen

@ -7,17 +7,17 @@ Separate lookup and state access locks prevent lookups
from stalling simple state access/write calls
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf391593651e 100644
index 85172de608f04abca1be4591749564ccc0e8d600..572263b112762e69bd61fedf7c0fdd810164e6dd 100644
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
@@ -60,6 +60,11 @@ public class GameProfileCache {
@Nullable
private Executor executor;
+ // Paper start
+ // Paper start - Fix GameProfileCache concurrency
+ protected final java.util.concurrent.locks.ReentrantLock stateLock = new java.util.concurrent.locks.ReentrantLock();
+ protected final java.util.concurrent.locks.ReentrantLock lookupLock = new java.util.concurrent.locks.ReentrantLock();
+ // Paper end
+ // Paper end - Fix GameProfileCache concurrency
+
public GameProfileCache(GameProfileRepository profileRepository, File cacheFile) {
this.profileRepository = profileRepository;
@ -26,13 +26,13 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
}
private void safeAdd(GameProfileCache.GameProfileInfo entry) {
+ try { this.stateLock.lock(); // Paper - allow better concurrency
+ try { this.stateLock.lock(); // Paper - Fix GameProfileCache concurrency
GameProfile gameprofile = entry.getProfile();
entry.setLastAccess(this.getNextOperation());
this.profilesByName.put(gameprofile.getName().toLowerCase(Locale.ROOT), entry);
this.profilesByUUID.put(gameprofile.getId(), entry);
+ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency
+ } finally { this.stateLock.unlock(); } // Paper - Fix GameProfileCache concurrency
}
private static Optional<GameProfile> lookupGameProfile(GameProfileRepository repository, String name) {
@ -40,20 +40,20 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
// Paper start
public @Nullable GameProfile getProfileIfCached(String name) {
+ try { this.stateLock.lock(); // Paper - allow better concurrency
+ try { this.stateLock.lock(); // Paper - Fix GameProfileCache concurrency
GameProfileCache.GameProfileInfo entry = this.profilesByName.get(name.toLowerCase(Locale.ROOT));
if (entry == null) {
return null;
}
entry.setLastAccess(this.getNextOperation());
return entry.getProfile();
+ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency
+ } finally { this.stateLock.unlock(); } // Paper - Fix GameProfileCache concurrency
}
// Paper end
public Optional<GameProfile> get(String name) {
String s1 = name.toLowerCase(Locale.ROOT);
+ boolean stateLocked = true; try { this.stateLock.lock(); // Paper - allow better concurrency
+ boolean stateLocked = true; try { this.stateLock.lock(); // Paper - Fix GameProfileCache concurrency
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
boolean flag = false;
@ -61,12 +61,12 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
if (usercache_usercacheentry != null) {
usercache_usercacheentry.setLastAccess(this.getNextOperation());
optional = Optional.of(usercache_usercacheentry.getProfile());
+ stateLocked = false; this.stateLock.unlock(); // Paper - allow better concurrency
+ stateLocked = false; this.stateLock.unlock(); // Paper - Fix GameProfileCache concurrency
} else {
+ stateLocked = false; this.stateLock.unlock(); // Paper - allow better concurrency
+ try { this.lookupLock.lock(); // Paper - allow better concurrency
+ stateLocked = false; this.stateLock.unlock(); // Paper - Fix GameProfileCache concurrency
+ try { this.lookupLock.lock(); // Paper - Fix GameProfileCache concurrency
optional = GameProfileCache.lookupGameProfile(this.profileRepository, name); // CraftBukkit - use correct case for offline players
+ } finally { this.lookupLock.unlock(); } // Paper - allow better concurrency
+ } finally { this.lookupLock.unlock(); } // Paper - Fix GameProfileCache concurrency
if (optional.isPresent()) {
this.add((GameProfile) optional.get());
flag = false;
@ -74,7 +74,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
}
return optional;
+ } finally { if (stateLocked) { this.stateLock.unlock(); } } // Paper - allow better concurrency
+ } finally { if (stateLocked) { this.stateLock.unlock(); } } // Paper - Fix GameProfileCache concurrency
}
public CompletableFuture<Optional<GameProfile>> getAsync(String username) {
@ -82,7 +82,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
}
public Optional<GameProfile> get(UUID uuid) {
+ try { this.stateLock.lock(); // Paper - allow better concurrency
+ try { this.stateLock.lock(); // Paper - Fix GameProfileCache concurrency
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid);
if (usercache_usercacheentry == null) {
@ -90,7 +90,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
usercache_usercacheentry.setLastAccess(this.getNextOperation());
return Optional.of(usercache_usercacheentry.getProfile());
}
+ } finally { this.stateLock.unlock(); } // Paper - allow better concurrency
+ } finally { this.stateLock.unlock(); } // Paper - Fix GameProfileCache concurrency
}
public void setExecutor(Executor executor) {
@ -99,7 +99,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
DateFormat dateformat = GameProfileCache.createDateFormat();
- this.getTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot
+ this.listTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot // Paper - allow better concurrency
+ this.listTopMRUProfiles(org.spigotmc.SpigotConfig.userCacheCap).forEach((usercache_usercacheentry) -> { // Spigot // Paper - Fix GameProfileCache concurrency
jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat));
});
String s = this.gson.toJson(jsonarray);
@ -108,7 +108,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
private Stream<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) {
- return ImmutableList.copyOf(this.profilesByUUID.values()).stream().sorted(Comparator.comparing(GameProfileCache.GameProfileInfo::getLastAccess).reversed()).limit((long) limit);
+ // Paper start - allow better concurrency
+ // Paper start - Fix GameProfileCache concurrency
+ return this.listTopMRUProfiles(limit).stream();
+ }
+
@ -120,7 +120,7 @@ index 85172de608f04abca1be4591749564ccc0e8d600..85df8ebb1e0030e98a2b03688451cf39
+ this.stateLock.unlock();
+ }
}
+ // Paper end
+ // Paper end - Fix GameProfileCache concurrency
private static JsonElement writeGameProfile(GameProfileCache.GameProfileInfo entry, DateFormat dateFormat) {
JsonObject jsonobject = new JsonObject();

Datei anzeigen

@ -257,14 +257,14 @@ index 0000000000000000000000000000000000000000..d3b39d88a72ca25057fd8574d32f28db
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 9df761f5cf043e8d2dffa711c20ab32fe2992331..d08c7b0b52065980f1f13c5533ff6355028322db 100644
index 9df761f5cf043e8d2dffa711c20ab32fe2992331..48cc5623973713e07d95639e5359fc15e59785cc 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -190,6 +190,16 @@ public final class NaturalSpawner {
world.getProfiler().pop();
}
+ // Paper start
+ // Paper start - Add mobcaps commands
+ public static int globalLimitForCategory(final ServerLevel level, final MobCategory category, final int spawnableChunkCount) {
+ final int categoryLimit = level.getWorld().getSpawnLimitUnsafe(CraftSpawnCategory.toBukkit(category));
+ if (categoryLimit < 1) {
@ -272,36 +272,36 @@ index 9df761f5cf043e8d2dffa711c20ab32fe2992331..d08c7b0b52065980f1f13c5533ff6355
+ }
+ return categoryLimit * spawnableChunkCount / NaturalSpawner.MAGIC_NUMBER;
+ }
+ // Paper end
+ // Paper end - Add mobcaps commands
+
public static void spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner) {
// Paper start - add parameters and int ret type
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7df30c0d3f647b74dd812fc9d286feb95b52dfae..8f61efe32500ebe47e13d96fd96df646adb3dd5b 100644
index 7df30c0d3f647b74dd812fc9d286feb95b52dfae..65809db4522c3b1ce0b5bf11828de129713d7d21 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2279,6 +2279,11 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {
+ // Paper start
+ // Paper start - Add mobcaps commands
+ return this.getSpawnLimitUnsafe(spawnCategory);
+ }
+ public int getSpawnLimitUnsafe(final SpawnCategory spawnCategory) {
+ // Paper end
+ // Paper end - Add mobcaps commands
return this.spawnCategoryLimit.getOrDefault(spawnCategory, -1);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b52d3413cfe725ff5778c897a0ba06ca834e533f..24156bd9d964e2c32bc758dd9e099744cf8ac647 100644
index b882e8d1b3e45277b5e9e3a359f51d9703bdb2d0..3eeb878924827861f79c6bc1b510d0167b9ac10b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1761,9 +1761,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
+ // Paper start
+ // Paper start - Add mobcaps commands
+ return this.getSpawnLimitUnsafe(spawnCategory);
+ }
+ public final int getSpawnLimitUnsafe(final SpawnCategory spawnCategory) {
@ -309,7 +309,7 @@ index b52d3413cfe725ff5778c897a0ba06ca834e533f..24156bd9d964e2c32bc758dd9e099744
if (limit < 0) {
- limit = this.server.getSpawnLimit(spawnCategory);
+ limit = this.server.getSpawnLimitUnsafe(spawnCategory);
+ // Paper end
+ // Paper end - Add mobcaps commands
}
return limit;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Sanitize ResourceLocation error logging
diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java
index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..38e2a8cec48bc779b8154d6d719031f457a2403e 100644
index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..5f9dcab27a07969c93555ad0892683c62cbebc8c 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -211,7 +211,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
@ -13,7 +13,7 @@ index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..38e2a8cec48bc779b8154d6d719031f4
private static String assertValidNamespace(String namespace, String path) {
if (!isValidNamespace(namespace)) {
- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + namespace + ":" + path);
+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper
+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper - Sanitize ResourceLocation error logging
} else {
return namespace;
}
@ -22,7 +22,7 @@ index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..38e2a8cec48bc779b8154d6d719031f4
private static String assertValidPath(String namespace, String path) {
if (!isValidPath(path)) {
- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + path);
+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper
+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(path)); // Paper - Sanitize ResourceLocation error logging
} else {
return path;
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Manually inline methods in BlockPosition
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index e5dfc4009cb06e500c6b54ee4228117061758b53..c47aa87db42dea74a2e07ffe6015257fa337da23 100644
index e5dfc4009cb06e500c6b54ee4228117061758b53..3a9715a81a8551c07ba61850e82b1ccb8a324c80 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -515,9 +515,9 @@ public class BlockPos extends Vec3i {
@ -26,26 +26,26 @@ index e5dfc4009cb06e500c6b54ee4228117061758b53..c47aa87db42dea74a2e07ffe6015257f
@Override
public BlockPos.MutableBlockPos setX(int i) {
- super.setX(i);
+ this.x = i; // Paper
+ this.x = i; // Paper - force line
return this;
}
@Override
public BlockPos.MutableBlockPos setY(int i) {
- super.setY(i);
+ this.y = i; // Paper
+ this.y = i; // Paper - force line
return this;
}
@Override
public BlockPos.MutableBlockPos setZ(int i) {
- super.setZ(i);
+ this.z = i; // Paper
+ this.z = i; // Paper - force line
return this;
}
diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java
index e87ef99260bff134529e00b9a75381cecaec01a4..74a3f2ba6aaec39ba4721fb546bfccb325c86343 100644
index e87ef99260bff134529e00b9a75381cecaec01a4..0f8766ea9dc1893f88c5b1e7d6e2a474100efcbb 100644
--- a/src/main/java/net/minecraft/core/Vec3i.java
+++ b/src/main/java/net/minecraft/core/Vec3i.java
@@ -19,9 +19,9 @@ public class Vec3i implements Comparable<Vec3i> {
@ -55,9 +55,9 @@ index e87ef99260bff134529e00b9a75381cecaec01a4..74a3f2ba6aaec39ba4721fb546bfccb3
- private int x;
- private int y;
- private int z;
+ protected int x; // Paper - protected
+ protected int y; // Paper - protected
+ protected int z; // Paper - protected
+ protected int x; // Paper - force line; protected
+ protected int y; // Paper - force line; protected
+ protected int z; // Paper - force line; protected
public static Codec<Vec3i> offsetCodec(int maxAbsValue) {
return ExtraCodecs.validate(CODEC, (vec) -> {

Datei anzeigen

@ -8,7 +8,7 @@ Provides quick access to culprits running far more threads than
they should be
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
index 365b7e7c665bec357fb76d1479bf17da6f603590..b17d40ced3f2d5859c61f1826ead72c5f07abe9f 100644
index 365b7e7c665bec357fb76d1479bf17da6f603590..e97f6b76ef2fe21c7c2eca8d4a707e5866d70de9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java
@@ -25,7 +25,10 @@ class CraftAsyncTask extends CraftTask {
@ -27,7 +27,7 @@ index 365b7e7c665bec357fb76d1479bf17da6f603590..b17d40ced3f2d5859c61f1826ead72c5
}
}
}
+ } finally { thread.setName(nameBefore); } // Paper - name worker thread according
+ } finally { thread.setName(nameBefore); } // Paper - name threads according to running plugin
}
LinkedList<BukkitWorker> getWorkers() {

Datei anzeigen

@ -9,18 +9,15 @@ previous getChunkAt method which had inlined logic for loaded
chunks did get inlined, but the standard CPS.getChunkAt
method was not inlined.
Paper recently reverted this optimisation, so it's been reintroduced
here.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 35ca44c88497e0b07f43ba7bf092360365b1c53a..e297be9cf8c59b6b8d051d5db70c3bebcd235a2d 100644
index 35ca44c88497e0b07f43ba7bf092360365b1c53a..69730027a70e91ec32604b1fb32820363ea20a71 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -458,6 +458,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline
+ // Paper start - make sure loaded chunks get the inlined variant of this function
+ // Paper start - Perf: make sure loaded chunks get the inlined variant of this function
+ net.minecraft.server.level.ServerChunkCache cps = ((ServerLevel)this).getChunkSource();
+ if (cps.mainThread == Thread.currentThread()) {
+ LevelChunk ifLoaded = cps.getChunkAtIfLoadedMainThread(chunkX, chunkZ);
@ -28,7 +25,7 @@ index 35ca44c88497e0b07f43ba7bf092360365b1c53a..e297be9cf8c59b6b8d051d5db70c3beb
+ return ifLoaded;
+ }
+ }
+ // Paper end - make sure loaded chunks get the inlined variant of this function
+ // Paper end - Perf: make sure loaded chunks get the inlined variant of this function
return (LevelChunk) this.getChunk(chunkX, chunkZ, ChunkStatus.FULL, true); // Paper - avoid a method jump
}

Datei anzeigen

@ -8,14 +8,14 @@ Lighting is purged on update anyways, so let's not add more
into the conversion process
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index e4b3a70ff9f906a10f2ba3c07642193ca3269db7..dfeda27add86be0d56ad023f7391fa21e36c5062 100644
index e4b3a70ff9f906a10f2ba3c07642193ca3269db7..7f7c05c498dfe11842a0c35d6e8c2c428cf7647b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -51,6 +51,7 @@ public class ChunkStorage implements AutoCloseable {
// CraftBukkit start
private boolean check(ServerChunkCache cps, int x, int z) {
+ if (true) return true; // Paper - this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
+ if (true) return true; // Paper - Perf: this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
ChunkPos pos = new ChunkPos(x, z);
if (cps != null) {
//com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); // Paper - this function is now MT-Safe

Datei anzeigen

@ -7,7 +7,7 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 07abd089e5091d292d4542bbe0fbb416a111bf8e..a0603e567deeede8b4cd2ba57ded44f29239d78d 100644
index 07abd089e5091d292d4542bbe0fbb416a111bf8e..534493aaddced9200e1618d5eabf2b176a1f35b6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1301,7 +1301,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -15,7 +15,7 @@ index 07abd089e5091d292d4542bbe0fbb416a111bf8e..a0603e567deeede8b4cd2ba57ded44f2
private final int range;
SectionPos lastSectionPos;
- public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
+ public final Set<ServerPlayerConnection> seenBy = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - optimise map impl
+ public final Set<ServerPlayerConnection> seenBy = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Perf: optimise map impl
public TrackedEntity(Entity entity, int i, int j, boolean flag) {
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit

Datei anzeigen

@ -7,10 +7,10 @@ Apparently the abstract block iteration was taking about
75% of the method call.
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index 6c1e8ba518c883aa5c079b4c94f068833609acc3..59bbdead2ebd8965d222540c7243dde051bbcc4b 100644
index 6c1e8ba518c883aa5c079b4c94f068833609acc3..47eb8bf604a63259c0200cada1403dc005a6cbac 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -151,19 +151,27 @@ public class FarmBlock extends Block {
@@ -151,19 +151,28 @@ public class FarmBlock extends Block {
}
private static boolean isNearWater(LevelReader world, BlockPos pos) {
@ -21,7 +21,7 @@ index 6c1e8ba518c883aa5c079b4c94f068833609acc3..59bbdead2ebd8965d222540c7243dde0
- do {
- if (!iterator.hasNext()) {
- return false;
+ // Paper start - remove abstract block iteration
+ // Paper start - Perf: remove abstract block iteration
+ int xOff = pos.getX();
+ int yOff = pos.getY();
+ int zOff = pos.getZ();
@ -46,6 +46,7 @@ index 6c1e8ba518c883aa5c079b4c94f068833609acc3..59bbdead2ebd8965d222540c7243dde0
-
- return true;
+ return false;
+ // Paper end - Perf: remove abstract block iteration
}
@Override

Datei anzeigen

@ -10,14 +10,14 @@ hoping that at least then we don't swap chunks, and maybe recover
them all.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index a95909bc818f395ce5772c5129f9cc9b789ce133..df9ae808c5a59ea25145c9df62f42fb33d159021 100644
index a95909bc818f395ce5772c5129f9cc9b789ce133..72cfe25cbc2076bc83c9f965ab70b0e636800212 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
import org.slf4j.Logger;
public class ChunkSerializer {
+ // Paper start
+ // Paper start - Attempt to recalculate regionfile header if it is corrupt
+ // TODO: Check on update
+ public static long getLastWorldSaveTime(CompoundTag chunkData) {
+ final int dataVersion = ChunkStorage.getVersion(chunkData);
@ -28,7 +28,7 @@ index a95909bc818f395ce5772c5129f9cc9b789ce133..df9ae808c5a59ea25145c9df62f42fb3
+ return chunkData.getLong("LastUpdate");
+ }
+ }
+ // Paper end
+ // Paper end - Attempt to recalculate regionfile header if it is corrupt
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states
private static final Logger LOGGER = LogUtils.getLogger();
@ -42,7 +42,7 @@ index a95909bc818f395ce5772c5129f9cc9b789ce133..df9ae808c5a59ea25145c9df62f42fb3
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getStatus()).toString());
BlendingData blendingdata = chunk.getBlendingData();
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
index dfeda27add86be0d56ad023f7391fa21e36c5062..8ebecb588058da174b0e0e19e54fcddfeeca1422 100644
index 7f7c05c498dfe11842a0c35d6e8c2c428cf7647b..4a84ada69c6abc8f2743579d4451e639836274b4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -41,7 +41,7 @@ public class ChunkStorage implements AutoCloseable {
@ -50,19 +50,19 @@ index dfeda27add86be0d56ad023f7391fa21e36c5062..8ebecb588058da174b0e0e19e54fcddf
// Paper start - async chunk io
// remove IO worker
- this.regionFileCache = new RegionFileStorage(directory, dsync); // Paper - nuke IOWorker
+ this.regionFileCache = new RegionFileStorage(directory, dsync, true); // Paper - nuke IOWorker // Paper
+ this.regionFileCache = new RegionFileStorage(directory, dsync, true); // Paper - nuke IOWorker // Paper - Attempt to recalculate regionfile header if it is corrupt
// Paper end - async chunk io
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java
index c8298a597818227de33a4afce4698ec0666cf758..6baceb6ce9021c489be6e79d338a9704285afa26 100644
index c8298a597818227de33a4afce4698ec0666cf758..6762b0f71ea9e369bb77103b7f1938983cb77a44 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java
@@ -9,6 +9,27 @@ import java.util.BitSet;
public class RegionBitmap {
private final BitSet used = new BitSet();
+ // Paper start
+ // Paper start - Attempt to recalculate regionfile header if it is corrupt
+ public final void copyFrom(RegionBitmap other) {
+ BitSet thisBitset = this.used;
+ BitSet otherBitset = other.used;
@ -81,20 +81,20 @@ index c8298a597818227de33a4afce4698ec0666cf758..6baceb6ce9021c489be6e79d338a9704
+ bitset.set(from, from + length);
+ return true;
+ }
+ // Paper end
+ // Paper end - Attempt to recalculate regionfile header if it is corrupt
+
public void force(int start, int size) {
this.used.set(start, start + size);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 647ce340c81606ab86d33e1f9dec1fb0afc262d8..98c8b676fc5b2add44d6ddf5d32f85bc07ea22cb 100644
index 647ce340c81606ab86d33e1f9dec1fb0afc262d8..2c951dfb17a11bd81c19080a1f8f498f8e534cff 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -50,6 +50,355 @@ public class RegionFile implements AutoCloseable {
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
public final Path regionFile; // Paper
+ // Paper start - try to recover from RegionFile header corruption
+ // Paper start - Attempt to recalculate regionfile header if it is corrupt
+ private static long roundToSectors(long bytes) {
+ long sectors = bytes >>> 12; // 4096 = 2^12
+ long remainingBytes = bytes & 4095;
@ -441,7 +441,7 @@ index 647ce340c81606ab86d33e1f9dec1fb0afc262d8..98c8b676fc5b2add44d6ddf5d32f85bc
+ }
+
+ final boolean canRecalcHeader; // final forces compile fail on new constructor
+ // Paper end
+ // Paper end - Attempt to recalculate regionfile header if it is corrupt
+
// Paper start - Cache chunk status
private final net.minecraft.world.level.chunk.ChunkStatus[] statuses = new net.minecraft.world.level.chunk.ChunkStatus[32 * 32];

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/build.gradle.kts b/build.gradle.kts
index c6241f858209ed662d8720217d143340916024e9..517920023bc28fea04eeb709364d5a7292adcc5e 100644
index c6241f858209ed662d8720217d143340916024e9..ff1636d3e047e124c73496f4942e991abe01c150 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -39,6 +39,11 @@ dependencies {
@ -16,12 +16,12 @@ index c6241f858209ed662d8720217d143340916024e9..517920023bc28fea04eeb709364d5a72
+ implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
+ isTransitive = false
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
diff --git a/src/main/java/net/minecraft/network/CipherDecoder.java b/src/main/java/net/minecraft/network/CipherDecoder.java
index 778beb445eac5769b9e4e07b4d1294c50ae2602b..c712fb8193115e1ab71b5e40fb0ccb9413062b03 100644
index 778beb445eac5769b9e4e07b4d1294c50ae2602b..7b895b6a626da6297f07582e96d98ecfb6c8c951 100644
--- a/src/main/java/net/minecraft/network/CipherDecoder.java
+++ b/src/main/java/net/minecraft/network/CipherDecoder.java
@@ -7,13 +7,29 @@ import java.util.List;
@ -29,17 +29,17 @@ index 778beb445eac5769b9e4e07b4d1294c50ae2602b..c712fb8193115e1ab71b5e40fb0ccb94
public class CipherDecoder extends MessageToMessageDecoder<ByteBuf> {
- private final CipherBase cipher;
+ private final com.velocitypowered.natives.encryption.VelocityCipher cipher; // Paper
+ private final com.velocitypowered.natives.encryption.VelocityCipher cipher; // Paper - Use Velocity cipher
- public CipherDecoder(Cipher cipher) {
- this.cipher = new CipherBase(cipher);
+ public CipherDecoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper
+ this.cipher = cipher; // Paper
+ public CipherDecoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
+ this.cipher = cipher; // Paper - Use Velocity cipher
}
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
- list.add(this.cipher.decipher(channelHandlerContext, byteBuf));
+ // Paper start
+ // Paper start - Use Velocity cipher
+ ByteBuf compatible = com.velocitypowered.natives.util.MoreByteBufUtils.ensureCompatible(channelHandlerContext.alloc(), cipher, byteBuf);
+ try {
+ cipher.process(compatible);
@ -48,18 +48,18 @@ index 778beb445eac5769b9e4e07b4d1294c50ae2602b..c712fb8193115e1ab71b5e40fb0ccb94
+ compatible.release(); // compatible will never be used if we throw an exception
+ throw e;
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
}
+
+ // Paper start
+ // Paper start - Use Velocity cipher
+ @Override
+ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
+ cipher.close();
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
}
diff --git a/src/main/java/net/minecraft/network/CipherEncoder.java b/src/main/java/net/minecraft/network/CipherEncoder.java
index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..5dd7be70603e8754d2625bb9d16900cb01b9c730 100644
index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..ffa1c48585fbbc1d30826d435043527f6183a3ee 100644
--- a/src/main/java/net/minecraft/network/CipherEncoder.java
+++ b/src/main/java/net/minecraft/network/CipherEncoder.java
@@ -4,15 +4,32 @@ import io.netty.buffer.ByteBuf;
@ -70,19 +70,19 @@ index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..5dd7be70603e8754d2625bb9d16900cb
-public class CipherEncoder extends MessageToByteEncoder<ByteBuf> {
- private final CipherBase cipher;
+public class CipherEncoder extends io.netty.handler.codec.MessageToMessageEncoder<ByteBuf> { // Paper - change superclass
+ private final com.velocitypowered.natives.encryption.VelocityCipher cipher; // Paper
+public class CipherEncoder extends io.netty.handler.codec.MessageToMessageEncoder<ByteBuf> { // Paper - Use Velocity cipher; change superclass
+ private final com.velocitypowered.natives.encryption.VelocityCipher cipher; // Paper - Use Velocity cipher
- public CipherEncoder(Cipher cipher) {
- this.cipher = new CipherBase(cipher);
+ public CipherEncoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper
+ this.cipher = cipher; // Paper
+ public CipherEncoder(com.velocitypowered.natives.encryption.VelocityCipher cipher) { // Paper - Use Velocity cipher
+ this.cipher = cipher; // Paper - Use Velocity cipher
}
- protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception {
- this.cipher.encipher(byteBuf, byteBuf2);
+ protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
+ // Paper start
+ // Paper start - Use Velocity cipher
+ ByteBuf compatible = com.velocitypowered.natives.util.MoreByteBufUtils.ensureCompatible(channelHandlerContext.alloc(), cipher, byteBuf);
+ try {
+ cipher.process(compatible);
@ -91,29 +91,29 @@ index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..5dd7be70603e8754d2625bb9d16900cb
+ compatible.release(); // compatible will never be used if we throw an exception
+ throw e;
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
}
+
+ // Paper start
+ // Paper start - Use Velocity cipher
+ @Override
+ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
+ cipher.close();
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
}
diff --git a/src/main/java/net/minecraft/network/CompressionDecoder.java b/src/main/java/net/minecraft/network/CompressionDecoder.java
index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..a0bab433d003de49bf55e71fd744ce47d6899182 100644
index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..2763052eb2d5b8eb432022ab00a417976f4b2927 100644
--- a/src/main/java/net/minecraft/network/CompressionDecoder.java
+++ b/src/main/java/net/minecraft/network/CompressionDecoder.java
@@ -13,13 +13,20 @@ public class CompressionDecoder extends ByteToMessageDecoder {
public static final int MAXIMUM_COMPRESSED_LENGTH = 2097152;
public static final int MAXIMUM_UNCOMPRESSED_LENGTH = 8388608;
private final Inflater inflater;
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper - Use Velocity cipher
private int threshold;
private boolean validateDecompressed;
+ // Paper start
+ // Paper start - Use Velocity cipher
public CompressionDecoder(int compressionThreshold, boolean rejectsBadPackets) {
+ this(null, compressionThreshold, rejectsBadPackets);
+ }
@ -123,7 +123,7 @@ index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..a0bab433d003de49bf55e71fd744ce47
- this.inflater = new Inflater();
+ this.inflater = compressor == null ? new Inflater() : null;
+ this.compressor = compressor;
+ // Paper end
+ // Paper end - Use Velocity cipher
}
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
@ -131,15 +131,15 @@ index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..a0bab433d003de49bf55e71fd744ce47
}
}
+ if (inflater != null) { // Paper - use velocity compression - fallback to vanilla inflater
+ if (inflater != null) { // Paper - Use Velocity cipher; fallback to vanilla inflater
this.setupInflaterInput(byteBuf);
ByteBuf byteBuf2 = this.inflate(channelHandlerContext, i);
this.inflater.reset();
list.add(byteBuf2);
+ return; // Paper - use velocity compression
+ return; // Paper - Use Velocity cipher
+ } // Paper - use velocity compression
+
+ // Paper start - use velocity compression
+ // Paper start - Use Velocity cipher
+ int claimedUncompressedSize = i; // OBFHELPER
+ ByteBuf compatibleIn = com.velocitypowered.natives.util.MoreByteBufUtils.ensureCompatible(channelHandlerContext.alloc(), this.compressor, byteBuf);
+ ByteBuf uncompressed = com.velocitypowered.natives.util.MoreByteBufUtils.preferredBuffer(channelHandlerContext.alloc(), this.compressor, claimedUncompressedSize);
@ -153,25 +153,25 @@ index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..a0bab433d003de49bf55e71fd744ce47
+ } finally {
+ compatibleIn.release();
+ }
+ // Paper end - use velocity compression
+ // Paper end - Use Velocity cipher
}
}
}
+ // Paper start
+ // Paper start - Use Velocity cipher
+ @Override
+ public void handlerRemoved0(ChannelHandlerContext ctx) throws Exception {
+ if (this.compressor != null) {
+ this.compressor.close();
+ }
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
+
private void setupInflaterInput(ByteBuf buf) {
ByteBuffer byteBuffer;
if (buf.nioBufferCount() > 0) {
diff --git a/src/main/java/net/minecraft/network/CompressionEncoder.java b/src/main/java/net/minecraft/network/CompressionEncoder.java
index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb69d166ce6 100644
index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3f091e099 100644
--- a/src/main/java/net/minecraft/network/CompressionEncoder.java
+++ b/src/main/java/net/minecraft/network/CompressionEncoder.java
@@ -6,21 +6,36 @@ import io.netty.handler.codec.MessageToByteEncoder;
@ -179,12 +179,12 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb6
public class CompressionEncoder extends MessageToByteEncoder<ByteBuf> {
- private final byte[] encodeBuf = new byte[8192];
+ private final byte[] encodeBuf; // Paper
+ private final byte[] encodeBuf; // Paper - Use Velocity cipher
private final Deflater deflater;
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper
+ private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper - Use Velocity cipher
private int threshold;
+ // Paper start
+ // Paper start - Use Velocity cipher
public CompressionEncoder(int compressionThreshold) {
+ this(null, compressionThreshold);
+ }
@ -199,17 +199,17 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb6
+ this.deflater = null;
+ }
+ this.compressor = compressor;
+ // Paper end
+ // Paper end - Use Velocity cipher
}
- protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) {
+ protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception { // Paper
+ protected void encode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, ByteBuf byteBuf2) throws Exception { // Paper - Use Velocity cipher
int i = byteBuf.readableBytes();
if (i < this.threshold) {
VarInt.write(byteBuf2, 0);
byteBuf2.writeBytes(byteBuf);
} else {
+ // Paper start
+ // Paper start - Use Velocity cipher
+ if (this.deflater != null) {
byte[] bs = new byte[i];
byteBuf.readBytes(bs);
@ -228,12 +228,12 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb6
+ } finally {
+ compatibleIn.release();
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
}
}
+ // Paper start
+ // Paper start - Use Velocity cipher
+ @Override
+ protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{
+ if (this.compressor != null) {
@ -258,13 +258,13 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..ec7239fd6a2ecf732d2843f9426e4cb6
+ this.compressor.close();
+ }
+ }
+ // Paper end
+ // Paper end - Use Velocity cipher
+
public int getThreshold() {
return this.threshold;
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index d4e23bfb6135d52c1359d7ccfabc6a0e595afe6e..4ab5773f5869e40272b2da9e21e2efbd1a7eec5a 100644
index d4e23bfb6135d52c1359d7ccfabc6a0e595afe6e..7f611f575c231dd459ae8ef17a10f71ef361a2cb 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -669,11 +669,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -275,7 +275,7 @@ index d4e23bfb6135d52c1359d7ccfabc6a0e595afe6e..4ab5773f5869e40272b2da9e21e2efbd
- this.encrypted = true;
- this.channel.pipeline().addBefore("splitter", "decrypt", new CipherDecoder(decryptionCipher));
- this.channel.pipeline().addBefore("prepender", "encrypt", new CipherEncoder(encryptionCipher));
+ // Paper start
+ // Paper start - Use Velocity cipher
+// public void setEncryptionKey(Cipher decryptionCipher, Cipher encryptionCipher) {
+// this.encrypted = true;
+// this.channel.pipeline().addBefore("splitter", "decrypt", new CipherDecoder(decryptionCipher));
@ -296,7 +296,7 @@ index d4e23bfb6135d52c1359d7ccfabc6a0e595afe6e..4ab5773f5869e40272b2da9e21e2efbd
+ }
+ }
}
+ // Paper end
+ // Paper end - Use Velocity cipher
public boolean isEncrypted() {
return this.encrypted;
@ -304,40 +304,40 @@ index d4e23bfb6135d52c1359d7ccfabc6a0e595afe6e..4ab5773f5869e40272b2da9e21e2efbd
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
if (compressionThreshold >= 0) {
+ com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(-1)); // Paper
+ com.velocitypowered.natives.compression.VelocityCompressor compressor = com.velocitypowered.natives.util.Natives.compress.get().create(io.papermc.paper.configuration.GlobalConfiguration.get().misc.compressionLevel.or(-1)); // Paper - Use Velocity cipher
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
((CompressionDecoder) this.channel.pipeline().get("decompress")).setThreshold(compressionThreshold, rejectsBadPackets);
} else {
- this.channel.pipeline().addBefore("decoder", "decompress", new CompressionDecoder(compressionThreshold, rejectsBadPackets));
+ this.channel.pipeline().addBefore("decoder", "decompress", new CompressionDecoder(compressor, compressionThreshold, rejectsBadPackets)); // Paper
+ this.channel.pipeline().addBefore("decoder", "decompress", new CompressionDecoder(compressor, compressionThreshold, rejectsBadPackets)); // Paper - Use Velocity cipher
}
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
((CompressionEncoder) this.channel.pipeline().get("compress")).setThreshold(compressionThreshold);
} else {
- this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
+ this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressor, compressionThreshold)); // Paper
+ this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressor, compressionThreshold)); // Paper - Use Velocity cipher
}
this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper
} else {
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 5f625acf04ddb56e3596d086252f9bfccfdb95f2..54c7f34ba3dc8466223e589702d0c93af8cf52a0 100644
index 5f625acf04ddb56e3596d086252f9bfccfdb95f2..f7d5af5e6a39469914bd9c496582929c9b8e0300 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -106,6 +106,11 @@ public class ServerConnectionListener {
ServerConnectionListener.LOGGER.info("Using default channel type");
}
+ // Paper start - indicate Velocity natives in use
+ // Paper start - Use Velocity cipher
+ ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
+ ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
+ // Paper end
+ // Paper end - Use Velocity cipher
+
this.channels.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel channel) {
Connection.setInitialProtocolAttributes(channel);
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index e2c7fa3fd05ebb3b76388410d26b6493baf4f877..7a2f78ae76354e15afa5368c8fb2a571c15dc82d 100644
index e2c7fa3fd05ebb3b76388410d26b6493baf4f877..67c1cf5eb198079bd146a4a8ca0492b94cca788c 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -223,12 +223,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -346,15 +346,15 @@ index e2c7fa3fd05ebb3b76388410d26b6493baf4f877..7a2f78ae76354e15afa5368c8fb2a571
SecretKey secretkey = packet.getSecretKey(privatekey);
- Cipher cipher = Crypt.getCipher(2, secretkey);
- Cipher cipher1 = Crypt.getCipher(1, secretkey);
+ // Paper start
+ // Paper start - Use Velocity cipher
+// Cipher cipher = Crypt.getCipher(2, secretkey);
+// Cipher cipher1 = Crypt.getCipher(1, secretkey);
+ // Paper end
+ // Paper end - Use Velocity cipher
s = (new BigInteger(Crypt.digestData("", this.server.getKeyPair().getPublic(), secretkey))).toString(16);
this.state = ServerLoginPacketListenerImpl.State.AUTHENTICATING;
- this.connection.setEncryptionKey(cipher, cipher1);
+ this.connection.setupEncryption(secretkey); // Paper
+ this.connection.setupEncryption(secretkey); // Paper - Use Velocity cipher
} catch (CryptException cryptographyexception) {
throw new IllegalStateException("Protocol error", cryptographyexception);
}

Datei anzeigen

@ -7,7 +7,7 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 4ab5773f5869e40272b2da9e21e2efbd1a7eec5a..8b7e50c0bce9ff201e92fc6fff8934ea17f1b293 100644
index 7f611f575c231dd459ae8ef17a10f71ef361a2cb..5e0793a1bfeaca021206b0b7cce20598ba6ed1d2 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -521,7 +521,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -76,7 +76,7 @@ index 7de24c39b460e43d27839b3821e67213508ece81..7297bca9224c12d7ace0e1967340d994
});
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a9f336ed75ef406c1179bdc6e63e6fd944470534..56c999c7f80b280966e81a0b1ca4929f034edb20 100644
index 8117a0334fdf59904e31a0419f7b5bf231d198c5..569fbb2f6c5f1ec286ecafe5c7f1b1fe6b547908 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1244,7 +1244,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -122,7 +122,7 @@ index a9f336ed75ef406c1179bdc6e63e6fd944470534..56c999c7f80b280966e81a0b1ca4929f
private void tickPassenger(Entity vehicle, Entity passenger) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 58aa16888666f81ba688037bff61d149a03767af..0710061e41d6d6e5b38e62212bbd04e9ada0ec68 100644
index b78bcccfb17f24cadea8ff63b6387a6f3ee6429b..a65a0ae8f7e9c2c5fe48d141dba6d95c2e94f426 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1031,7 +1031,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -192,7 +192,7 @@ index 58aa16888666f81ba688037bff61d149a03767af..0710061e41d6d6e5b38e62212bbd04e9
}
public void addDeltaMovement(Vec3 velocity) {
@@ -4358,7 +4402,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4375,7 +4419,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end - fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {

Datei anzeigen

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 30 Aug 2021 04:26:40 -0700
Subject: [PATCH] Reduce worldgen thread worker count for low core count CPUs
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index e67a2aa92f9c9bb5a4ba9fc869aa738a43cd8595..7be16ce8c8582d8587c4d1cb4c099fa6fe5f1324 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -155,7 +155,19 @@ public class Util {
private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority
// Paper start - use simpler thread pool that allows 1 thread
- int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 1));
+ // Paper start - also try to avoid suffocating the system with the worldgen workers
+ int cpus = Runtime.getRuntime().availableProcessors() / 2;
+ int i;
+ if (cpus <= 4) {
+ i = cpus <= 2 ? 1 : 2;
+ } else if (cpus <= 8) {
+ // [5, 8]
+ i = Math.max(3, cpus - 2);
+ } else {
+ i = cpus * 2 / 3;
+ }
+ i = Math.min(8, i);
+ // Paper end - also try to avoid suffocating the system with the worldgen workers
i = Integer.getInteger("Paper.WorkerThreadCount", i);
ExecutorService executorService;

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 56c999c7f80b280966e81a0b1ca4929f034edb20..cae00701c5dbf40be07ea5c2d01ea8929f4fa216 100644
index 569fbb2f6c5f1ec286ecafe5c7f1b1fe6b547908..8f249587b873c5768bb5ebf13d5f378355e17556 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2696,6 +2696,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
+ // Paper start
+ // Paper start - Fix merchant inventory not closing on entity removal
+ if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
+ merchant.getTrader().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED);
+ }
+ // Paper end
+ // Paper end - Fix merchant inventory not closing on entity removal
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
}

Datei anzeigen

@ -11,7 +11,7 @@ encountering a command node with ASK_SERVER suggestions, however a
modified client can send this packet whenever it wants.
diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java
index 858e41fba7dc285dd21a93f3918cc5de3887df5f..43018b34308eb12791616724e40c006b2141835c 100644
index 858e41fba7dc285dd21a93f3918cc5de3887df5f..92848b64a78fce7a92e1657c2da6fc5ee53eea44 100644
--- a/src/main/java/com/mojang/brigadier/CommandDispatcher.java
+++ b/src/main/java/com/mojang/brigadier/CommandDispatcher.java
@@ -538,10 +538,14 @@ public class CommandDispatcher<S> {
@ -26,7 +26,7 @@ index 858e41fba7dc285dd21a93f3918cc5de3887df5f..43018b34308eb12791616724e40c006b
} catch (final CommandSyntaxException ignored) {
}
+ }
+ // Paper end
+ // Paper end - Don't suggest if the requirement isn't met
futures[i++] = future;
}

Datei anzeigen

@ -24,7 +24,7 @@ and an action can be defined: DROP or KICK
If interval or rate are less-than 0, the limit is ignored
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 8b7e50c0bce9ff201e92fc6fff8934ea17f1b293..2ae08b21c63490bbf8cd870f9585d82ed131f815 100644
index 5e0793a1bfeaca021206b0b7cce20598ba6ed1d2..c0306ca996bb32b6a478c8d7158757af722a27ab 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -132,6 +132,22 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Ensure valid vehicle status
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 87fdc78409fb16c961c04a5551980a8a231b70d0..60164d8ff63bf536ddf46605a9dc7931ebc5b82a 100644
index 87fdc78409fb16c961c04a5551980a8a231b70d0..f99498d6864bc48683f8156e0365f1175edce0ba 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -576,7 +576,7 @@ public class ServerPlayer extends Player {
@ -13,7 +13,7 @@ index 87fdc78409fb16c961c04a5551980a8a231b70d0..60164d8ff63bf536ddf46605a9dc7931
}
- if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger()) {
+ if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger() && !entity.isRemoved()) { // Paper
+ if (persistVehicle && entity1 != null && entity != this && entity.hasExactlyOnePlayerPassenger() && !entity.isRemoved()) { // Paper - Ensure valid vehicle status
// CraftBukkit end
CompoundTag nbttagcompound2 = new CompoundTag();
CompoundTag nbttagcompound3 = new CompoundTag();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent softlocked end exit portal generation
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index c29ccc66c95faba425acb0ca06af15e2783b4bae..44f799d595d7150f00dfdfa2f85c87386f896607 100644
index c29ccc66c95faba425acb0ca06af15e2783b4bae..02acd171f1d3d783b7cab56c69feca5325878fa8 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -466,6 +466,11 @@ public class EndDragonFight {
@ -16,7 +16,7 @@ index c29ccc66c95faba425acb0ca06af15e2783b4bae..44f799d595d7150f00dfdfa2f85c8738
+ if (this.portalLocation.getY() <= this.level.getMinBuildHeight()) {
+ this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
+ }
+ // Paper end
+ // Paper end - Prevent "softlocked" exit portal generation
if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation)) {
int i = Mth.positiveCeilDiv(4, 16);

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Fix CocaoDecorator causing a crash when trying to generate
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..0fc355bd847749f7ce716b283dd571f143824795 100644
index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..f0085174a8f6e05f30c583b1211a7be43128e540 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
@@ -25,6 +25,7 @@ public class CocoaDecorator extends TreeDecorator {
@Override
public void place(TreeDecorator.Context generator) {
+ if (generator.logs().isEmpty()) return; // Paper
+ if (generator.logs().isEmpty()) return; // Paper - Fix crash when trying to generate without logs
RandomSource randomSource = generator.random();
if (!(randomSource.nextFloat() >= this.probability)) {
List<BlockPos> list = generator.logs();

Datei anzeigen

@ -5,19 +5,19 @@ Subject: [PATCH] fix various menus with empty level accesses
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
index c96b04f045dda384cdee9254a1765ef97e5f7f03..f00a957a0f55e69f93e6d7dc80193304447c3dcb 100644
index c96b04f045dda384cdee9254a1765ef97e5f7f03..85e336637db8643fc5aca1dba724c9b341cbf46f 100644
--- a/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
+++ b/src/main/java/net/minecraft/world/inventory/ContainerLevelAccess.java
@@ -27,6 +27,12 @@ public interface ContainerLevelAccess {
public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> getter) {
return Optional.empty();
}
+ // Paper start
+ // Paper start - fix menus with empty level accesses
+ @Override
+ public org.bukkit.Location getLocation() {
+ return null;
+ }
+ // Paper end
+ // Paper end - fix menus with empty level accesses
};
static ContainerLevelAccess create(final Level world, final BlockPos pos) {

Datei anzeigen

@ -8,7 +8,7 @@ This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0710061e41d6d6e5b38e62212bbd04e9ada0ec68..b01f722e9d52254e68634dbdf0749fa0fcc81da8 100644
index a65a0ae8f7e9c2c5fe48d141dba6d95c2e94f426..0591b20138bf8b36aa7d78fc0c672ab55abf4f24 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1918,6 +1918,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -5,14 +5,14 @@ Subject: [PATCH] prevent unintended light block manipulation
diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java
index a0fadee4be7c263ceaf1f4a987169b0f50308072..5e36baecd1e9fa02e00c250dd7ebe41e89fffeb7 100644
index a0fadee4be7c263ceaf1f4a987169b0f50308072..a847b79da488c9d6059c9da941a50de8b1bfc24f 100644
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
@@ -54,6 +54,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (!world.isClientSide && player.canUseGameMasterBlocks()) {
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper
+ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper - Prevent unintended light block manipulation
world.setBlock(pos, state.cycle(LEVEL), 2);
return InteractionResult.SUCCESS;
} else {

Datei anzeigen

@ -19,7 +19,7 @@ index 1080e1f67afe5574baca0df50cdb1d029a7a586a..a2f71a6d1a9e98133dff6cd0f625da94
}
final Object val = config.get(key);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 0a21632a3e02690a8edcc17ac25d2551a8964bbe..996a49e1ccf827edf28ca92e947014517b7dad6e 100644
index 0a21632a3e02690a8edcc17ac25d2551a8964bbe..10b4458f3081dea06c1ff39d4134ab8e99adcc99 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -431,7 +431,14 @@ public abstract class ChunkGenerator {
@ -27,14 +27,14 @@ index 0a21632a3e02690a8edcc17ac25d2551a8964bbe..996a49e1ccf827edf28ca92e94701451
};
- seededrandom.setFeatureSeed(i, l1, l);
+ // Paper start - change populationSeed used in random
+ // Paper start - Configurable feature seeds; change populationSeed used in random
+ long featurePopulationSeed = i;
+ final long configFeatureSeed = generatoraccessseed.getMinecraftWorld().paperConfig().featureSeeds.features.getLong(placedfeature.feature());
+ if (configFeatureSeed != -1) {
+ featurePopulationSeed = seededrandom.setDecorationSeed(configFeatureSeed, blockposition.getX(), blockposition.getZ()); // See seededrandom.setDecorationSeed from above
+ }
+ seededrandom.setFeatureSeed(featurePopulationSeed, l1, l);
+ // Paper end
+ // Paper end - Configurable feature seeds
try {
generatoraccessseed.setCurrentlyGenerating(supplier1);

Datei anzeigen

@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index f0d6e6f85dc2a9ae8d70dd691b144fac0298bf33..e69a0121c8644d831cbb8bc1c95d9219d1c343da 100644
index f0d6e6f85dc2a9ae8d70dd691b144fac0298bf33..63bfc209c7d77170ae7b60595d800bb19f1b5da6 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -179,6 +179,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -72,7 +72,7 @@ index f0d6e6f85dc2a9ae8d70dd691b144fac0298bf33..e69a0121c8644d831cbb8bc1c95d9219
+ DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
+ DedicatedServer.LOGGER.warn("****************************");
+ }
+ // Paper end
+ // Paper end - detect running as root
+
DedicatedServer.LOGGER.info("Loading properties");
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b01f722e9d52254e68634dbdf0749fa0fcc81da8..9e617eb10380525f1aa7aa9cd7096aa133fe5920 100644
index 0591b20138bf8b36aa7d78fc0c672ab55abf4f24..d2b2ab7415999b76d8cb0747f5b4235b5b4e07f6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -794,7 +794,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -5,17 +5,17 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1f3363da6642673d286cb7704aa61cb910c5d23f..ffc999a3a398bc73fffa7a68805baa1da7504750 100644
index 1f3363da6642673d286cb7704aa61cb910c5d23f..f76c6360408a4d804143770d71eaf9c2146bcfa6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2677,13 +2677,26 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.hasEffect(MobEffects.JUMP) ? 0.1F * ((float) this.getEffect(MobEffects.JUMP).getAmplifier() + 1.0F) : 0.0F;
}
+ protected long lastJumpTime = 0L; // Paper
+ protected long lastJumpTime = 0L; // Paper - Prevent excessive velocity through repeated crits
protected void jumpFromGround() {
Vec3 vec3d = this.getDeltaMovement();
+ // Paper start
+ // Paper start - Prevent excessive velocity through repeated crits
+ long time = System.nanoTime();
+ boolean canCrit = true;
+ if (this instanceof net.minecraft.world.entity.player.Player) {
@ -25,13 +25,13 @@ index 1f3363da6642673d286cb7704aa61cb910c5d23f..ffc999a3a398bc73fffa7a68805baa1d
+ canCrit = true;
+ }
+ }
+ // Paper end
+ // Paper end - Prevent excessive velocity through repeated crits
this.setDeltaMovement(vec3d.x, (double) this.getJumpPower(), vec3d.z);
if (this.isSprinting()) {
float f = this.getYRot() * 0.017453292F;
+ if (canCrit) // Paper
+ if (canCrit) // Paper - Prevent excessive velocity through repeated crits
this.setDeltaMovement(this.getDeltaMovement().add((double) (-Mth.sin(f) * 0.2F), 0.0D, (double) (Mth.cos(f) * 0.2F)));
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 7be16ce8c8582d8587c4d1cb4c099fa6fe5f1324..646afa849148cdd5bc9812a1ebd9cb5d15c39311 100644
index 3b73151b594e6f3882afa2a223d0d7ca5a0b47b3..736c7aed99928af654a8ee30602f705de18a8df6 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -955,17 +955,7 @@ public class Util {
@@ -952,17 +952,7 @@ public class Util {
}
public void openUrl(URL url) {

Datei anzeigen

@ -34,7 +34,7 @@ index e0802f1cb73a80b08482832c2b269ac8485d5c1a..945a0317e9e49a159a1f42882a0a267a
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ffc999a3a398bc73fffa7a68805baa1da7504750..d1210e8cd501f0f3be92189d129f1d354ddb00cb 100644
index f76c6360408a4d804143770d71eaf9c2146bcfa6..b63c4510cb6a14d754776967ccc7020d85fc2abd 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3188,7 +3188,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -33,7 +33,7 @@ index 648530ce3183362ed71cbd2de534471da65ab787..bfbbb0f6e73e9d59e73944b77e088021
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d1210e8cd501f0f3be92189d129f1d354ddb00cb..1a16dc3ac00c2756f1ea7154c38345393f3d5a96 100644
index b63c4510cb6a14d754776967ccc7020d85fc2abd..95c9b69934fb1d8b49caf9e5c6184435bd18b66d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3190,7 +3190,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8f61efe32500ebe47e13d96fd96df646adb3dd5b..9f9492f0f5bc9c39f4c0021956e3240a466f3085 100644
index 65809db4522c3b1ce0b5bf11828de129713d7d21..4195bdfef0916f18cd448ba2c47e44f4c3996943 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2459,6 +2459,88 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -2179,7 +2179,7 @@ index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d3
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 60164d8ff63bf536ddf46605a9dc7931ebc5b82a..7c8f5ae6bd83bd08403738dcd364b0af06fb1a9b 100644
index f99498d6864bc48683f8156e0365f1175edce0ba..f62f3a904ca09b7a5edf40b739a70c00de927429 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -469,7 +469,7 @@ public class ServerPlayer extends Player {
@ -2214,7 +2214,7 @@ index f7588787769902506e317bdb052483c5dc377693..8f0d1e9e8a191a2049f3ad2d9b4ffdbd
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9e617eb10380525f1aa7aa9cd7096aa133fe5920..519e3f0e376198fb399819f4587ccf935b93ea1a 100644
index d2b2ab7415999b76d8cb0747f5b4235b5b4e07f6..7d70af32d67c5201e278424f7025eb8db5653d8e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1217,9 +1217,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -2600,7 +2600,7 @@ index a25497eec004add7408a63b1a0f09e3fa443b324..9f892de55ab03367daed4c30cc44c9dd
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 94a4ceeea167164fb589518881952dd5e082f8c2..2287987d5bb0e6c4cb6153f04c420fe5ec7c8089 100644
index 0d685f1f446061cc723d190b16eedcb2ddedfa46..b8188a5d0ac9be4d4ca52bd4faaf5a677029f1dc 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -300,6 +300,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {

Datei anzeigen

@ -8,7 +8,7 @@ Move collision logic to just the hasNewCollision call instead of getCubes + hasN
CHECK ME
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1e519cdd673a4d4beb53ae84822e7b85c25a5e97..554b0cd2f61005b57e1b0f68730354a8753fb0b7 100644
index bfbbb0f6e73e9d59e73944b77e08802132f2a739..027bc0d89b7ade602565ed3717e87c56de7265e1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -543,7 +543,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl

Datei anzeigen

@ -8,7 +8,7 @@ This ensures at least a valid version of the chunk exists
on disk, even if outdated
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 98c8b676fc5b2add44d6ddf5d32f85bc07ea22cb..83966430240d375e7618e13c75676d510a222c37 100644
index 2c951dfb17a11bd81c19080a1f8f498f8e534cff..b0fa77d298ad1476fdc2433b0308276068e53a71 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -1003,6 +1003,9 @@ public class RegionFile implements AutoCloseable {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 519e3f0e376198fb399819f4587ccf935b93ea1a..449601d6a8e89ae4f225407d7e00efedbe6eb6c9 100644
index 7d70af32d67c5201e278424f7025eb8db5653d8e..0d9d46b97314bd9a95d5d4f35bf196abfd11c200 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3531,6 +3531,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

Datei anzeigen

@ -35,7 +35,7 @@ index 79732086bc4cdbca8364d78eb60d68c758055966..e65d7980b7ebed60786bc31e2f8156fd
+ // Paper end - tell clients to ask server for suggestions for EntityArguments
}
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index bc0f9bf88de8f79f8e2aa2261d5a8bdc9dd1f53a..c2bd7eea15437f3526da37ce1c8642084a26406b 100644
index 9a01905bdbf0b721a129984d71c5745fa5e3c8a5..4ef2f90809b946dcdb52a4ab58cd1c15b682f790 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -532,6 +532,7 @@ public class Commands {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Validate usernames
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 7a2f78ae76354e15afa5368c8fb2a571c15dc82d..6121a3879eeb1d13653e93da02ecdbbcb2a866ac 100644
index 67c1cf5eb198079bd146a4a8ca0492b94cca788c..c03329267a2a97af32a0c2c9d7e94fa00596e1cf 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -63,6 +63,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -39,7 +39,7 @@ index 8f0d1e9e8a191a2049f3ad2d9b4ffdbd15c45d9f..1038bdb761c4b413cb92e08aa7ef634b
}
}
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 bce494bb7bc1ce20809ac7d355f04aa7aad78308..6ab0c3116a4238a4c5369cc33452fed594149ea4 100644
index 6018717ea7ff9d3947e48aacd3dbedc075a8376e..548343be02a627d2c2475a4452363876a126b3a8 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2340,9 +2340,23 @@ public abstract class Player extends LivingEntity {

Datei anzeigen

@ -18,7 +18,7 @@ index 6873036e7d24a2b8e85ab7ae270eec63bd7e7b5b..70adb35d0f267666e44c61ac0578a12f
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9f9492f0f5bc9c39f4c0021956e3240a466f3085..6e1ebb33413018d0cd2275eb76a7bdfbf8542da1 100644
index 4195bdfef0916f18cd448ba2c47e44f4c3996943..fe0a12e0f8a5318f7a8d2d336da62aa9f7710832 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1258,7 +1258,7 @@ public final class CraftServer implements Server {
@ -31,7 +31,7 @@ index 9f9492f0f5bc9c39f4c0021956e3240a466f3085..6e1ebb33413018d0cd2275eb76a7bdfb
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 24156bd9d964e2c32bc758dd9e099744cf8ac647..999602a6c11257b05083bcc2d36b6e30b2b129f4 100644
index 3eeb878924827861f79c6bc1b510d0167b9ac10b..d17454114ced443b576ca0fa608a4846364efbe5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -205,6 +205,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Freeze Tick Lock API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4ffd551e6ea540cff14eaba0e95ed2c7c0bca513..2f0c5e1b4b2dfb8006447c296170e80a97b36562 100644
index 0d9d46b97314bd9a95d5d4f35bf196abfd11c200..b9e1f7d74f7ba8d4375077a39738bde6eb98e7ab 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -409,6 +409,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -46,7 +46,7 @@ index 4ffd551e6ea540cff14eaba0e95ed2c7c0bca513..2f0c5e1b4b2dfb8006447c296170e80a
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cf91a4b9d2aab2ed32d7d53e5d3bd97838b7a8a4..e27b19cf56b269c426cb6ddf81513497b70c676f 100644
index 95c9b69934fb1d8b49caf9e5c6184435bd18b66d..861f0d81501f63fdfa25f5f6f9da4701957fc7d8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3452,7 +3452,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6e1ebb33413018d0cd2275eb76a7bdfbf8542da1..d53abb73ab61151a14baef8ce5cdf40ff8709238 100644
index fe0a12e0f8a5318f7a8d2d336da62aa9f7710832..9f4d929e0e248cc2cc02ccb0c8915aeb6d9c03b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2110,6 +2110,13 @@ public final class CraftServer implements Server {
@ -153,7 +153,7 @@ index 7f22950ae61436e91a59cd29a345809c42bbe739..1e3091687735b461d3b6a313ab876112
protected ServerCommandSender() {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index f4961a0f360a39124544cbe0adbd94eeeef32ab5..11d7471faf35339b290b5b90c7db595e4813deb7 100644
index bda9a0b99184adce28bb7851612ed7f4e324826d..61115db85b81e627d11a0de21691a2ca69aafe2c 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -81,6 +81,11 @@ public final class VanillaCommandWrapper extends BukkitCommand {

Datei anzeigen

@ -20,7 +20,7 @@ seeds/salts to the frequency reducer which has a similar effect.
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 996a49e1ccf827edf28ca92e947014517b7dad6e..65db282b32dfec041579812f9b7275d8c0b99a0d 100644
index 10b4458f3081dea06c1ff39d4134ab8e99adcc99..6b743d4c7b304c21e2e89300e69df8eff672e8a6 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -568,7 +568,7 @@ public abstract class ChunkGenerator {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 999602a6c11257b05083bcc2d36b6e30b2b129f4..cf43f2e7bfc465c1c804daa5d86a6ce1808d8041 100644
index d17454114ced443b576ca0fa608a4846364efbe5..0f5b125a307769c6430dbb9f3289efd66c2c8601 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -144,6 +144,7 @@ import org.jetbrains.annotations.NotNull;

Datei anzeigen

@ -6,13 +6,13 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit
Copies appropriate checks from CraftWorld#getSpawnLimit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d53abb73ab61151a14baef8ce5cdf40ff8709238..bafdb900286c9015840aa74e8a84493bdaf8eaa2 100644
index 9f4d929e0e248cc2cc02ccb0c8915aeb6d9c03b5..630048f21d794cd2f5c10e7b1a7fca30a14e6856 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2287,6 +2287,8 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {
// Paper start
// Paper start - Add mobcaps commands
+ Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
+ Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " does not have a spawn limit.");
return this.getSpawnLimitUnsafe(spawnCategory);

Datei anzeigen

@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4f
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bafdb900286c9015840aa74e8a84493bdaf8eaa2..d96450c5b83bf785cdb24ca1c2653e642be9302d 100644
index 630048f21d794cd2f5c10e7b1a7fca30a14e6856..1278e02a723aac491af24b42c6268164b5f16ddb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2708,6 +2708,15 @@ public final class CraftServer implements Server {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen