13
0
geforkt von Mirrors/Paper

More patchy patched patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-12-07 22:05:01 +01:00
Ursprung d0620624d7
Commit 5b6d903302
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
57 geänderte Dateien mit 288 neuen und 313 gelöschten Zeilen

Datei anzeigen

@ -73,7 +73,7 @@ index 298e4468f7b5346733257f7117f76c66e9a1d8f0..d1652c237b2b272f0dfe80f774cff160
public void close() throws IOException { public void close() throws IOException {
// CraftBukkit start // CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3fff95ffe0e343f873dda31507567cbd8fa2460e..772512a77f67ef83b99241de930c07a0b8c96c8a 100644 index 3fff95ffe0e343f873dda31507567cbd8fa2460e..750f41e03f54b0dbac85c2a46edae2cc1505d12c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1144,6 +1144,37 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1144,6 +1144,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -104,7 +104,7 @@ index 3fff95ffe0e343f873dda31507567cbd8fa2460e..772512a77f67ef83b99241de930c07a0
+ +
+ this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings()); + this.serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
+ this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save()); + this.serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
+ this.convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData()); + this.convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ } + }

Datei anzeigen

@ -265,10 +265,10 @@ index 0000000000000000000000000000000000000000..2e02d94e2903c48f6d08e743c1cf8bad
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index b031dece541d2765f9488a5ffcb0d339c38ccc9e..21941af701eab308f87ca64b2801c55444814acb 100644 index bf3fb416d36a19958033cdbf5cc313556fa0201b..0a49769bfa83d0b9c435e3ab4bba85979d660ff8 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -191,6 +191,16 @@ public final class NaturalSpawner { @@ -192,6 +192,16 @@ public final class NaturalSpawner {
world.getProfiler().pop(); world.getProfiler().pop();
} }
@ -286,10 +286,10 @@ index b031dece541d2765f9488a5ffcb0d339c38ccc9e..21941af701eab308f87ca64b2801c554
// Paper start - add parameters and int ret type // Paper start - add parameters and int ret type
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null); 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3ebf81b45cf1897471a3262d23cc59dd45652b6d..c648acdd0066f6c480d08927a3c72524cde32ec7 100644 index 1b4143092f709541469c037325d826f25d9e675f..3af2e5d3bdbf82c142f5ea2629456329bda7666f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2156,6 +2156,11 @@ public final class CraftServer implements Server { @@ -2180,6 +2180,11 @@ public final class CraftServer implements Server {
@Override @Override
public int getSpawnLimit(SpawnCategory spawnCategory) { public int getSpawnLimit(SpawnCategory spawnCategory) {
@ -302,10 +302,10 @@ index 3ebf81b45cf1897471a3262d23cc59dd45652b6d..c648acdd0066f6c480d08927a3c72524
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ef1b84c52722e33f1f3d346df60c11d5bb805a0b..80abef83b4b2533fdc50773d4d76c3c6af662df1 100644 index 30561840201f3e560753d91f82a646bad20f1a93..7a3aaeb5191f03b8288dde7567bed686150e70a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1701,9 +1701,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1700,9 +1700,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Validate.notNull(spawnCategory, "SpawnCategory cannot be null"); Validate.notNull(spawnCategory, "SpawnCategory cannot be null");
Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported."); Validate.isTrue(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory." + spawnCategory + " are not supported.");

Datei anzeigen

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Thu, 26 Aug 2021 12:09:47 +0200
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 bad95669727f0968f4a7d6e498ff6dfaab49a56e..6d8ce6885f879eb2bffbe45374ba87fb4c72dd42 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -200,7 +200,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
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
} else {
return namespace;
}
@@ -221,7 +221,7 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
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
} else {
return path;
}

Datei anzeigen

@ -837,17 +837,17 @@ index 0000000000000000000000000000000000000000..05640f5f70e81833530e8098d30c400f
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
index 4f75f2be7070d49c2c60866ad7146da19ab61652..43243537b765a2d270be6de3f053fea77ff67d18 100644 index 9fd6cf0c98cbf6300ef23d4aab32a6110aeba665..d4c91e0a0c64fcb7f1145de3f30134cb1f1f8ee6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -87,7 +87,11 @@ public class AcquirePoi extends Behavior<PathfinderMob> { @@ -62,7 +62,11 @@ public class AcquirePoi {
return true; return true;
} }
}; };
- Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(this.poiType, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet()); - Set<Pair<Holder<PoiType>, BlockPos>> set = poiManager.findAllClosestFirstWithType(poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet());
+ // Paper start - optimise POI access + // Paper start - optimise POI access
+ java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>(); + java.util.List<Pair<Holder<PoiType>, BlockPos>> poiposes = new java.util.ArrayList<>();
+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, this.poiType, predicate, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); + io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
+ Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes); + Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
+ // Paper end - optimise POI access + // Paper end - optimise POI access
Path path = findPathToPois(entity, set); Path path = findPathToPois(entity, set);
@ -875,7 +875,7 @@ index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c3585
BlockPos blockPos = path.getTarget(); BlockPos blockPos = path.getTarget();
Optional<Holder<PoiType>> optional = poiManager.getType(blockPos); Optional<Holder<PoiType>> optional = poiManager.getType(blockPos);
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 6d9ccb87265bcb5c2aecf2e5a0a043ac3c4cbefd..291af79b754ba1a78556f5c8b7b004268761a768 100644 index 440e4f35e38d38e5407a6fecf09ab9511a44a670..8950b220b9a3512cd4667beb7bdec0e82e07edc6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -127,43 +127,62 @@ public class PoiManager extends SectionStorage<PoiSection> { @@ -127,43 +127,62 @@ public class PoiManager extends SectionStorage<PoiSection> {
@ -961,7 +961,7 @@ index 6d9ccb87265bcb5c2aecf2e5a0a043ac3c4cbefd..291af79b754ba1a78556f5c8b7b00426
public boolean release(BlockPos pos) { public boolean release(BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
index e921e3cce8c746e28d73e1a7e67a7efe656ec09f..8241320f5f01d0b093024ca27f6d8bdbac487ab3 100644 index 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe34018b8df74 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
@@ -26,7 +26,7 @@ import org.slf4j.Logger; @@ -26,7 +26,7 @@ import org.slf4j.Logger;
@ -992,7 +992,7 @@ index c396076bfb1d41cc0f8248d6f3aa4fc3f7d1c998..d783072bc964e45c308197e6f79874eb
return Optional.empty(); return Optional.empty();
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
index 1369d4f818d203e3092fd6ba4def106dda16d6d2..b7cb9fbb15c83cd4225a241e44132279d9308f96 100644 index faaf50cb9bce254aef554ed8b402b145532e12a4..92d13c9f1ec1e5ff72c1d68f924a8d1c86c91565 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -51,18 +51,39 @@ public class PortalForcer { @@ -51,18 +51,39 @@ public class PortalForcer {

Datei anzeigen

@ -72,10 +72,10 @@ index a61f55ed1fbe5aac5289014cb95cb6950b4c77fa..e11ec87e8007979a1c6932b414bcd70c
int i = 0; int i = 0;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf48973472 100644 index 993d04766c81990e72166f1348a01d8ef7e05d0f..109baae0c68b28720508af4a9e0b32b72b3dcb23 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -110,6 +110,8 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator; @@ -113,6 +113,8 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// CraftBukkit end // CraftBukkit end
@ -84,7 +84,7 @@ index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
private static final byte CHUNK_TYPE_REPLACEABLE = -1; private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -147,6 +149,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -151,6 +153,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Queue<Runnable> unloadQueue; private final Queue<Runnable> unloadQueue;
int viewDistance; int viewDistance;
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobDistanceMap; // Paper
@ -93,10 +93,10 @@ index f337b380c443016fc593dc768e32b751b7c7aa96..f2a8a1a47080cd3c62ece108d34f05cf
// Paper - rewrite chunk system // Paper - rewrite chunk system
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832ce974505 100644 index d1652c237b2b272f0dfe80f774cff16056f39046..b768767b92bf7691a6e57627c69818a1f5fd82c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -47,6 +47,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp @@ -48,6 +48,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelData;
import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelStorageSource;
@ -104,7 +104,7 @@ index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832
public class ServerChunkCache extends ChunkSource { public class ServerChunkCache extends ChunkSource {
@@ -723,42 +724,59 @@ public class ServerChunkCache extends ChunkSource { @@ -724,42 +725,59 @@ public class ServerChunkCache extends ChunkSource {
this.lastSpawnState = spawnercreature_d; this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("filteringLoadedChunks"); gameprofilerfiller.popPush("filteringLoadedChunks");
@ -181,7 +181,7 @@ index 998c333c0b7064e9077c2b30d6b36623ffc419c7..ef9ae57072e1b558c1a4a81b71196832
this.level.timings.chunkTicks.stopTiming(); // Paper this.level.timings.chunkTicks.stopTiming(); // Paper
gameprofilerfiller.popPush("customSpawners"); gameprofilerfiller.popPush("customSpawners");
if (flag2) { if (flag2) {
@@ -766,15 +784,24 @@ public class ServerChunkCache extends ChunkSource { @@ -767,15 +785,24 @@ public class ServerChunkCache extends ChunkSource {
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
} // Paper - timings } // Paper - timings
} }

Datei anzeigen

@ -19,10 +19,10 @@ index 23e564b05ba438924180c91f9b19a60731eedd1b..5ec241d49ff5e3a161a39006f05823a5
private MinecraftTimings() {} private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1203076f688a16af17b7e55d913c9248e3f0fec7..ee6dc7d149f96c9a63e627e765b8d3a0107af864 100644 index 213033a59be4239f1225286764be83dcc6fbf973..0868805c78d991c602d8f1d1b5aeb5c790c13384 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1298,6 +1298,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1305,6 +1305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean pollTaskInternal() { private boolean pollTaskInternal() {
if (super.pollTask()) { if (super.pollTask()) {
@ -30,7 +30,7 @@ index 1203076f688a16af17b7e55d913c9248e3f0fec7..ee6dc7d149f96c9a63e627e765b8d3a0
return true; return true;
} else { } else {
if (this.haveTime()) { if (this.haveTime()) {
@@ -2669,4 +2670,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2686,4 +2687,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
// Paper end // Paper end
@ -106,10 +106,10 @@ index 1203076f688a16af17b7e55d913c9248e3f0fec7..ee6dc7d149f96c9a63e627e765b8d3a0
+ // Paper end - execute chunk tasks mid tick + // Paper end - execute chunk tasks mid tick
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index ef9ae57072e1b558c1a4a81b71196832ce974505..2aba72cd7a87b8b999cfbc7a2e7a58ea95717c19 100644 index b768767b92bf7691a6e57627c69818a1f5fd82c8..ebd0da4f87c74f12d702e1ae4f3206885272e4f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -748,6 +748,7 @@ public class ServerChunkCache extends ChunkSource { @@ -749,6 +749,7 @@ public class ServerChunkCache extends ChunkSource {
iterator1 = shuffled.iterator(); iterator1 = shuffled.iterator();
} }
@ -117,7 +117,7 @@ index ef9ae57072e1b558c1a4a81b71196832ce974505..2aba72cd7a87b8b999cfbc7a2e7a58ea
try { try {
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
LevelChunk chunk1 = iterator1.next(); LevelChunk chunk1 = iterator1.next();
@@ -765,6 +766,7 @@ public class ServerChunkCache extends ChunkSource { @@ -766,6 +767,7 @@ public class ServerChunkCache extends ChunkSource {
if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - the chunk is known ticking
this.level.tickChunk(chunk1, k); this.level.tickChunk(chunk1, k);
@ -126,10 +126,10 @@ index ef9ae57072e1b558c1a4a81b71196832ce974505..2aba72cd7a87b8b999cfbc7a2e7a58ea
} }
// Paper start - optimise chunk tick iteration // Paper start - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c5867232ed6f630d76dad9d111022b37ca781b94..205a9dc093b6c79cbd91a82f705d087719ad8681 100644 index 528a946af676167b0a3affc7d17b8e5219446988..390fdb2cf33901814c475b2e7da7dc1a79beda29 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -212,6 +212,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -215,6 +215,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final StructureManager structureManager; private final StructureManager structureManager;
private final StructureCheck structureCheck; private final StructureCheck structureCheck;
private final boolean tickTime; private final boolean tickTime;
@ -137,7 +137,7 @@ index c5867232ed6f630d76dad9d111022b37ca781b94..205a9dc093b6c79cbd91a82f705d0877
// CraftBukkit start // CraftBukkit start
public final LevelStorageSource.LevelStorageAccess convertable; public final LevelStorageSource.LevelStorageAccess convertable;
@@ -1027,6 +1028,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1048,6 +1049,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (fluid1.is(fluid)) { if (fluid1.is(fluid)) {
fluid1.tick(this, pos); fluid1.tick(this, pos);
} }
@ -145,7 +145,7 @@ index c5867232ed6f630d76dad9d111022b37ca781b94..205a9dc093b6c79cbd91a82f705d0877
} }
@@ -1036,6 +1038,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1057,6 +1059,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (iblockdata.is(block)) { if (iblockdata.is(block)) {
iblockdata.tick(this, pos, this.random); iblockdata.tick(this, pos, this.random);
} }
@ -154,10 +154,10 @@ index c5867232ed6f630d76dad9d111022b37ca781b94..205a9dc093b6c79cbd91a82f705d0877
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e2e705d9d48adf61bb10f0ef60e2717ea660e24a..70b6479ef8aeb51135b31add61e4fdab0c495233 100644 index 8a73f999c18bd3f8880af831f7d4bc3c97241627..10f4cbf82cc4a79aacfd1f8e1e53a6c1f4963865 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -804,6 +804,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -825,6 +825,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end // Spigot end
} else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) { } else if (this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick(); tickingblockentity.tick();
@ -169,7 +169,7 @@ index e2e705d9d48adf61bb10f0ef60e2717ea660e24a..70b6479ef8aeb51135b31add61e4fdab
} }
} }
this.blockEntityTickers.removeAll(toRemove); this.blockEntityTickers.removeAll(toRemove);
@@ -818,6 +823,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -839,6 +844,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) { public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
try { try {
tickConsumer.accept(entity); tickConsumer.accept(entity);

Datei anzeigen

@ -10,10 +10,10 @@ hoping that at least then we don't swap chunks, and maybe recover
them all. 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 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 4236cf65b893bc21d2597010a2f9745fc0e107a4..6e39c2c1556f41140b92064a6fa3a38427504aee 100644 index f8edcc9697289c2cf43c9021d5518955d0d701e7..313a3319c630a4f26f9c53255a0ac67f3c15e410 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -68,6 +68,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks; @@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
import org.slf4j.Logger; import org.slf4j.Logger;
public class ChunkSerializer { public class ChunkSerializer {
@ -32,7 +32,7 @@ index 4236cf65b893bc21d2597010a2f9745fc0e107a4..6e39c2c1556f41140b92064a6fa3a384
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 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(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -480,7 +492,7 @@ public class ChunkSerializer { @@ -486,7 +498,7 @@ public class ChunkSerializer {
nbttagcompound.putInt("xPos", chunkcoordintpair.x); nbttagcompound.putInt("xPos", chunkcoordintpair.x);
nbttagcompound.putInt("yPos", chunk.getMinSection()); nbttagcompound.putInt("yPos", chunk.getMinSection());
nbttagcompound.putInt("zPos", chunkcoordintpair.z); nbttagcompound.putInt("zPos", chunkcoordintpair.z);
@ -685,7 +685,7 @@ index cda87a66fe80bf910f629c64e36c1fecbad81d77..9bae47f99336c377beb72c4b50b7f01c
return bytebuffer; return bytebuffer;
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index c881d15efa94fc379ed2817a534fef3a4dd3d90d..e71a451a6b385716cc46db7350b58b4192304547 100644 index 65fd57609e45ccd49ebfc1ba80d25243da13ab6e..d5b501bcb33a785ef0301bf6bb8d396b9d4fbb6a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -26,7 +26,15 @@ public class RegionFileStorage implements AutoCloseable { @@ -26,7 +26,15 @@ public class RegionFileStorage implements AutoCloseable {
@ -705,12 +705,12 @@ index c881d15efa94fc379ed2817a534fef3a4dd3d90d..e71a451a6b385716cc46db7350b58b41
this.sync = dsync; this.sync = dsync;
} }
@@ -88,9 +96,9 @@ public class RegionFileStorage implements AutoCloseable { @@ -88,9 +96,9 @@ public class RegionFileStorage implements AutoCloseable {
Files.createDirectories(this.folder); FileUtil.createDirectoriesSafe(this.folder);
Path path = this.folder; Path path = this.folder;
int j = chunkcoordintpair.getRegionX(); int j = chunkcoordintpair.getRegionX();
- Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); - Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca");
+ Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change + Path path1 = path.resolve("r." + j + "." + chunkcoordintpair.getRegionZ() + ".mca"); // Paper - diff on change
if (existingOnly && !Files.exists(path1)) return null; // CraftBukkit if (existingOnly && !java.nio.file.Files.exists(path1)) return null; // CraftBukkit
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync); - RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
+ RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header + RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header

Datei anzeigen

@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
index ab712fd29b316e1235645bacaa79aa0a64d0bc00..340d0648fcf9b9749c4daa1c25a226b947707c3d 100644 index b617f7e7a27284fbbad06d7a9926b938ba87cf18..170f5cb3f01a57ad76e3bbeacd5b7c7e52f29959 100644
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
@@ -39,11 +39,13 @@ public abstract class StateHolder<O, S> { @@ -39,11 +39,13 @@ public abstract class StateHolder<O, S> {
@ -235,8 +235,8 @@ index ab712fd29b316e1235645bacaa79aa0a64d0bc00..340d0648fcf9b9749c4daa1c25a226b9
+ // Paper end - optimise state lookup + // Paper end - optimise state lookup
} }
public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) { public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
@@ -133,7 +129,7 @@ public abstract class StateHolder<O, S> { @@ -147,7 +143,7 @@ public abstract class StateHolder<O, S> {
} }
} }

Datei anzeigen

@ -78,10 +78,10 @@ index acfa1907bfc9c29d261cfccc00d65bad9ad1a002..d6f3869f5725c7f081efb7f486f74dbb
}); });
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc1b565e5d 100644 index 390fdb2cf33901814c475b2e7da7dc1a79beda29..3ba995c8d21427a3dbbde22c8faa0a7888507880 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1042,7 +1042,26 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1063,7 +1063,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
@ -108,7 +108,7 @@ index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@@ -1082,7 +1101,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1103,7 +1122,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
// } finally { timer.stopTiming(); } // Paper - timings - move up // } finally { timer.stopTiming(); } // Paper - timings - move up
@ -124,7 +124,7 @@ index 205a9dc093b6c79cbd91a82f705d087719ad8681..eaaf69434b152fbfa099bf0cfa3190bc
private void tickPassenger(Entity vehicle, Entity passenger) { 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03332464b1 100644 index 15d9159bb67619a40edc4be5556615dcd9a211a0..a4d4e5cb3bd7a4816671b058c640ccc90dec8f54 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -971,7 +971,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -971,7 +971,42 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -184,7 +184,7 @@ index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03
} }
protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) {
@@ -3972,7 +4014,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -4018,7 +4060,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
public void setDeltaMovement(Vec3 velocity) { public void setDeltaMovement(Vec3 velocity) {
@ -193,8 +193,8 @@ index dcbbf53b23a9347470986f052ecba0149d7503aa..8d342290a9ed81b20260e2e4f7262e03
+ } // Paper + } // Paper
} }
public void setDeltaMovement(double x, double y, double z) { public void addDeltaMovement(Vec3 velocity) {
@@ -4054,7 +4098,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -4104,7 +4148,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
// Paper end - fix MC-4 // Paper end - fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) { if (this.position.x != x || this.position.y != y || this.position.z != z) {

Datei anzeigen

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582d4300899 100644 index 08fee16ab39d9da3c4262b356dd956fd5c967d06..b1d12c78edf21cc29a9f9ca54e7957ddc8875ffb 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -484,9 +484,9 @@ public class BlockPos extends Vec3i { @@ -488,9 +488,9 @@ public class BlockPos extends Vec3i {
} }
public BlockPos.MutableBlockPos set(int x, int y, int z) { public BlockPos.MutableBlockPos set(int x, int y, int z) {
@ -21,7 +21,7 @@ index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582
return this; return this;
} }
@@ -550,19 +550,19 @@ public class BlockPos extends Vec3i { @@ -554,19 +554,19 @@ public class BlockPos extends Vec3i {
// Paper start - comment out useless overrides @Override - TODO figure out why this is suddenly important to keep // Paper start - comment out useless overrides @Override - TODO figure out why this is suddenly important to keep
@Override @Override
public BlockPos.MutableBlockPos setX(int i) { public BlockPos.MutableBlockPos setX(int i) {
@ -45,11 +45,11 @@ index e68cd32a7db88f29d3224b0908119232ab3cf71a..153451ecd5b3c8e8ecb2d5ec91ccd582
} }
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java
index 73b3c5f5c037fbe3f588f8f4b0113bef283632a4..c06c7da7de84bc764ea7b9612b3dc2303b49b22e 100644 index 9482d5ca34bbc098a5afa785054d6d60d6a2decb..cc73ce9f860d1ed3a746e08364a3be97ffa5c8c2 100644
--- a/src/main/java/net/minecraft/core/Vec3i.java --- a/src/main/java/net/minecraft/core/Vec3i.java
+++ b/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> { @@ -19,9 +19,9 @@ public class Vec3i implements Comparable<Vec3i> {
return IntStream.of(vec3i.getX(), vec3i.getY(), vec3i.getZ()); return IntStream.of(vec.getX(), vec.getY(), vec.getZ());
}); });
public static final Vec3i ZERO = new Vec3i(0, 0, 0); public static final Vec3i ZERO = new Vec3i(0, 0, 0);
- private int x; - private int x;

Datei anzeigen

@ -13,10 +13,10 @@ Paper recently reverted this optimisation, so it's been reintroduced
here. here.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 70b6479ef8aeb51135b31add61e4fdab0c495233..97623e46160bf038bbcc4584bb921d524b3830c0 100644 index 10f4cbf82cc4a79aacfd1f8e1e53a6c1f4963865..c56de0c388f5902d85b0810c6e105c24d721bcdd 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -367,6 +367,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -366,6 +366,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override @Override
public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline public final LevelChunk getChunk(int chunkX, int chunkZ) { // Paper - final to help inline

Datei anzeigen

@ -22,10 +22,10 @@ With this change I could get all 200 on at 0ms ping.
So in general this patch should reduce Netty I/O thread load. So in general this patch should reduce Netty I/O thread load.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 2aba72cd7a87b8b999cfbc7a2e7a58ea95717c19..4ff563d903633f181e1268daa77f250cfec204a0 100644 index ebd0da4f87c74f12d702e1ae4f3206885272e4f7..ca84eddbdb1e198b899750e5f6b3eafd25ce970f 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -804,7 +804,24 @@ public class ServerChunkCache extends ChunkSource { @@ -805,7 +805,24 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
gameprofilerfiller.pop(); gameprofilerfiller.pop();
// Paper end - use set of chunks requiring updates, rather than iterating every single one loaded // Paper end - use set of chunks requiring updates, rather than iterating every single one loaded

Datei anzeigen

@ -9,10 +9,10 @@ Configurable under
`send-full-pos-for-hard-colliding-entities` `send-full-pos-for-hard-colliding-entities`
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 98b8239205c61df5a2a4e344c50645e2cd2cbaad..523a4963b644cec57c7338cdda72b5e17247f49a 100644 index 6281ade15b2700d16dc1f98c2affea8c0ba936c9..64683e218c9c43cfd30514800cfa8da42e37563e 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -165,7 +165,7 @@ public class ServerEntity { @@ -169,7 +169,7 @@ public class ServerEntity {
long i1 = this.positionCodec.encodeZ(vec3d); long i1 = this.positionCodec.encodeZ(vec3d);
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;

Datei anzeigen

@ -7,10 +7,10 @@ Reference2BooleanOpenHashMap is going to have
better lookups than HashMap. 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 diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f2a8a1a47080cd3c62ece108d34f05cf48973472..315fec3941d71ee29c8f2fdc864c227bde54a0ca 100644 index 109baae0c68b28720508af4a9e0b32b72b3dcb23..fab05c504ede66b91f07666341df70338ab4b6db 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1360,7 +1360,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1397,7 +1397,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final Entity entity; final Entity entity;
private final int range; private final int range;
SectionPos lastSectionPos; SectionPos lastSectionPos;

Datei anzeigen

@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdcbee89d18 100644 index 3ba995c8d21427a3dbbde22c8faa0a7888507880..02e58f7de47af48c9e23dfd2ebe5fab9967dd82c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -706,6 +706,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -707,6 +707,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
entityplayer.stopSleepInBed(false, false); entityplayer.stopSleepInBed(false, false);
}); });
} }
@ -104,7 +104,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
public void tickChunk(LevelChunk chunk, int randomTickSpeed) { public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
ChunkPos chunkcoordintpair = chunk.getPos(); ChunkPos chunkcoordintpair = chunk.getPos();
@@ -715,10 +719,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -716,10 +720,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
gameprofilerfiller.push("thunder"); gameprofilerfiller.push("thunder");
@ -117,9 +117,9 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
if (this.isRainingAt(blockposition)) { if (this.isRainingAt(blockposition)) {
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
@@ -742,64 +746,75 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -749,18 +753,26 @@ public class ServerLevel extends Level implements WorldGenLevel {
int l;
gameprofilerfiller.popPush("iceandsnow");
if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
- blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15)); - blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(j, 0, k, 15));
- BlockPos blockposition1 = blockposition.below(); - BlockPos blockposition1 = blockposition.below();
@ -141,14 +141,21 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
} }
if (flag) { if (flag) {
int i1 = this.getGameRules().getInt(GameRules.RULE_SNOW_ACCUMULATION_HEIGHT);
BlockState iblockdata;
+ blockposition.setY(normalY); // Paper + blockposition.setY(normalY); // Paper
if (biomebase.shouldSnow(this, blockposition)) { if (i1 > 0 && biomebase.shouldSnow(this, blockposition)) {
iblockdata = this.getBlockState(blockposition);
if (iblockdata.is(Blocks.SNOW)) {
@@ -775,52 +787,55 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
} }
}
+ blockposition.setY(downY); // Paper + blockposition.setY(downY); // Paper
- BlockState iblockdata = this.getBlockState(blockposition1); - iblockdata = this.getBlockState(blockposition1);
+ BlockState iblockdata = this.getBlockState(blockposition); // Paper + iblockdata = this.getBlockState(blockposition); // Paper
Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation(); Biome.Precipitation biomebase_precipitation = biomebase.getPrecipitation();
- if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) { - if (biomebase_precipitation == Biome.Precipitation.RAIN && biomebase.coldEnoughToSnow(blockposition1)) {
@ -167,19 +174,19 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
timings.chunkTicksBlocks.startTiming(); // Paper timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) { if (randomTickSpeed > 0) {
- LevelChunkSection[] achunksection = chunk.getSections(); - LevelChunkSection[] achunksection = chunk.getSections();
- int l = achunksection.length; - int j1 = achunksection.length;
- -
- for (int i1 = 0; i1 < l; ++i1) { - for (int k1 = 0; k1 < j1; ++k1) {
- LevelChunkSection chunksection = achunksection[i1]; - LevelChunkSection chunksection = achunksection[k1];
- -
- if (chunksection.isRandomlyTicking()) { - if (chunksection.isRandomlyTicking()) {
- int j1 = chunksection.bottomBlockY(); - int l1 = chunksection.bottomBlockY();
- -
- for (int k1 = 0; k1 < randomTickSpeed; ++k1) { - for (l = 0; l < randomTickSpeed; ++l) {
- BlockPos blockposition2 = this.getBlockRandomPos(j, j1, k, 15); - BlockPos blockposition2 = this.getBlockRandomPos(j, l1, k, 15);
- -
- gameprofilerfiller.push("randomTick"); - gameprofilerfiller.push("randomTick");
- BlockState iblockdata1 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k); - BlockState iblockdata2 = chunksection.getBlockState(blockposition2.getX() - j, blockposition2.getY() - l1, blockposition2.getZ() - k);
+ LevelChunkSection[] sections = chunk.getSections(); + LevelChunkSection[] sections = chunk.getSections();
+ int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this); + int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
+ for (int sectionIndex = 0; sectionIndex < sections.length; ++sectionIndex) { + for (int sectionIndex = 0; sectionIndex < sections.length; ++sectionIndex) {
@ -188,8 +195,8 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
+ continue; + continue;
+ } + }
- if (iblockdata1.isRandomlyTicking()) { - if (iblockdata2.isRandomlyTicking()) {
- iblockdata1.randomTick(this, blockposition2, this.random); - iblockdata2.randomTick(this, blockposition2, this.random);
- } - }
+ int yPos = (sectionIndex + minSection) << 4; + int yPos = (sectionIndex + minSection) << 4;
+ for (int a = 0; a < randomTickSpeed; ++a) { + for (int a = 0; a < randomTickSpeed; ++a) {
@ -199,7 +206,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
+ continue; + continue;
+ } + }
- FluidState fluid = iblockdata1.getFluidState(); - FluidState fluid = iblockdata2.getFluidState();
+ long raw = section.tickingList.getRaw(index); + long raw = section.tickingList.getRaw(index);
+ int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw); + int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw);
+ int randomX = location & 15; + int randomX = location & 15;
@ -216,7 +223,7 @@ index eaaf69434b152fbfa099bf0cfa3190bc1b565e5d..1a790b84a96c975af8ae14a35b271fdc
- } - }
+ iblockdata.randomTick(this, blockposition2, this.randomTickRandom); + iblockdata.randomTick(this, blockposition2, this.randomTickRandom);
+ // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock). + // We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock).
+ // TODO CHECK ON UPDATE + // TODO CHECK ON UPDATE (ping the Canadian)
} }
} }
} }
@ -299,7 +306,7 @@ index 9686ce7536c9924b1b2aced4f013f46759cbc72e..5d8e9bdf5538b19681f21949368d862f
public void getAll(IntConsumer action) { public void getAll(IntConsumer action) {
for(int i = 0; i < this.size; ++i) { for(int i = 0; i < this.size; ++i) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index 0cea2eacfe3264a9b3500dc3a6a19d21d74d54e9..4764b975386f1c5629a59f762f7ba1c1ae2598c5 100644 index 30663713e198bfe40b95c48524b71ea65f39965e..25503678e7d049a8b3172cfad8a5606958c32302 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -83,7 +83,7 @@ public class Turtle extends Animal { @@ -83,7 +83,7 @@ public class Turtle extends Animal {
@ -312,10 +319,10 @@ index 0cea2eacfe3264a9b3500dc3a6a19d21d74d54e9..4764b975386f1c5629a59f762f7ba1c1
public BlockPos getHomePos() { public BlockPos getHomePos() {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 97623e46160bf038bbcc4584bb921d524b3830c0..b5fd3a9b58fb56db92d579d307edc99bbe344c79 100644 index c56de0c388f5902d85b0810c6e105c24d721bcdd..62bf7fec8188e69e7811aa4e1f0f3131f8af0bd7 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1306,10 +1306,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1368,10 +1368,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract RecipeManager getRecipeManager(); public abstract RecipeManager getRecipeManager();
public BlockPos getBlockRandomPos(int x, int y, int z, int l) { public BlockPos getBlockRandomPos(int x, int y, int z, int l) {
@ -429,7 +436,7 @@ index 066874d27495dcaa3dea254b7328257e46920357..c3f1334b2bb97f0633f3ea43b97ee49a
public PalettedContainer<BlockState> getStates() { public PalettedContainer<BlockState> getStates() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 9e652cf68b289696b5aee53ac157fc52cca10d2c..7908360dd47937b2cb702e381802b7b278a5198e 100644 index 5cd4b81a9e89402c617aa3458200b95faa551c9c..2362688501d246f4a1ced41d63f75548a19ad013 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -383,6 +383,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -383,6 +383,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer

Datei anzeigen

@ -39,10 +39,10 @@ index e11ec87e8007979a1c6932b414bcd70c10db746c..bc46479fd0622a90fd98ac88f92b2840
// Paper end // Paper end
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd119aa2c44d 100644 index fab05c504ede66b91f07666341df70338ab4b6db..fb47e820beb5b8224a44d41a7b83e10e6eb783c1 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -152,6 +152,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -156,6 +156,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final ReferenceOpenHashSet<ChunkHolder> needsChangeBroadcasting = new ReferenceOpenHashSet<>(); public final ReferenceOpenHashSet<ChunkHolder> needsChangeBroadcasting = new ReferenceOpenHashSet<>();
// Paper - rewrite chunk system // Paper - rewrite chunk system
@ -55,7 +55,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11
// Paper start - distance maps // Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@@ -204,6 +210,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -208,6 +214,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player))); trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player)));
} }
// Paper end - use distance map to optimise entity tracker // Paper end - use distance map to optimise entity tracker
@ -63,7 +63,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11
} }
void removePlayerFromDistanceMaps(ServerPlayer player) { void removePlayerFromDistanceMaps(ServerPlayer player) {
@@ -213,6 +220,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -217,6 +224,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.playerMobSpawnMap.remove(player); this.playerMobSpawnMap.remove(player);
this.playerChunkTickRangeMap.remove(player); this.playerChunkTickRangeMap.remove(player);
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
@ -71,7 +71,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11
// Paper start - per player mob spawning // Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) { if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.remove(player); this.playerMobDistanceMap.remove(player);
@@ -244,6 +252,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -248,6 +256,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player))); trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player)));
} }
// Paper end - use distance map to optimise entity tracker // Paper end - use distance map to optimise entity tracker
@ -79,7 +79,7 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11
} }
// Paper end // Paper end
// Paper start // Paper start
@@ -397,6 +406,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -405,6 +414,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
}); });
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
@ -104,10 +104,10 @@ index 315fec3941d71ee29c8f2fdc864c227bde54a0ca..882820653800e0fe9e16441cb4edcd11
protected ChunkGenerator generator() { protected ChunkGenerator generator() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c077367581521cc1d 100644 index 02e58f7de47af48c9e23dfd2ebe5fab9967dd82c..91b4866c15104ad8ed7b0967df1fc8d9e433b096 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -443,6 +443,84 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -446,6 +446,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper end // Paper end
public final ReferenceOpenHashSet<ServerPlayer> pendingLogin = new ReferenceOpenHashSet<>(); // Paper public final ReferenceOpenHashSet<ServerPlayer> pendingLogin = new ReferenceOpenHashSet<>(); // Paper
@ -191,8 +191,8 @@ index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c07736758
+ +
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
@@ -546,6 +624,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -549,6 +627,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void tick(BooleanSupplier shouldKeepTicking) { public void tick(BooleanSupplier shouldKeepTicking) {
@ -208,10 +208,10 @@ index 1a790b84a96c975af8ae14a35b271fdcbee89d18..502da788bace6c078fc3c58c07736758
this.handlingTick = true; this.handlingTick = true;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 147ec41ae4a3b9e9ad495ab4309c9f7306122749..cf40ebd06c52a7a00e6f704a29ae9d2b5186d35a 100644 index 082da4f8eaede9d7f70341c207a2aaa6f07b997e..49b983064ea810382b6112f5dc7f93ba4e5710bd 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -808,7 +808,12 @@ public abstract class Mob extends LivingEntity { @@ -826,7 +826,12 @@ public abstract class Mob extends LivingEntity {
if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(); this.discard();
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
@ -226,10 +226,10 @@ index 147ec41ae4a3b9e9ad495ab4309c9f7306122749..cf40ebd06c52a7a00e6f704a29ae9d2b
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); double d0 = entityhuman.distanceToSqr((Entity) this);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b5fd3a9b58fb56db92d579d307edc99bbe344c79..09c2d318330e03d0230a82b30985bba3a4231615 100644 index 62bf7fec8188e69e7811aa4e1f0f3131f8af0bd7..363d908ef7707311210fa662f706c59a8a5e7f76 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -205,6 +205,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -204,6 +204,69 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getChunkIfLoaded(chunkX, chunkZ) != null; return this.getChunkIfLoaded(chunkX, chunkZ) != null;
} }
// Paper end // Paper end
@ -300,10 +300,10 @@ index b5fd3a9b58fb56db92d579d307edc99bbe344c79..09c2d318330e03d0230a82b30985bba3
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c60f6c5e4a 100644 index 0a49769bfa83d0b9c435e3ab4bba85979d660ff8..01b21f520ef1c834b9bafc3de85c1fa4fcf539d6 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -259,7 +259,7 @@ public final class NaturalSpawner { @@ -260,7 +260,7 @@ public final class NaturalSpawner {
blockposition_mutableblockposition.set(l, i, i1); blockposition_mutableblockposition.set(l, i, i1);
double d0 = (double) l + 0.5D; double d0 = (double) l + 0.5D;
double d1 = (double) i1 + 0.5D; double d1 = (double) i1 + 0.5D;
@ -312,7 +312,7 @@ index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c6
if (entityhuman != null) { if (entityhuman != null) {
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
@@ -333,7 +333,7 @@ public final class NaturalSpawner { @@ -334,7 +334,7 @@ public final class NaturalSpawner {
} }
private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) {
@ -322,7 +322,7 @@ index 21941af701eab308f87ca64b2801c55444814acb..7c7408b9686c8ff945c30892d45914c6
private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper private static Boolean isValidSpawnPostitionForType(ServerLevel world, MobCategory group, StructureManager structureAccessor, ChunkGenerator chunkGenerator, MobSpawnSettings.SpawnerData spawnEntry, BlockPos.MutableBlockPos pos, double squaredDistance) { // Paper
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index aa3adc628178962ce89df0e372c925e8f4801606..5e54cf312160e537d2fe6e6fedc618160359330e 100644 index a3c1bba1c1f795d203207776bab41b4b8f4e69d7..28e4b302284f955a73e75d0f4276d55fb51826f5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -269,6 +269,98 @@ public class LevelChunk extends ChunkAccess { @@ -269,6 +269,98 @@ public class LevelChunk extends ChunkAccess {

Datei anzeigen

@ -5,97 +5,69 @@ Subject: [PATCH] Remove streams for villager AI
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a8f6fa4f0 100644 index b45c4f50705f80163d44d9e588f86a5770f5be38..10cbb80c7cd9ba30150d8d935c0d115719c35509 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
@@ -30,11 +30,19 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> { @@ -52,7 +52,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
if (this.hasRequiredMemories(entity)) {
@Override this.status = Behavior.Status.RUNNING;
protected boolean canStillUse(ServerLevel world, E entity, long time) {
- return this.behaviors.stream().filter((task) -> {
- return task.getStatus() == Behavior.Status.RUNNING;
- }).anyMatch((task) -> {
- return task.canStillUse(world, entity, time);
- });
+ // Paper start - remove streams
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries;
+ for (int i = 0; i < entries.size(); i++) {
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i);
+ Behavior<? super E> behavior = entry.getData();
+ if (behavior.getStatus() == Status.RUNNING) {
+ if (behavior.canStillUse(world, entity, time)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ // Paper end - remove streams
}
@Override
@@ -45,25 +53,35 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
@Override
protected void start(ServerLevel world, E entity, long time) {
this.orderPolicy.apply(this.behaviors); this.orderPolicy.apply(this.behaviors);
- this.runningPolicy.apply(this.behaviors.stream(), world, entity, time); - this.runningPolicy.apply(this.behaviors.stream(), world, entity, time);
+ this.runningPolicy.apply(this.behaviors.entries, world, entity, time); // Paper - remove streams + this.runningPolicy.apply(this.behaviors.entries, world, entity, time);
} return true;
} else {
return false;
@@ -61,11 +61,13 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
@Override @Override
protected void tick(ServerLevel world, E entity, long time) { public final void tickOrStop(ServerLevel world, E entity, long time) {
- this.behaviors.stream().filter((task) -> { - this.behaviors.stream().filter((task) -> {
- return task.getStatus() == Behavior.Status.RUNNING; - return task.getStatus() == Behavior.Status.RUNNING;
- }).forEach((task) -> { - }).forEach((task) -> {
- task.tickOrStop(world, entity, time); - task.tickOrStop(world, entity, time);
- }); - });
+ // Paper start - remove streams + // Paper start
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries; + for (BehaviorControl<? super E> task : this.behaviors) {
+ for (int i = 0; i < entries.size(); i++) { + if (task.getStatus() == Behavior.Status.RUNNING) {
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i); + task.tickOrStop(world, entity, time);
+ Behavior<? super E> behavior = entry.getData();
+ if (behavior.getStatus() == Status.RUNNING) {
+ behavior.tickOrStop(world, entity, time);
+ } + }
+ } + }
+ // Paper end - remove streams + // Paper end
} if (this.behaviors.stream().noneMatch((task) -> {
return task.getStatus() == Behavior.Status.RUNNING;
})) {
@@ -77,11 +79,11 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
@Override @Override
protected void stop(ServerLevel world, E entity, long time) { public final void doStop(ServerLevel world, E entity, long time) {
this.status = Behavior.Status.STOPPED;
- this.behaviors.stream().filter((task) -> { - this.behaviors.stream().filter((task) -> {
- return task.getStatus() == Behavior.Status.RUNNING; - return task.getStatus() == Behavior.Status.RUNNING;
- }).forEach((task) -> { - }).forEach((task) -> {
- task.doStop(world, entity, time); - task.doStop(world, entity, time);
- }); - });
+ // Paper start - remove streams + for (BehaviorControl<? super E> behavior : this.behaviors) {
+ List<ShufflingList.WeightedEntry<Behavior<? super E>>> entries = this.behaviors.entries; + if (behavior.getStatus() == Behavior.Status.RUNNING) {
+ for (int i = 0; i < entries.size(); i++) {
+ ShufflingList.WeightedEntry<Behavior<? super E>> entry = entries.get(i);
+ Behavior<? super E> behavior = entry.getData();
+ if (behavior.getStatus() == Status.RUNNING) {
+ behavior.doStop(world, entity, time); + behavior.doStop(world, entity, time);
+ } + }
+ } + }
+ // Paper end - remove streams
this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory); this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory);
} }
@@ -94,25 +112,33 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> { @@ -117,25 +119,31 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
public static enum RunningPolicy { public static enum RunningPolicy {
RUN_ONE { RUN_ONE {
@Override @Override
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) { - public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) {
- tasks.filter((task) -> { - tasks.filter((task) -> {
- return task.getStatus() == Behavior.Status.STOPPED; - return task.getStatus() == Behavior.Status.STOPPED;
- }).filter((task) -> { - }).filter((task) -> {
- return task.tryStart(world, entity, time); - return task.tryStart(world, entity, time);
- }).findFirst(); - }).findFirst();
+ // Paper start - remove streams + // Paper start - remove streams
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) { + public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
+ for (int i = 0; i < tasks.size(); i++) { + for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
+ ShufflingList.WeightedEntry<Behavior<? super E>> task = tasks.get(i); + final BehaviorControl<? super E> behavior = task.getData();
+ Behavior<? super E> behavior = task.getData(); + if (behavior.getStatus() == Behavior.Status.STOPPED && behavior.tryStart(world, entity, time)) {
+ if (behavior.getStatus() == Status.STOPPED && behavior.tryStart(world, entity, time)) {
+ break; + break;
+ } + }
+ } + }
@ -104,18 +76,17 @@ index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a
}, },
TRY_ALL { TRY_ALL {
@Override @Override
- public <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time) { - public <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time) {
- tasks.filter((task) -> { - tasks.filter((task) -> {
- return task.getStatus() == Behavior.Status.STOPPED; - return task.getStatus() == Behavior.Status.STOPPED;
- }).forEach((task) -> { - }).forEach((task) -> {
- task.tryStart(world, entity, time); - task.tryStart(world, entity, time);
- }); - });
+ // Paper start - remove streams + // Paper start - remove streams
+ public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time) { + public <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time) {
+ for (int i = 0; i < tasks.size(); i++) { + for (ShufflingList.WeightedEntry<BehaviorControl<? super E>> task : tasks) {
+ ShufflingList.WeightedEntry<Behavior<? super E>> task = tasks.get(i); + final BehaviorControl<? super E> behavior = task.getData();
+ Behavior<? super E> behavior = task.getData(); + if (behavior.getStatus() == Behavior.Status.STOPPED) {
+ if (behavior.getStatus() == Status.STOPPED) {
+ behavior.tryStart(world, entity, time); + behavior.tryStart(world, entity, time);
+ } + }
+ } + }
@ -123,18 +94,18 @@ index 5a5d454b5987bb01d03f91c15b7a6bff46f1de71..c545539fc5d20cc69a0e5d2e261ef46a
} }
}; };
- public abstract <E extends LivingEntity> void apply(Stream<Behavior<? super E>> tasks, ServerLevel world, E entity, long time); - public abstract <E extends LivingEntity> void apply(Stream<BehaviorControl<? super E>> tasks, ServerLevel world, E entity, long time);
+ public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<Behavior<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams + public abstract <E extends LivingEntity> void apply(List<ShufflingList.WeightedEntry<BehaviorControl<? super E>>> tasks, ServerLevel world, E entity, long time); // Paper - remove streams
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
index 090bba46b6ecd7d0e1415feb678b9b23264fe5e9..ca771d60283d94c00aa65d06ef93071e412357e8 100644 index 731ef21dbbd25d6924717de42f4569a9b5935643..fe3ab3d388f0481fb0db06b7f730f868dbf8e8a5 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
@@ -12,7 +12,7 @@ import java.util.stream.Stream; @@ -14,7 +14,7 @@ import java.util.stream.Stream;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
public class ShufflingList<U> { public class ShufflingList<U> implements Iterable<U> {
- protected final List<ShufflingList.WeightedEntry<U>> entries; - protected final List<ShufflingList.WeightedEntry<U>> entries;
+ public final List<ShufflingList.WeightedEntry<U>> entries; // Paper - public + public final List<ShufflingList.WeightedEntry<U>> entries; // Paper - public
private final RandomSource random = RandomSource.create(); private final RandomSource random = RandomSource.create();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 2d1e639bd2880469d849ca1242184b0af1f6903c..88000dae363f55044f86e72e9f6fb0214cd320bc 100644 index 8f32e0c3078366f4b07a499b1838929564a05b76..f9839f17bcda4619c257162e9bf14d5e00053c80 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -27,6 +27,11 @@ dependencies { @@ -27,6 +27,11 @@ dependencies {
@ -341,10 +341,10 @@ index b80aedd2002959b4026c27ce76b3ed17f0acfb5b..2985271132c9ae822dcb0d7a7e6f0c26
protected void initChannel(Channel channel) { protected void initChannel(Channel channel) {
try { try {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index fa469313d4b38bd9441b3010743e1054420bd525..7d7d7336eea6db6505b57198cca2b03960fb1ec0 100644 index 7661f248c1c0b8de3b15793f45bf239ab561083b..721de6bb83603be91e28ff13271697f9434d9f87 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -304,12 +304,14 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se @@ -265,12 +265,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
} }
SecretKey secretkey = packet.getSecretKey(privatekey); SecretKey secretkey = packet.getSecretKey(privatekey);

Datei anzeigen

@ -5,7 +5,7 @@ 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 diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index adb1c48f42157fb127be4fd9f0a6f3784d8c4b39..998f63fba0d45a44eaf9cbe48a034bac4e02e965 100644 index 439ae035d8b2787916e017e2636115b5455811f1..a54c0a4d0849087229d08ccc89872c3603f2f426 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -146,7 +146,19 @@ public class Util { @@ -146,7 +146,19 @@ public class Util {

Datei anzeigen

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 502da788bace6c078fc3c58c077367581521cc1d..ffe42e757d11978d861a70b69f9050014f7f8ea8 100644 index 91b4866c15104ad8ed7b0967df1fc8d9e433b096..2b823f40c9435cfac6590487426e1ec1c051ecec 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2609,6 +2609,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2590,6 +2590,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end // Spigot end
// Spigot Start // Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 131577917ef0420f6b75a3cfa896ba4306ded3e7..eab752600a2711a73516fa029b8eca17d52fde3c 100644 index 875cf692f747b51c16c69e40e0fd5af0161cf858..045f1b81e568d9adca8e5f9374b5a3ce1267d118 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -847,6 +847,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -839,6 +839,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
// Paper end // Paper end
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index eac88fdb3c9184e9c0d3500c62fbc34958bfcb47..1463d210656c801f8da89d8a2060680684e9c46e 100644 index d02cab4c09e2036f6b1ac3667ef8282475daf015..cbe4bf568d5bc97b316f3a9af7a1ad9d88f7f3b5 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -498,7 +498,7 @@ public class ServerPlayer extends Player { @@ -520,7 +520,7 @@ public class ServerPlayer extends Player {
} }
} }

Datei anzeigen

@ -5,10 +5,10 @@ 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 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 99b175625c79fe5c4d944810e3fe11be5eed997f..f8d846345c1cc3c78f9ac14635b26f2affc77190 100644 index abd13cefd3d8409e1ef8ea70d92877f76f89da6c..230de1c71b0a6d6370df2fedb337cf0e332a7596 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -413,6 +413,11 @@ public class EndDragonFight { @@ -419,6 +419,11 @@ public class EndDragonFight {
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Don't log debug logging being disabled
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index edc5f195cc3de8885b839469656650ba465346be..5d162f59fc5ef9adf7fa762b137bbcfca745d9c5 100644 index 3ac48dafe2300ff4cf4591569fec9ce4916503cd..612c3169c3463d702b85975e1db79ae6e47d60d0 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -382,7 +382,7 @@ public class SpigotConfig @@ -382,7 +382,7 @@ public class SpigotConfig

Datei anzeigen

@ -10,47 +10,52 @@ chunk bans via the large amount of NBT created by unstacking the items.
Fixes GH-5140 and GH-4748. Fixes GH-5140 and GH-4748.
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..375d26ac2453f637bac3fa89873b6760095916b7 100644 index 1326539c88aabfbe1bbaf2905268abfa729d8167..3bc13092873609af9c6f412190dd989d39f1df23 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
@@ -56,9 +56,17 @@ public class LootTable { @@ -56,14 +56,22 @@ public class LootTable {
this.compositeFunction = LootItemFunctions.compose(functions); this.compositeFunction = LootItemFunctions.compose(functions);
} }
+ @Deprecated // Paper - preserve overstacked items
public static Consumer<ItemStack> createStackSplitter(Consumer<ItemStack> lootConsumer) {
+ // Paper start - preserve overstacked items + // Paper start - preserve overstacked items
+ return createStackSplitter(lootConsumer, null); + @Deprecated
public static Consumer<ItemStack> createStackSplitter(LootContext context, Consumer<ItemStack> consumer) {
+ return createStackSplitter(context, consumer, null);
+ } + }
+ + public static Consumer<ItemStack> createStackSplitter(LootContext context, Consumer<ItemStack> consumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel level) {
+ public static Consumer<ItemStack> createStackSplitter(Consumer<ItemStack> lootConsumer, @org.jetbrains.annotations.Nullable net.minecraft.server.level.ServerLevel world) { + boolean skipSplitter = level != null && !level.paperConfig().fixes.splitOverstackedLoot;
+ boolean skipSplitter = world != null && !world.paperConfig().fixes.splitOverstackedLoot;
+ // Paper end + // Paper end
return (itemstack) -> { return (itemstack) -> {
if (itemstack.isItemEnabled(context.getLevel().enabledFeatures())) {
- if (itemstack.getCount() < itemstack.getMaxStackSize()) { - if (itemstack.getCount() < itemstack.getMaxStackSize()) {
+ if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items + if (skipSplitter || itemstack.getCount() < itemstack.getMaxStackSize()) { // Paper - preserve overstacked items
lootConsumer.accept(itemstack); consumer.accept(itemstack);
} else { } else {
int i = itemstack.getCount(); int i = itemstack.getCount();
@@ -95,7 +103,7 @@ public class LootTable {
+
while (i > 0) {
ItemStack itemstack1 = itemstack.copy();
@@ -97,7 +105,7 @@ public class LootTable {
} }
public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) { public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) {
- this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer)); - this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer));
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items + this.getRandomItemsRaw(context, LootTable.createStackSplitter(context, lootConsumer, context.getLevel())); // Paper - preserve overstacked items
} }
public ObjectArrayList<ItemStack> getRandomItems(LootContext context) { public ObjectArrayList<ItemStack> getRandomItems(LootContext context) {
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
index 057676201aa2d19032537832849f3857425d357a..b5c6b7280a9c6964e2ad4aa9bd4517146c98e727 100644 index 880a0686519dc033b3c3b2bf0126f49af6fb48de..eddad9593bccd9e91fbb6d79fa2bdd766b004690 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
@@ -46,7 +46,7 @@ public class SetContainerContents extends LootItemConditionalFunction { @@ -46,7 +46,7 @@ public class SetContainerContents extends LootItemConditionalFunction {
NonNullList<ItemStack> nonNullList = NonNullList.create(); NonNullList<ItemStack> nonNullList = NonNullList.create();
this.entries.forEach((entry) -> { this.entries.forEach((entry) -> {
entry.expand(context, (choice) -> { entry.expand(context, (choice) -> {
- choice.createItemStack(LootTable.createStackSplitter(nonNullList::add), context); - choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add), context);
+ choice.createItemStack(LootTable.createStackSplitter(nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items + choice.createItemStack(LootTable.createStackSplitter(context, nonNullList::add, context.getLevel()), context); // Paper - preserve overstacked items
}); });
}); });
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();

Datei anzeigen

@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players. 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8d342290a9ed81b20260e2e4f7262e03332464b1..3194c4461a5a86e28e73414a94dbfa7e611ee3a8 100644 index a4d4e5cb3bd7a4816671b058c640ccc90dec8f54..9a6a3718788e7085f6defc3c82ba4bb66dd6c5b3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1763,6 +1763,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1778,6 +1778,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F); this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
this.yRotO = this.getYRot(); this.yRotO = this.getYRot();
this.xRotO = this.getXRot(); this.xRotO = this.getXRot();
@ -19,7 +19,7 @@ index 8d342290a9ed81b20260e2e4f7262e03332464b1..3194c4461a5a86e28e73414a94dbfa7e
} }
public void absMoveTo(double x, double y, double z) { public void absMoveTo(double x, double y, double z) {
@@ -1801,6 +1802,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1816,6 +1817,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setXRot(pitch); this.setXRot(pitch);
this.setOldPosAndRot(); this.setOldPosAndRot();
this.reapplyPosition(); this.reapplyPosition();

Datei anzeigen

@ -5,13 +5,13 @@ 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 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 d648902737350103c2078c80796038a054f16acc..98124ee3bea51e40a9a3cb9014ee84bfc26e91f7 100644 index 6427302f53336fe035882d0a09e3e2d2d929d3b7..6eec44c484763f877aece6d9676ffc166bc10395 100644
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
@@ -46,6 +46,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { @@ -46,6 +46,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
@Override @Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (!world.isClientSide) { 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
world.setBlock(pos, state.cycle(LEVEL), 2); world.setBlock(pos, state.cycle(LEVEL), 2);
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;

Datei anzeigen

@ -13,7 +13,7 @@ the material type of the block at that location.
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index b0174aedb7358af1e80278e2f5f13e00c35ab3c6..d62181bd8bccfcfdd7da8f635bdf7ebc36294705 100644 index be98a87edbe62cfcf5c1b6f6cd1d8e31b546c144..4e2cd5435cc2c87bc604e7eba4f587c0b029e571 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -250,7 +250,7 @@ public abstract class BlockEntity { @@ -250,7 +250,7 @@ public abstract class BlockEntity {
@ -39,7 +39,7 @@ index 87c25170fbe8b0591d452612496ee1a627138de7..a2894f02ceb7c58f6eafe055e1ff47b1
private final T tileEntity; private final T tileEntity;
private final T snapshot; private final T snapshot;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f490fe4712f 100644 index 812eb8c75bf5308a3a0771a1faabdb22a3d80c28..670d69c04626cb606081e06c4caf92686af4c860 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity; @@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
@ -50,7 +50,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; import net.minecraft.world.level.block.entity.BrewingStandBlockEntity;
import net.minecraft.world.level.block.entity.CampfireBlockEntity; import net.minecraft.world.level.block.entity.CampfireBlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity;
@@ -108,187 +109,57 @@ public final class CraftBlockStates { @@ -110,217 +111,58 @@ public final class CraftBlockStates {
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) { private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
@Override @Override
public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) { public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
@ -76,6 +76,8 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
- Arrays.asList( - Arrays.asList(
- Material.ACACIA_SIGN, - Material.ACACIA_SIGN,
- Material.ACACIA_WALL_SIGN, - Material.ACACIA_WALL_SIGN,
- Material.BAMBOO_SIGN,
- Material.BAMBOO_WALL_SIGN,
- Material.BIRCH_SIGN, - Material.BIRCH_SIGN,
- Material.BIRCH_WALL_SIGN, - Material.BIRCH_WALL_SIGN,
- Material.CRIMSON_SIGN, - Material.CRIMSON_SIGN,
@ -97,10 +99,37 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
- -
- register( - register(
- Arrays.asList( - Arrays.asList(
- Material.ACACIA_HANGING_SIGN,
- Material.ACACIA_WALL_HANGING_SIGN,
- Material.BAMBOO_HANGING_SIGN,
- Material.BAMBOO_WALL_HANGING_SIGN,
- Material.BIRCH_HANGING_SIGN,
- Material.BIRCH_WALL_HANGING_SIGN,
- Material.CRIMSON_HANGING_SIGN,
- Material.CRIMSON_WALL_HANGING_SIGN,
- Material.DARK_OAK_HANGING_SIGN,
- Material.DARK_OAK_WALL_HANGING_SIGN,
- Material.JUNGLE_HANGING_SIGN,
- Material.JUNGLE_WALL_HANGING_SIGN,
- Material.MANGROVE_HANGING_SIGN,
- Material.MANGROVE_WALL_HANGING_SIGN,
- Material.OAK_HANGING_SIGN,
- Material.OAK_WALL_HANGING_SIGN,
- Material.SPRUCE_HANGING_SIGN,
- Material.SPRUCE_WALL_HANGING_SIGN,
- Material.WARPED_HANGING_SIGN,
- Material.WARPED_WALL_HANGING_SIGN
- ), CraftHangingSign.class, CraftHangingSign::new, HangingSignBlockEntity::new
- );
-
- register(
- Arrays.asList(
- Material.CREEPER_HEAD, - Material.CREEPER_HEAD,
- Material.CREEPER_WALL_HEAD, - Material.CREEPER_WALL_HEAD,
- Material.DRAGON_HEAD, - Material.DRAGON_HEAD,
- Material.DRAGON_WALL_HEAD, - Material.DRAGON_WALL_HEAD,
- Material.PIGLIN_HEAD,
- Material.PIGLIN_WALL_HEAD,
- Material.PLAYER_HEAD, - Material.PLAYER_HEAD,
- Material.PLAYER_WALL_HEAD, - Material.PLAYER_WALL_HEAD,
- Material.SKELETON_SKULL, - Material.SKELETON_SKULL,
@ -220,6 +249,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new); - register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new); - register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new); - register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new);
- register(Material.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new, ChiseledBookShelfBlockEntity::new);
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new); - register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new); - register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new); - register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
@ -257,6 +287,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new); + register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new); + register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); + register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
+ register(BlockEntityType.CHISELED_BOOKSHELF, CraftChiseledBookshelf.class, CraftChiseledBookshelf::new);
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new); + register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new); + register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new); + register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
@ -283,7 +314,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
} }
private static void register(Material blockType, BlockStateFactory<?> factory) { private static void register(Material blockType, BlockStateFactory<?> factory) {
@@ -296,30 +167,33 @@ public final class CraftBlockStates { @@ -328,30 +170,33 @@ public final class CraftBlockStates {
} }
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register( private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
@ -332,7 +363,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
public static Class<? extends CraftBlockState> getBlockStateType(Material material) { public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
Preconditions.checkNotNull(material, "material is null"); Preconditions.checkNotNull(material, "material is null");
return CraftBlockStates.getFactory(material).blockStateType; return CraftBlockStates.getFactory(material).blockStateType;
@@ -335,6 +209,13 @@ public final class CraftBlockStates { @@ -367,6 +212,13 @@ public final class CraftBlockStates {
return null; return null;
} }
@ -346,7 +377,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
public static BlockState getBlockState(Block block) { public static BlockState getBlockState(Block block) {
// Paper start // Paper start
return CraftBlockStates.getBlockState(block, true); return CraftBlockStates.getBlockState(block, true);
@@ -392,7 +273,7 @@ public final class CraftBlockStates { @@ -424,7 +276,7 @@ public final class CraftBlockStates {
if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) { if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) {
factory = CraftBlockStates.DEFAULT_FACTORY; factory = CraftBlockStates.DEFAULT_FACTORY;
} else { } else {
@ -356,7 +387,7 @@ index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f49
return factory.createBlockState(world, blockPosition, blockData, tileEntity); return factory.createBlockState(world, blockPosition, blockData, tileEntity);
} }
diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
index 15f760c4c71a0493c7c18c3908d229f6b8778a43..95e4a4080a4a168b53f69d9cd7d67c27263c1b7f 100644 index a6dbd1919bce5b5092666372f4cc31d2e2190c42..58b6b214d3f90aa03ec172d7bfe8c97e2c17b9a5 100644
--- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java --- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java +++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
@@ -45,4 +45,11 @@ public class BlockStateTest extends AbstractTestingBase { @@ -45,4 +45,11 @@ public class BlockStateTest extends AbstractTestingBase {

Datei anzeigen

@ -23,7 +23,7 @@ index d6f3869f5725c7f081efb7f486f74dbb99d4d005..8bc0cb9ad5bb4e76d962ff54305e2c08
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error"); net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error))); networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index 37cd7b44559e5705b31296df87c94d2ab200138d..37e52ea9ab694b466358981bc2a3c99f28a70c7d 100644 index 21393ad40095a4049e5b6871169b2db7aa92d13c..e6553b936dac1eb25a310d1a33acb0b1a5e646d2 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
+++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@@ -185,7 +185,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter { @@ -185,7 +185,7 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
@ -49,10 +49,10 @@ index 2985271132c9ae822dcb0d7a7e6f0c268d1736cc..cfdbcd024de6ad0f9d4e83b2f912b36e
networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> { networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 7d7d7336eea6db6505b57198cca2b03960fb1ec0..e8d3f455a1a08606568079a3811e2b3ed9d666c7 100644 index 721de6bb83603be91e28ff13271697f9434d9f87..1a88f9f49aea58321d1c1d4d720944c565c00968 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -225,7 +225,10 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se @@ -206,7 +206,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
} }
public String getUserName() { public String getUserName() {
@ -63,12 +63,12 @@ index 7d7d7336eea6db6505b57198cca2b03960fb1ec0..e8d3f455a1a08606568079a3811e2b3e
+ // Paper end + // Paper end
} }
@Nullable @Override
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index eedcccde859d39fada71122488ea019cc7405e27..279b7953638d1400072bd153dc3d0c63efdf9035 100644 index f734c7ea8c6ce468882ea758a358a8f19a16dcdb..c4e5e2b6283bd3163711a09d6a647c516ed8a1c3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -243,7 +243,7 @@ public abstract class PlayerList { @@ -249,7 +249,7 @@ public abstract class PlayerList {
final String s1; final String s1;
if (connection.getRemoteAddress() != null) { if (connection.getRemoteAddress() != null) {

Datei anzeigen

@ -19,10 +19,10 @@ index 98171f6c8e23f6ef89b897e4b80e3afb2a1950a0..06bff37e4c1fddd3be6343049a66787c
} }
final Object val = config.get(key); 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 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 c35bf0709e83e05c2135d7a5c98bf44c48d0c31f..4ce5d41b23d6204f280e6d4d21713ec5d9a724d1 100644 index d916159abb9c817b57897e6ec8b65a2079bf8e18..e0638949774215d4c2524761ffebf378206cd2d0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -606,7 +606,14 @@ public abstract class ChunkGenerator { @@ -434,7 +434,14 @@ public abstract class ChunkGenerator {
return (String) optional.orElseGet(placedfeature::toString); return (String) optional.orElseGet(placedfeature::toString);
}; };

Datei anzeigen

@ -57,10 +57,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 7dba8ef3291987cc428cd337693c3446d01e435b..c399aaeee89e12a7da4e054acd877fe033676dfd 100644 index 7dcffb49a982a8db00d66441a03e2951b1d29ff9..5b46cabf4f2e2a1f7feaad378dd98d64aeef8671 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -184,6 +184,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -179,6 +179,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }

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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3194c4461a5a86e28e73414a94dbfa7e611ee3a8..3f71b0f328842b3659bc01af8502cdc9561c7e5d 100644 index 9a6a3718788e7085f6defc3c82ba4bb66dd6c5b3..9d7304e97ecc56b78e1a890762346d192c792f4c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -779,7 +779,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -779,7 +779,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

Datei anzeigen

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8b377ca58a0e4d11701a831c5f976e61f642f8a8..2aefacac58212d9ba76cf449455241d9c1fd36db 100644 index 00726cca55d45043003032e32b045d84e74cf1d2..bd392ff909a217d069a81b2026ab3ce4c38662f3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2651,14 +2651,27 @@ public abstract class LivingEntity extends Entity { @@ -2672,14 +2672,27 @@ public abstract class LivingEntity extends Entity {
return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D; return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D;
} }

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 998f63fba0d45a44eaf9cbe48a034bac4e02e965..6b7943e8348b0a41ca69fb56ccfd5f1c1484eb07 100644 index a54c0a4d0849087229d08ccc89872c3603f2f426..5ef58831a857fd8aa4ac30147762dc17d773a53e 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -889,17 +889,7 @@ public class Util { @@ -892,17 +892,7 @@ public class Util {
} }
public void openUrl(URL url) { public void openUrl(URL url) {

Datei anzeigen

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Thu, 26 Aug 2021 12:09:47 +0200
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 0e04275f62c5c2d8afede431f78f38f06e8009e6..7017dd42f832d928f1008a05f01701667d951644 100644
--- a/src/main/java/net/minecraft/resources/ResourceLocation.java
+++ b/src/main/java/net/minecraft/resources/ResourceLocation.java
@@ -32,9 +32,9 @@ public class ResourceLocation implements Comparable<ResourceLocation> {
this.namespace = StringUtils.isEmpty(id[0]) ? "minecraft" : id[0];
this.path = id[1];
if (!isValidNamespace(this.namespace)) {
- throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + this.namespace + ":" + this.path);
+ throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper
} else if (!isValidPath(this.path)) {
- throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + this.path);
+ throw new ResourceLocationException("Non [a-z0-9/._-] character in path of location: " + this.namespace + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper
}
}

Datei anzeigen

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sat, 16 Oct 2021 17:38:35 -0700
Subject: [PATCH] Use correct LevelStem registry when loading default
end/nether
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/resources/RegistryLoader.java b/src/main/java/net/minecraft/resources/RegistryLoader.java
index 8da1226a6c293abb038d10c7921a77ed71ad06cc..f958f0ae738a6fb26400e17e54c8d69e95268cdd 100644
--- a/src/main/java/net/minecraft/resources/RegistryLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryLoader.java
@@ -46,6 +46,12 @@ public class RegistryLoader {
RegistryLoader.ReadCache<E> readCache = this.readCache(registryRef);
DataResult<Holder<E>> dataResult = readCache.values.get(entryKey);
if (dataResult != null) {
+ // Paper start - register in registry due to craftbukkit running this 3 times instead of once
+ if (registryRef == (ResourceKey) Registry.LEVEL_STEM_REGISTRY && dataResult.result().isPresent()) {
+ // OptionalInt.empty() because the LevelStem registry is only loaded from the resource manager, not the InMemory resource access
+ registry.registerOrOverride(java.util.OptionalInt.empty(), entryKey, dataResult.result().get().value(), dataResult.lifecycle());
+ }
+ // Paper end
return dataResult;
} else {
Holder<E> holder = registry.getOrCreateHolderOrThrow(entryKey);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ee6dc7d149f96c9a63e627e765b8d3a0107af864..75651db840072806bb4ef15c4de370fdf6b46c05 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -553,7 +553,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long i = generatorsettings.seed();
long j = BiomeManager.obfuscateSeed(i);
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(iworlddataserver));
- LevelStem worlddimension = (LevelStem) iregistry.get(dimensionKey);
+ // Paper start - Use correct LevelStem registry
+ final LevelStem worlddimension;
+ if (dimensionKey == LevelStem.END || dimensionKey == LevelStem.NETHER) {
+ worlddimension = generatorsettings.dimensions().get(dimensionKey);
+ } else {
+ worlddimension = iregistry.get(dimensionKey);
+ }
+ // Paper end
org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value());
if (biomeProvider == null && gen != null) {