From 872f10bf7b9d250166cc298dc448fa46f232182e Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 24 Jun 2020 04:38:17 -0400 Subject: [PATCH] Initial prep for 1.16 Remove patcehs we know need to go add comment on one im not sure should be dropped go ahead and fix patched repos to turn off gpg signing, as this helps rebase/apply --continue commands not suck. Go ahead and prep the pom file change --- Spigot-API-Patches/POM-changes.patch | 2 +- Spigot-Server-Patches/Fix-MC-161754.patch | 2 +- ...ro-tick-instant-grow-farms-MC-113809.patch | 96 --------- Spigot-Server-Patches/POM-Changes.patch | 4 +- ...-Villager-AI-optimizations-DROP-1.16.patch | 195 ------------------ scripts/applyPatches.sh | 1 + 6 files changed, 5 insertions(+), 295 deletions(-) delete mode 100644 Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch delete mode 100644 Spigot-Server-Patches/Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch diff --git a/Spigot-API-Patches/POM-changes.patch b/Spigot-API-Patches/POM-changes.patch index db82c76e90..949639be87 100644 --- a/Spigot-API-Patches/POM-changes.patch +++ b/Spigot-API-Patches/POM-changes.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - spigot-api + com.destroystokyo.paper + paper-api - 1.15.2-R0.1-SNAPSHOT + 1.16-R0.1-SNAPSHOT jar - Spigot-API diff --git a/Spigot-Server-Patches/Fix-MC-161754.patch b/Spigot-Server-Patches/Fix-MC-161754.patch index ecb8057b72..b27cbf5962 100644 --- a/Spigot-Server-Patches/Fix-MC-161754.patch +++ b/Spigot-Server-Patches/Fix-MC-161754.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean canUse(EntityHuman entityhuman) { - return this.c.a(entityhuman) && this.d.isAlive() && this.d.g((Entity) entityhuman) < 8.0F; -+ return this.c.a(entityhuman) && (this.d.isAlive() && this.d.valid) && this.d.g((Entity) entityhuman) < 8.0F; // Paper - Fix MC-161754 ++ return this.c.a(entityhuman) && (this.d.isAlive() && this.d.valid) && this.d.g((Entity) entityhuman) < 8.0F; // Paper - Fix MC-161754 - evaluate we might still want this in 1.16 as im not confident mojang fixed this, and made it worse } @Override diff --git a/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch b/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch deleted file mode 100644 index f2340f049c..0000000000 --- a/Spigot-Server-Patches/Fix-zero-tick-instant-grow-farms-MC-113809.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Phoenix616 -Date: Sun, 15 Sep 2019 11:32:32 -0500 -Subject: [PATCH] Fix zero-tick instant grow farms MC-113809 - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); - } - -+ public boolean fixZeroTickInstantGrowFarms = true; -+ private void fixZeroTickInstantGrowFarms() { -+ fixZeroTickInstantGrowFarms = getBoolean("fix-zero-tick-instant-grow-farms", fixZeroTickInstantGrowFarms); -+ } -+ - public boolean altItemDespawnRateEnabled; - public Map altItemDespawnRateMap; - private void altItemDespawnRate() { -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -0,0 +0,0 @@ public class Block implements IMaterial { - private final float g; - protected final BlockStateList blockStateList; - private IBlockData blockData; -+ public boolean randomTick = false; // Paper - fix MC-113809 - protected final boolean v; - private final boolean i; - private final boolean j; -diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBamboo.java -+++ b/src/main/java/net/minecraft/server/BlockBamboo.java -@@ -0,0 +0,0 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { - if (!iblockdata.canPlace(worldserver, blockposition)) { - worldserver.b(blockposition, true); - } else if ((Integer) iblockdata.get(BlockBamboo.f) == 0) { -+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809 - if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot - int i = this.b(worldserver, blockposition) + 1; - -diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockCactus.java -+++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -0,0 +0,0 @@ public class BlockCactus extends Block { - if (!iblockdata.canPlace(worldserver, blockposition)) { - worldserver.b(blockposition, true); - } else { -+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809 - BlockPosition blockposition1 = blockposition.up(); - - if (worldserver.isEmpty(blockposition1)) { -diff --git a/src/main/java/net/minecraft/server/BlockChorusFlower.java b/src/main/java/net/minecraft/server/BlockChorusFlower.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockChorusFlower.java -+++ b/src/main/java/net/minecraft/server/BlockChorusFlower.java -@@ -0,0 +0,0 @@ public class BlockChorusFlower extends Block { - if (!iblockdata.canPlace(worldserver, blockposition)) { - worldserver.b(blockposition, true); - } else { -+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809 - BlockPosition blockposition1 = blockposition.up(); - - if (worldserver.isEmpty(blockposition1) && blockposition1.getY() < 256) { -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -0,0 +0,0 @@ public class BlockReed extends Block { - if (!iblockdata.canPlace(worldserver, blockposition)) { - worldserver.b(blockposition, true); - } else if (worldserver.isEmpty(blockposition.up())) { -+ if (worldserver.paperConfig.fixZeroTickInstantGrowFarms && !randomTick) return; // Paper - fix MC-113809 - int i; - - for (i = 1; worldserver.getType(blockposition.down(i)).getBlock() == this; ++i) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World { - IBlockData iblockdata = chunksection.getType(blockposition2.getX() - j, blockposition2.getY() - j1, blockposition2.getZ() - k); - - if (iblockdata.q()) { -+ iblockdata.getBlock().randomTick = true; // Paper - fix MC-113809 - iblockdata.b(this, blockposition2, this.random); -+ iblockdata.getBlock().randomTick = false; // Paper - fix MC-113809 - } - - Fluid fluid = iblockdata.getFluid(); diff --git a/Spigot-Server-Patches/POM-Changes.patch b/Spigot-Server-Patches/POM-Changes.patch index 28508323ff..c7beadb737 100644 --- a/Spigot-Server-Patches/POM-Changes.patch +++ b/Spigot-Server-Patches/POM-Changes.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - spigot + paper jar - 1.15.2-R0.1-SNAPSHOT + 1.16-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ + Paper @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + UTF-8 unknown - 1.15.2 + 1.16 @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch b/Spigot-Server-Patches/Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch deleted file mode 100644 index ec3c0d962e..0000000000 --- a/Spigot-Server-Patches/Port-20w15a-Villager-AI-optimizations-DROP-1.16.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Callahan -Date: Wed, 8 Apr 2020 18:00:17 -0500 -Subject: [PATCH] Port 20w15a Villager AI optimizations - DROP 1.16 - - -diff --git a/src/main/java/net/minecraft/server/BehaviorController.java b/src/main/java/net/minecraft/server/BehaviorController.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BehaviorController.java -+++ b/src/main/java/net/minecraft/server/BehaviorController.java -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - this.g = Sets.newHashSet(); - this.h = Activity.IDLE; - this.i = -9999L; -- collection.forEach((memorymoduletype) -> { -- Optional optional = (Optional) this.memories.put(memorymoduletype, Optional.empty()); -- }); -- collection1.forEach((sensortype) -> { -- Sensor sensor = (Sensor) this.sensors.put(sensortype, sensortype.a()); -- }); -- this.sensors.values().forEach((sensor) -> { -- Iterator iterator = sensor.a().iterator(); -- -- while (iterator.hasNext()) { -- MemoryModuleType memorymoduletype = (MemoryModuleType) iterator.next(); -- -- this.memories.put(memorymoduletype, Optional.empty()); -+ // Paper start - Port 20w15a pathfinder optimizations -+ for (final MemoryModuleType memoryModuleType : collection) { -+ this.memories.put(memoryModuleType, Optional.empty()); -+ } -+ for (final SensorType> sensorType : collection1) { -+ this.sensors.put(sensorType, sensorType.a()); -+ } -+ for (final Sensor sensor : this.sensors.values()) { -+ for (final MemoryModuleType memoryModuleType : sensor.a()) { -+ this.memories.put(memoryModuleType, Optional.empty()); - } -- -- }); -- Iterator iterator = dynamic.get("memories").asMap(Function.identity(), Function.identity()).entrySet().iterator(); -- -- while (iterator.hasNext()) { -- Entry, Dynamic> entry = (Entry) iterator.next(); -- -- this.a((MemoryModuleType) IRegistry.MEMORY_MODULE_TYPE.get(new MinecraftKey(((Dynamic) entry.getKey()).asString(""))), (Dynamic) entry.getValue()); - } -- -+ for (final Map.Entry, Dynamic> entry : dynamic.get("memories").asMap(Function.identity(), Function.identity()).entrySet()) { -+ this.a((MemoryModuleType) IRegistry.MEMORY_MODULE_TYPE.get(new MinecraftKey((entry.getKey()).asString(""))), entry.getValue()); -+ } -+ // Paper end - Port 20w15a pathfinder optimizations - } - - public boolean hasMemory(MemoryModuleType memorymoduletype) { -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - } - - private void a(MemoryModuleType memorymoduletype, Dynamic dynamic) { -- this.setMemory(memorymoduletype, ((Function) memorymoduletype.getSerializer().orElseThrow(RuntimeException::new)).apply(dynamic)); -+ this.setMemory(memorymoduletype, (memorymoduletype.getSerializer().orElseThrow(RuntimeException::new)).apply(dynamic)); // Paper - decompile fix - } - - public void removeMemory(MemoryModuleType memorymoduletype) { -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - this.f = set; - } - -+ // Paper start - Port 20w15a pathfinder optimizations - @Deprecated -- public Stream> d() { -- return this.c.values().stream().flatMap((map) -> { -- return map.values().stream(); -- }).flatMap(Collection::stream).filter((behavior) -> { -- return behavior.a() == Behavior.Status.RUNNING; -- }); -+ public java.util.List> d() { -+ final java.util.List> behaviorList = (java.util.List>) new it.unimi.dsi.fastutil.objects.ObjectArrayList(); -+ for (final Map>> map : this.c.values()) { -+ for (final Set> set : map.values()) { -+ for (final Behavior behavior : set) { -+ if (behavior.a() == Behavior.Status.RUNNING) { -+ behaviorList.add(behavior); -+ } -+ } -+ } -+ } -+ return behaviorList; -+ // Paper end - Port 20w15a pathfinder optimizations - } - - public void a(Activity activity) { -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - - public BehaviorController f() { - BehaviorController behaviorcontroller = new BehaviorController<>(this.memories.keySet(), this.sensors.keySet(), new Dynamic(DynamicOpsNBT.a, new NBTTagCompound())); -- -- this.memories.forEach((memorymoduletype, optional) -> { -- optional.ifPresent((object) -> { -- Optional optional1 = (Optional) behaviorcontroller.memories.put(memorymoduletype, Optional.of(object)); -- }); -- }); -+ // Paper start - Port 20w15a pathfinder optimizations -+ for (final Entry, Optional> entry : this.memories.entrySet()) { -+ final MemoryModuleType memoryModuleType = entry.getKey(); -+ if (entry.getValue().isPresent()) { -+ behaviorcontroller.memories.put(memoryModuleType, entry.getValue()); -+ } -+ } -+ // Paper end - Port 20w15a pathfinder optimizations - return behaviorcontroller; - } - -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - public void b(WorldServer worldserver, E e0) { - long i = e0.world.getTime(); - -- this.d().forEach((behavior) -> { -+ for(Behavior behavior : this.d()) { // Paper - Port 20w15a pathfinder optimizations - behavior.e(worldserver, e0, i); -- }); -+ } - } - - @Override - public T a(DynamicOps dynamicops) { -- T t0 = dynamicops.createMap((Map) this.memories.entrySet().stream().filter((entry) -> { -+ T t0 = dynamicops.createMap(this.memories.entrySet().stream().filter((entry) -> { // Paper - decompile fix - return ((MemoryModuleType) entry.getKey()).getSerializer().isPresent() && ((Optional) entry.getValue()).isPresent(); - }).map((entry) -> { - return Pair.of(dynamicops.createString(IRegistry.MEMORY_MODULE_TYPE.getKey(entry.getKey()).toString()), ((MinecraftSerializable) ((Optional) entry.getValue()).get()).a(dynamicops)); -@@ -0,0 +0,0 @@ public class BehaviorController implements MinecraftSeri - - private void d(WorldServer worldserver, E e0) { - long i = worldserver.getTime(); -- -- this.c.values().stream().flatMap((map) -> { -- return map.entrySet().stream(); -- }).filter((entry) -> { -- return this.g.contains(entry.getKey()); -- }).map(Entry::getValue).flatMap(Collection::stream).filter((behavior) -> { -- return behavior.a() == Behavior.Status.STOPPED; -- }).forEach((behavior) -> { -- behavior.b(worldserver, e0, i); -- }); -+ // Paper start - Port 20w15a pathfinder optimizations -+ for (final Map>> map : this.c.values()) { -+ for (final Map.Entry>> entry : map.entrySet()) { -+ final Activity activity = entry.getKey(); -+ if (this.g.contains(activity)) { -+ final Set> set = entry.getValue(); -+ for (final Behavior behavior : set) { -+ if (behavior.a() == Behavior.Status.STOPPED) { -+ behavior.b(worldserver, e0, i); -+ } -+ } -+ } -+ } -+ } -+ // Paper end - Port 20w15a pathfinder optimizations - } - - private void e(WorldServer worldserver, E e0) { - long i = worldserver.getTime(); - -- this.d().forEach((behavior) -> { -+ for (final Behavior behavior : this.d()) { // Paper - Port 20w15a pathfinder optimizations - behavior.c(worldserver, e0, i); -- }); -+ } - } - - private boolean d(Activity activity) { -- return ((Set) this.e.get(activity)).stream().allMatch((pair) -> { -- MemoryModuleType memorymoduletype = (MemoryModuleType) pair.getFirst(); -- MemoryStatus memorystatus = (MemoryStatus) pair.getSecond(); -- -- return this.a(memorymoduletype, memorystatus); -- }); -+ // Paper start - Port 20w15a pathfinder optimizations -+ if (!this.e.containsKey(activity)) { -+ return false; -+ } -+ for (final Pair, MemoryStatus> pair : this.e.get(activity)) { -+ MemoryModuleType memorymoduletype = pair.getFirst(); -+ MemoryStatus memorystatus = pair.getSecond(); -+ if (!this.a(memorymoduletype, memorystatus)) { -+ return false; -+ } -+ } -+ return true; -+ // Paper end - Port 20w15a pathfinder optimizations - } - - private boolean a(Object object) { diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh index e4c073fda2..e700fde80b 100755 --- a/scripts/applyPatches.sh +++ b/scripts/applyPatches.sh @@ -39,6 +39,7 @@ function applyPatch { statusfile=".git/patch-apply-failed" rm -f "$statusfile" + git config commit.gpgsign false $gitcmd am --abort >/dev/null 2>&1 # Special case Windows handling because of ARG_MAX constraint