bunch o' patches
This commit is contained in:
parent
dc12a6e9fe
commit
0745f97bb5
|
@ -3,6 +3,7 @@ From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|||
Date: Wed, 15 Jul 2020 19:34:11 -0700
|
||||
Subject: [PATCH] Move range check for block placing up
|
||||
|
||||
TODO: vanilla has smth very similar already in place starting in 1.19 -MM
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 6acc4ee50ba32a208930bda89d37f155e3f4835a..0f031b094a180bcce1fe3b388321db838ca4df63 100644
|
|
@ -0,0 +1,22 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 28 Jun 2020 19:36:55 -0400
|
||||
Subject: [PATCH] Don't allow null UUID's for chat
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/ChatSender.java b/src/main/java/net/minecraft/network/chat/ChatSender.java
|
||||
index 1710d09d115a4adceeb56e07d68d8529eb099a26..8f5ccd61a37db718f527375387b421d438471b3c 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/ChatSender.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/ChatSender.java
|
||||
@@ -13,6 +13,11 @@ public record ChatSender(UUID uuid, Component name, @Nullable Component teamName
|
||||
public ChatSender(FriendlyByteBuf buf) {
|
||||
this(buf.readUUID(), buf.readComponent(), buf.readNullable(FriendlyByteBuf::readComponent));
|
||||
}
|
||||
+ // Paper start
|
||||
+ public ChatSender {
|
||||
+ com.google.common.base.Preconditions.checkNotNull(uuid, "uuid cannot be null");
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public static ChatSender system(Component name) {
|
||||
return new ChatSender(Util.NIL_UUID, name);
|
|
@ -7,10 +7,10 @@ Don't constantly send format: false for all formatting options when parent alrea
|
|||
has it false
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
index 0de5a46423ae0403dcbfca630dfd7c5ac1e1761d..26d43c229caf9f8504af7071c3a61ec6da7e27ec 100644
|
||||
index 4fede2161792ba3e7cdf0cc5a1f533188becc6f7..0f70be614f8f5350ad558d0ae645cdf0027e1e76 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
@@ -46,6 +46,7 @@ public final class CraftChatMessage {
|
||||
@@ -47,6 +47,7 @@ public final class CraftChatMessage {
|
||||
// Separate pattern with no group 3, new lines are part of previous string
|
||||
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
|
||||
// ChatColor.b does not explicitly reset, its more of empty
|
||||
|
@ -18,7 +18,7 @@ index 0de5a46423ae0403dcbfca630dfd7c5ac1e1761d..26d43c229caf9f8504af7071c3a61ec6
|
|||
private static final Style RESET = Style.EMPTY.withBold(false).withItalic(false).withUnderlined(false).withStrikethrough(false).withObfuscated(false);
|
||||
|
||||
private final List<Component> list = new ArrayList<Component>();
|
||||
@@ -67,6 +68,7 @@ public final class CraftChatMessage {
|
||||
@@ -68,6 +69,7 @@ public final class CraftChatMessage {
|
||||
Matcher matcher = (keepNewlines ? StringMessage.INCREMENTAL_PATTERN_KEEP_NEWLINES : StringMessage.INCREMENTAL_PATTERN).matcher(message);
|
||||
String match = null;
|
||||
boolean needsAdd = false;
|
||||
|
@ -26,7 +26,7 @@ index 0de5a46423ae0403dcbfca630dfd7c5ac1e1761d..26d43c229caf9f8504af7071c3a61ec6
|
|||
while (matcher.find()) {
|
||||
int groupId = 0;
|
||||
while ((match = matcher.group(++groupId)) == null) {
|
||||
@@ -112,7 +114,26 @@ public final class CraftChatMessage {
|
||||
@@ -113,7 +115,26 @@ public final class CraftChatMessage {
|
||||
throw new AssertionError("Unexpected message format");
|
||||
}
|
||||
} else { // Color resets formatting
|
|
@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot
|
|||
operations faster
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index a1060bd5ee1f2f6ce34cfcf2e76a89cddc425c5f..11745a71e5b2f00417b4e7f9cbc516071bd45ed9 100644
|
||||
index f8361dcf9d0378497ec5a34ea53b4e0019700851..e68cd32a7db88f29d3224b0908119232ab3cf71a 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -30,15 +30,16 @@ public class BlockPos extends Vec3i {
|
||||
|
@ -84,7 +84,7 @@ index a1060bd5ee1f2f6ce34cfcf2e76a89cddc425c5f..11745a71e5b2f00417b4e7f9cbc51607
|
|||
|
||||
public static long getFlatIndex(long y) {
|
||||
diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java
|
||||
index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab79d725ce 100644
|
||||
index a481bd6328fe9e66f6911bf32ed11947c504c93c..a9d0d72aad7b1b708617a082c5efcd881a0f00d3 100644
|
||||
--- a/src/main/java/net/minecraft/core/SectionPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/SectionPos.java
|
||||
@@ -38,7 +38,7 @@ public class SectionPos extends Vec3i {
|
||||
|
@ -96,7 +96,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public static SectionPos of(ChunkPos chunkPos, int y) {
|
||||
@@ -50,7 +50,7 @@ public class SectionPos extends Vec3i {
|
||||
@@ -54,7 +54,7 @@ public class SectionPos extends Vec3i {
|
||||
}
|
||||
|
||||
public static SectionPos of(long packed) {
|
||||
|
@ -105,7 +105,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public static SectionPos bottomOf(ChunkAccess chunk) {
|
||||
@@ -61,8 +61,16 @@ public class SectionPos extends Vec3i {
|
||||
@@ -65,8 +65,16 @@ public class SectionPos extends Vec3i {
|
||||
return offset(packed, direction.getStepX(), direction.getStepY(), direction.getStepZ());
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public static int posToSectionCoord(double coord) {
|
||||
@@ -78,10 +86,7 @@ public class SectionPos extends Vec3i {
|
||||
@@ -86,10 +94,7 @@ public class SectionPos extends Vec3i {
|
||||
}
|
||||
|
||||
public static short sectionRelativePos(BlockPos pos) {
|
||||
|
@ -135,7 +135,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public static int sectionRelativeX(short packedLocalPos) {
|
||||
@@ -144,16 +149,16 @@ public class SectionPos extends Vec3i {
|
||||
@@ -152,16 +157,16 @@ public class SectionPos extends Vec3i {
|
||||
return this.getZ();
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public int maxBlockX() {
|
||||
@@ -169,7 +174,8 @@ public class SectionPos extends Vec3i {
|
||||
@@ -177,7 +182,8 @@ public class SectionPos extends Vec3i {
|
||||
}
|
||||
|
||||
public static long blockToSection(long blockPos) {
|
||||
|
@ -168,7 +168,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
public static long getZeroNode(long pos) {
|
||||
@@ -193,15 +199,18 @@ public class SectionPos extends Vec3i {
|
||||
@@ -201,15 +207,18 @@ public class SectionPos extends Vec3i {
|
||||
return asLong(blockToSectionCoord(pos.getX()), blockToSectionCoord(pos.getY()), blockToSectionCoord(pos.getZ()));
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ index 49d6eebdc66478cb4c39d360db9cc0b822839fa1..b9555911a3e9ffca3ce7053075a36eab
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -214,16 +223,11 @@ public class SectionPos extends Vec3i {
|
||||
@@ -222,16 +231,11 @@ public class SectionPos extends Vec3i {
|
||||
}
|
||||
|
||||
public static Stream<SectionPos> cube(SectionPos center, int radius) {
|
|
@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead
|
|||
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0c736a05aaaaaaba65730ca9c731045ac1c9338c..212e43114e4797669338ffdd47548d0100365380 100644
|
||||
index f16737dcdff71c047284fc61ad0b74d65cd6dc3c..52ad386510af54e3c85ab7c952592982beaedbd1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -359,7 +359,7 @@ public final class CraftServer implements Server {
|
||||
@@ -354,7 +354,7 @@ public final class CraftServer implements Server {
|
||||
this.overrideSpawnLimits();
|
||||
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||
|
@ -34,7 +34,7 @@ index 0c736a05aaaaaaba65730ca9c731045ac1c9338c..212e43114e4797669338ffdd47548d01
|
|||
this.minimumAPI = this.configuration.getString("settings.minimum-api");
|
||||
this.loadIcon();
|
||||
}
|
||||
@@ -925,7 +925,7 @@ public final class CraftServer implements Server {
|
||||
@@ -920,7 +920,7 @@ public final class CraftServer implements Server {
|
||||
this.console.setMotd(config.motd);
|
||||
this.overrideSpawnLimits();
|
||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||
|
@ -44,7 +44,7 @@ index 0c736a05aaaaaaba65730ca9c731045ac1c9338c..212e43114e4797669338ffdd47548d01
|
|||
this.printSaveWarning = false;
|
||||
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 6bdf3679ea9461475b139a0622857b1dc56ea5b2..3c3959240c72fe705db5ee79cf8faaaddd361ee9 100644
|
||||
index 4685879eadff725311d648d165e2aa9ad851f6fc..62aef8853b168d6330fb3fe357dfb8de310cc37f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -277,8 +277,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
@ -50,10 +50,10 @@ index 7839ee18955725463fa420a19927019f9814ee24..536fc6bf1451ea84af6084b1976eee32
|
|||
return this.getBoolean(path, def, true);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f85ee370c89b59ad58f182da2ff6d0d11c6e3a8b..5edb1f4be4d0306a22827d1330a08251e5cb1fbe 100644
|
||||
index 06e7ca13f24838bdb2305e1c12b1aeac9152612f..817459063cbe37422d2d1b560f4751857139c6f6 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -898,7 +898,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -851,7 +851,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
try {
|
||||
this.isSaving = true;
|
||||
|
@ -62,7 +62,7 @@ index f85ee370c89b59ad58f182da2ff6d0d11c6e3a8b..5edb1f4be4d0306a22827d1330a08251
|
|||
flag3 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
@@ -1440,13 +1440,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1398,13 +1398,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ index f85ee370c89b59ad58f182da2ff6d0d11c6e3a8b..5edb1f4be4d0306a22827d1330a08251
|
|||
// Paper start - move executeAll() into full server tick timing
|
||||
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22..71af341580f08c71f4c4e6c758955cad14e7530d 100644
|
||||
index 4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f..c21fd8a27be72056122643c9f3dda352d55bd0ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -92,6 +92,8 @@ public class ChunkHolder {
|
||||
|
@ -110,7 +110,7 @@ index 1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22..71af341580f08c71f4c4e6c758955cad
|
|||
|
||||
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
||||
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
|
||||
@@ -498,7 +500,19 @@ public class ChunkHolder {
|
||||
@@ -502,7 +504,19 @@ public class ChunkHolder {
|
||||
boolean flag2 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER);
|
||||
boolean flag3 = playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER);
|
||||
|
||||
|
@ -130,7 +130,7 @@ index 1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22..71af341580f08c71f4c4e6c758955cad
|
|||
if (!flag2 && flag3) {
|
||||
int expectCreateCount = ++this.fullChunkCreateCount; // Paper
|
||||
this.fullChunkFuture = chunkStorage.prepareAccessibleChunk(this);
|
||||
@@ -629,9 +643,33 @@ public class ChunkHolder {
|
||||
@@ -633,9 +647,33 @@ public class ChunkHolder {
|
||||
}
|
||||
|
||||
public void refreshAccessibility() {
|
||||
|
@ -165,10 +165,10 @@ index 1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22..71af341580f08c71f4c4e6c758955cad
|
|||
for (int i = 0; i < this.futures.length(); ++i) {
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131 100644
|
||||
index 95dbf60604d86666a359c0d861ef3eb8313e6184..73990ab5095253ae76d36968abf4d10f50af4d1b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -104,6 +104,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
|
||||
@@ -107,6 +107,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
|
||||
import net.minecraft.world.level.storage.DimensionDataStorage;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -176,7 +176,7 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
import org.slf4j.Logger;
|
||||
@@ -694,6 +695,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -710,6 +711,64 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
protected void saveAllChunks(boolean flush) {
|
||||
if (flush) {
|
||||
List<ChunkHolder> list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList());
|
||||
@@ -778,13 +837,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -794,13 +853,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
int l = 0;
|
||||
|
@ -256,7 +256,7 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
|
||||
}
|
||||
|
||||
@@ -822,6 +875,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -838,6 +891,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
this.level.unload(chunk);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
|
||||
this.lightEngine.updateChunkStatus(ichunkaccess.getPos());
|
||||
this.lightEngine.tryScheduleUpdate();
|
||||
@@ -1232,6 +1286,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1258,6 +1312,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
asyncSaveData, chunk);
|
||||
|
||||
chunk.setUnsaved(false);
|
||||
|
@ -272,7 +272,7 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
}
|
||||
// Paper end
|
||||
|
||||
@@ -1241,6 +1296,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1267,6 +1322,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
if (!chunk.isUnsaved()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -281,10 +281,10 @@ index 2c9cd3619b0759905637eff746a761ebe89a38d8..1614b056d9e0c9e6b62d6c6a8926e87b
|
|||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 846e6f41fdb6413b10f908c6b3f5c199a9f5ef38..9079e469161098e1520f6b9fd963adedd500024b 100644
|
||||
index d247f8997e5afc4c6449495da0b302a4814df495..92ef60cb5ec230ac359b321249cacca18fd4d2da 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -813,6 +813,15 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -814,6 +814,15 @@ public class ServerChunkCache extends ChunkSource {
|
||||
} // Paper - Timings
|
||||
}
|
||||
|
||||
|
@ -301,10 +301,10 @@ index 846e6f41fdb6413b10f908c6b3f5c199a9f5ef38..9079e469161098e1520f6b9fd963aded
|
|||
public void close() throws IOException {
|
||||
// CraftBukkit start
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 894186d25863a437e49ef0c10b2f2dab34af7ed0..38af4d10e2e09c0917ae8ff265e5a6c610fa4404 100644
|
||||
index e5f7ed6e70231c447f3983ae181e23acc6f69de6..c79dd3cdb5d3d1e8cb79a7efdf48f513679c5f51 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1061,6 +1061,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1079,6 +1079,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
|
||||
}
|
||||
|
||||
|
@ -343,10 +343,10 @@ index 894186d25863a437e49ef0c10b2f2dab34af7ed0..38af4d10e2e09c0917ae8ff265e5a6c6
|
|||
ServerChunkCache chunkproviderserver = this.getChunkSource();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d60d3ea1ec9c14dafda9f0fffd16ed2ba947789b..0a2c94e289dd0dac88a38516a9be09a03acfc579 100644
|
||||
index 896fe621d47ff3fef40e109d63251480fea082a9..b4d6f2bc63bb7ad2e08897b73392df5ab1c77910 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -170,6 +170,7 @@ import org.bukkit.inventory.MainHand;
|
||||
@@ -177,6 +177,7 @@ import org.bukkit.inventory.MainHand;
|
||||
public class ServerPlayer extends Player {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
@ -355,10 +355,10 @@ index d60d3ea1ec9c14dafda9f0fffd16ed2ba947789b..0a2c94e289dd0dac88a38516a9be09a0
|
|||
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
||||
public ServerGamePacketListenerImpl connection;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 4ccb008508a008d782f0c639663b423f1a6dfdef..7edadb4795618b38d2fa321faa085cc69f9529bf 100644
|
||||
index 1b955c9a6f5532d30d58b8a852d7583d3effd53a..8f33d924236811c5636469ad218096d18ec67643 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -560,6 +560,7 @@ public abstract class PlayerList {
|
||||
@@ -561,6 +561,7 @@ public abstract class PlayerList {
|
||||
protected void save(ServerPlayer player) {
|
||||
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
||||
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
|
||||
|
@ -366,7 +366,7 @@ index 4ccb008508a008d782f0c639663b423f1a6dfdef..7edadb4795618b38d2fa321faa085cc6
|
|||
this.playerIo.save(player);
|
||||
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
|
||||
|
||||
@@ -1162,10 +1163,22 @@ public abstract class PlayerList {
|
||||
@@ -1163,10 +1164,22 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void saveAll() {
|
||||
|
@ -391,19 +391,19 @@ index 4ccb008508a008d782f0c639663b423f1a6dfdef..7edadb4795618b38d2fa321faa085cc6
|
|||
MinecraftTimings.savePlayers.stopTiming(); // Paper
|
||||
return null; }); // Paper - ensure main
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
index 8038b37bdfdd41eadb4f3cb4dd7ef245051ed3a4..20b288fdef75c9994b174cb4d7d082c5e69eb26b 100644
|
||||
index a5160f0336f1ab50e415bddaa958616e8a08dfee..bef890d2e8d883165a48a7f5b39a865198749a0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
@@ -458,6 +458,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
@@ -455,6 +455,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
public LevelHeightAccessor getHeightAccessorForGeneration() {
|
||||
return this;
|
||||
}
|
||||
+ public void setLastSaved(long ticks) {} // Paper
|
||||
|
||||
// CraftBukkit start - decompile error
|
||||
public static record TicksToSave(SerializableTickContainer<Block> blocks, SerializableTickContainer<Fluid> fluids) {
|
||||
|
||||
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 0b049b267a1e1d6b48c035ed54ff24337863fb9e..b9ad77606d88d7ca41c0070063b8599ecc048422 100644
|
||||
index f362f0edf7ee81d2e21d86d57b86420f9619f32e..2e84b4e52055ec373e8d59c4bea8afefae1ba8e1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -87,6 +87,12 @@ public class LevelChunk extends ChunkAccess {
|
|
@ -46,12 +46,12 @@ index 0778fdd4f47015787f7ffbfb39c31ec0e1c039bd..912fd5135e89348bdd3c0a8b6c07860e
|
|||
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
index d6a742066b2e5ebf3975c190cca5134abf3cf1a3..fdf78f7ab15a8c81699c6c0e5d0333c482c7d0a3 100644
|
||||
index 2df77845b78b9d5fae0a36103d42c8202ee2af9e..07abc6f2edab5a5750199dd9c24b890becc4d073 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -74,6 +74,11 @@ public final class NbtUtils {
|
||||
if (compound.contains("Name", 8)) {
|
||||
string = compound.getString("Name");
|
||||
if (nbt.contains("Name", 8)) {
|
||||
string = nbt.getString("Name");
|
||||
}
|
||||
+ // Paper start - support string UUID's
|
||||
+ if (compound.contains("Id", 8)) {
|
||||
|
@ -59,5 +59,5 @@ index d6a742066b2e5ebf3975c190cca5134abf3cf1a3..fdf78f7ab15a8c81699c6c0e5d0333c4
|
|||
+ }
|
||||
+ // Paper end
|
||||
|
||||
if (compound.hasUUID("Id")) {
|
||||
uUID = compound.getUUID("Id");
|
||||
if (nbt.hasUUID("Id")) {
|
||||
uUID = nbt.getUUID("Id");
|
|
@ -9,7 +9,7 @@ growing to large sizes and preventing login.
|
|||
This now automatically cleans up the extra properties.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
index fdf78f7ab15a8c81699c6c0e5d0333c482c7d0a3..050ee055b9a2a0767f58d6677ad7f2d927fbaa54 100644
|
||||
index 07abc6f2edab5a5750199dd9c24b890becc4d073..2cb1c1475c6917a0fae498fdd2c3c9eb7927438c 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -92,7 +92,8 @@ public final class NbtUtils {
|
||||
|
@ -23,10 +23,10 @@ index fdf78f7ab15a8c81699c6c0e5d0333c482c7d0a3..050ee055b9a2a0767f58d6677ad7f2d9
|
|||
String string3 = compoundTag2.getString("Value");
|
||||
if (compoundTag2.contains("Signature", 8)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/PlayerHeadItem.java b/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
||||
index 7fb2cc8d49a2d8f256f625cb99b66ef8efc3fc0e..f9980110a4614bb0206dce3dc796d9459069b750 100644
|
||||
index 2fb1500e9d3202b6377bf4d8e50102a98f409148..72a0c7ad03b18c3156b4f3c7240f7551583f981c 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
||||
@@ -53,6 +53,18 @@ public class PlayerHeadItem extends StandingAndWallBlockItem {
|
||||
@@ -52,6 +52,18 @@ public class PlayerHeadItem extends StandingAndWallBlockItem {
|
||||
});
|
||||
// CraftBukkit start
|
||||
} else {
|
|
@ -30,7 +30,7 @@ index 0520c45197629cbdc2777d9ae11eef572e793160..46c313d581b9af6aa0a48f97ae3cc800
|
|||
public CraftAttributeMap(AttributeMap handle) {
|
||||
this.handle = handle;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index ac779f3cedb7ddd74f39a18f08afbcdad8cd13b1..389a0af8562bf7de6b8e52015286da06aef2f428 100644
|
||||
index 4304ee35a9bd912c2ae4058febf22f0eea25adbd..4a91da3561d16995e8cfe04ebbc104da009a2503 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -480,7 +480,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Mon, 29 Jun 2020 17:03:06 -0400
|
||||
Subject: [PATCH] Remove some streams from structures
|
||||
|
||||
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
index 89ec6902abaed56e57d3aa7e355a3db70baa02a0..0548be182bc342cc3855dcf7cc11519fc2805121 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
@@ -36,9 +36,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
||||
int j = chunkPos.getMinBlockZ();
|
||||
ObjectList<Beardifier.Rigid> objectList = new ObjectArrayList<>(10);
|
||||
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<>(32);
|
||||
- structureManager.startsForStructure(chunkPos, (structure) -> {
|
||||
+ // Paper start - replace for each
|
||||
+ for (net.minecraft.world.level.levelgen.structure.StructureStart structureStart : structureManager.startsForStructure(chunkPos, (structure) -> {
|
||||
return structure.terrainAdaptation() != TerrainAdjustment.NONE;
|
||||
- }).forEach((structureStart) -> {
|
||||
+ })) {
|
||||
TerrainAdjustment terrainAdjustment = structureStart.getStructure().terrainAdaptation();
|
||||
|
||||
for(StructurePiece structurePiece : structureStart.getPieces()) {
|
||||
@@ -63,7 +64,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
||||
}
|
||||
}
|
||||
|
||||
- });
|
||||
+ } // Paper
|
||||
return new Beardifier(objectList.iterator(), objectList2.iterator());
|
||||
}
|
||||
|
|
@ -5,24 +5,16 @@ Subject: [PATCH] Remove streams from classes related villager gossip
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
index e98951ac056910340c498d866715e174d461f723..8d879cc6f8b96c7521d4b55fcf1f3abb9e669ecd 100644
|
||||
index 0de65462956fa734b6405614e047161696e596fb..aa277479f5552503a202a057b1a3ede379f2bbbf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
@@ -8,6 +8,7 @@ import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -58,8 +59,21 @@ public class GossipContainer {
|
||||
@@ -58,8 +58,21 @@ public class GossipContainer {
|
||||
});
|
||||
}
|
||||
|
||||
+ // Paper start - Remove streams from reputation
|
||||
+ private List<GossipContainer.GossipEntry> decompress() {
|
||||
+ List<GossipContainer.GossipEntry> list = new ObjectArrayList<>();
|
||||
+ List<GossipContainer.GossipEntry> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ for (Map.Entry<UUID, GossipContainer.EntityGossips> entry : getReputations().entrySet()) {
|
||||
+ for (GossipContainer.GossipEntry cur : entry.getValue().decompress(entry.getKey())) {
|
||||
+ if (cur.weightedValue() != 0)
|
||||
|
@ -33,26 +25,22 @@ index e98951ac056910340c498d866715e174d461f723..8d879cc6f8b96c7521d4b55fcf1f3abb
|
|||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private Collection<GossipContainer.GossipEntry> selectGossipsForTransfer(Random random, int count) {
|
||||
private Collection<GossipContainer.GossipEntry> selectGossipsForTransfer(RandomSource random, int count) {
|
||||
- List<GossipContainer.GossipEntry> list = this.unpack().collect(Collectors.toList());
|
||||
+ List<GossipContainer.GossipEntry> list = decompress(); // Paper - Remove streams from reputation
|
||||
+ List<GossipContainer.GossipEntry> list = this.decompress(); // Paper - Remove streams from reputation
|
||||
if (list.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
@@ -152,9 +166,9 @@ public class GossipContainer {
|
||||
|
||||
@@ -153,7 +166,7 @@ public class GossipContainer {
|
||||
}
|
||||
|
||||
- public <T> Dynamic<T> store(DynamicOps<T> dynamicOps) {
|
||||
public <T> Dynamic<T> store(DynamicOps<T> dynamicOps) {
|
||||
- return new Dynamic<>(dynamicOps, dynamicOps.createList(this.unpack().map((gossipEntry) -> {
|
||||
- return gossipEntry.store(dynamicOps);
|
||||
+ public <T> Dynamic<T> store(DynamicOps<T> dynamicops) {
|
||||
+ return new Dynamic(dynamicops, dynamicops.createList(this.decompress().stream().map((reputation_b) -> {
|
||||
+ return reputation_b.store(dynamicops);
|
||||
+ return new Dynamic<>(dynamicOps, dynamicOps.createList(this.decompress().stream().map((gossipEntry) -> {
|
||||
return gossipEntry.store(dynamicOps);
|
||||
}).map(Dynamic::getValue)));
|
||||
}
|
||||
|
||||
@@ -179,11 +193,23 @@ public class GossipContainer {
|
||||
@@ -179,11 +192,23 @@ public class GossipContainer {
|
||||
final Object2IntMap<GossipType> entries = new Object2IntOpenHashMap<>();
|
||||
|
||||
public int weightedValue(Predicate<GossipType> gossipTypeFilter) {
|
||||
|
@ -72,7 +60,7 @@ index e98951ac056910340c498d866715e174d461f723..8d879cc6f8b96c7521d4b55fcf1f3abb
|
|||
+ }
|
||||
+
|
||||
+ public List<GossipContainer.GossipEntry> decompress(UUID uuid) {
|
||||
+ List<GossipContainer.GossipEntry> list = new ObjectArrayList<>();
|
||||
+ List<GossipContainer.GossipEntry> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
|
||||
+ for (Object2IntMap.Entry<GossipType> entry : entries.object2IntEntrySet()) {
|
||||
+ list.add(new GossipContainer.GossipEntry(uuid, entry.getKey(), entry.getIntValue()));
|
||||
+ }
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 389a0af8562bf7de6b8e52015286da06aef2f428..24588933984cea75e983752ebd0c5643ff1e7846 100644
|
||||
index 4a91da3561d16995e8cfe04ebbc104da009a2503..c475ddea1c995df1dfcaf4f491f341761a5f8802 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -874,11 +874,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
@ -7,16 +7,16 @@ CraftBukkit has a bug in their implementation and is incorrectly handling forget
|
|||
Also adds more target reasons for why it forgot target.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
|
||||
index 3210f8de59b8760fc48809bd451744b46119c0b0..85f8634edddd3b8a05cb3f89262032fb8c49b560 100644
|
||||
index 44d3c9da39389b72bfc5ee39c1abb6baf9dccdb1..565691aaed71de3efe15dd751fbbbe7849ef56b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
|
||||
@@ -50,15 +50,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
|
||||
@@ -56,15 +56,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
|
||||
LivingEntity entityliving = this.getAttackTarget(entity);
|
||||
|
||||
if (!entity.canAttack(entityliving)) {
|
||||
- this.clearAttackTarget(entity);
|
||||
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
|
||||
} else if (StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entity)) {
|
||||
} else if (this.canGrowTiredOfTryingToReachTarget && StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entity)) {
|
||||
- this.clearAttackTarget(entity);
|
||||
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper
|
||||
} else if (this.isCurrentTargetDeadOrRemoved(entity)) {
|
||||
|
@ -31,7 +31,7 @@ index 3210f8de59b8760fc48809bd451744b46119c0b0..85f8634edddd3b8a05cb3f89262032fb
|
|||
}
|
||||
}
|
||||
|
||||
@@ -82,17 +82,20 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
|
||||
@@ -88,17 +88,20 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
|
||||
return optional.isPresent() && !((LivingEntity) optional.get()).isAlive();
|
||||
}
|
||||
|
||||
|
@ -41,20 +41,19 @@ index 3210f8de59b8760fc48809bd451744b46119c0b0..85f8634edddd3b8a05cb3f89262032fb
|
|||
- LivingEntity old = entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ // Paper start - fix this event
|
||||
+ //EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ // LivingEntity old = entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entity, null, reason);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
- if (event.getTarget() != null) {
|
||||
- entity.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ // comment out, bad logic - bad
|
||||
+ /*if (event.getTarget() != null) {
|
||||
+ e0.getBehaviorController().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
entity.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
return;
|
||||
- }
|
||||
+ }*/
|
||||
+ // Paper end
|
||||
// CraftBukkit end
|
||||
this.onTargetErased.accept(entity);
|
||||
this.onTargetErased.accept(entity, this.getAttackTarget(entity));
|
||||
entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 5d51296954dc9e1c3c9576d7afb5287c76ab3afe..ba0f9d729a4d4bd35050ab41d6d70ee3ea46beeb 100644
|
||||
index 36fa5864edb6da34ba005487fd62255421d6190f..54983139e0b2e7fab96e5bf2be31fec2c1776f0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1372,7 +1372,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1408,7 +1408,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.isInWater() || this.isInRain();
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,10 @@ index 5d51296954dc9e1c3c9576d7afb5287c76ab3afe..ba0f9d729a4d4bd35050ab41d6d70ee3
|
|||
return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index b732d9de71e5799969852a22f22e860637f7d64e..1f2503748e0534d48db558d09997683d563b649c 100644
|
||||
index 5f232c45d6e01943cf1ca1d7802d4915887a6b32..904ce802b2aaebc1f48f7c444e2611fefa14f9a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1243,5 +1243,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -1254,5 +1254,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
||||
return getHandle().spawnReason;
|
||||
}
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Update itemstack legacy name and lore
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index b78769cf6a70fb7513ea8d3302cb2dd4bf242752..1edd9d27a3af291e7ed9900009d0f6c30845e0b7 100644
|
||||
index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..bdd2e7e723e1f90bf2b7f6067f6b2f2855c2065f 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -170,6 +170,44 @@ public final class ItemStack {
|
||||
@@ -168,6 +168,44 @@ public final class ItemStack {
|
||||
list.sort((Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ index b78769cf6a70fb7513ea8d3302cb2dd4bf242752..1edd9d27a3af291e7ed9900009d0f6c3
|
|||
// Paper end
|
||||
|
||||
public ItemStack(ItemLike item) {
|
||||
@@ -220,6 +258,7 @@ public final class ItemStack {
|
||||
@@ -222,6 +260,7 @@ public final class ItemStack {
|
||||
this.tag = nbttagcompound.getCompound("tag").copy();
|
||||
// CraftBukkit end
|
||||
this.processEnchantOrder(this.tag); // Paper
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Spawn player in correct world on login
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 7edadb4795618b38d2fa321faa085cc69f9529bf..9d9570b281041a08879f0bc3eedeef764ce5a47c 100644
|
||||
index 8f33d924236811c5636469ad218096d18ec67643..f9fbbd0130c1d3e2ed51f0c79d275c6861aec4fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -196,7 +196,18 @@ public abstract class PlayerList {
|
||||
@@ -199,7 +199,18 @@ public abstract class PlayerList {
|
||||
}String lastKnownName = s; // Paper
|
||||
// CraftBukkit end
|
||||
|
|
@ -8,88 +8,88 @@ Adds a new event for all crafting stations that generate a result slot item
|
|||
Anvil, Grindstone and Smithing now extend this event
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
index a91c26fcf33b39b81a077d42ac0183616e213292..ec89526f1eabef4681fed57b74fc1bef5be4c0c1 100644
|
||||
index eb22059fe008c3d3fc0364a7f85f91b4cca8b328..506d758efbf16da9467f120321d2359a8832e477 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
@@ -316,6 +316,7 @@ public class AnvilMenu extends ItemCombinerMenu {
|
||||
}
|
||||
|
||||
this.createResult();
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
index fc2b400c58ddbd7b012707c61d9a37363d351251..35e13a5fc23fc0cc046345059b43b37b348a3803 100644
|
||||
index fc2b400c58ddbd7b012707c61d9a37363d351251..4f5593d387545545e30475d3edaa92a4306ba96b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
|
||||
@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
|
||||
this.setupResultSlot(itemstack, itemstack1, itemstack2);
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index aa0ba9c7dcb0ee81c9081031c447eeab61d92a10..aa47947ea2f04afd3cca4b359891609025c112d5 100644
|
||||
index aa0ba9c7dcb0ee81c9081031c447eeab61d92a10..7a0c38c743ef02f5b9c052f88c2d6429a53b8286 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
super.slotsChanged(inventory);
|
||||
if (inventory == this.repairSlots) {
|
||||
this.createResult();
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
index f5e52220abc5c678c090b32d83eb9644fa91ce9d..0a30b051e2fb4f081d0d579b30732aa8289c3389 100644
|
||||
index f5e52220abc5c678c090b32d83eb9644fa91ce9d..35575434f3c90f1bd23df6584ee8a5a991f93f9f 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -78,6 +78,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
super.slotsChanged(inventory);
|
||||
if (inventory == this.inputSlots) {
|
||||
this.createResult();
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
index 5d9e444793bc9995f669596e699ace095ae3cb2b..fba8c59071847d9669943534ff8a0898b5787c28 100644
|
||||
index 3b3e7a89ce1fc719d241c7a3dc8c746191d91f85..9cbdcb87d76fa36887413754ef625a16624aadd7 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
|
||||
@@ -198,7 +198,8 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
}
|
||||
@@ -243,7 +243,8 @@ public class LoomMenu extends AbstractContainerMenu {
|
||||
this.resultSlot.set(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
this.setupResultSlot();
|
||||
- this.broadcastChanges();
|
||||
+ //this.c(); // Paper - done below
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper
|
||||
}
|
||||
|
||||
public void registerUpdateListener(Runnable inventoryChangeListener) {
|
||||
- this.broadcastChanges();
|
||||
+ // this.broadcastChanges(); // Paper - done below
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper
|
||||
} else {
|
||||
this.resultSlot.set(ItemStack.EMPTY);
|
||||
this.selectablePatterns = List.of();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
|
||||
index 92dd2ea23185bba311e184b2ac9744a423c102ea..cb3f522a586b841056c35378a49dd50bfa673f61 100644
|
||||
index 92dd2ea23185bba311e184b2ac9744a423c102ea..71bb09e3d31f098503d0e1bdf073b60f07d76ed0 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
|
||||
@@ -76,6 +76,7 @@ public class SmithingMenu extends ItemCombinerMenu {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index cdebd0cdf6eb901464cf4c16089b10ea0147b54d..221b6ffb426edc034183dbaf37de29c694874c62 100644
|
||||
index cdebd0cdf6eb901464cf4c16089b10ea0147b54d..b47dc7671fab2117b989d647d7e8e36d12af5f76 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -176,6 +176,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
this.setupRecipeList(inventory, itemstack);
|
||||
}
|
||||
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 1); // Paper
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper
|
||||
}
|
||||
|
||||
private void setupRecipeList(Container input, ItemStack stack) {
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2b63a1cac397d80103b172477a0f3933e030e9a3..795b24ff5357a52624abc994bcfcc772ca7f5e7b 100644
|
||||
index 4cfb5c89538c8d0ce20883bc6d2a5f7dc4967acd..ddfa929499aa65d40d44d70a8dc6f2656f0242d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3378,7 +3378,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3410,7 +3410,7 @@ public abstract class LivingEntity extends Entity {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
super.stopRiding(suppressCancellation); // Paper - suppress
|
|
@ -80,7 +80,7 @@ index defeba92b2a7a5d9d5031f2adc0581d87070bb47..a6bcf936747720202857ba586fa35c46
|
|||
chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey));
|
||||
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f33917148d5e1 100644
|
||||
index c21fd8a27be72056122643c9f3dda352d55bd0ce..20b2736dcb1d1c7c046b4bb5ce9352ca90aaf39a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -60,7 +60,7 @@ public class ChunkHolder {
|
||||
|
@ -100,7 +100,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
boolean isUpdateQueued = false; // Paper
|
||||
private final ChunkMap chunkMap; // Paper
|
||||
|
||||
@@ -444,12 +445,18 @@ public class ChunkHolder {
|
||||
@@ -448,12 +449,18 @@ public class ChunkHolder {
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
|
||||
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
|
||||
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
|
||||
@@ -460,9 +467,22 @@ public class ChunkHolder {
|
||||
@@ -464,9 +471,22 @@ public class ChunkHolder {
|
||||
// ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
|
@ -143,7 +143,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
// Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
||||
// lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
|
||||
// These actions may however happen deferred, so we manually set the needsSaving flag already here.
|
||||
@@ -519,12 +539,14 @@ public class ChunkHolder {
|
||||
@@ -523,12 +543,14 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER);
|
||||
// Paper start - cache ticking ready status
|
||||
this.fullChunkFuture.thenAccept(either -> {
|
||||
|
@ -158,7 +158,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
}
|
||||
});
|
||||
this.updateChunkToSave(this.fullChunkFuture, "full");
|
||||
@@ -545,6 +567,7 @@ public class ChunkHolder {
|
||||
@@ -549,6 +571,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.tickingChunkFuture.thenAccept(either -> {
|
||||
|
@ -166,7 +166,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
either.ifLeft(chunk -> {
|
||||
// note: Here is a very good place to add callbacks to logic waiting on this.
|
||||
ChunkHolder.this.isTickingReady = true;
|
||||
@@ -580,6 +603,7 @@ public class ChunkHolder {
|
||||
@@ -584,6 +607,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.entityTickingChunkFuture.thenAccept(either -> {
|
||||
|
@ -174,7 +174,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
either.ifLeft(chunk -> {
|
||||
ChunkHolder.this.isEntityTickingReady = true;
|
||||
// Paper start - entity ticking chunk set
|
||||
@@ -606,16 +630,45 @@ public class ChunkHolder {
|
||||
@@ -610,16 +634,45 @@ public class ChunkHolder {
|
||||
this.demoteFullChunk(chunkStorage, playerchunk_state1);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
});
|
||||
}
|
||||
}).exceptionally((throwable) -> {
|
||||
@@ -740,7 +793,134 @@ public class ChunkHolder {
|
||||
@@ -744,7 +797,134 @@ public class ChunkHolder {
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -360,20 +360,20 @@ index 71af341580f08c71f4c4e6c758955cad14e7530d..af0a36071b4cf1ec77839eb8aa8f3391
|
|||
return this.isEntityTickingReady;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1ebc914fc35 100644
|
||||
index 73990ab5095253ae76d36968abf4d10f50af4d1b..e4348b4f45515b879f9b2f839e7af7fa9c16a463 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -131,6 +131,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -134,6 +134,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
public final ServerLevel level;
|
||||
private final ThreadedLevelLightEngine lightEngine;
|
||||
private final BlockableEventLoop<Runnable> mainThreadExecutor;
|
||||
+ final java.util.concurrent.Executor mainInvokingExecutor; // Paper
|
||||
public ChunkGenerator generator;
|
||||
private RandomState randomState;
|
||||
public final Supplier<DimensionDataStorage> overworldDataStorage;
|
||||
private final PoiManager poiManager;
|
||||
@@ -320,6 +321,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.level = world;
|
||||
this.generator = chunkGenerator;
|
||||
@@ -332,6 +333,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
this.mainThreadExecutor = mainThreadExecutor;
|
||||
+ // Paper start
|
||||
+ this.mainInvokingExecutor = (run) -> {
|
||||
|
@ -387,7 +387,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
|
||||
|
||||
Objects.requireNonNull(mainThreadExecutor);
|
||||
@@ -431,6 +441,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -447,6 +457,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
// Paper start
|
||||
public void updatePlayerMobTypeMap(Entity entity) {
|
||||
if (!this.level.paperConfig.perPlayerMobSpawns) {
|
||||
@@ -541,6 +582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -557,6 +598,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
List<ChunkHolder> list1 = new ArrayList();
|
||||
int j = centerChunk.x;
|
||||
int k = centerChunk.z;
|
||||
|
@ -433,7 +433,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
|
||||
for (int l = -margin; l <= margin; ++l) {
|
||||
for (int i1 = -margin; i1 <= margin; ++i1) {
|
||||
@@ -559,6 +601,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -575,6 +617,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1);
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this);
|
||||
|
@ -448,7 +448,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
|
||||
list1.add(playerchunk);
|
||||
list.add(completablefuture);
|
||||
@@ -916,11 +966,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -932,11 +982,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
if (requiredStatus == ChunkStatus.EMPTY) {
|
||||
return this.scheduleChunkLoad(chunkcoordintpair);
|
||||
} else {
|
||||
|
@ -468,8 +468,8 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
+ // Paper - revert 1.17 chunk system changes
|
||||
|
||||
if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) {
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> {
|
||||
@@ -932,6 +990,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureTemplateManager, this.lightEngine, (ichunkaccess) -> {
|
||||
@@ -948,6 +1006,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
} else {
|
||||
return this.scheduleChunkGeneration(holder, requiredStatus);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
}
|
||||
}
|
||||
|
||||
@@ -988,14 +1047,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -987,14 +1046,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
};
|
||||
|
||||
CompletableFuture<CompoundTag> chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z);
|
||||
|
@ -505,9 +505,9 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
}
|
||||
+ this.level.asyncChunkTaskManager.raisePriority(pos.x, pos.z, priority); // Paper
|
||||
return ret;
|
||||
// Paper end
|
||||
// Paper end - Async chunk io
|
||||
}
|
||||
@@ -1047,7 +1116,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1073,7 +1142,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.releaseLightTicket(chunkcoordintpair);
|
||||
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
|
||||
});
|
||||
|
@ -519,7 +519,7 @@ index 1614b056d9e0c9e6b62d6c6a8926e87b2f3ad131..c6ea30c9e91382297a5340096540f1eb
|
|||
}
|
||||
|
||||
protected void releaseLightTicket(ChunkPos pos) {
|
||||
@@ -1131,7 +1203,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1157,7 +1229,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
long i = chunkHolder.getPos().toLong();
|
||||
|
||||
Objects.requireNonNull(chunkHolder);
|
||||
|
@ -711,10 +711,10 @@ index 211566dada0f820af331695b4c62035b89f25a53..d2865ce0523b74aaa935db72c6f34788
|
|||
Ticket<ChunkPos> ticket = new Ticket<>(TicketType.FORCED, 31, pos);
|
||||
long i = pos.toLong();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97efc7875c7 100644
|
||||
index 92ef60cb5ec230ac359b321249cacca18fd4d2da..ab22b2a9287bb2c70404d6ff488af2001151f48d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -589,6 +589,26 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -590,6 +590,26 @@ public class ServerChunkCache extends ChunkSource {
|
||||
return CompletableFuture.completedFuture(either);
|
||||
}, this.mainThreadProcessor);
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
// Paper end - async chunk io
|
||||
|
||||
@Nullable
|
||||
@@ -629,6 +649,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -630,6 +650,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
Objects.requireNonNull(completablefuture);
|
||||
if (!completablefuture.isDone()) { // Paper
|
||||
// Paper start - async chunk io/loading
|
||||
|
@ -750,7 +750,7 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1);
|
||||
// Paper end
|
||||
@@ -637,6 +659,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -638,6 +660,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
|
||||
this.level.timings.syncChunkLoad.stopTiming(); // Paper
|
||||
|
@ -759,7 +759,7 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
} // Paper
|
||||
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
return ichunkaccess1;
|
||||
@@ -710,10 +734,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -711,10 +735,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
if (create && !currentlyUnloading) {
|
||||
// CraftBukkit end
|
||||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
|
@ -772,7 +772,7 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
this.runDistanceManagerUpdates();
|
||||
playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
gameprofilerfiller.pop();
|
||||
@@ -723,7 +749,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -724,7 +750,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) {
|
||||
@@ -775,6 +807,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -776,6 +808,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
|
||||
public boolean runDistanceManagerUpdates() {
|
||||
|
@ -796,10 +796,10 @@ index 9079e469161098e1520f6b9fd963adedd500024b..d0170f92335b331d6904e8c27e75f97e
|
|||
boolean flag1 = this.chunkMap.promoteChunkMap();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 0a2c94e289dd0dac88a38516a9be09a03acfc579..c363b5f48253cd77c6b986b85f068a38df5319b8 100644
|
||||
index b4d6f2bc63bb7ad2e08897b73392df5ab1c77910..8ffec264b8656f56a8370ea84b495a576b5007bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -185,6 +185,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -192,6 +192,7 @@ public class ServerPlayer extends Player {
|
||||
private int lastRecordedArmor = Integer.MIN_VALUE;
|
||||
private int lastRecordedLevel = Integer.MIN_VALUE;
|
||||
private int lastRecordedExperience = Integer.MIN_VALUE;
|
||||
|
@ -807,7 +807,7 @@ index 0a2c94e289dd0dac88a38516a9be09a03acfc579..c363b5f48253cd77c6b986b85f068a38
|
|||
private float lastSentHealth = -1.0E8F;
|
||||
private int lastSentFood = -99999999;
|
||||
private boolean lastFoodSaturationZero = true;
|
||||
@@ -329,6 +330,21 @@ public class ServerPlayer extends Player {
|
||||
@@ -336,6 +337,21 @@ public class ServerPlayer extends Player {
|
||||
this.maxHealthCache = this.getMaxHealth();
|
||||
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
|
||||
}
|
||||
|
@ -830,7 +830,7 @@ index 0a2c94e289dd0dac88a38516a9be09a03acfc579..c363b5f48253cd77c6b986b85f068a38
|
|||
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||
// If this is an issue, PRs are welcome
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
index 43fcd179b43a2c64e6ea71da537263cc516485a0..bd475554a630fb68433dd6e6640586cf5240cfed 100644
|
||||
index 5b238e41ffa3e374b52ee955cb39087571c6ffc2..5539f2a7e069cbe98997b734f3b1cd498148f09b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
@@ -26,15 +26,140 @@ import org.slf4j.Logger;
|
||||
|
@ -994,7 +994,7 @@ index 43fcd179b43a2c64e6ea71da537263cc516485a0..bd475554a630fb68433dd6e6640586cf
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -142,8 +263,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -154,8 +275,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) {
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
|
@ -1011,7 +1011,7 @@ index 43fcd179b43a2c64e6ea71da537263cc516485a0..bd475554a630fb68433dd6e6640586cf
|
|||
LevelChunkSection[] levelChunkSections = chunk.getSections();
|
||||
|
||||
for(int i = 0; i < chunk.getSectionsCount(); ++i) {
|
||||
@@ -163,51 +290,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
@@ -175,51 +302,45 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
|
||||
|
||||
}, () -> {
|
||||
return "lightChunk " + chunkPos + " " + excludeBlocks;
|
||||
|
@ -1112,10 +1112,10 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d
|
|||
private final String name;
|
||||
private final Comparator<T> comparator;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 9d9570b281041a08879f0bc3eedeef764ce5a47c..738967c8f6b57a52ab7a2b1302c9a9e6f4698d2c 100644
|
||||
index f9fbbd0130c1d3e2ed51f0c79d275c6861aec4fd..28ef198d96e78fb51125519f3707545f1e0f6b29 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -175,6 +175,7 @@ public abstract class PlayerList {
|
||||
@@ -178,6 +178,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public void placeNewPlayer(Connection connection, ServerPlayer player) {
|
||||
|
@ -1123,7 +1123,7 @@ index 9d9570b281041a08879f0bc3eedeef764ce5a47c..738967c8f6b57a52ab7a2b1302c9a9e6
|
|||
ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper
|
||||
if (prev != null) {
|
||||
disconnectPendingPlayer(prev);
|
||||
@@ -289,8 +290,8 @@ public abstract class PlayerList {
|
||||
@@ -292,8 +293,8 @@ public abstract class PlayerList {
|
||||
net.minecraft.server.level.ChunkMap playerChunkMap = worldserver1.getChunkSource().chunkMap;
|
||||
net.minecraft.server.level.DistanceManager distanceManager = playerChunkMap.distanceManager;
|
||||
distanceManager.addTicket(net.minecraft.server.level.TicketType.LOGIN, pos, 31, pos.toLong());
|
||||
|
@ -1135,10 +1135,10 @@ index 9d9570b281041a08879f0bc3eedeef764ce5a47c..738967c8f6b57a52ab7a2b1302c9a9e6
|
|||
if (updatingChunk != null) {
|
||||
return updatingChunk.getEntityTickingChunkFuture();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index ba0f9d729a4d4bd35050ab41d6d70ee3ea46beeb..3c3960abd63297bf6c247bc48de3b77a90cee06d 100644
|
||||
index 54983139e0b2e7fab96e5bf2be31fec2c1776f0b..911dd8bf57b767e658bd9fce87616e07693d2639 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -231,7 +231,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -252,7 +252,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
private BlockPos blockPosition;
|
||||
private ChunkPos chunkPosition;
|
||||
private Vec3 deltaMovement;
|
||||
|
@ -1148,7 +1148,7 @@ index ba0f9d729a4d4bd35050ab41d6d70ee3ea46beeb..3c3960abd63297bf6c247bc48de3b77a
|
|||
public float yRotO;
|
||||
public float xRotO;
|
||||
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 b9ad77606d88d7ca41c0070063b8599ecc048422..0388b89a5f67ebaf344de53464922daddd234199 100644
|
||||
index 2e84b4e52055ec373e8d59c4bea8afefae1ba8e1..25132e88c08335e0cbd85d948d0863c9cbb28d3e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -141,7 +141,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
@ -1160,7 +1160,7 @@ index b9ad77606d88d7ca41c0070063b8599ecc048422..0388b89a5f67ebaf344de53464922dad
|
|||
private long neighbourChunksLoadedBitset;
|
||||
private final LevelChunk[] loadedNeighbourChunks = new LevelChunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)];
|
||||
|
||||
@@ -673,6 +673,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -693,6 +693,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
// CraftBukkit start
|
||||
public void loadCallback() {
|
||||
|
@ -1168,7 +1168,7 @@ index b9ad77606d88d7ca41c0070063b8599ecc048422..0388b89a5f67ebaf344de53464922dad
|
|||
// Paper start - neighbour cache
|
||||
int chunkX = this.chunkPos.x;
|
||||
int chunkZ = this.chunkPos.z;
|
||||
@@ -727,6 +728,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -747,6 +748,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
|
||||
public void unloadCallback() {
|
||||
|
@ -1177,7 +1177,7 @@ index b9ad77606d88d7ca41c0070063b8599ecc048422..0388b89a5f67ebaf344de53464922dad
|
|||
org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 3c3959240c72fe705db5ee79cf8faaaddd361ee9..3571f8406630c268b8a6ad48d2f4351e2f8fc617 100644
|
||||
index 62aef8853b168d6330fb3fe357dfb8de310cc37f..d84db6b9cbabd7979c391fa7d1ae1f55b5fab227 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1998,6 +1998,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
@ -1194,10 +1194,10 @@ index 3c3959240c72fe705db5ee79cf8faaaddd361ee9..3571f8406630c268b8a6ad48d2f4351e
|
|||
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);
|
||||
if (chunk != null) addTicket(x, z); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 83a4457d6be91efda74d05268dac83c8194cea78..03ed4da5b2a175f19b60830f54124edd1d0d24cd 100644
|
||||
index 4c3321a0645cfdbb651a87078d577776c62729a3..664c93c4f26edf7f84c6cff02f97b18b8d40f851 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1031,6 +1031,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1029,6 +1029,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
index 5df72f16e6b954ecee23a6f8daa29de0d3d991fe..7789032797447d3518bf0af15e4e0dcf0826dce8 100644
|
||||
index d15ef330db69e0c948824d9bf112a26680c90b1b..25c98fa91260c5fe3bd42c0861e3834b4ec5dc5c 100644
|
||||
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
@@ -296,6 +296,7 @@ public enum ConnectionProtocol {
|
||||
@@ -299,6 +299,7 @@ public enum ConnectionProtocol {
|
||||
|
||||
@Nullable
|
||||
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Optimize the advancement data player iteration to be O(N)
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index ecd62d2625bc5def3ac68f642f2c6f156060f129..f8f0be77126d2f3a1c53f7405ce4de4f0dca42be 100644
|
||||
index 4591364057110b8abe6cc669b76918096cb6b776..736e604205c0dcbe2cf1f1e0d507f53a9c0d941b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -437,6 +437,16 @@ public class PlayerAdvancements {
|
||||
@@ -436,6 +436,16 @@ public class PlayerAdvancements {
|
||||
}
|
||||
|
||||
private void ensureVisibility(Advancement advancement) {
|
||||
|
@ -26,7 +26,7 @@ index ecd62d2625bc5def3ac68f642f2c6f156060f129..f8f0be77126d2f3a1c53f7405ce4de4f
|
|||
boolean flag = this.shouldBeVisible(advancement);
|
||||
boolean flag1 = this.visible.contains(advancement);
|
||||
|
||||
@@ -452,15 +462,23 @@ public class PlayerAdvancements {
|
||||
@@ -451,15 +461,23 @@ public class PlayerAdvancements {
|
||||
}
|
||||
|
||||
if (flag != flag1 && advancement.getParent() != null) {
|
|
@ -9,10 +9,10 @@ instead of getting stuck in a never despawn state (bubble columns,
|
|||
etc).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 91505b592e95240e0dc71a17906ab48f5eb94f34..b436103957113bff5e553dacb869c775a3f8b059 100644
|
||||
index 62beefb6693d1801d9d8994c7247dca5bd646b0b..cad3d93c2a8cd8f5b55ba05a50a2cdc22729ebd8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -198,6 +198,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
@@ -199,6 +199,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
|
||||
++this.inGroundTime;
|
||||
} else {
|
|
@ -26,19 +26,19 @@ index a4f97c1df86c574af9b9824a38034a3d76d6e357..d65defd5fc54086a969c568b93dfb05f
|
|||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index 31aaad639b6c285226ca7aca1bd2285cfe0d9117..db26d834d9a59c4fd60f99077f0118c08293678f 100644
|
||||
index 0b8d8b9875acf4c0a6bd47941ff57d01285dd507..3ad9f1327cd99e16e8eca86d72cb8a57f28b245e 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -56,7 +56,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
private final ResultConsumer<CommandSourceStack> consumer;
|
||||
@@ -55,7 +55,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
private final EntityAnchorArgument.Anchor anchor;
|
||||
private final Vec2 rotation;
|
||||
private final CommandSigningContext signingContext;
|
||||
- public volatile CommandNode currentCommand; // CraftBukkit
|
||||
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
|
||||
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
|
||||
this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -177,9 +177,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@@ -185,9 +185,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@Override
|
||||
public boolean hasPermission(int level) {
|
||||
// CraftBukkit start
|
|
@ -10,18 +10,10 @@ This fixes that by checking if the modified spawn location is
|
|||
still at a respawn anchor.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 738967c8f6b57a52ab7a2b1302c9a9e6f4698d2c..019bbc77fe0a85de6d8eef53496981d1d7d0c320 100644
|
||||
index 28ef198d96e78fb51125519f3707545f1e0f6b29..34b5250649ba98b8f4a8a4cd1a76141d360fbe86 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -79,6 +79,7 @@ import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
+import net.minecraft.world.level.block.RespawnAnchorBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.border.BorderChangeListener;
|
||||
import net.minecraft.world.level.border.WorldBorder;
|
||||
@@ -834,6 +835,7 @@ public abstract class PlayerList {
|
||||
@@ -835,6 +835,7 @@ public abstract class PlayerList {
|
||||
// Paper start
|
||||
boolean isBedSpawn = false;
|
||||
boolean isRespawn = false;
|
||||
|
@ -29,7 +21,7 @@ index 738967c8f6b57a52ab7a2b1302c9a9e6f4698d2c..019bbc77fe0a85de6d8eef53496981d1
|
|||
// Paper end
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
@@ -844,7 +846,7 @@ public abstract class PlayerList {
|
||||
@@ -845,7 +846,7 @@ public abstract class PlayerList {
|
||||
Optional optional;
|
||||
|
||||
if (blockposition != null) {
|
||||
|
@ -38,7 +30,7 @@ index 738967c8f6b57a52ab7a2b1302c9a9e6f4698d2c..019bbc77fe0a85de6d8eef53496981d1
|
|||
} else {
|
||||
optional = Optional.empty();
|
||||
}
|
||||
@@ -888,7 +890,12 @@ public abstract class PlayerList {
|
||||
@@ -889,7 +890,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
|
@ -52,17 +44,17 @@ index 738967c8f6b57a52ab7a2b1302c9a9e6f4698d2c..019bbc77fe0a85de6d8eef53496981d1
|
|||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||
isRespawn = true; // Paper
|
||||
} else {
|
||||
@@ -926,8 +933,12 @@ public abstract class PlayerList {
|
||||
@@ -927,8 +933,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
// entityplayer1.initInventoryMenu();
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
- if (flag2) {
|
||||
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
||||
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
|
||||
+ // Paper start - Fix SPIGOT-5989
|
||||
+ if (flag2 && !isLocAltered) {
|
||||
+ BlockState data = worldserver1.getBlockState(blockposition);
|
||||
+ worldserver1.setBlock(blockposition, data.setValue(RespawnAnchorBlock.CHARGE, data.getValue(RespawnAnchorBlock.CHARGE) - 1), 3);
|
||||
+ entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F));
|
||||
+ worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3);
|
||||
+ entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
|
||||
+ // Paper end
|
||||
}
|
||||
// Added from changeDimension
|
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 10 Jul 2020 13:12:33 -0500
|
||||
Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index efa3c79533ac2abff8387f3bbe6e312ffc727e77..41576d9c9518ae05f63c087736b323ce03f6046a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -138,8 +138,17 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
||||
- File file = (File) optionset.valueOf("universe"); // CraftBukkit
|
||||
- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file); // Paper
|
||||
+ // Paper start - fix SPIGOT-5824
|
||||
+ File file;
|
||||
+ File userCacheFile = new File(Services.USERID_CACHE_FILE);
|
||||
+ if (optionset.has("universe")) {
|
||||
+ file = (File) optionset.valueOf("universe"); // CraftBukkit
|
||||
+ userCacheFile = new File(file, Services.USERID_CACHE_FILE);
|
||||
+ } else {
|
||||
+ file = new File(bukkitConfiguration.getString("settings.world-container", "."));
|
||||
+ }
|
||||
+ // Paper end - fix SPIGOT-5824
|
||||
+ Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile); // Paper
|
||||
// CraftBukkit start
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
||||
diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java
|
||||
index 697ca7457115423a8c4d8a7d1f7a353237b56509..d249e0b753493eb46481ac2cd51e04af2ba0db00 100644
|
||||
--- a/src/main/java/net/minecraft/server/Services.java
|
||||
+++ b/src/main/java/net/minecraft/server/Services.java
|
||||
@@ -8,12 +8,12 @@ import net.minecraft.server.players.GameProfileCache;
|
||||
import net.minecraft.util.SignatureValidator;
|
||||
|
||||
public record Services(MinecraftSessionService sessionService, SignatureValidator serviceSignatureValidator, GameProfileRepository profileRepository, GameProfileCache profileCache) {
|
||||
- private static final String USERID_CACHE_FILE = "usercache.json";
|
||||
+ public static final String USERID_CACHE_FILE = "usercache.json"; // Paper - private -> public
|
||||
|
||||
- public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory) {
|
||||
+ public static Services create(YggdrasilAuthenticationService authenticationService, File rootDirectory, File userCacheFile) { // Paper
|
||||
MinecraftSessionService minecraftSessionService = authenticationService.createMinecraftSessionService();
|
||||
GameProfileRepository gameProfileRepository = authenticationService.createProfileRepository();
|
||||
- GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, new File(rootDirectory, "usercache.json"));
|
||||
+ GameProfileCache gameProfileCache = new GameProfileCache(gameProfileRepository, userCacheFile); // Paper
|
||||
SignatureValidator signatureValidator = SignatureValidator.from(authenticationService.getServicesKey());
|
||||
return new Services(minecraftSessionService, signatureValidator, gameProfileRepository, gameProfileCache);
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 28 Jun 2020 19:36:55 -0400
|
||||
Subject: [PATCH] Don't allow null UUID's for chat
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||||
index cccaaf5ea40eb4d62da4863e4e1b0682fd851f32..72734f37e5642f8c391aae7b18d6414dcfb0fd2a 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
|
||||
@@ -19,7 +19,7 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
|
||||
public ClientboundChatPacket(Component message, ChatType type, UUID sender) {
|
||||
this.message = message;
|
||||
this.type = type;
|
||||
- this.sender = sender;
|
||||
+ this.sender = sender != null ? sender : net.minecraft.Util.NIL_UUID;
|
||||
}
|
||||
|
||||
public ClientboundChatPacket(FriendlyByteBuf buf) {
|
|
@ -1,41 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Mon, 29 Jun 2020 17:03:06 -0400
|
||||
Subject: [PATCH] Remove some streams from structures
|
||||
|
||||
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
index 353fd8290a48c722a5eb86794dd09ca81960c8f5..e7b02df8fd5c19537fc793f0c61ebb85c86b2100 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.level.levelgen.feature.NoiseEffect;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece;
|
||||
import net.minecraft.world.level.levelgen.structure.StructurePiece;
|
||||
+import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
import net.minecraft.world.level.levelgen.structure.pools.JigsawJunction;
|
||||
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
||||
|
||||
@@ -40,9 +41,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
||||
int j = chunkPos.getMinBlockZ();
|
||||
this.junctions = new ObjectArrayList<>(32);
|
||||
this.rigids = new ObjectArrayList<>(10);
|
||||
- structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> {
|
||||
+ // Paper start - replace for each
|
||||
+ for (StructureStart start : structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), (configuredStructureFeature) -> {
|
||||
return configuredStructureFeature.adaptNoise;
|
||||
- }).forEach((start) -> {
|
||||
+ })) { // Paper end
|
||||
for(StructurePiece structurePiece : start.getPieces()) {
|
||||
if (structurePiece.isCloseToChunk(chunkPos, 12)) {
|
||||
if (structurePiece instanceof PoolElementStructurePiece) {
|
||||
@@ -65,7 +67,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
||||
}
|
||||
}
|
||||
|
||||
- });
|
||||
+ } // Paper
|
||||
this.pieceIterator = this.rigids.iterator();
|
||||
this.junctionIterator = this.junctions.iterator();
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 10 Jul 2020 13:12:33 -0500
|
||||
Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 6a006f22d33491be4413fb64649ba9f6f51acac8..e17bb884929d4f4b7dc5b2d71234ff81d840c994 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -137,11 +137,20 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
||||
- File file = (File) optionset.valueOf("universe"); // CraftBukkit
|
||||
+ // Paper start - fix SPIGOT-5824
|
||||
+ File file;
|
||||
+ File userCacheFile = new File("usercache.json");
|
||||
+ if (optionset.has("universe")) {
|
||||
+ file = (File) optionset.valueOf("universe"); // CraftBukkit
|
||||
+ userCacheFile = new File(file, "usercache.json");
|
||||
+ } else {
|
||||
+ file = new File(bukkitConfiguration.getString("settings.world-container", "."));
|
||||
+ }
|
||||
+ // Paper end - fix SPIGOT-5824
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY); // Paper
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
||||
- GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName()));
|
||||
+ GameProfileCache usercache = new GameProfileCache(gameprofilerepository, userCacheFile); // Paper - only move usercache.json into folder if --universe is used, not world-container
|
||||
// CraftBukkit start
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
Loading…
Reference in New Issue