diff --git a/patches/api-unmapped/0175-Ignore-package-private-methods-for-nullability-annot.patch b/patches/api/0175-Ignore-package-private-methods-for-nullability-annot.patch similarity index 100% rename from patches/api-unmapped/0175-Ignore-package-private-methods-for-nullability-annot.patch rename to patches/api/0175-Ignore-package-private-methods-for-nullability-annot.patch diff --git a/patches/api-unmapped/0176-Flip-some-Spigot-API-null-annotations.patch b/patches/api/0176-Flip-some-Spigot-API-null-annotations.patch similarity index 95% rename from patches/api-unmapped/0176-Flip-some-Spigot-API-null-annotations.patch rename to patches/api/0176-Flip-some-Spigot-API-null-annotations.patch index 44f9bcdbe..ceb58db8e 100644 --- a/patches/api-unmapped/0176-Flip-some-Spigot-API-null-annotations.patch +++ b/patches/api/0176-Flip-some-Spigot-API-null-annotations.patch @@ -9,7 +9,7 @@ a ton of noise to plugin developers. These do not help plugin developers if they bring moise noise than value. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index dcaefdaf5a0de8486f59115c8c4d4c211b7d64cd..e3304fcc8c4fd176abd3fb7d4b47e5ccb7bdd37f 100644 +index a69e0b0c9f515256c6406ef8ff55f72c98dabe0d..7dd3fc9301de9a88313179088f6b5ce4c1362f06 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1389,7 +1389,7 @@ public final class Bukkit { @@ -62,7 +62,7 @@ index 9c91c49ed7302c12fcb1d8e9bc58712efc199954..d5d67b3d84cd88ed0f858497e68535ec if (this.world == null) { return null; diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 9b8e6b7bbbed44e2659379c8046acaa35aaa8910..989a732e5ef2053deede245d65fbf99cdf117c5e 100644 +index 17f8dd9870a47227a7c9bb09cceedb94f7190ead..139a96d01e3a7e2e298592ce5d485dfc21c9c6c7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1171,7 +1171,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -84,7 +84,7 @@ index 9b8e6b7bbbed44e2659379c8046acaa35aaa8910..989a732e5ef2053deede245d65fbf99c /** diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 591e095dabd4cb72881abf206b1d7f0c8818cef3..ecf509a970ed4f0052d5d2c756406bf96052a680 100644 +index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java +++ b/src/main/java/org/bukkit/inventory/ItemFactory.java @@ -3,6 +3,7 @@ package org.bukkit.inventory; diff --git a/patches/api-unmapped/0177-Server-Tick-Events.patch b/patches/api/0177-Server-Tick-Events.patch similarity index 100% rename from patches/api-unmapped/0177-Server-Tick-Events.patch rename to patches/api/0177-Server-Tick-Events.patch diff --git a/patches/api-unmapped/0178-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch similarity index 100% rename from patches/api-unmapped/0178-PlayerDeathEvent-getItemsToKeep.patch rename to patches/api/0178-PlayerDeathEvent-getItemsToKeep.patch diff --git a/patches/api-unmapped/0179-Add-Heightmap-API.patch b/patches/api/0179-Add-Heightmap-API.patch similarity index 99% rename from patches/api-unmapped/0179-Add-Heightmap-API.patch rename to patches/api/0179-Add-Heightmap-API.patch index 73e1e8d46..cb8917e37 100644 --- a/patches/api-unmapped/0179-Add-Heightmap-API.patch +++ b/patches/api/0179-Add-Heightmap-API.patch @@ -103,7 +103,7 @@ index d5d67b3d84cd88ed0f858497e68535ec0162c700..432d5711b7ec34eafeb27df82d367612 * Creates explosion at this location with given power * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 19060c7d9c74b9b2808103f3d5627444aece6ccb..f8e104d5e61e52c5fe658d7cda373f62424c7bea 100644 +index b80a2fe9eb6824d986126e451900a62244d3a8e7..6fe2875f95bb600606d66e2f7113d325d10a9b9c 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -160,6 +160,87 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad diff --git a/patches/api-unmapped/0180-Mob-Spawner-API-Enhancements.patch b/patches/api/0180-Mob-Spawner-API-Enhancements.patch similarity index 100% rename from patches/api-unmapped/0180-Mob-Spawner-API-Enhancements.patch rename to patches/api/0180-Mob-Spawner-API-Enhancements.patch diff --git a/patches/server-remapped/0355-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch b/patches/removed/1.17/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch similarity index 76% rename from patches/server-remapped/0355-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch rename to patches/removed/1.17/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch index 3475c0127..2d90ba443 100644 --- a/patches/server-remapped/0355-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch +++ b/patches/removed/1.17/0327-MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch @@ -4,12 +4,13 @@ Date: Mon, 27 May 2019 17:35:39 -0500 Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative size +1.17 update note: Likely fixed in 1.17 diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index 949553229a55f8c8b9a5c0141409d1520eff22c7..fe4312a58b0b2ffd63db14068d99c5391e0eb0a0 100644 +index 4733f74ff028c03a60b73280caf9e4d1e2f0ca30..882c216b508a8623c2393b668cff6d702fe738b9 100644 --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -@@ -194,6 +194,12 @@ public class AreaEffectCloud extends Entity { +@@ -197,6 +197,12 @@ public class AreaEffectCloud extends Entity { super.tick(); boolean flag = this.isWaiting(); float f = this.getRadius(); @@ -21,4 +22,4 @@ index 949553229a55f8c8b9a5c0141409d1520eff22c7..fe4312a58b0b2ffd63db14068d99c539 + // Paper end if (this.level.isClientSide) { - ParticleOptions particleparam = this.getParticle(); + if (flag && this.random.nextBoolean()) { diff --git a/patches/server-remapped/0351-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/patches/removed/1.17/0351-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch similarity index 100% rename from patches/server-remapped/0351-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch rename to patches/removed/1.17/0351-Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch diff --git a/patches/server-remapped/0352-Duplicate-UUID-Resolve-Option.patch b/patches/removed/1.17/0352-Duplicate-UUID-Resolve-Option.patch similarity index 100% rename from patches/server-remapped/0352-Duplicate-UUID-Resolve-Option.patch rename to patches/removed/1.17/0352-Duplicate-UUID-Resolve-Option.patch diff --git a/patches/server-remapped/0344-Optimize-Captured-TileEntity-Lookup.patch b/patches/server-remapped/0344-Optimize-Captured-TileEntity-Lookup.patch deleted file mode 100644 index 5c22ff496..000000000 --- a/patches/server-remapped/0344-Optimize-Captured-TileEntity-Lookup.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 6 Apr 2019 10:16:48 -0400 -Subject: [PATCH] Optimize Captured TileEntity Lookup - -upstream was doing a containsKey/get pattern, and always doing it at that. -that scenario is only even valid if were in the middle of a block place. - -Optimize to check if the captured list even has values in it, and also to -just do a get call since the value can never be null. - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index c8542636e89748699d608eb29569cacb6321d334..5193271bc257248e0d2bc9d9a477e999a97deada 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -968,12 +968,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return null; - } else { - // CraftBukkit start -- if (capturedTileEntities.containsKey(blockposition)) { -- return capturedTileEntities.get(blockposition); -+ BlockEntity tileentity = null; // Paper -+ if (!capturedTileEntities.isEmpty() && (tileentity = capturedTileEntities.get(blockposition)) != null) { // Paper -+ return tileentity; // Paper - } - // CraftBukkit end - -- BlockEntity tileentity = null; -+ //TileEntity tileentity = null; // Paper - move up - - if (this.updatingBlockEntities) { - tileentity = this.getPendingBlockEntityAt(blockposition); diff --git a/patches/server-remapped/0345-Add-Heightmap-API.patch b/patches/server-remapped/0345-Add-Heightmap-API.patch deleted file mode 100644 index 2926bb8ee..000000000 --- a/patches/server-remapped/0345-Add-Heightmap-API.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Tue, 1 Jan 2019 02:22:01 -0800 -Subject: [PATCH] Add Heightmap API - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5193271bc257248e0d2bc9d9a477e999a97deada..eb88d830fb45a6b8c990e8bdc1943d80f63c8b93 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -670,8 +670,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - } - } - -- @Override -- public int getHeight(Heightmap.Types heightmap, int x, int z) { -+ public final int getHighestBlockY(final Heightmap.Types heightmap, final int x, final int z) { return this.getHeight(heightmap, x, z); } // Paper - OBFHELPER -+ @Override public int getHeight(Heightmap.Types heightmap, int x, int z) { // Paper - OBFHELPER - int k; - - if (x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7b5abccac9793811bd56340c8f9d23806e832365..a4231e1c3d468355c0b55ac9d2c239f1b4c54594 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -325,6 +325,29 @@ public class CraftWorld implements World { - return getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING); - } - -+ // Paper start - Implement heightmap api -+ @Override -+ public int getHighestBlockYAt(final int x, final int z, final com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { -+ this.getChunkAt(x >> 4, z >> 4); // heightmap will ret 0 on unloaded areas -+ -+ switch (heightmap) { -+ case LIGHT_BLOCKING: -+ throw new UnsupportedOperationException(); // TODO -+ //return this.world.getHighestBlockY(HeightMap.Type.LIGHT_BLOCKING, x, z); -+ case ANY: -+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.Heightmap.Types.WORLD_SURFACE, x, z); -+ case SOLID: -+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.Heightmap.Types.OCEAN_FLOOR, x, z); -+ case SOLID_OR_LIQUID: -+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING, x, z); -+ case SOLID_OR_LIQUID_NO_LEAVES: -+ return this.world.getHighestBlockY(net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, x, z); -+ default: -+ throw new UnsupportedOperationException(); -+ } -+ } -+ // Paper end -+ - @Override - public Location getSpawnLocation() { - BlockPos spawn = world.getSpawn(); diff --git a/patches/server-remapped/0346-Mob-Spawner-API-Enhancements.patch b/patches/server-remapped/0346-Mob-Spawner-API-Enhancements.patch deleted file mode 100644 index b3ee86473..000000000 --- a/patches/server-remapped/0346-Mob-Spawner-API-Enhancements.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Fri, 19 Apr 2019 12:41:13 -0500 -Subject: [PATCH] Mob Spawner API Enhancements - - -diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 3a7aec9bd2f3fd1b4a1981fb6a8c64b69e4875f8..6ca378ec7868b855d46c749910c656f82ddb009f 100644 ---- a/src/main/java/net/minecraft/world/level/BaseSpawner.java -+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -65,6 +65,7 @@ public abstract class BaseSpawner { - this.spawnPotentials.clear(); // CraftBukkit - SPIGOT-3496, MC-92282 - } - -+ public boolean isActivated() { return isNearPlayer(); } // Paper - OBFHELPER - private boolean isNearPlayer() { - BlockPos blockposition = this.getPos(); - -@@ -221,6 +222,7 @@ public abstract class BaseSpawner { - } - } - -+ public void resetTimer() { delay(); } // Paper - OBFHELPER - private void delay() { - if (this.maxSpawnDelay <= this.minSpawnDelay) { - this.spawnDelay = this.minSpawnDelay; -@@ -238,7 +240,13 @@ public abstract class BaseSpawner { - } - - public void load(CompoundTag tag) { -+ // Paper start - use larger int if set -+ if (tag.contains("Paper.Delay")) { -+ this.spawnDelay = tag.getInt("Paper.Delay"); -+ } else { - this.spawnDelay = tag.getShort("Delay"); -+ } -+ // Paper end - this.spawnPotentials.clear(); - if (tag.contains("SpawnPotentials", 9)) { - ListTag nbttaglist = tag.getList("SpawnPotentials", 10); -@@ -253,10 +261,15 @@ public abstract class BaseSpawner { - } else if (!this.spawnPotentials.isEmpty()) { - this.setNextSpawnData((SpawnData) WeighedRandom.getRandomItem(this.getLevel().random, this.spawnPotentials)); - } -- -+ // Paper start - use ints if set -+ if (tag.contains("Paper.MinSpawnDelay", 99)) { -+ this.minSpawnDelay = tag.getInt("Paper.MinSpawnDelay"); -+ this.maxSpawnDelay = tag.getInt("Paper.MaxSpawnDelay"); -+ this.spawnCount = tag.getShort("SpawnCount"); -+ } else // Paper end - if (tag.contains("MinSpawnDelay", 99)) { -- this.minSpawnDelay = tag.getShort("MinSpawnDelay"); -- this.maxSpawnDelay = tag.getShort("MaxSpawnDelay"); -+ this.minSpawnDelay = tag.getInt("MinSpawnDelay"); -+ this.maxSpawnDelay = tag.getInt("MaxSpawnDelay"); - this.spawnCount = tag.getShort("SpawnCount"); - } - -@@ -281,9 +294,20 @@ public abstract class BaseSpawner { - if (minecraftkey == null) { - return tag; - } else { -- tag.putShort("Delay", (short) this.spawnDelay); -- tag.putShort("MinSpawnDelay", (short) this.minSpawnDelay); -- tag.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay); -+ // Paper start -+ if (spawnDelay > Short.MAX_VALUE) { -+ tag.putInt("Paper.Delay", this.spawnDelay); -+ } -+ tag.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay)); -+ -+ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) { -+ tag.putInt("Paper.MinSpawnDelay", this.minSpawnDelay); -+ tag.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay); -+ } -+ -+ tag.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); -+ tag.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); -+ // Paper end - tag.putShort("SpawnCount", (short) this.spawnCount); - tag.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); - tag.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); -diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -index daaf861041cf7c8f59c85535ecb99e402ab4f658..a5b88b545e08eaabf894305a9bee31c55c5b1b87 100644 ---- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -@@ -1,12 +1,20 @@ - package org.bukkit.craftbukkit.block; - - import com.google.common.base.Preconditions; -+import net.minecraft.core.Registry; -+import net.minecraft.nbt.CompoundTag; - import net.minecraft.resources.ResourceLocation; -+import net.minecraft.world.level.SpawnData; - import net.minecraft.world.level.block.entity.SpawnerBlockEntity; - import org.bukkit.Material; - import org.bukkit.block.Block; - import org.bukkit.block.CreatureSpawner; - import org.bukkit.entity.EntityType; -+// Paper start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.inventory.ItemStack; -+// Paper end - - public class CraftCreatureSpawner extends CraftBlockEntityState implements CreatureSpawner { - -@@ -120,4 +128,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState inv : this.inventory.getComponents()) { ++ for (NonNullList inv : this.getInventory().getComponents()) { + processKeep(event, inv); + } + processKeep(event, null); diff --git a/patches/server/0319-Optimize-Captured-TileEntity-Lookup.patch b/patches/server/0319-Optimize-Captured-TileEntity-Lookup.patch new file mode 100644 index 000000000..12b5730d5 --- /dev/null +++ b/patches/server/0319-Optimize-Captured-TileEntity-Lookup.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 6 Apr 2019 10:16:48 -0400 +Subject: [PATCH] Optimize Captured TileEntity Lookup + +upstream was doing a containsKey/get pattern, and always doing it at that. +that scenario is only even valid if were in the middle of a block place. + +Optimize to check if the captured list even has values in it, and also to +just do a get call since the value can never be null. + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index a1b713391c2445967c3b5a645304f193c013d551..9891e40972c1dc6bebe8ccec2bf82123dcdd7e94 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -869,9 +869,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + + @Nullable + public BlockEntity getTileEntity(BlockPos blockposition, boolean validate) { +- if (this.capturedTileEntities.containsKey(blockposition)) { +- return this.capturedTileEntities.get(blockposition); ++ // Paper start - Optimize capturedTileEntities lookup ++ net.minecraft.world.level.block.entity.BlockEntity blockEntity; ++ if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) { ++ return blockEntity; + } ++ // Paper end + // CraftBukkit end + return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); + } diff --git a/patches/server/0320-Add-Heightmap-API.patch b/patches/server/0320-Add-Heightmap-API.patch new file mode 100644 index 000000000..4c7380555 --- /dev/null +++ b/patches/server/0320-Add-Heightmap-API.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Tue, 1 Jan 2019 02:22:01 -0800 +Subject: [PATCH] Add Heightmap API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index fda8858375a08e0aac15ca00751df5a34ed6a0f2..5f93589106bcf29eabd4544951fa3ad36e00c5a6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -341,6 +341,29 @@ public class CraftWorld implements World { + return this.getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING); + } + ++ // Paper start - Implement heightmap api ++ @Override ++ public int getHighestBlockYAt(final int x, final int z, final com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { ++ this.getChunkAt(x >> 4, z >> 4); // heightmap will ret 0 on unloaded areas ++ ++ switch (heightmap) { ++ case LIGHT_BLOCKING: ++ throw new UnsupportedOperationException(); // TODO ++ //return this.world.getHighestBlockY(HeightMap.Type.LIGHT_BLOCKING, x, z); ++ case ANY: ++ return this.world.getHeight(net.minecraft.world.level.levelgen.Heightmap.Types.WORLD_SURFACE, x, z); ++ case SOLID: ++ return this.world.getHeight(net.minecraft.world.level.levelgen.Heightmap.Types.OCEAN_FLOOR, x, z); ++ case SOLID_OR_LIQUID: ++ return this.world.getHeight(net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING, x, z); ++ case SOLID_OR_LIQUID_NO_LEAVES: ++ return this.world.getHeight(net.minecraft.world.level.levelgen.Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, x, z); ++ default: ++ throw new UnsupportedOperationException(); ++ } ++ } ++ // Paper end ++ + @Override + public Location getSpawnLocation() { + BlockPos spawn = this.world.getSharedSpawnPos(); diff --git a/patches/server/0321-Mob-Spawner-API-Enhancements.patch b/patches/server/0321-Mob-Spawner-API-Enhancements.patch new file mode 100644 index 000000000..d24f3a6b4 --- /dev/null +++ b/patches/server/0321-Mob-Spawner-API-Enhancements.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Fri, 19 Apr 2019 12:41:13 -0500 +Subject: [PATCH] Mob Spawner API Enhancements + + +diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java +index 3aadcb472ab808ee981065ddfa86be6cbf38c8d9..c6298b12e4e0c20be20e7e493be728f028f9eb31 100644 +--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java ++++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +@@ -31,7 +31,7 @@ public abstract class BaseSpawner { + + private static final Logger LOGGER = LogManager.getLogger(); + private static final int EVENT_SPAWN = 1; +- private static WeightedRandomList EMPTY_POTENTIALS = WeightedRandomList.create(); ++ public static WeightedRandomList EMPTY_POTENTIALS = WeightedRandomList.create(); // Paper - private->public + public int spawnDelay = 20; + public WeightedRandomList spawnPotentials; + public SpawnData nextSpawnData; +@@ -77,7 +77,7 @@ public abstract class BaseSpawner { + this.spawnPotentials = BaseSpawner.EMPTY_POTENTIALS; // CraftBukkit - SPIGOT-3496, MC-92282 + } + +- private boolean isNearPlayer(Level world, BlockPos pos) { ++ public boolean isNearPlayer(Level world, BlockPos pos) { // Paper private->public + return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper + } + +@@ -204,7 +204,7 @@ public abstract class BaseSpawner { + } + } + +- private void delay(Level world, BlockPos pos) { ++ public void delay(Level world, BlockPos pos) { // Paper private->public + if (this.maxSpawnDelay <= this.minSpawnDelay) { + this.spawnDelay = this.minSpawnDelay; + } else { +@@ -218,7 +218,13 @@ public abstract class BaseSpawner { + } + + public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) { ++ // Paper start - use larger int if set ++ if (nbt.contains("Paper.Delay")) { ++ this.spawnDelay = nbt.getInt("Paper.Delay"); ++ } else { + this.spawnDelay = nbt.getShort("Delay"); ++ } ++ // Paper end + List list = Lists.newArrayList(); + + if (nbt.contains("SpawnPotentials", 9)) { +@@ -237,10 +243,15 @@ public abstract class BaseSpawner { + this.setSpawnData(world, pos, mobspawnerdata); + }); + } +- ++ // Paper start - use ints if set ++ if (nbt.contains("Paper.MinSpawnDelay", 99)) { ++ this.minSpawnDelay = nbt.getInt("Paper.MinSpawnDelay"); ++ this.maxSpawnDelay = nbt.getInt("Paper.MaxSpawnDelay"); ++ this.spawnCount = nbt.getShort("SpawnCount"); ++ } else // Paper end + if (nbt.contains("MinSpawnDelay", 99)) { +- this.minSpawnDelay = nbt.getShort("MinSpawnDelay"); +- this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay"); ++ this.minSpawnDelay = nbt.getInt("MinSpawnDelay"); // Paper - short->int ++ this.maxSpawnDelay = nbt.getInt("MaxSpawnDelay"); // Paper - short->int + this.spawnCount = nbt.getShort("SpawnCount"); + } + +@@ -262,9 +273,20 @@ public abstract class BaseSpawner { + if (minecraftkey == null) { + return nbt; + } else { +- nbt.putShort("Delay", (short) this.spawnDelay); +- nbt.putShort("MinSpawnDelay", (short) this.minSpawnDelay); +- nbt.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay); ++ // Paper start ++ if (spawnDelay > Short.MAX_VALUE) { ++ nbt.putInt("Paper.Delay", this.spawnDelay); ++ } ++ nbt.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay)); ++ ++ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) { ++ nbt.putInt("Paper.MinSpawnDelay", this.minSpawnDelay); ++ nbt.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay); ++ } ++ ++ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); ++ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); ++ // Paper end + nbt.putShort("SpawnCount", (short) this.spawnCount); + nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); + nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +index ff8eba31e6169b5a1debe47f17a40e6d0be67897..75575b24aa0291c26d65de9787bc9d2f88c867e4 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +@@ -121,4 +121,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState void filterTextPacket(T text, Consumer consumer, BiFunction>> backingFilterer) { + private void filterTextPacket(T text, Consumer consumer, BiFunction> backingFilterer) { diff --git a/patches/server-remapped/0349-Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/patches/server/0323-Fix-sounds-when-item-frames-are-modified-MC-123450.patch similarity index 78% rename from patches/server-remapped/0349-Fix-sounds-when-item-frames-are-modified-MC-123450.patch rename to patches/server/0323-Fix-sounds-when-item-frames-are-modified-MC-123450.patch index 262820c22..25c0eca23 100644 --- a/patches/server-remapped/0349-Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/patches/server/0323-Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450) This also fixes the adding sound playing when the item frame direction is changed. diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index d6e6846a12a889222ced67937c09d184a64c60b9..429d8a50a35f07bfc16dbedf28560fa6df817644 100644 +index 5fab5f74f7ef2ba94d7dae1679653201d7ccb30f..b829efdb40051a41b3bf1cabb8bf7d7c952797b5 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -@@ -277,7 +277,7 @@ public class ItemFrame extends HangingEntity { +@@ -307,7 +307,7 @@ public class ItemFrame extends HangingEntity { } this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack); - if (!itemstack.isEmpty() && playSound) { // CraftBukkit + if (!itemstack.isEmpty() && flag && playSound) { // CraftBukkit // Paper - only play sound when update flag is set - this.playSound(SoundEvents.ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F); + this.playSound(this.getAddItemSound(), 1.0F, 1.0F); } diff --git a/patches/server-remapped/0350-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/patches/server/0324-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch similarity index 80% rename from patches/server-remapped/0350-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch rename to patches/server/0324-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch index 367d2e18c..92eb435a4 100644 --- a/patches/server-remapped/0350-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch +++ b/patches/server/0324-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch @@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled synchronously when the server gets shut down. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 35984c7e994570a909ed4ffaabe64ae941b15e71..9beda5e429b5c520a41d9c7f536dc48dbb6f6f9e 100644 +index eb103c15218c334b9f85a57e30582e9efb188704..c8a59de4673d430fc8ec2e53315f107293122e7e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2190,7 +2190,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop