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
4d40e87b33
commit
ea0ec8c5a0
185 changed files with 96 additions and 179 deletions
|
@ -1,153 +0,0 @@
|
|||
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
|
||||
1.17 Update: Looks like whatever this patch is trying to fix might be already fixed upstream, needs to be investigated
|
||||
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 0a65e442ddc31c06f3bb0ff5aa152daee7a210af..a81ad258b39b7472312ab1bedeeacaf26ffae4f7 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
|
||||
@@ -17,7 +17,7 @@ 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 WeightedList<Behavior<? super E>> behaviors = new WeightedList<>();
|
||||
+ private final WeightedList<Behavior<? super E>> behaviors = new WeightedList<>(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);
|
||||
@@ -65,10 +65,9 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
||||
}).forEach((behavior) -> {
|
||||
behavior.g(world, entity, time);
|
||||
});
|
||||
- Set set = this.exitErasedMemories;
|
||||
Brain behaviorcontroller = entity.getBrain();
|
||||
|
||||
- set.forEach(behaviorcontroller::removeMemory);
|
||||
+ this.exitErasedMemories.forEach(behaviorcontroller::eraseMemory); // Paper - decomp fix
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,11 +110,11 @@ public class GateBehavior<E extends LivingEntity> extends Behavior<E> {
|
||||
static enum OrderPolicy {
|
||||
|
||||
ORDERED((weightedlist) -> {
|
||||
- }), SHUFFLED(WeightedList::a);
|
||||
+ }), SHUFFLED(WeightedList::shuffle);
|
||||
|
||||
private final Consumer<WeightedList<?>> consumer;
|
||||
|
||||
- private OrderPolicy(Consumer consumer) {
|
||||
+ private OrderPolicy(Consumer<WeightedList<?>> consumer) { // Paper - decomp fix
|
||||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java
|
||||
index e4c1c58e9a9c744c7ebb9948a27766b84a081b9e..85df30ef7c03c2f8ae741a8cac8bf601490d2539 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java
|
||||
@@ -6,7 +6,7 @@ import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
-import com.mojang.serialization.OptionalDynamic;
|
||||
+
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -14,26 +14,32 @@ import java.util.stream.Stream;
|
||||
|
||||
public class WeightedList<U> {
|
||||
|
||||
- protected final List<WeightedList.WeightedEntry<U>> entries;
|
||||
+ protected final List<WeightedList.WeightedEntry<U>> list; // Paper - decompile conflict
|
||||
private final Random random;
|
||||
+ private final boolean isUnsafe; // Paper
|
||||
|
||||
- public WeightedList() {
|
||||
- this(Lists.newArrayList());
|
||||
+ // Paper start - add useClone option
|
||||
+ public WeightedList() { this(true); }
|
||||
+ public WeightedList(boolean isUnsafe) {
|
||||
+ this(Lists.newArrayList(), isUnsafe);
|
||||
}
|
||||
|
||||
- private WeightedList(List<WeightedList.WeightedEntry<U>> entries) {
|
||||
+ private WeightedList(List<WeightedList.WeightedEntry<U>> entries) { this(entries, true); }
|
||||
+ private WeightedList(List<WeightedList.WeightedEntry<U>> list, boolean isUnsafe) {
|
||||
+ this.isUnsafe = isUnsafe;
|
||||
+ // Paper end
|
||||
this.random = new Random();
|
||||
- this.entries = Lists.newArrayList(entries);
|
||||
+ this.list = Lists.newArrayList(list); // Paper - decompile conflict
|
||||
}
|
||||
|
||||
public static <U> Codec<WeightedList<U>> codec(Codec<U> codec) {
|
||||
- return WeightedList.entries.a(codec).listOf().xmap(WeightedList::new, (weightedlist) -> {
|
||||
- return weightedlist.a;
|
||||
+ return WeightedList.WeightedEntry.codec(codec).listOf().xmap(WeightedList::new, (weightedlist) -> { // Paper - decompile conflict
|
||||
+ return weightedlist.list; // Paper - decompile conflict
|
||||
});
|
||||
}
|
||||
|
||||
public WeightedList<U> add(U item, int weight) {
|
||||
- this.entries.add(new WeightedList.WeightedEntry<>(item, weight));
|
||||
+ this.list.add(new WeightedList.WeightedEntry<>(item, weight)); // Paper - decompile conflict
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -42,21 +48,20 @@ public class WeightedList<U> {
|
||||
}
|
||||
|
||||
public WeightedList<U> shuffle(Random random) {
|
||||
- this.entries.forEach((weightedlist_a) -> {
|
||||
- weightedlist_a.setRandom(random.nextFloat());
|
||||
- });
|
||||
- this.entries.sort(Comparator.comparingDouble((object) -> {
|
||||
- return ((WeightedList.WeightedEntry) object).getRandWeight();
|
||||
- }));
|
||||
- return this;
|
||||
+ // Paper start - make concurrent safe, work off a clone of the list
|
||||
+ List<WeightedList.WeightedEntry<U>> list = isUnsafe ? new java.util.ArrayList<WeightedList.WeightedEntry<U>>(this.list) : this.list;
|
||||
+ list.forEach((weightedlist_a) -> weightedlist_a.setRandom(random.nextFloat()));
|
||||
+ list.sort(Comparator.comparingDouble(WeightedEntry::getRandWeight));
|
||||
+ return isUnsafe ? new WeightedList<>(list, isUnsafe) : this;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
- return this.entries.isEmpty();
|
||||
+ return this.list.isEmpty(); // Paper - decompile conflict
|
||||
}
|
||||
|
||||
public Stream<U> stream() {
|
||||
- return this.entries.stream().map(WeightedList.entries::a);
|
||||
+ return this.list.stream().map(WeightedList.WeightedEntry::getData); // Paper - decompile conflict
|
||||
}
|
||||
|
||||
public U getOne(Random random) {
|
||||
@@ -64,7 +69,7 @@ public class WeightedList<U> {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
- return "WeightedList[" + this.entries + "]";
|
||||
+ return "WeightedList[" + this.list + "]"; // Paper - decompile conflict
|
||||
}
|
||||
|
||||
public static class WeightedEntry<T> {
|
||||
@@ -98,11 +103,7 @@ public class WeightedList<U> {
|
||||
return new Codec<WeightedList.WeightedEntry<E>>() {
|
||||
public <T> DataResult<Pair<WeightedList.WeightedEntry<E>, T>> decode(DynamicOps<T> dynamicops, T t0) {
|
||||
Dynamic<T> dynamic = new Dynamic(dynamicops, t0);
|
||||
- OptionalDynamic optionaldynamic = dynamic.get("data");
|
||||
- Codec codec1 = codec;
|
||||
-
|
||||
- codec.getClass();
|
||||
- return optionaldynamic.flatMap(codec1::parse).map((object) -> {
|
||||
+ return dynamic.get("data").flatMap(codec::parse).map((object) -> { // Paper - decompile error
|
||||
return new WeightedList.WeightedEntry<>(object, dynamic.get("weight").asInt(1));
|
||||
}).map((weightedlist_a) -> {
|
||||
return Pair.of(weightedlist_a, dynamicops.empty());
|
|
@ -1,52 +0,0 @@
|
|||
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
|
||||
1.17 Update: See if this is still needed, might be fixed upstream
|
||||
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.
|
||||
|
||||
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 7582c7cd4235d212a0cf66a4c59ce0cedaa360ad..e7b178127228dea5a17ba0fbd6bae148d70e8eb5 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
|
||||
@@ -12,6 +12,8 @@ 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;
|
||||
@@ -94,7 +96,26 @@ public class MapItemSavedData extends SavedData {
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag tag) {
|
||||
- DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, tag.get("dimension"))); // CraftBukkit - decompile error
|
||||
+ // Paper start - fix "Not a string" spam
|
||||
+ Tag dimension = tag.get("dimension");
|
||||
+ if (dimension instanceof NumericTag && ((NumericTag) dimension).getAsInt() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
|
||||
+ long least = tag.getLong("UUIDLeast");
|
||||
+ long most = tag.getLong("UUIDMost");
|
||||
+
|
||||
+ if (least != 0L && most != 0L) {
|
||||
+ this.uniqueId = new UUID(most, least);
|
||||
+ CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
|
||||
+ 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;
|
||||
|
||||
logger.getClass();
|
|
@ -8,7 +8,8 @@ to a chunk. The default values of -1 disable the limit. Although
|
|||
defaults are only included for certain entites, this allows setting
|
||||
limits for any entity type.
|
||||
|
||||
1.17: entities not in chunks anymore
|
||||
1.17: looks like tracking the count on should work fine just putting it in the EntityType#loadEntitiesRecursive, but
|
||||
the tracking count on save needs some more work to implement.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7ebc85264a2cbfb601dfe5472b561cac1a7cf8bf..486e5438254348db68017228af131cba7defd637 100644
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
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.
|
||||
|
||||
Relies on other not-applied patches
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 6fad9329213e4e8a3ef9ce7fb568ad22484a11f3..a6b2b69a5a79fb8cea81e55018ee7f57c8820e56 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -295,6 +295,13 @@ 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 524f33371b9de1d4dd6972fe59ffbe1804d7c5f3..0bb4aaa546939b67a5d22865190f30478a9337c1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
||||
@@ -26,6 +26,10 @@ 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;
|
Loading…
Add table
Add a link
Reference in a new issue