From 52bc694983eddc40bb0bf55d7db1f118a5ce189f Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 14 Jun 2021 11:46:59 +0200 Subject: [PATCH] more work uwu --- ...reResultEvent-PrepareGrindstoneEvent.patch | 0 .../Add-entity-liquid-API.patch | 0 ...llow-delegation-to-vanilla-chunk-gen.patch | 0 .../Support-components-in-ItemMeta.patch | 0 ...-TargetReasons-for-1.16-mob-behavior.patch | 0 ...ix-Concurrency-issue-in-WeightedList.patch | 153 ------------------ .../Remove-some-streams-from-structures.patch | 143 ---------------- .../Add-PrepareResultEvent.patch | 4 +- .../Add-entity-liquid-API.patch | 8 +- ...llow-delegation-to-vanilla-chunk-gen.patch | 30 +--- ...nvert-legacy-attributes-in-Item-Meta.patch | 0 ...k-for-portal-on-world-gen-entity-add.patch | 0 ...ix-arrows-never-despawning-MC-125757.patch | 0 ...argetLivingEntityEvent-for-1.16-mobs.patch | 25 +-- ...ove-range-check-for-block-placing-up.patch | 14 +- ...ze-NetworkManager-Exception-Handling.patch | 68 ++------ ...ancement-data-player-iteration-to-be.patch | 0 ...from-classes-related-villager-gossip.patch | 40 +++-- ...awn-player-in-correct-world-on-login.patch | 0 .../Support-components-in-ItemMeta.patch | 4 +- ...-Vanilla-Command-permission-checking.patch | 4 +- ...pdate-itemstack-legacy-name-and-lore.patch | 24 +-- 22 files changed, 76 insertions(+), 441 deletions(-) rename patches/{api-unmapped => api}/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch (100%) rename patches/{api-unmapped => api}/Add-entity-liquid-API.patch (100%) rename patches/{api-unmapped => api}/Allow-delegation-to-vanilla-chunk-gen.patch (100%) rename patches/{api-unmapped => api}/Support-components-in-ItemMeta.patch (100%) rename patches/{api-unmapped => api}/added-2-new-TargetReasons-for-1.16-mob-behavior.patch (100%) delete mode 100644 patches/server-remapped/Fix-Concurrency-issue-in-WeightedList.patch delete mode 100644 patches/server-remapped/Remove-some-streams-from-structures.patch rename patches/{server-remapped => server}/Add-PrepareResultEvent.patch (98%) rename patches/{server-remapped => server}/Add-entity-liquid-API.patch (95%) rename patches/{server-remapped => server}/Allow-delegation-to-vanilla-chunk-gen.patch (73%) rename patches/{server-remapped => server}/Convert-legacy-attributes-in-Item-Meta.patch (100%) rename patches/{server-remapped => server}/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch (100%) rename patches/{server-remapped => server}/Fix-arrows-never-despawning-MC-125757.patch (100%) rename patches/{server-remapped => server}/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch (72%) rename patches/{server-remapped => server}/Move-range-check-for-block-placing-up.patch (76%) rename patches/{server-remapped => server}/Optimize-NetworkManager-Exception-Handling.patch (57%) rename patches/{server-remapped => server}/Optimize-the-advancement-data-player-iteration-to-be.patch (100%) rename patches/{server-remapped => server}/Remove-streams-from-classes-related-villager-gossip.patch (73%) rename patches/{server-remapped => server}/Spawn-player-in-correct-world-on-login.patch (100%) rename patches/{server-remapped => server}/Support-components-in-ItemMeta.patch (97%) rename patches/{server-remapped => server}/Thread-Safe-Vanilla-Command-permission-checking.patch (93%) rename patches/{server-remapped => server}/Update-itemstack-legacy-name-and-lore.patch (76%) diff --git a/patches/api-unmapped/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch similarity index 100% rename from patches/api-unmapped/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch rename to patches/api/Add-PrepareResultEvent-PrepareGrindstoneEvent.patch diff --git a/patches/api-unmapped/Add-entity-liquid-API.patch b/patches/api/Add-entity-liquid-API.patch similarity index 100% rename from patches/api-unmapped/Add-entity-liquid-API.patch rename to patches/api/Add-entity-liquid-API.patch diff --git a/patches/api-unmapped/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/api-unmapped/Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/api/Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/api-unmapped/Support-components-in-ItemMeta.patch b/patches/api/Support-components-in-ItemMeta.patch similarity index 100% rename from patches/api-unmapped/Support-components-in-ItemMeta.patch rename to patches/api/Support-components-in-ItemMeta.patch diff --git a/patches/api-unmapped/added-2-new-TargetReasons-for-1.16-mob-behavior.patch b/patches/api/added-2-new-TargetReasons-for-1.16-mob-behavior.patch similarity index 100% rename from patches/api-unmapped/added-2-new-TargetReasons-for-1.16-mob-behavior.patch rename to patches/api/added-2-new-TargetReasons-for-1.16-mob-behavior.patch diff --git a/patches/server-remapped/Fix-Concurrency-issue-in-WeightedList.patch b/patches/server-remapped/Fix-Concurrency-issue-in-WeightedList.patch deleted file mode 100644 index 8ee7668888..0000000000 --- a/patches/server-remapped/Fix-Concurrency-issue-in-WeightedList.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -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 extends Behavior { - private final Set> exitErasedMemories; - private final GateBehavior.OrderPolicy orderPolicy; - private final GateBehavior.RunningPolicy runningPolicy; -- private final WeightedList> behaviors = new WeightedList<>(); -+ private final WeightedList> behaviors = new WeightedList<>(false); // Paper - don't use a clone - - public GateBehavior(Map, MemoryStatus> requiredMemoryState, Set> memoriesToForgetWhenStopped, GateBehavior.OrderPolicy order, GateBehavior.RunningPolicy runMode, List, Integer>> tasks) { - super(requiredMemoryState); -@@ -0,0 +0,0 @@ public class GateBehavior extends Behavior { - }).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 -@@ -0,0 +0,0 @@ public class GateBehavior extends Behavior { - static enum OrderPolicy { - - ORDERED((weightedlist) -> { -- }), SHUFFLED(WeightedList::a); -+ }), SHUFFLED(WeightedList::shuffle); - - private final Consumer> consumer; - -- private OrderPolicy(Consumer consumer) { -+ private OrderPolicy(Consumer> 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ import java.util.stream.Stream; - - public class WeightedList { - -- protected final List> entries; -+ protected final List> 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> entries) { -+ private WeightedList(List> entries) { this(entries, true); } -+ private WeightedList(List> 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 Codec> codec(Codec 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 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; - } - -@@ -0,0 +0,0 @@ public class WeightedList { - } - - public WeightedList 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> list = isUnsafe ? new java.util.ArrayList>(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 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) { -@@ -0,0 +0,0 @@ public class WeightedList { - } - - public String toString() { -- return "WeightedList[" + this.entries + "]"; -+ return "WeightedList[" + this.list + "]"; // Paper - decompile conflict - } - - public static class WeightedEntry { -@@ -0,0 +0,0 @@ public class WeightedList { - return new Codec>() { - public DataResult, T>> decode(DynamicOps dynamicops, T t0) { - Dynamic 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()); diff --git a/patches/server-remapped/Remove-some-streams-from-structures.patch b/patches/server-remapped/Remove-some-streams-from-structures.patch deleted file mode 100644 index 7013043271..0000000000 --- a/patches/server-remapped/Remove-some-streams-from-structures.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.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/StructureFeatureManager.java b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java -+++ b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.level; - - import com.mojang.datafixers.DataFixUtils; -+import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper - import java.util.stream.Stream; - import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; - import net.minecraft.core.SectionPos; --import net.minecraft.core.Vec3i; - import net.minecraft.server.level.WorldGenRegion; - import net.minecraft.world.level.chunk.ChunkStatus; - import net.minecraft.world.level.chunk.FeatureAccess; - import net.minecraft.world.level.levelgen.WorldGenSettings; - import net.minecraft.world.level.levelgen.feature.StructureFeature; -+import net.minecraft.world.level.levelgen.structure.StructurePiece; - import net.minecraft.world.level.levelgen.structure.StructureStart; - - public class StructureFeatureManager { - -- private final LevelAccessor level; -+ private final LevelAccessor level; public LevelAccessor getLevel() { return level; } // Paper - OBFHELPER - private final WorldGenSettings worldGenSettings; - - public StructureFeatureManager(LevelAccessor world, WorldGenSettings options) { -@@ -0,0 +0,0 @@ public class StructureFeatureManager { - }); - } - -+ // Paper start - remove structure streams -+ public java.util.List> getFeatureStarts(SectionPos sectionPosition, StructureFeature structureGenerator) { -+ java.util.List> list = new ObjectArrayList<>(); -+ for (Long curLong: getLevel().getChunk(sectionPosition.x(), sectionPosition.z(), ChunkStatus.STRUCTURE_REFERENCES).getReferencesForFeature(structureGenerator)) { -+ SectionPos sectionPosition1 = SectionPos.of(new ChunkPos(curLong), 0); -+ StructureStart structurestart = getStartForFeature(sectionPosition1, structureGenerator, getLevel().getChunk(sectionPosition1.x(), sectionPosition1.z(), ChunkStatus.STRUCTURE_STARTS)); -+ if (structurestart != null && structurestart.e()) { -+ list.add(structurestart); -+ } -+ } -+ return list; -+ } -+ // Paper end -+ - @Nullable - public StructureStart getStartForFeature(SectionPos pos, StructureFeature feature, FeatureAccess holder) { - return holder.getStartForFeature(feature); -@@ -0,0 +0,0 @@ public class StructureFeatureManager { - } - - public StructureStart getStructureAt(BlockPos pos, boolean matchChildren, StructureFeature feature) { -- return (StructureStart) DataFixUtils.orElse(this.startsForFeature(SectionPos.of(pos), feature).filter((structurestart) -> { -- return structurestart.c().b((Vec3i) pos); -- }).filter((structurestart) -> { -- return !matchChildren || structurestart.d().stream().anyMatch((structurepiece) -> { -- return structurepiece.g().b((BaseBlockPosition) blockposition); -- }); -- }).findFirst(), StructureStart.a); -+ // Paper start - remove structure streams -+ for (StructureStart structurestart : getFeatureStarts(SectionPos.of(pos), feature)) { -+ if (structurestart.c().b(pos)) { -+ if (!matchChildren) { -+ return structurestart; -+ } -+ for (StructurePiece structurepiece : structurestart.d()) { -+ if (structurepiece.g().b(pos)) { -+ return structurestart; -+ } -+ } -+ } -+ } -+ return StructureStart.a; -+ // Paper end - } - - // Spigot start -diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/biome/Biome.java -+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.WorldgenRandom; - import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; - import net.minecraft.world.level.levelgen.feature.StructureFeature; - import net.minecraft.world.level.levelgen.structure.BoundingBox; -+import net.minecraft.world.level.levelgen.structure.StructureStart; - import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder; - import net.minecraft.world.level.levelgen.synth.PerlinSimplexNoise; - import net.minecraft.world.level.material.FluidState; -@@ -0,0 +0,0 @@ public final class Biome { - int l1 = j1 << 4; - - try { -- structureAccessor.startsForFeature(SectionPos.of(pos), structuregenerator).forEach((structurestart) -> { -- structurestart.a(region, structureAccessor, chunkGenerator, random, new BoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkPos(i1, j1)); -- }); -+ // Paper start - remove structure streams -+ for (StructureStart structureStart : structureAccessor.getFeatureStarts(SectionPos.of(pos), structuregenerator)) { -+ structureStart.a(region, structureAccessor, chunkGenerator, random, new BoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkPos(i1, j1)); -+ } -+ // Paper end - } catch (Exception exception) { - CrashReport crashreport = CrashReport.forThrowable(exception, "Feature placement"); - -diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.feature.structures.StructureTemplatePo - 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.synth.ImprovedNoise; - import net.minecraft.world.level.levelgen.synth.PerlinNoise; - import net.minecraft.world.level.levelgen.synth.PerlinSimplexNoise; -@@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { - while (iterator.hasNext()) { - StructureFeature structuregenerator = (StructureFeature) iterator.next(); - -- accessor.startsForFeature(SectionPos.of(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { -+ for (StructureStart structurestart : accessor.getFeatureStarts(SectionPos.of(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams - Iterator iterator1 = structurestart.d().iterator(); - - while (iterator1.hasNext()) { -@@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { - } - } - -- }); -+ } // Paper - remove structure streams - } - - double[][][] adouble = new double[2][this.chunkCountZ + 1][this.chunkCountY + 1]; diff --git a/patches/server-remapped/Add-PrepareResultEvent.patch b/patches/server/Add-PrepareResultEvent.patch similarity index 98% rename from patches/server-remapped/Add-PrepareResultEvent.patch rename to patches/server/Add-PrepareResultEvent.patch index 101d945a6b..c5c389b027 100644 --- a/patches/server-remapped/Add-PrepareResultEvent.patch +++ b/patches/server/Add-PrepareResultEvent.patch @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 2); // Paper } - // CraftBukkit start + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java @@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, 3); // Paper } - @Override + public void registerUpdateListener(Runnable inventoryChangeListener) { diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java diff --git a/patches/server-remapped/Add-entity-liquid-API.patch b/patches/server/Add-entity-liquid-API.patch similarity index 95% rename from patches/server-remapped/Add-entity-liquid-API.patch rename to patches/server/Add-entity-liquid-API.patch index 0e91637dd3..e4a09662bc 100644 --- a/patches/server-remapped/Add-entity-liquid-API.patch +++ b/patches/server/Add-entity-liquid-API.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.wasTouchingWater; } @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private boolean isInBubbleColumn() { return this.level.getBlockState(this.blockPosition()).is(Blocks.BUBBLE_COLUMN); } -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } @@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean isInWaterOrBubble() { return this.isInWater() || this.isInBubbleColumn(); } -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - return this.fluidOnEyes == tag; +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + return this.fluidOnEyes == fluidTag; } + public final boolean isInLava() { return isInLava(); } // Paper - OBFHELPER diff --git a/patches/server-remapped/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch similarity index 73% rename from patches/server-remapped/Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/Allow-delegation-to-vanilla-chunk-gen.patch index 63528c13c5..0296b992f5 100644 --- a/patches/server-remapped/Allow-delegation-to-vanilla-chunk-gen.patch +++ b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch @@ -4,28 +4,6 @@ Date: Wed, 29 Apr 2020 02:10:32 +0200 Subject: [PATCH] Allow delegation to vanilla chunk gen -diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -+++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class UpgradeData { - - private static final Logger LOGGER = LogManager.getLogger(); -- public static final UpgradeData EMPTY = new UpgradeData(); -+ public static final UpgradeData EMPTY = new UpgradeData(); public static UpgradeData getEmptyConverter() { return EMPTY; } // Paper - obfhelper - private static final Direction8[] DIRECTIONS = Direction8.values(); - private final EnumSet sides; - private final int[][] index; -@@ -0,0 +0,0 @@ public class UpgradeData { - if ((Integer) iblockdata.getValue(BlockStateProperties.DISTANCE) >= j) { - world.setBlock(blockposition, (BlockState) iblockdata.setValue(BlockStateProperties.DISTANCE, j), 18); - if (i != 7) { -- Direction[] aenumdirection = null.f; -+ Direction[] aenumdirection = DIRECTIONS; // Paper - decomp fix - int k = aenumdirection.length; - - for (int l = 0; l < k; ++l) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -68,16 +46,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; - */ public final class CraftChunkData implements ChunkGenerator.ChunkData { + private final int minHeight; private final int maxHeight; - private final LevelChunkSection[] sections; + private LevelChunkSection[] sections; // Paper - remove final private Set tiles; - private World world; // Paper - Anti-Xray - Add world + public CraftChunkData(World world) { @@ -0,0 +0,0 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { - return sections; + return this.sections; } + // Paper start @@ -87,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + Set getTiles() { - return tiles; + return this.tiles; } diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server-remapped/Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/Convert-legacy-attributes-in-Item-Meta.patch similarity index 100% rename from patches/server-remapped/Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/Convert-legacy-attributes-in-Item-Meta.patch diff --git a/patches/server-remapped/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 100% rename from patches/server-remapped/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch diff --git a/patches/server-remapped/Fix-arrows-never-despawning-MC-125757.patch b/patches/server/Fix-arrows-never-despawning-MC-125757.patch similarity index 100% rename from patches/server-remapped/Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/Fix-arrows-never-despawning-MC-125757.patch diff --git a/patches/server-remapped/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/patches/server/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch similarity index 72% rename from patches/server-remapped/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch rename to patches/server/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch index e3860bdb81..6d5627f0fb 100644 --- a/patches/server-remapped/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch +++ b/patches/server/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch @@ -11,23 +11,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java @@ -0,0 +0,0 @@ public class StopAttackingIfTargetInvalid extends Behavior { + LivingEntity entityliving = this.getAttackTarget(entity); - protected void start(ServerLevel world, E entity, long time) { - if (isTiredOfTryingToReachTarget((LivingEntity) entity)) { + if (!entity.canAttack(entityliving)) { - this.clearAttackTarget(entity); -+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper ++ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper + } else if (StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget((LivingEntity) entity)) { +- this.clearAttackTarget(entity); ++ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper } else if (this.isCurrentTargetDeadOrRemoved(entity)) { - this.clearAttackTarget(entity); -+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_DIED); // Paper ++ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_DIED); // Paper } else if (this.isCurrentTargetInDifferentLevel(entity)) { - this.clearAttackTarget(entity); -+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_OTHER_LEVEL); // Paper - } else if (!EntitySelector.ATTACK_ALLOWED.test(this.getAttackTarget(entity))) { -- this.clearAttackTarget(entity); -+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper ++ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_OTHER_LEVEL); // Paper } else if (this.stopAttackingWhen.test(this.getAttackTarget(entity))) { - this.clearAttackTarget(entity); -+ this.d(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper ++ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper } } @@ -35,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return optional.isPresent() && !((LivingEntity) optional.get()).isAlive(); } -- private void clearAttackTarget(E entity) { -+ private void d(E e0, EntityTargetEvent.TargetReason reason) { +- protected void clearAttackTarget(E entity) { ++ protected void clearAttackTarget(E e0, EntityTargetEvent.TargetReason reason) { // CraftBukkit start - 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); @@ -56,7 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }*/ + // Paper end // CraftBukkit end +- this.onTargetErased.accept(entity); - entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); -+ e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); ++ this.onTargetErased.accept(e0); } } diff --git a/patches/server-remapped/Move-range-check-for-block-placing-up.patch b/patches/server/Move-range-check-for-block-placing-up.patch similarity index 76% rename from patches/server-remapped/Move-range-check-for-block-placing-up.patch rename to patches/server/Move-range-check-for-block-placing-up.patch index df0d060881..cbdebb889f 100644 --- a/patches/server-remapped/Move-range-check-for-block-placing-up.patch +++ b/patches/server/Move-range-check-for-block-placing-up.patch @@ -8,25 +8,27 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser BlockPos blockposition = movingobjectpositionblock.getBlockPos(); Direction enumdirection = movingobjectpositionblock.getDirection(); + // Paper start - move check up -+ Location eyeLoc = this.getPlayer().getEyeLocation(); ++ Location eyeLoc = this.getCraftPlayer().getEyeLocation(); + double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); -+ if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) { ++ if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) { + return; + } + // Paper end - move check up + this.player.resetLastActionTime(); - if (blockposition.getY() < this.server.getMaxBuildHeight()) { + int i = this.player.level.getMaxBuildHeight(); + + if (blockposition.getY() < i) { if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition)) { // CraftBukkit start - Check if we can actually do something over this large a distance -- Location eyeLoc = this.getPlayer().getEyeLocation(); +- Location eyeLoc = this.getCraftPlayer().getEyeLocation(); - double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); -- if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) { +- if (reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? ServerGamePacketListenerImpl.CREATIVE_PLACE_DISTANCE_SQUARED : ServerGamePacketListenerImpl.SURVIVAL_PLACE_DISTANCE_SQUARED)) { - return; - } + // Paper - move check up diff --git a/patches/server-remapped/Optimize-NetworkManager-Exception-Handling.patch b/patches/server/Optimize-NetworkManager-Exception-Handling.patch similarity index 57% rename from patches/server-remapped/Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/Optimize-NetworkManager-Exception-Handling.patch index f774dafab4..7a414431a7 100644 --- a/patches/server-remapped/Optimize-NetworkManager-Exception-Handling.patch +++ b/patches/server/Optimize-NetworkManager-Exception-Handling.patch @@ -11,74 +11,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public enum ConnectionProtocol { @Nullable - public Packet createPacket(int id) { -+ if (id < 0 || id >= this.idToConstructor.size()) return null; // Paper - Supplier> supplier = (Supplier) this.idToConstructor.get(id); - - return supplier != null ? (Packet) supplier.get() : null; + public Packet createPacket(int id, FriendlyByteBuf buf) { ++ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper + Function> function = this.idToDeserializer.get(id); + return function != null ? function.apply(buf) : null; + } diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java +++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java -@@ -0,0 +0,0 @@ import java.util.List; +@@ -0,0 +0,0 @@ import io.netty.handler.codec.CorruptedFrameException; + import java.util.List; public class Varint21FrameDecoder extends ByteToMessageDecoder { - + private final byte[] lenBuf = new byte[3]; // Paper - public Varint21FrameDecoder() {} - - protected void decode(ChannelHandlerContext channelhandlercontext, ByteBuf bytebuf, List list) throws Exception { + @Override + protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List list) { + // Paper start - if channel is not active just discard the packet -+ if (!channelhandlercontext.channel().isActive()) { -+ bytebuf.skipBytes(bytebuf.readableBytes()); ++ if (!channelHandlerContext.channel().isActive()) { ++ byteBuf.skipBytes(byteBuf.readableBytes()); + return; + } + // Paper end - bytebuf.markReaderIndex(); -- byte[] abyte = new byte[3]; + byteBuf.markReaderIndex(); + // Paper start - reuse temporary length buffer + byte[] abyte = lenBuf; + java.util.Arrays.fill(abyte, (byte) 0); + // Paper end + byte[] bs = new byte[3]; - for (int i = 0; i < abyte.length; ++i) { - if (!bytebuf.isReadable()) { -diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/network/protocol/Packet.java -+++ b/src/main/java/net/minecraft/network/protocol/Packet.java -@@ -0,0 +0,0 @@ package net.minecraft.network.protocol; - - import io.netty.channel.ChannelFuture; // Paper - import java.io.IOException; -+import net.minecraft.network.Connection; - import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.PacketListener; -+import net.minecraft.server.level.ServerPlayer; - - public interface Packet { - -@@ -0,0 +0,0 @@ public interface Packet { - /** - * @param player Null if not at PLAY stage yet - */ -- default void onPacketDispatch(@javax.annotation.Nullable EntityPlayer player) {} -+ default void onPacketDispatch(@javax.annotation.Nullable ServerPlayer player) {} - - /** - * @param player Null if not at PLAY stage yet - * @param future Can be null if packet was cancelled - */ -- default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable ChannelFuture future) {} -+ default void onPacketDispatchFinish(@javax.annotation.Nullable ServerPlayer player, @javax.annotation.Nullable ChannelFuture future) {} - default boolean hasFinishListener() { return false; } - default boolean isReady() { return true; } - default java.util.List getExtraPackets() { return null; } -- default boolean packetTooLarge(NetworkManager manager) { -+ default boolean packetTooLarge(Connection manager) { - return false; - } - // Paper end + for(int i = 0; i < bs.length; ++i) { diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java @@ -113,5 +75,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } else { - PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); + PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); } diff --git a/patches/server-remapped/Optimize-the-advancement-data-player-iteration-to-be.patch b/patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch similarity index 100% rename from patches/server-remapped/Optimize-the-advancement-data-player-iteration-to-be.patch rename to patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch diff --git a/patches/server-remapped/Remove-streams-from-classes-related-villager-gossip.patch b/patches/server/Remove-streams-from-classes-related-villager-gossip.patch similarity index 73% rename from patches/server-remapped/Remove-streams-from-classes-related-villager-gossip.patch rename to patches/server/Remove-streams-from-classes-related-villager-gossip.patch index b5a80570f9..595e411134 100644 --- a/patches/server-remapped/Remove-streams-from-classes-related-villager-gossip.patch +++ b/patches/server/Remove-streams-from-classes-related-villager-gossip.patch @@ -8,14 +8,14 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ import com.mojang.serialization.DynamicOps; +@@ -0,0 +0,0 @@ import com.mojang.serialization.Dynamic; + import com.mojang.serialization.DynamicOps; import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper import it.unimi.dsi.fastutil.objects.ObjectIterator; + import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; import java.util.Arrays; - import java.util.Collection; @@ -0,0 +0,0 @@ public class GossipContainer { }); } @@ -34,40 +34,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + private Collection selectGossipsForTransfer(Random random, int count) { -- List list = (List) this.unpack().collect(Collectors.toList()); +- List list = this.unpack().collect(Collectors.toList()); + List list = decompress(); // Paper - Remove streams from reputation - if (list.isEmpty()) { return Collections.emptyList(); + } else { @@ -0,0 +0,0 @@ public class GossipContainer { + } - public Dynamic store(DynamicOps dynamicops) { -- return new Dynamic(dynamicops, dynamicops.createList(this.unpack().map((reputation_b) -> { +- public Dynamic store(DynamicOps dynamicOps) { +- return new Dynamic<>(dynamicOps, dynamicOps.createList(this.unpack().map((gossipEntry) -> { +- return gossipEntry.store(dynamicOps); ++ public Dynamic store(DynamicOps dynamicops) { + return new Dynamic(dynamicops, dynamicops.createList(this.decompress().stream().map((reputation_b) -> { - return reputation_b.store(dynamicops); ++ return reputation_b.store(dynamicops); }).map(Dynamic::getValue))); } + @@ -0,0 +0,0 @@ public class GossipContainer { - - public static class EntityGossips { // Paper - make public - -- private final Object2IntMap entries; -+ private final Object2IntMap entries; private Object2IntMap getEntries() { return entries; } // Paper - OBFHELPER - - public EntityGossips() { // Paper - make public - update CraftVillager setReputation on change - this.entries = new Object2IntOpenHashMap(); - } + final Object2IntMap entries = new Object2IntOpenHashMap<>(); public int weightedValue(Predicate gossipTypeFilter) { - return this.entries.object2IntEntrySet().stream().filter((entry) -> { - return gossipTypeFilter.test(entry.getKey()); - }).mapToInt((entry) -> { -- return entry.getIntValue() * ((GossipType) entry.getKey()).weight; +- return entry.getIntValue() * (entry.getKey()).weight; - }).sum(); + // Paper start - Remove streams from reputation + int weight = 0; -+ for (Object2IntMap.Entry entry : getEntries().object2IntEntrySet()) { ++ for (Object2IntMap.Entry entry : entries.object2IntEntrySet()) { + if (gossipTypeFilter.test(entry.getKey())) { + weight += entry.getIntValue() * entry.getKey().getWeight(); + } @@ -77,7 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + public List decompress(UUID uuid) { + List list = new ObjectArrayList<>(); -+ for (Object2IntMap.Entry entry : getEntries().object2IntEntrySet()) { ++ for (Object2IntMap.Entry entry : entries.object2IntEntrySet()) { + list.add(new GossipContainer.GossipEntry(uuid, entry.getKey(), entry.getIntValue())); + } + return list; @@ -90,8 +86,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipType.java @@ -0,0 +0,0 @@ public enum GossipType { - MAJOR_NEGATIVE("major_negative", -5, 100, 10, 10), MINOR_NEGATIVE("minor_negative", -1, 200, 20, 20), MINOR_POSITIVE("minor_positive", 1, 200, 1, 5), MAJOR_POSITIVE("major_positive", 5, 100, 0, 100), TRADING("trading", 1, 25, 2, 20); - + public static final int REPUTATION_CHANGE_PER_EVERLASTING_MEMORY = 20; + public static final int REPUTATION_CHANGE_PER_TRADE = 2; public final String id; - public final int weight; + public final int weight; public int getWeight() { return weight; } // Paper - OBFHELPER diff --git a/patches/server-remapped/Spawn-player-in-correct-world-on-login.patch b/patches/server/Spawn-player-in-correct-world-on-login.patch similarity index 100% rename from patches/server-remapped/Spawn-player-in-correct-world-on-login.patch rename to patches/server/Spawn-player-in-correct-world-on-login.patch diff --git a/patches/server-remapped/Support-components-in-ItemMeta.patch b/patches/server/Support-components-in-ItemMeta.patch similarity index 97% rename from patches/server-remapped/Support-components-in-ItemMeta.patch rename to patches/server/Support-components-in-ItemMeta.patch index 49e2500685..68359caee6 100644 --- a/patches/server-remapped/Support-components-in-ItemMeta.patch +++ b/patches/server/Support-components-in-ItemMeta.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override public boolean hasDisplayName() { - return displayName != null; + return this.displayName != null; @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return this.lore == null ? null : new ArrayList(Lists.transform(this.lore, CraftChatMessage::fromJSONComponent)); } @@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override public boolean hasCustomModelData() { - return customModelData != null; + return this.customModelData != null; @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } diff --git a/patches/server-remapped/Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 93% rename from patches/server-remapped/Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/Thread-Safe-Vanilla-Command-permission-checking.patch index bfab0a6922..7161c7c2f2 100644 --- a/patches/server-remapped/Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/patches/server/Thread-Safe-Vanilla-Command-permission-checking.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 try { - ((CommandSourceStack) source).currentCommand = this; + ((CommandSourceStack) source).currentCommand.set(this); // Paper - return requirement.test(source); + return this.requirement.test(source); } finally { - ((CommandSourceStack) source).currentCommand = null; + ((CommandSourceStack) source).currentCommand.set(null); // Paper @@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - fix concurrency issue + CommandNode currentCommand = this.currentCommand.get(); if (currentCommand != null) { - return hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand)); + return this.hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand)); + // Paper end } // CraftBukkit end diff --git a/patches/server-remapped/Update-itemstack-legacy-name-and-lore.patch b/patches/server/Update-itemstack-legacy-name-and-lore.patch similarity index 76% rename from patches/server-remapped/Update-itemstack-legacy-name-and-lore.patch rename to patches/server/Update-itemstack-legacy-name-and-lore.patch index 1efea26e37..72e5206646 100644 --- a/patches/server-remapped/Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/Update-itemstack-legacy-name-and-lore.patch @@ -8,16 +8,8 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ import net.minecraft.core.Registry; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.ListTag; - import net.minecraft.nbt.NbtOps; -+import net.minecraft.nbt.StringTag; - import net.minecraft.nbt.Tag; - import net.minecraft.network.chat.Component; - import net.minecraft.network.chat.ComponentUtils; @@ -0,0 +0,0 @@ public final class ItemStack { - list.sort((Comparator) enchantSorter); // Paper + list.sort((Comparator) enchantSorter); // Paper } catch (Exception ignored) {} } + @@ -42,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + try { + list.set(index, convert(json)); + } catch (JsonParseException e) { -+ list.set(index, StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent("")))); ++ list.set(index, net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent("")))); + } + } + } @@ -50,25 +42,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ private StringTag convert(String json) { ++ private net.minecraft.nbt.StringTag convert(String json) { + Component component = Component.Serializer.jsonToComponent(json); + if (component instanceof TextComponent && component.getContents().contains("\u00A7") && component.getSiblings().isEmpty()) { + // Only convert if the root component is a single comp with legacy in it, don't convert already normal components + component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(component.getContents())[0]; + } -+ return StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component)); ++ return net.minecraft.nbt.StringTag.create(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component)); + } // Paper end public ItemStack(ItemLike item) { @@ -0,0 +0,0 @@ public final class ItemStack { - // CraftBukkit start - make defensive copy as this data may be coming from the save thread this.tag = (CompoundTag) nbttagcompound.getCompound("tag").copy(); - processEnchantOrder(this.tag); // Paper -+ processText(); // Paper - this.getItem().verifyTagAfterLoad(this.tag); // CraftBukkit end + this.processEnchantOrder(this.tag); // Paper ++ this.processText(); // Paper + this.getItem().verifyTagAfterLoad(this.tag); } + @@ -0,0 +0,0 @@ public final class ItemStack { } }