This commit is contained in:
Jason Penilla 2021-11-23 19:42:31 -08:00 committed by MiniDigger | Martin
parent 35d0ab1ca8
commit 5d0d11e4b6
20 changed files with 79 additions and 103 deletions

View File

@ -36,6 +36,10 @@ public net.minecraft.network.protocol.game.ServerboundInteractPacket$ActionType
# Configurable RCON IP address # Configurable RCON IP address
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String; public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
# Mob Spawner API Enhancements
public net.minecraft.world.level.BaseSpawner isNearPlayer(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z
public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V
# LootTable API # LootTable API
public org.bukkit.craftbukkit.block.CraftBlockEntityState getTileEntity()Lnet/minecraft/world/level/block/entity/BlockEntity; public org.bukkit.craftbukkit.block.CraftBlockEntityState getTileEntity()Lnet/minecraft/world/level/block/entity/BlockEntity;
public org.bukkit.craftbukkit.block.CraftLootable setLootTable(Lorg/bukkit/loot/LootTable;J)V public org.bukkit.craftbukkit.block.CraftLootable setLootTable(Lorg/bukkit/loot/LootTable;J)V

View File

@ -9,10 +9,10 @@ a ton of noise to plugin developers.
These do not help plugin developers if they bring moise noise than value. 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 diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a950e52a971 100644 index 80517b3bc7fe470c418cf9343c86b151ad9a702a..50412ec90cd480b7457dd30723d4978fb90fae72 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1519,7 +1519,7 @@ public final class Bukkit { @@ -1533,7 +1533,7 @@ public final class Bukkit {
* *
* @return the scoreboard manager or null if no worlds are loaded. * @return the scoreboard manager or null if no worlds are loaded.
*/ */
@ -21,7 +21,7 @@ index a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a95
public static ScoreboardManager getScoreboardManager() { public static ScoreboardManager getScoreboardManager() {
return server.getScoreboardManager(); return server.getScoreboardManager();
} }
@@ -1816,7 +1816,7 @@ public final class Bukkit { @@ -1830,7 +1830,7 @@ public final class Bukkit {
* @param clazz the class of the tag entries * @param clazz the class of the tag entries
* @return the tag or null * @return the tag or null
*/ */
@ -62,10 +62,10 @@ index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..23ca89dde7f6ac9082d4b97fce295942
if (this.world == null) { if (this.world == null) {
return null; return null;
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efeda85382c7 100644 index 2534560ccc8340500b71572ee6121df8ec06e154..5d3479f494e874d9824b178bfc0664d81e9b5649 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -1286,7 +1286,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -1298,7 +1298,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* *
* @return the scoreboard manager or null if no worlds are loaded. * @return the scoreboard manager or null if no worlds are loaded.
*/ */
@ -74,7 +74,7 @@ index 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efed
ScoreboardManager getScoreboardManager(); ScoreboardManager getScoreboardManager();
/** /**
@@ -1556,7 +1556,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -1568,7 +1568,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param clazz the class of the tag entries * @param clazz the class of the tag entries
* @return the tag or null * @return the tag or null
*/ */

View File

@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4..8c46eaebf004823c1c31eb2c7304181487cb1332 100644 index 48f272747b8d5ab43f79a9d474713aca79f121b7..61d12cb8f0a924abf696b6da7258f34dbb7b51b6 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent {

View File

@ -103,7 +103,7 @@ index 23ca89dde7f6ac9082d4b97fce2959425f3680cb..8321441b8f528a05e297f485672f928e
* Creates explosion at this location with given power * 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 diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e4d3618afa8a022ae556febd23be76b5fe6dfe0e..bcac107353149d0129571a3548965a407aa7640c 100644 index 614c04c31c95e9a404b5caac3e07285ce2c58367..ed97f1f2566582df2c1794856caefff5bedb0fb0 100644
--- a/src/main/java/org/bukkit/World.java --- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java
@@ -160,6 +160,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -160,6 +160,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient

View File

@ -64,13 +64,13 @@ index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74
+ Sound getFallSound(); + Sound getFallSound();
+} +}
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 18ab5cca036522df2d245f755d6c67904e6398e8..5ac36e0f90d0889853736390877aa92ec0ca181b 100644 index 79c0fa47a0d733d1547f8926d88169939c986d8c..5e92f8f6ba5368ae934c24154ab13fbc6a46272f 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -587,4 +587,16 @@ public interface Block extends Metadatable { @@ -596,4 +596,16 @@ public interface Block extends Metadatable {
* @return <code>true</code> if the block data can be placed here
*/ */
@NotNull boolean canPlace(@NotNull BlockData data);
VoxelShape getCollisionShape();
+ +
+ // Paper start + // Paper start
+ /** + /**

View File

@ -61,13 +61,13 @@ index d149ecefb0ee379f3fa7e64e4d70bdd23adbd49b..5d37c82bd5cd20aa2d452f0214f33037
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index a0ac89c6b27b2de0055e551df613247b23288b6c..b3a4c907bb15907d82e58247cb049e3f9fcf990e 100644 index 62dc233b6d53c28b8c64a372f60f87e258a7c2a6..08d9980a5b9b26f7dbdfcb6cda7a3995d58bea81 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -51,7 +51,7 @@ public abstract class BaseSpawner { @@ -51,7 +51,7 @@ public abstract class BaseSpawner {
} }
private boolean isNearPlayer(Level world, BlockPos pos) { public boolean isNearPlayer(Level world, BlockPos pos) {
- return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); - return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange);
+ return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper + return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
} }

View File

@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0 vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 0741dcbd06395b4696eb6083128a5d9b679cb3fb..82ffe3624943d2e931e2cc2f85ede94f369bd06b 100644 index 2716fb59e83e2e2bca845bd1b58c5aefb7aa89a0..f3991a30f634122020ca6334bc6f2ca84e93ecac 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -105,6 +105,7 @@ public class ItemEntity extends Entity { @@ -106,6 +106,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers // CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick; int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@ -17,7 +17,7 @@ index 0741dcbd06395b4696eb6083128a5d9b679cb3fb..82ffe3624943d2e931e2cc2f85ede94f
if (this.age != -32768) this.age += elapsedTicks; if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick; this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end // CraftBukkit end
@@ -193,6 +194,7 @@ public class ItemEntity extends Entity { @@ -192,6 +193,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers // CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick; int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e7fefa95597d4c7388052731a79b8c7c55d2a766..1a7a9315893887227da8bc39230b656b79f96f49 100644 index 76923773118ac2f152ba7b3a0bb5d0e71d95533c..e512c30390953b90c9709f30d55585a1379141db 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1330,6 +1330,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1318,6 +1318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}); });
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end // Paper end
@ -17,16 +17,15 @@ index e7fefa95597d4c7388052731a79b8c7c55d2a766..1a7a9315893887227da8bc39230b656b
++this.tickCount; ++this.tickCount;
this.tickChildren(shouldKeepTicking); this.tickChildren(shouldKeepTicking);
@@ -1374,6 +1375,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1356,6 +1357,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks();
} }
// Paper end // Paper end
+ // Paper start + // Paper start
+ long endTime = System.nanoTime(); + long endTime = System.nanoTime();
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime; + long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent(); + new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
+ // Paper end + // Paper end
+
this.profiler.push("tallying"); this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;

View File

@ -8,10 +8,10 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 366d1de99479b53d2e9dac03d71a5a3b1be31ee3..a055419b381a1e244d9d88208f0fcf2e5ba6b379 100644 index e8ef3adad0bfddf17271e095ec928c8acb9413f2..ea73914ec8fb877de3f34cf7d5a0d60d547733fe 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -724,6 +724,46 @@ public class ServerPlayer extends Player { @@ -762,6 +762,46 @@ public class ServerPlayer extends Player {
}); });
} }
@ -58,7 +58,7 @@ index 366d1de99479b53d2e9dac03d71a5a3b1be31ee3..a055419b381a1e244d9d88208f0fcf2e
@Override @Override
public void die(DamageSource source) { public void die(DamageSource source) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@@ -809,7 +849,12 @@ public class ServerPlayer extends Player { @@ -847,7 +887,12 @@ public class ServerPlayer extends Player {
this.dropExperience(); this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) { if (!event.getKeepInventory()) {

View File

@ -10,13 +10,13 @@ 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. 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 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7b522b984a0152bc43be1589d26478ecf4988696..be63e37b9adef56f78c58efca262c8ab94489f8e 100644 index f7fccb4761e829a2a1d431f56cfb4288ae0bbd2d..faaa93e77523fbb942690491687410df48899ddb 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -866,9 +866,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -875,9 +875,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable @Nullable
public BlockEntity getTileEntity(BlockPos blockposition, boolean validate) { public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
- if (this.capturedTileEntities.containsKey(blockposition)) { - if (this.capturedTileEntities.containsKey(blockposition)) {
- return this.capturedTileEntities.get(blockposition); - return this.capturedTileEntities.get(blockposition);
+ // Paper start - Optimize capturedTileEntities lookup + // Paper start - Optimize capturedTileEntities lookup

View File

@ -5,7 +5,7 @@ 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 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a6884bde5e6e717c5f37b0b96070b44f1253ce35..25d587136e69fb4d6e62cc074a16bfb0deceb52a 100644 index 8615d4abbf18ab105ca7edffa10e8122ef76add3..b521b6f2db867037ee986e32f7e2cbcd3038d8a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -204,6 +204,29 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -204,6 +204,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -5,37 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa534de377c6 100644 index 1e0d630a5c192a0fb60882acecd8a6ed68d00a92..dba24bb35085a14a3780c10762f229eb40f84ef9 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/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 { @@ -230,7 +230,13 @@ public abstract class BaseSpawner {
private static final Logger LOGGER = LogManager.getLogger();
private static final int EVENT_SPAWN = 1;
- private static WeightedRandomList<SpawnData> EMPTY_POTENTIALS = WeightedRandomList.create();
+ public static WeightedRandomList<SpawnData> EMPTY_POTENTIALS = WeightedRandomList.create(); // Paper - private->public
public int spawnDelay = 20;
public WeightedRandomList<SpawnData> 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
}
@@ -226,7 +226,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 {
@@ -240,7 +240,13 @@ public abstract class BaseSpawner {
} }
public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) { public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) {
@ -46,14 +19,13 @@ index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa53
this.spawnDelay = nbt.getShort("Delay"); this.spawnDelay = nbt.getShort("Delay");
+ } + }
+ // Paper end + // Paper end
List<SpawnData> list = Lists.newArrayList(); boolean flag = nbt.contains("SpawnPotentials", 9);
boolean flag1 = nbt.contains("SpawnData", 10);
if (nbt.contains("SpawnPotentials", 9)) { @@ -266,9 +272,15 @@ public abstract class BaseSpawner {
@@ -259,10 +265,15 @@ public abstract class BaseSpawner { }
this.setNextSpawnData(world, pos, mobspawnerdata);
});
} }
-
+ // Paper start - use ints if set + // Paper start - use ints if set
+ if (nbt.contains("Paper.MinSpawnDelay", 99)) { + if (nbt.contains("Paper.MinSpawnDelay", 99)) {
+ this.minSpawnDelay = nbt.getInt("Paper.MinSpawnDelay"); + this.minSpawnDelay = nbt.getInt("Paper.MinSpawnDelay");
@ -63,37 +35,37 @@ index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa53
if (nbt.contains("MinSpawnDelay", 99)) { if (nbt.contains("MinSpawnDelay", 99)) {
- this.minSpawnDelay = nbt.getShort("MinSpawnDelay"); - this.minSpawnDelay = nbt.getShort("MinSpawnDelay");
- this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay"); - this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay");
+ this.minSpawnDelay = nbt.getInt("MinSpawnDelay"); // Paper - short->int + this.minSpawnDelay = nbt.getInt("MinSpawnDelay"); // Paper - short -> int
+ this.maxSpawnDelay = nbt.getInt("MaxSpawnDelay"); // Paper - short->int + this.maxSpawnDelay = nbt.getInt("MaxSpawnDelay"); // Paper - short -> int
this.spawnCount = nbt.getShort("SpawnCount"); this.spawnCount = nbt.getShort("SpawnCount");
} }
@@ -284,9 +295,20 @@ public abstract class BaseSpawner { @@ -285,9 +297,20 @@ public abstract class BaseSpawner {
if (minecraftkey == null) { }
return nbt;
} else { public CompoundTag save(CompoundTag nbttagcompound) {
- nbt.putShort("Delay", (short) this.spawnDelay); - nbttagcompound.putShort("Delay", (short) this.spawnDelay);
- nbt.putShort("MinSpawnDelay", (short) this.minSpawnDelay); - nbttagcompound.putShort("MinSpawnDelay", (short) this.minSpawnDelay);
- nbt.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay); - nbttagcompound.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
+ // Paper start + // Paper start
+ if (spawnDelay > Short.MAX_VALUE) { + if (spawnDelay > Short.MAX_VALUE) {
+ nbt.putInt("Paper.Delay", this.spawnDelay); + nbttagcompound.putInt("Paper.Delay", this.spawnDelay);
+ } + }
+ nbt.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay)); + nbttagcompound.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay));
+ +
+ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) { + if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) {
+ nbt.putInt("Paper.MinSpawnDelay", this.minSpawnDelay); + nbttagcompound.putInt("Paper.MinSpawnDelay", this.minSpawnDelay);
+ nbt.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay); + nbttagcompound.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay);
+ } + }
+ +
+ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay)); + nbttagcompound.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
+ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay)); + nbttagcompound.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
+ // Paper end + // Paper end
nbt.putShort("SpawnCount", (short) this.spawnCount); nbttagcompound.putShort("SpawnCount", (short) this.spawnCount);
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbttagcompound.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange); nbttagcompound.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 diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..b6c1460e342685c9c3c418be786d9b19c006184b 100644 index 6c427b15f78970912bae881f5aba1cfae2a4ba53..128a675a5af5148216dfa4bea6a5762b639f69f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -116,4 +116,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti @@ -116,4 +116,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti
@ -122,8 +94,8 @@ index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..b6c1460e342685c9c3c418be786d9b19
+ entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag())); + entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag()));
+ compound.put("Entity", entity); + compound.put("Entity", entity);
+ compound.putInt("Weight", this.getSnapshotNBT().contains("Weight", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_ANY_NUMBER) ? this.getSnapshotNBT().getInt("Weight") : 1); + compound.putInt("Weight", this.getSnapshotNBT().contains("Weight", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_ANY_NUMBER) ? this.getSnapshotNBT().getInt("Weight") : 1);
+ this.getSnapshot().getSpawner().setNextSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound)); + this.getSnapshot().getSpawner().setNextSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound, java.util.Optional.empty())); // 1.18 todo - is empty optional correct
+ this.getSnapshot().getSpawner().spawnPotentials= net.minecraft.world.level.BaseSpawner.EMPTY_POTENTIALS; + this.getSnapshot().getSpawner().spawnPotentials = net.minecraft.util.random.SimpleWeightedRandomList.empty(); // 1.18 todo - previously used removed field, check
+ } + }
+ // Paper end + // Paper end
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index fafb0052efb2942955d3964967f203413cb09574..ea19697d8e60a993979d61a4d0f89110fd2cc574 100644 index d27bc3d8433c0692019c0eb968c857d95a9558f0..f4444fb23a75d0617438f6b25df7bd401ab65a26 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -439,7 +439,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -438,7 +438,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Objects.requireNonNull(this.connection); Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait // CraftBukkit - Don't wait

View File

@ -6,7 +6,7 @@ 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. 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 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 5fab5f74f7ef2ba94d7dae1679653201d7ccb30f..b829efdb40051a41b3bf1cabb8bf7d7c952797b5 100644 index 82ad5f56e2a16eb9650d4aceccb40ad84cc40418..30159f4f387b61b50589fad61f91c9e5a4adaf12 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -307,7 +307,7 @@ public class ItemFrame extends HangingEntity { @@ -307,7 +307,7 @@ public class ItemFrame extends HangingEntity {

View File

@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled
synchronously when the server gets shut down. 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 diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1a7a9315893887227da8bc39230b656b79f96f49..8fc9c88a3e4733505dcb53bad1bfdffcb7a2bfc2 100644 index e512c30390953b90c9709f30d55585a1379141db..beefed4d29fee9c20ee69bef88a7af2cc3770707 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2288,7 +2288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2283,7 +2283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
@Override @Override
public boolean isSameThread() { public boolean isSameThread() {
@ -29,10 +29,10 @@ index 1a7a9315893887227da8bc39230b656b79f96f49..8fc9c88a3e4733505dcb53bad1bfdffc
public boolean isDebugging() { public boolean isDebugging() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 67eb0b97d6ca74e815140eea7f5262b55f6f8e6e..0dbab8b372d174f343c7d57b147692a68ba2fb95 100644 index b0b01f9c6c209faf6e400aa8aa221260cb80d12a..634c50378d860808081868b2d20145d3b01259a7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2004,7 +2004,7 @@ public final class CraftServer implements Server { @@ -2049,7 +2049,7 @@ public final class CraftServer implements Server {
@Override @Override
public boolean isPrimaryThread() { public boolean isPrimaryThread() {

View File

@ -9,7 +9,7 @@ waiting for the execution queue to get to our request; We can just query
the chunk status and get a response now, vs having to wait the chunk status and get a response now, vs having to wait
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 25d587136e69fb4d6e62cc074a16bfb0deceb52a..3d13316726582283147714264f95595c518ff67f 100644 index b521b6f2db867037ee986e32f7e2cbcd3038d8a3..f68fa8f971c39e3d150860542341a2564730b089 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -275,13 +275,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -275,13 +275,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -49,13 +49,14 @@ index 0000000000000000000000000000000000000000..9a516520d975f52169e346adc4ec6d9d
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index f1c4c3a3392c2d4d836fa10d7a38558d08084d9d..71b5ef18e6b0ef48834c125d9503f70359a2dfd0 100644 index 3250559589eb4db7b3df828144cee81a19651842..0408a72e801178375426edf3e1c1880774ca5478 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -594,4 +594,10 @@ public class CraftBlock implements Block { @@ -606,4 +606,11 @@ public class CraftBlock implements Block {
VoxelShape shape = this.getNMS().getCollisionShape(world, position);
return new CraftVoxelShape(shape); return iblockdata.canSurvive(world, this.position);
} }
+
+ // Paper start + // Paper start
+ @Override + @Override
+ public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() { + public com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup() {