mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Updated Upstream (Bukkit/CraftBukkit) & more patches
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e9ce88b9 SPIGOT-6562: Add more specific sculk sensor event CraftBukkit Changes: d7ef1e91 SPIGOT-6558: Attempt to improve SkullMeta e7a63287 SPIGOT-6562: Add more specific sculk sensor event
This commit is contained in:
parent
1c31ebc273
commit
e14e8ce3bc
5 changed files with 165 additions and 2 deletions
40
patches/server/Clear-SyncLoadInfo.patch
Normal file
40
patches/server/Clear-SyncLoadInfo.patch
Normal file
|
@ -0,0 +1,40 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Fri, 26 Feb 2021 16:10:53 -0600
|
||||
Subject: [PATCH] Clear SyncLoadInfo
|
||||
|
||||
This patch merely adds the extra argument "clear" after /paper syncloadinfo to clear currently stored syncload info.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -0,0 +0,0 @@ public class PaperCommand extends Command {
|
||||
sender.sendMessage(ChatColor.RED + "This command requires the server startup flag '-Dpaper.debug-sync-loads=true' to be set.");
|
||||
return;
|
||||
}
|
||||
+
|
||||
+ if (args.length > 1 && args[1].equals("clear")) {
|
||||
+ SyncLoadFinder.clear();
|
||||
+ sender.sendMessage(ChatColor.GRAY + "Sync load data cleared.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
File file = new File(new File(new File("."), "debug"),
|
||||
"sync-load-info" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss").format(LocalDateTime.now()) + ".txt");
|
||||
file.getParentFile().mkdirs();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
@@ -0,0 +0,0 @@ public class SyncLoadFinder {
|
||||
public final Long2IntOpenHashMap coordinateTimes = new Long2IntOpenHashMap();
|
||||
}
|
||||
|
||||
+ public static void clear() {
|
||||
+ SYNC_LOADS.clear();
|
||||
+ }
|
||||
+
|
||||
public static void logSyncLoad(final Level world, final int chunkX, final int chunkZ) {
|
||||
if (!ENABLED) {
|
||||
return;
|
69
patches/server/Fix-Concurrency-issue-in-WeightedList.patch
Normal file
69
patches/server/Fix-Concurrency-issue-in-WeightedList.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 6 Jul 2020 18:36:41 -0400
|
||||
Subject: [PATCH] Fix Concurrency issue in WeightedList
|
||||
|
||||
if multiple threads from worldgen sort at same time, it will crash.
|
||||
So make a copy of the list for sorting purposes.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
@@ -0,0 +0,0 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
||||
private final Set<MemoryModuleType<?>> exitErasedMemories;
|
||||
private final GateBehavior.OrderPolicy orderPolicy;
|
||||
private final GateBehavior.RunningPolicy runningPolicy;
|
||||
- private final ShufflingList<Behavior<? super E>> behaviors = new ShufflingList<>();
|
||||
+ private final ShufflingList<Behavior<? super E>> behaviors = new ShufflingList<>(false); // Paper - don't use a clone
|
||||
|
||||
public GateBehavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState, Set<MemoryModuleType<?>> memoriesToForgetWhenStopped, GateBehavior.OrderPolicy order, GateBehavior.RunningPolicy runMode, List<Pair<Behavior<? super E>, Integer>> tasks) {
|
||||
super(requiredMemoryState);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
@@ -0,0 +0,0 @@ import java.util.stream.Stream;
|
||||
public class ShufflingList<U> {
|
||||
protected final List<ShufflingList.WeightedEntry<U>> entries;
|
||||
private final Random random = new Random();
|
||||
+ private final boolean isUnsafe; // Paper
|
||||
|
||||
public ShufflingList() {
|
||||
+ // Paper start
|
||||
+ this(true);
|
||||
+ }
|
||||
+ public ShufflingList(boolean isUnsafe) {
|
||||
+ this.isUnsafe = isUnsafe;
|
||||
+ // Paper end
|
||||
this.entries = Lists.newArrayList();
|
||||
}
|
||||
|
||||
private ShufflingList(List<ShufflingList.WeightedEntry<U>> list) {
|
||||
+ // Paper start
|
||||
+ this(list, true);
|
||||
+ }
|
||||
+ private ShufflingList(List<ShufflingList.WeightedEntry<U>> list, boolean isUnsafe) {
|
||||
+ this.isUnsafe = isUnsafe;
|
||||
+ // Paper end
|
||||
this.entries = Lists.newArrayList(list);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ShufflingList<U> {
|
||||
}
|
||||
|
||||
public ShufflingList<U> shuffle() {
|
||||
- this.entries.forEach((entry) -> {
|
||||
- entry.setRandom(this.random.nextFloat());
|
||||
- });
|
||||
- this.entries.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight));
|
||||
- return this;
|
||||
+ // Paper start - make concurrent safe, work off a clone of the list
|
||||
+ List<ShufflingList.WeightedEntry<U>> list = this.isUnsafe ? Lists.newArrayList(this.entries) : this.entries;
|
||||
+ list.forEach(entry -> entry.setRandom(this.random.nextFloat()));
|
||||
+ list.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight));
|
||||
+ return this.isUnsafe ? new ShufflingList<>(list, this.isUnsafe) : this;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public Stream<U> stream() {
|
54
patches/server/Fix-Not-a-string-Map-Conversion-spam.patch
Normal file
54
patches/server/Fix-Not-a-string-Map-Conversion-spam.patch
Normal file
|
@ -0,0 +1,54 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 8 Oct 2020 00:00:25 -0400
|
||||
Subject: [PATCH] Fix "Not a string" Map Conversion spam
|
||||
|
||||
The maps did convert successfully, but had noisy logs due to Spigot
|
||||
implementing this logic incorrectly.
|
||||
|
||||
This stops the spam by converting the old format to new before
|
||||
requesting the world.
|
||||
|
||||
Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
+import net.minecraft.nbt.NumericTag;
|
||||
+import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||
}
|
||||
|
||||
public static MapItemSavedData load(CompoundTag nbt) {
|
||||
- DataResult dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbt.get("dimension")));
|
||||
+ // Paper start - fix "Not a string" spam
|
||||
+ Tag dimension = nbt.get("dimension");
|
||||
+ if (dimension instanceof NumericTag && ((NumericTag) dimension).getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
|
||||
+ long least = nbt.getLong("UUIDLeast");
|
||||
+ long most = nbt.getLong("UUIDMost");
|
||||
+
|
||||
+ if (least != 0L && most != 0L) {
|
||||
+ UUID uuid = new UUID(most, least);
|
||||
+ CraftWorld world = (CraftWorld) Bukkit.getWorld(uuid);
|
||||
+ if (world != null) {
|
||||
+ dimension = StringTag.create("minecraft:" + world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
+ } else {
|
||||
+ dimension = StringTag.create("bukkit:_invalidworld_");
|
||||
+ }
|
||||
+ } else {
|
||||
+ dimension = StringTag.create("bukkit:_invalidworld_");
|
||||
+ }
|
||||
+ }
|
||||
+ DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, dimension)); // CraftBukkit - decompile error
|
||||
+ // Paper end - fix "Not a string" spam
|
||||
Logger logger = MapItemSavedData.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
|
@ -1 +1 @@
|
|||
Subproject commit ebb0e28d11747aa0bb4bb39fad8979ccfaa925b6
|
||||
Subproject commit e9ce88b99c08332877866313784cd84e9d9b54fb
|
|
@ -1 +1 @@
|
|||
Subproject commit f992ce6097f846ed5967fc797d98ae3e84ef1b10
|
||||
Subproject commit d7ef1e91fa6431aa649b4bfcdabdbbef8ba41267
|
Loading…
Reference in a new issue