mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Apply all patches
This commit is contained in:
parent
286f49b866
commit
4ce929d6da
38 changed files with 139 additions and 124 deletions
|
@ -94,8 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
- Vec3 startPos = CraftLocation.toVec3D(start);
|
- Vec3 startPos = CraftLocation.toVec3D(start);
|
||||||
+ Vec3 startPos = io.papermc.paper.util.MCUtil.toVec3(start); // Paper
|
+ Vec3 startPos = io.papermc.paper.util.MCUtil.toVec3(start); // Paper
|
||||||
Vec3 endPos = startPos.add(dir.getX(), dir.getY(), dir.getZ());
|
Vec3 endPos = startPos.add(dir.getX(), dir.getY(), dir.getZ());
|
||||||
- HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null));
|
- HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()));
|
||||||
+ HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null), canCollide); // Paper - use method with canCollide predicate
|
+ HitResult nmsHitResult = this.getHandle().clip(new ClipContext(startPos, endPos, ignorePassableBlocks ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), CollisionContext.empty()), canCollide); // Paper - use method with canCollide predicate
|
||||||
|
|
||||||
return CraftRayTraceResult.fromNMS(this, nmsHitResult);
|
return CraftRayTraceResult.fromNMS(this, nmsHitResult);
|
||||||
}
|
}
|
|
@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
JsonObject jsonobject = GsonHelper.convertToJsonObject(jsonelement, "advancement");
|
JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class);
|
||||||
net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.fromJson(jsonobject, new DeserializationContext(minecraftkey, MinecraftServer.getServer().getLootData()));
|
net.minecraft.advancements.Advancement nms = Util.getOrThrow(net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement), JsonParseException::new);
|
||||||
if (nms != null) {
|
if (nms != null) {
|
||||||
- MinecraftServer.getServer().getAdvancements().advancements.put(minecraftkey, new AdvancementHolder(minecraftkey, nms));
|
- MinecraftServer.getServer().getAdvancements().advancements.put(minecraftkey, new AdvancementHolder(minecraftkey, nms));
|
||||||
+ // Paper start - Fix throw UnsupportedOperationException
|
+ // Paper start - Fix throw UnsupportedOperationException
|
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
for(CriterionTrigger.Listener<T> listener : set) {
|
for(CriterionTrigger.Listener<T> listener : set) {
|
||||||
T simpleInstance = listener.trigger();
|
T simpleInstance = listener.trigger();
|
||||||
if (predicate.test(simpleInstance)) {
|
if (predicate.test(simpleInstance)) {
|
||||||
Optional<ContextAwarePredicate> optional = simpleInstance.playerPredicate();
|
Optional<ContextAwarePredicate> optional = simpleInstance.player();
|
||||||
- if (optional.isEmpty() || optional.get().matches(lootContext)) {
|
- if (optional.isEmpty() || optional.get().matches(lootContext)) {
|
||||||
+ if (optional.isEmpty() || optional.get().matches(lootContext = (lootContext == null ? EntityPredicate.createContext(player, player) : lootContext))) { // Paper - lazily create LootContext for criterions
|
+ if (optional.isEmpty() || optional.get().matches(lootContext = (lootContext == null ? EntityPredicate.createContext(player, player) : lootContext))) { // Paper - lazily create LootContext for criterions
|
||||||
if (list == null) {
|
if (list == null) {
|
|
@ -192,38 +192,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
|
||||||
this.lastSpawnState = spawnercreature_d;
|
gameprofilerfiller.push("pollingChunks");
|
||||||
gameprofilerfiller.popPush("filteringLoadedChunks");
|
gameprofilerfiller.push("filteringLoadedChunks");
|
||||||
- List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(l);
|
- List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(this.chunkMap.size());
|
||||||
- Iterator iterator = this.chunkMap.getChunks().iterator();
|
- Iterator iterator = this.chunkMap.getChunks().iterator();
|
||||||
+ // Paper - optimise chunk tick iteration
|
|
||||||
+ // Paper - optimise chunk tick iteration
|
|
||||||
this.level.timings.chunkTicks.startTiming(); // Paper
|
this.level.timings.chunkTicks.startTiming(); // Paper
|
||||||
|
|
||||||
- while (iterator.hasNext()) {
|
- while (iterator.hasNext()) {
|
||||||
- ChunkHolder playerchunk = (ChunkHolder) iterator.next();
|
- ChunkHolder playerchunk = (ChunkHolder) iterator.next();
|
||||||
- LevelChunk chunk = playerchunk.getTickingChunk();
|
- LevelChunk chunk = playerchunk.getTickingChunk();
|
||||||
-
|
|
||||||
- if (chunk != null) {
|
|
||||||
- list.add(new ServerChunkCache.ChunkAndHolder(chunk, playerchunk));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ // Paper - optimise chunk tick iteration
|
|
||||||
|
|
||||||
gameprofilerfiller.popPush("spawnAndTick");
|
|
||||||
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
|
||||||
|
|
||||||
- Collections.shuffle(list);
|
|
||||||
- // Paper start - call player naturally spawn event
|
|
||||||
- int chunkRange = level.spigotConfig.mobSpawnRange;
|
|
||||||
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
|
||||||
- chunkRange = Math.min(chunkRange, 8);
|
|
||||||
- for (ServerPlayer entityPlayer : this.level.players()) {
|
|
||||||
- entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
|
|
||||||
- entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
|
||||||
- };
|
|
||||||
- // Paper end
|
|
||||||
- Iterator iterator1 = list.iterator();
|
|
||||||
+ // Paper start - optimise chunk tick iteration
|
+ // Paper start - optimise chunk tick iteration
|
||||||
+ ChunkMap playerChunkMap = this.chunkMap;
|
+ ChunkMap playerChunkMap = this.chunkMap;
|
||||||
+ for (ServerPlayer player : this.level.players) {
|
+ for (ServerPlayer player : this.level.players) {
|
||||||
|
@ -235,7 +212,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ int viewDistance = io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player);
|
+ int viewDistance = io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player);
|
||||||
+
|
|
||||||
|
- if (chunk != null) {
|
||||||
|
- list.add(new ServerChunkCache.ChunkAndHolder(chunk, playerchunk));
|
||||||
+ // copied and modified from isOutisdeRange
|
+ // copied and modified from isOutisdeRange
|
||||||
+ int chunkRange = (int)level.spigotConfig.mobSpawnRange;
|
+ int chunkRange = (int)level.spigotConfig.mobSpawnRange;
|
||||||
+ chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
|
+ chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
|
||||||
|
@ -248,7 +227,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ player.playerNaturallySpawnedEvent = null;
|
+ player.playerNaturallySpawnedEvent = null;
|
||||||
+ player.lastEntitySpawnRadiusSquared = -1.0;
|
+ player.lastEntitySpawnRadiusSquared = -1.0;
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
|
+ int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
|
||||||
+ int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
|
+ int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
|
||||||
|
@ -257,80 +236,137 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
|
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
|
||||||
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
|
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
|
||||||
+ player.playerNaturallySpawnedEvent = event;
|
+ player.playerNaturallySpawnedEvent = event;
|
||||||
+ }
|
}
|
||||||
+ // Paper end - optimise chunk tick iteration
|
+ // Paper end - optimise chunk tick iteration
|
||||||
|
|
||||||
int chunksTicked = 0; // Paper
|
if (this.level.getServer().tickRateManager().runsNormally()) {
|
||||||
+ // Paper start - optimise chunk tick iteration
|
gameprofilerfiller.popPush("naturalSpawnCount");
|
||||||
+ io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
+ Iterator<LevelChunk> iterator1;
|
gameprofilerfiller.popPush("spawnAndTick");
|
||||||
+ if (this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
|
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||||
+ iterator1 = this.tickingChunks.iterator();
|
|
||||||
+ } else {
|
|
||||||
+ iterator1 = this.tickingChunks.unsafeIterator();
|
|
||||||
+ List<LevelChunk> shuffled = Lists.newArrayListWithCapacity(this.tickingChunks.size());
|
|
||||||
+ while (iterator1.hasNext()) {
|
|
||||||
+ shuffled.add(iterator1.next());
|
|
||||||
+ }
|
|
||||||
+ Collections.shuffle(shuffled);
|
|
||||||
+ iterator1 = shuffled.iterator();
|
|
||||||
+ }
|
|
||||||
+ try {
|
|
||||||
+ // Paper end - optimise chunk tick iteration
|
|
||||||
while (iterator1.hasNext()) {
|
|
||||||
- ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
|
|
||||||
- LevelChunk chunk1 = chunkproviderserver_a.chunk;
|
|
||||||
+ LevelChunk chunk1 = iterator1.next(); // Paper - optimise chunk tick iteration
|
|
||||||
ChunkPos chunkcoordintpair = chunk1.getPos();
|
|
||||||
|
|
||||||
- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
|
- Util.shuffle(list, this.level.random);
|
||||||
|
- // Paper start - call player naturally spawn event
|
||||||
|
- int chunkRange = level.spigotConfig.mobSpawnRange;
|
||||||
|
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
||||||
|
- chunkRange = Math.min(chunkRange, 8);
|
||||||
|
- for (ServerPlayer entityPlayer : this.level.players()) {
|
||||||
|
- entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
|
||||||
|
- entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
||||||
+ // Paper start - optimise chunk tick iteration
|
+ // Paper start - optimise chunk tick iteration
|
||||||
+ com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
+ for (ServerPlayer player : this.level.players) {
|
||||||
+ = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
+ if (!player.affectsSpawning || player.isSpectator()) {
|
||||||
+ if (playersNearby == null) {
|
+ playerChunkMap.playerMobSpawnMap.remove(player);
|
||||||
+ continue;
|
+ player.playerNaturallySpawnedEvent = null;
|
||||||
+ }
|
+ player.lastEntitySpawnRadiusSquared = -1.0;
|
||||||
+ Object[] rawData = playersNearby.getRawData();
|
|
||||||
+ boolean spawn = false;
|
|
||||||
+ boolean tick = false;
|
|
||||||
+ for (int itr = 0, len = playersNearby.size(); itr < len; ++itr) {
|
|
||||||
+ ServerPlayer player = (ServerPlayer)rawData[itr];
|
|
||||||
+ if (player.isSpectator()) {
|
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ double distance = ChunkMap.euclideanDistanceSquared(chunkcoordintpair, player);
|
+ int viewDistance = io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player);
|
||||||
+ spawn |= player.lastEntitySpawnRadiusSquared >= distance;
|
+
|
||||||
+ tick |= ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) * ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) >= distance;
|
+ // copied and modified from isOutisdeRange
|
||||||
+ if (spawn & tick) {
|
+ int chunkRange = (int)level.spigotConfig.mobSpawnRange;
|
||||||
+ break;
|
+ chunkRange = (chunkRange > viewDistance) ? viewDistance : chunkRange;
|
||||||
|
+ chunkRange = (chunkRange > DistanceManager.MOB_SPAWN_RANGE) ? DistanceManager.MOB_SPAWN_RANGE : chunkRange;
|
||||||
|
+
|
||||||
|
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(player.getBukkitEntity(), (byte)chunkRange);
|
||||||
|
+ event.callEvent();
|
||||||
|
+ if (event.isCancelled() || event.getSpawnRadius() < 0) {
|
||||||
|
+ playerChunkMap.playerMobSpawnMap.remove(player);
|
||||||
|
+ player.playerNaturallySpawnedEvent = null;
|
||||||
|
+ player.lastEntitySpawnRadiusSquared = -1.0;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int range = Math.min(event.getSpawnRadius(), DistanceManager.MOB_SPAWN_RANGE); // limit to max spawn range
|
||||||
|
+ int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getX());
|
||||||
|
+ int chunkZ = io.papermc.paper.util.CoordinateUtils.getChunkCoordinate(player.getZ());
|
||||||
|
+
|
||||||
|
+ playerChunkMap.playerMobSpawnMap.addOrUpdate(player, chunkX, chunkZ, range);
|
||||||
|
+ player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in anyPlayerCloseEnoughForSpawning
|
||||||
|
+ player.playerNaturallySpawnedEvent = event;
|
||||||
|
}
|
||||||
|
- // Paper end
|
||||||
|
+ // Paper end - optimise chunk tick iteration
|
||||||
|
int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||||
|
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||||
|
- Iterator iterator1 = list.iterator();
|
||||||
|
|
||||||
|
int chunksTicked = 0; // Paper
|
||||||
|
- while (iterator1.hasNext()) {
|
||||||
|
- ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
|
||||||
|
- LevelChunk chunk1 = chunkproviderserver_a.chunk;
|
||||||
|
+ // Paper start - optimise chunk tick iteration
|
||||||
|
+ io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = this.chunkMap.getNearbyPlayers(); // Paper - optimise chunk tick iteration
|
||||||
|
+ Iterator<LevelChunk> chunkIterator;
|
||||||
|
+ if (this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
|
||||||
|
+ chunkIterator = this.tickingChunks.iterator();
|
||||||
|
+ } else {
|
||||||
|
+ chunkIterator = this.tickingChunks.unsafeIterator();
|
||||||
|
+ List<LevelChunk> shuffled = Lists.newArrayListWithCapacity(this.tickingChunks.size());
|
||||||
|
+ while (chunkIterator.hasNext()) {
|
||||||
|
+ shuffled.add(chunkIterator.next());
|
||||||
|
+ }
|
||||||
|
+ Util.shuffle(shuffled, this.level.random);
|
||||||
|
+ chunkIterator = shuffled.iterator();
|
||||||
|
+ }
|
||||||
|
+ try {
|
||||||
|
+ // Paper end - optimise chunk tick iteration
|
||||||
|
+ while (chunkIterator.hasNext()) {
|
||||||
|
+ LevelChunk chunk1 = chunkIterator.next(); // Paper - optimise chunk tick iteration
|
||||||
|
ChunkPos chunkcoordintpair = chunk1.getPos();
|
||||||
|
|
||||||
|
- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
|
||||||
|
+ // Paper start - optimise chunk tick iteration
|
||||||
|
+ com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
||||||
|
+ = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||||
|
+ if (playersNearby == null) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Object[] rawData = playersNearby.getRawData();
|
||||||
|
+ boolean spawn = false;
|
||||||
|
+ boolean tick = false;
|
||||||
|
+ for (int itr = 0, len = playersNearby.size(); itr < len; ++itr) {
|
||||||
|
+ ServerPlayer player = (ServerPlayer)rawData[itr];
|
||||||
|
+ if (player.isSpectator()) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ double distance = ChunkMap.euclideanDistanceSquared(chunkcoordintpair, player);
|
||||||
|
+ spawn |= player.lastEntitySpawnRadiusSquared >= distance;
|
||||||
|
+ tick |= ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) * ((double)io.papermc.paper.util.player.NearbyPlayers.SPAWN_RANGE_VIEW_DISTANCE_BLOCKS) >= distance;
|
||||||
|
+ if (spawn & tick) {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) {
|
||||||
|
+ // Paper end - optimise chunk tick iteration
|
||||||
|
chunk1.incrementInhabitedTime(j);
|
||||||
|
- if (flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
|
||||||
|
+ if (spawn && flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
|
||||||
|
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
|
||||||
|
+ if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration
|
||||||
|
this.level.timings.doTickTiles.startTiming(); // Spigot
|
||||||
|
this.level.tickChunk(chunk1, l);
|
||||||
|
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ // Paper start - optimise chunk tick iteration
|
||||||
|
+ } finally {
|
||||||
|
+ if (chunkIterator instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
|
||||||
|
+ safeIterator.finishedIterating();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - optimise chunk tick iteration
|
+ // Paper end - optimise chunk tick iteration
|
||||||
+ if (tick && chunk1.chunkStatus.isOrAfter(net.minecraft.server.level.FullChunkStatus.ENTITY_TICKING)) { // Paper - optimise chunk tick iteration
|
|
||||||
chunk1.incrementInhabitedTime(j);
|
|
||||||
- if (flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
|
|
||||||
+ if (spawn && flag2 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) { // Spigot // Paper - optimise chunk tick iteration
|
|
||||||
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
|
gameprofilerfiller.popPush("customSpawners");
|
||||||
+ if (true || this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { // Paper - optimise chunk tick iteration
|
if (flag) {
|
||||||
this.level.tickChunk(chunk1, k);
|
|
||||||
if ((chunksTicked++ & 1) == 0) net.minecraft.server.MinecraftServer.getServer().executeMidTickTasks(); // Paper
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ // Paper start - optimise chunk tick iteration
|
|
||||||
+ } finally {
|
|
||||||
+ if (iterator1 instanceof io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator safeIterator) {
|
|
||||||
+ safeIterator.finishedIterating();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Paper end - optimise chunk tick iteration
|
|
||||||
this.level.timings.chunkTicks.stopTiming(); // Paper
|
|
||||||
gameprofilerfiller.popPush("customSpawners");
|
|
||||||
if (flag2) {
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +393,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ // Paper - optimise chunk tick iteration
|
+ // Paper - optimise chunk tick iteration
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
gameprofilerfiller.pop();
|
gameprofilerfiller.pop();
|
||||||
this.chunkMap.tick();
|
}
|
||||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@ -42,7 +42,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) {
|
public ItemEntity spawnAtLocation(ItemStack stack, float yOffset) {
|
||||||
|
@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else if (this.level().isClientSide) {
|
} else if (this.level().isClientSide) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start - Capture drops for death event
|
// CraftBukkit start - Capture drops for death event
|
||||||
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
|
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
|
||||||
|
@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
- entityitem.setDefaultPickUpDelay();
|
- entityitem.setDefaultPickUpDelay();
|
||||||
+ entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
|
+ entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
|
||||||
// Paper start
|
// Paper start
|
||||||
return this.spawnAtLocation(entityitem);
|
return this.spawnAtLocation(entityitem);
|
||||||
}
|
}
|
||||||
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
|
|
@ -9,15 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- 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
|
||||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
@Override
|
|
||||||
public boolean enforceSecureProfile() {
|
public boolean enforceSecureProfile() {
|
||||||
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
|
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
|
||||||
-
|
|
||||||
- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.profileKeySignatureValidator() != null;
|
- return dedicatedserverproperties.enforceSecureProfile && dedicatedserverproperties.onlineMode && this.services.canValidateProfileKeys();
|
||||||
+ // Paper start - fix secure profile with proxy online mode
|
+ // Paper start - fix secure profile with proxy online mode
|
||||||
+ return dedicatedserverproperties.enforceSecureProfile
|
+ return dedicatedserverproperties.enforceSecureProfile
|
||||||
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||||
+ && this.services.profileKeySignatureValidator() != null;
|
+ && this.services.canValidateProfileKeys();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
||||||
Date: Tue, 7 Nov 2023 18:59:04 -0800
|
|
||||||
Subject: [PATCH] Don't unpack loot table for TEs not in world
|
|
||||||
|
|
||||||
Fixed by 23w44a/1.20.3. Remove it then
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unpackLootTable(@Nullable Player player) {
|
|
||||||
- if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
|
|
||||||
+ if (this.level != null && this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper - don't unpack loot table if not in world
|
|
||||||
LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable);
|
|
||||||
if (player instanceof ServerPlayer) {
|
|
||||||
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.lootTable);
|
|
Loading…
Reference in a new issue