diff --git a/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch index 489466a9fd..859927fe88 100644 --- a/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch +++ b/patches/server/Ability-to-control-player-s-insomnia-and-phantoms.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Ability to control player's insomnia and phantoms private EntitySelector() {} - // Paper start + // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java diff --git a/patches/server/Add-BeaconEffectEvent.patch b/patches/server/Add-BeaconEffectEvent.patch index a630681152..c496287ad1 100644 --- a/patches/server/Add-BeaconEffectEvent.patch +++ b/patches/server/Add-BeaconEffectEvent.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - BeaconEffectEvent + org.bukkit.block.Block block = ((Player) list.get(0)).level().getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()); + PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(effects, i, b0, true, true)); -+ // Paper end ++ // Paper end - BeaconEffectEvent while (iterator.hasNext()) { - entityhuman = (Player) iterator.next(); @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary); + if (CraftEventFactory.callEvent(event).isCancelled()) continue; + entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON); -+ // Paper end ++ // Paper end - BeaconEffectEvent } } } diff --git a/patches/server/Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/Add-Early-Warning-Feature-to-WatchDog.patch index 144c833f24..71512c8e16 100644 --- a/patches/server/Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/Add-Early-Warning-Feature-to-WatchDog.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start + org.spigotmc.WatchdogThread.hasStarted = true; // Paper Arrays.fill( this.recentTps, 20 ); - long tickSection = Util.getNanos(), curTime, tickCount = 1; // Paper + long tickSection = Util.getMillis(), tickCount = 1; while (this.running) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/Add-configurable-entity-despawn-distances.patch similarity index 90% rename from patches/server/Add-configurable-despawn-distances-for-living-entiti.patch rename to patches/server/Add-configurable-entity-despawn-distances.patch index b0f56112c3..ad508a570e 100644 --- a/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/Add-configurable-entity-despawn-distances.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Suddenly Date: Tue, 1 Mar 2016 13:51:54 -0600 -Subject: [PATCH] Add configurable despawn distances for living entities +Subject: [PATCH] Add configurable entity despawn distances diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); - int i = this.getType().getCategory().getDespawnDistance(); -+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - custom despawn distances ++ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - Configurable despawn distances int j = i * i; if (d0 > (double) j && this.removeWhenFarAway(d0)) { @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - int k = this.getType().getCategory().getNoDespawnDistance(); -+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - custom despawn distances ++ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - Configurable despawn distances int l = k * k; if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { diff --git a/patches/server/Add-exception-reporting-event.patch b/patches/server/Add-exception-reporting-event.patch index 46c3e2d483..76200db71d 100644 --- a/patches/server/Add-exception-reporting-event.patch +++ b/patches/server/Add-exception-reporting-event.patch @@ -103,12 +103,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.mojang.serialization.Codec; import java.io.IOException; @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - // Paper start - Prevent tile entity and entity crashes + // Paper start - Prevent block entity and entity crashes final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); + getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent entity.discard(); - // Paper end + // Paper end - Prevent block entity and entity crashes } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -164,12 +164,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } @@ -0,0 +0,0 @@ public class LevelChunk extends ChunkAccess { - // Paper start - Prevent tile entity and entity crashes + // Paper start - Prevent block entity and entity crashes final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); + net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent LevelChunk.this.removeBlockEntity(this.getPos()); - // Paper end + // Paper end - Prevent block entity and entity crashes // Spigot start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/Add-option-to-nerf-pigmen-from-nether-portals.patch index ba44792916..1bd35cece0 100644 --- a/patches/server/Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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, EntityAccess, CommandSource, S + public void inactiveTick() { } // Spigot end - // Paper start protected int numCollisions = 0; // Paper - Cap entity collisions + public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one + // Paper start - Entity origin API @javax.annotation.Nullable - private org.bukkit.util.Vector origin; @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (spawnedViaMobSpawner) { nbttagcompound.putBoolean("Paper.FromMobSpawner", true); diff --git a/patches/server/Add-phantom-creative-and-insomniac-controls.patch b/patches/server/Add-phantom-creative-and-insomniac-controls.patch index f8cdbb0aa9..41705d485b 100644 --- a/patches/server/Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/Add-phantom-creative-and-insomniac-controls.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static Predicate IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper - Add phantom creative and insomniac controls private EntitySelector() {} - // Paper start + // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java diff --git a/patches/server/Add-tick-times-API-and-mspt-command.patch b/patches/server/Add-tick-times-API-and-mspt-command.patch index 753a50cd37..06b9ef18a0 100644 --- a/patches/server/Add-tick-times-API-and-mspt-command.patch +++ b/patches/server/Add-tick-times-API-and-mspt-command.patch @@ -188,19 +188,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - net.minecraft.server.MinecraftServer.getServer().tps15.getAverage() - }; + return CraftMagicNumbers.INSTANCE; } -+ + + @Override + public long[] getTickTimes() { -+ return getServer().tickTimes5s.getTimes(); ++ return this.getServer().tickTimes5s.getTimes(); + } + + @Override + public double getAverageTickTime() { -+ return getServer().tickTimes5s.getAverage(); ++ return this.getServer().tickTimes5s.getAverage(); + } - // Paper end - ++ // Spigot start + private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() + { diff --git a/patches/server/Allow-for-toggling-of-spawn-chunks.patch b/patches/server/Allow-for-toggling-of-spawn-chunks.patch index 0585456d4b..c9c6177e3a 100644 --- a/patches/server/Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/Allow-for-toggling-of-spawn-chunks.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }); // CraftBukkit end this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings -+ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper ++ this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); } diff --git a/patches/server/Allow-nerfed-mobs-to-jump.patch b/patches/server/Allow-nerfed-mobs-to-jump.patch index 93e2442726..37cc28c372 100644 --- a/patches/server/Allow-nerfed-mobs-to-jump.patch +++ b/patches/server/Allow-nerfed-mobs-to-jump.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final BodyRotationControl bodyRotationControl; protected PathNavigation navigation; public GoalSelector goalSelector; -+ @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper ++ @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper - Allow nerfed mobs to jump and float public GoalSelector targetSelector; @Nullable private LivingEntity target; @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + return; + } -+ // Paper end ++ // Paper end - Allow nerfed mobs to jump and float this.level().getProfiler().push("sensing"); this.sensing.tick(); this.level().getProfiler().pop(); @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public FloatGoal(Mob mob) { this.mob = mob; -+ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper ++ if (mob.getCommandSenderWorld().paperConfig().entities.behavior.spawnerNerfedMobsShouldJump) mob.goalFloat = this; // Paper - Allow nerfed mobs to jump and float this.setFlags(EnumSet.of(Goal.Flag.JUMP)); mob.getNavigation().setCanFloat(true); } diff --git a/patches/server/Anti-Xray.patch b/patches/server/Anti-Xray.patch index 401f1eaa0b..a4f0205806 100644 --- a/patches/server/Anti-Xray.patch +++ b/patches/server/Anti-Xray.patch @@ -1189,7 +1189,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.generator = gen; @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper + this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray diff --git a/patches/server/Cap-Entity-Collisions.patch b/patches/server/Cap-Entity-Collisions.patch index c92cdca283..e8a7f7dbc4 100644 --- a/patches/server/Cap-Entity-Collisions.patch +++ b/patches/server/Cap-Entity-Collisions.patch @@ -16,13 +16,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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, EntityAccess, CommandSource, S + public long activatedTick = Integer.MIN_VALUE; public void inactiveTick() { } // Spigot end - // Paper start + protected int numCollisions = 0; // Paper - Cap entity collisions + // Paper start - Entity origin API @javax.annotation.Nullable private org.bukkit.util.Vector origin; - @javax.annotation.Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/patches/server/Collision-optimisations.patch b/patches/server/Collision-optimisations.patch index f0d607f42b..2f89ad97f0 100644 --- a/patches/server/Collision-optimisations.patch +++ b/patches/server/Collision-optimisations.patch @@ -2611,7 +2611,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - optimise collisions } - // Paper start + // Paper start - Affects Spawning API diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/server/Configurable-baby-zombie-movement-speed.patch b/patches/server/Configurable-baby-zombie-movement-speed.patch index bd59b09c78..56bb4c5b78 100644 --- a/patches/server/Configurable-baby-zombie-movement-speed.patch +++ b/patches/server/Configurable-baby-zombie-movement-speed.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); - attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY.getId()); -+ attributemodifiable.removeModifier(this.babyModifier.getId()); // Paper ++ attributemodifiable.removeModifier(this.babyModifier.getId()); // Paper - Make baby speed configurable if (baby) { - attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY); -+ attributemodifiable.addTransientModifier(this.babyModifier); // Paper ++ attributemodifiable.addTransientModifier(this.babyModifier); // Paper - Make baby speed configurable } } diff --git a/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch index cf1b48f049..5e012e8bf8 100644 --- a/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = this.getHeightBelowUpToMax(world, pos) + 1; - if (i < 16) { -+ if (i < world.paperConfig().maxGrowthHeight.bamboo.max) { // Paper ++ if (i < world.paperConfig().maxGrowthHeight.bamboo.max) { // Paper - Configurable cactus/bamboo/reed growth heights this.growBamboo(state, world, pos, random, i); } } @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = this.getHeightBelowUpToMax(world, pos); - return i + j + 1 < 16 && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; -+ return i + j + 1 < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; // Paper ++ return i + j + 1 < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; // Paper - Configurable cactus/bamboo/reed growth heights } @Override @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockState iblockdata1 = world.getBlockState(blockposition1); - if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here -+ if (k >= world.paperConfig().maxGrowthHeight.bamboo.max || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus bamboo and reed growth heights ++ if (k >= world.paperConfig().maxGrowthHeight.bamboo.max || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus/bamboo/reed growth heights return; } @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = (Integer) state.getValue(BambooStalkBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; - int k = (height < 11 || random.nextFloat() >= 0.25F) && height != 15 ? 0 : 1; -+ int k = (height < world.paperConfig().maxGrowthHeight.bamboo.min || random.nextFloat() >= 0.25F) && height != (world.paperConfig().maxGrowthHeight.bamboo.max - 1) ? 0 : 1; // Paper ++ int k = (height < world.paperConfig().maxGrowthHeight.bamboo.min || random.nextFloat() >= 0.25F) && height != (world.paperConfig().maxGrowthHeight.bamboo.max - 1) ? 0 : 1; // Paper - Configurable cactus/bamboo/reed growth heights // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, blockpropertybamboosize)).setValue(BambooStalkBlock.STAGE, k), 3)) { @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i; - for (i = 0; i < 16 && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { -+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ++ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth heights ; } @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i; - for (i = 0; i < 16 && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { -+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper ++ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth heights ; } @@ -73,7 +73,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - if (i < 3) { -+ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable growth height ++ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth heightst int j = (Integer) state.getValue(CactusBlock.AGE); int modifier = world.spigotConfig.cactusModifier; // Spigot - SPIGOT-7159: Better modifier resolution @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - if (i < 3) { -+ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable growth height ++ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable cactus/bamboo/reed growth heights int j = (Integer) state.getValue(SugarCaneBlock.AGE); int modifier = world.spigotConfig.caneModifier; // Spigot - SPIGOT-7159: Better modifier resolution diff --git a/patches/server/Configurable-container-update-tick-rate.patch b/patches/server/Configurable-container-update-tick-rate.patch index f9263034eb..89e5eb27c4 100644 --- a/patches/server/Configurable-container-update-tick-rate.patch +++ b/patches/server/Configurable-container-update-tick-rate.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private RemoteChatSession chatSession; private int containerCounter; public boolean wonGame; -+ private int containerUpdateDelay; // Paper ++ private int containerUpdateDelay; // Paper - Configurable container update tick rate // CraftBukkit start public String displayName; @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.containerMenu.broadcastChanges(); + containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; + } -+ // Paper end ++ // Paper end - Configurable container update tick rate if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) { this.closeContainer(); this.containerMenu = this.inventoryMenu; diff --git a/patches/server/Configurable-end-credits.patch b/patches/server/Configurable-end-credits.patch index fcb80adcd5..2c6555c73d 100644 --- a/patches/server/Configurable-end-credits.patch +++ b/patches/server/Configurable-end-credits.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.unRide(); this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -+ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits ++ if (this.level().paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Option to disable end credits this.wonGame = true; this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); this.seenCredits = true; diff --git a/patches/server/Configurable-fishing-time-ranges.patch b/patches/server/Configurable-fishing-time-ranges.patch index 6dfff4a857..6dac131fb7 100644 --- a/patches/server/Configurable-fishing-time-ranges.patch +++ b/patches/server/Configurable-fishing-time-ranges.patch @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.noCulling = true; this.luck = Math.max(0, luckOfTheSeaLevel); this.lureSpeed = Math.max(0, lureLevel); -+ // Paper start ++ // Paper start - Configurable fishing time ranges + minWaitTime = world.paperConfig().fishingTimeRange.minimum; + maxWaitTime = world.paperConfig().fishingTimeRange.maximum; -+ // Paper end ++ // Paper end - Configurable fishing time ranges } public FishingHook(EntityType type, Level world) { diff --git a/patches/server/Configurable-mob-spawner-tick-rate.patch b/patches/server/Configurable-mob-spawner-tick-rate.patch index 9e09e47df3..3081039152 100644 --- a/patches/server/Configurable-mob-spawner-tick-rate.patch +++ b/patches/server/Configurable-mob-spawner-tick-rate.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int maxNearbyEntities = 6; public int requiredPlayerRange = 16; public int spawnRange = 4; -+ private int tickDelay = 0; // Paper ++ private int tickDelay = 0; // Paper - Configurable mob spawner tick rate public BaseSpawner() {} @@ -24,16 +24,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (spawnDelay > 0 && --tickDelay > 0) return; + tickDelay = world.paperConfig().tickRates.mobSpawner; + if (tickDelay == -1) { return; } // If disabled -+ // Paper end ++ // Paper end - Configurable mob spawner tick rate if (this.isNearPlayer(world, pos)) { - if (this.spawnDelay == -1) { -+ if (this.spawnDelay < -tickDelay) { ++ if (this.spawnDelay < -tickDelay) { // Paper - Configurable mob spawner tick rate this.delay(world, pos); } if (this.spawnDelay > 0) { - --this.spawnDelay; -+ this.spawnDelay -= tickDelay; // Paper ++ this.spawnDelay -= tickDelay; // Paper - Configurable mob spawner tick rate } else { boolean flag = false; RandomSource randomsource = world.getRandom(); diff --git a/patches/server/Configurable-top-of-nether-void-damage.patch b/patches/server/Configurable-top-of-nether-void-damage.patch index 85eb87f546..9c69aeb87e 100644 --- a/patches/server/Configurable-top-of-nether-void-damage.patch +++ b/patches/server/Configurable-top-of-nether-void-damage.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER + && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) + && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { -+ // Paper end ++ // Paper end - Configurable nether ceiling damage this.onBelowWorld(); } @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return holder.is(PoiTypes.NETHER_PORTAL); }, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> { - return worldborder.isWithinBounds(villageplacerecord.getPos()); -+ return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - don't teleport into void damage ++ return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - Configurable nether ceiling damage }).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error return villageplacerecord.getPos().distSqr(blockposition); }).thenComparingInt((villageplacerecord) -> { @@ -39,11 +39,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockposition2 = null; WorldBorder worldborder = this.level.getWorldBorder(); int i = Math.min(this.level.getMaxBuildHeight(), this.level.getMinBuildHeight() + this.level.getLogicalHeight()) - 1; -+ // Paper start - if ceiling void damage is enabled, make sure the max height doesn't exceed the void damage height ++ // Paper start - Configurable nether ceiling damage; make sure the max height doesn't exceed the void damage height + if (this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.enabled()) { + i = Math.min(i, this.level.paperConfig().environment.netherCeilingVoidDamageHeight.intValue() - 1); + } -+ // Paper end ++ // Paper end - Configurable nether ceiling damage BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); Iterator iterator = BlockPos.spiralAround(blockposition, createRadius, Direction.EAST, Direction.SOUTH).iterator(); // CraftBukkit diff --git a/patches/server/Disable-explosion-knockback.patch b/patches/server/Disable-explosion-knockback.patch index b3c9a1db99..44b6e9a6fe 100644 --- a/patches/server/Disable-explosion-knockback.patch +++ b/patches/server/Disable-explosion-knockback.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 LivingEntity entityliving = (LivingEntity) entity; - d13 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); -+ d13 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); // Paper - disable explosion knockback ++ d13 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); // Paper - Option to disable explosion knockback } else { d13 = d12; } @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Player entityhuman = (Player) entity; - if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying)) { -+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback ++ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Option to disable explosion knockback this.hitPlayers.put(entityhuman, vec3d1); } } diff --git a/patches/server/Disable-ice-and-snow.patch b/patches/server/Disable-ice-and-snow.patch index 119c38fb25..996216c844 100644 --- a/patches/server/Disable-ice-and-snow.patch +++ b/patches/server/Disable-ice-and-snow.patch @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 gameprofilerfiller.popPush("iceandsnow"); -+ if (!this.paperConfig().environment.disableIceAndSnow) { // Paper ++ if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int l = 0; l < randomTickSpeed; ++l) { if (this.random.nextInt(48) == 0) { this.tickPrecipitation(this.getBlockRandomPos(j, 0, k, 15)); } } -+ } // Paper ++ } // Paper - Option to disable ice and snow gameprofilerfiller.popPush("tickBlocks"); timings.chunkTicksBlocks.startTiming(); // Paper diff --git a/patches/server/Disable-thunder.patch b/patches/server/Disable-thunder.patch index 8098afd565..9cb40b734f 100644 --- a/patches/server/Disable-thunder.patch +++ b/patches/server/Disable-thunder.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 gameprofilerfiller.push("thunder"); - if (flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot -+ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder ++ if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { diff --git a/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch index fca27e85c1..56c1288b27 100644 --- a/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.move(MoverType.SELF, this.getDeltaMovement()); -+ // Paper start - Configurable EntityFallingBlock height nerf ++ // Paper start - Configurable falling blocks height nerf + if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) { + if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { + this.spawnAtLocation(block); @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.discard(); + return; + } -+ // Paper end ++ // Paper end - Configurable falling blocks height nerf if (!this.level().isClientSide) { BlockPos blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; @@ -34,12 +34,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.move(MoverType.SELF, this.getDeltaMovement()); -+ // Paper start - Configurable TNT entity height nerf ++ // Paper start - Configurable TNT height nerf + if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { + this.discard(); + return; + } -+ // Paper end ++ // Paper end - Configurable TNT height nerf this.setDeltaMovement(this.getDeltaMovement().scale(0.98D)); if (this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); @@ -51,12 +51,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void tick() { super.tick(); if (this.fuse > 0) { -+ // Paper start - Configurable TNT entity height nerf ++ // Paper start - Configurable TNT height nerf + if (this.level().paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) { + this.discard(); + return; + } -+ // Paper end ++ // Paper end - Configurable TNT height nerf --this.fuse; this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D); } else if (this.fuse == 0) { diff --git a/patches/server/Entity-Activation-Range-2.0.patch b/patches/server/Entity-Activation-Range-2.0.patch index ccb3201607..18c5aba33e 100644 --- a/patches/server/Entity-Activation-Range-2.0.patch +++ b/patches/server/Entity-Activation-Range-2.0.patch @@ -115,14 +115,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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, EntityAccess, CommandSource, S - // Paper start + // Spigot end protected int numCollisions = 0; // Paper - Cap entity collisions public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals + public long activatedImmunityTick = Integer.MIN_VALUE; // Paper - EAR + public boolean isTemporarilyActive; // Paper - EAR public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one + // Paper start - Entity origin API @javax.annotation.Nullable - private org.bukkit.util.Vector origin; @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } else { this.wasOnFire = this.isOnFire(); diff --git a/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch index 177ed44ae7..180bc70bfd 100644 --- a/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/Entity-AddTo-RemoveFrom-World-Events.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } - // Paper end + // Paper end - Entity origin API + new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity(), ServerLevel.this.getWorld()).callEvent(); // Paper - fire while valid } diff --git a/patches/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch index 24fe449646..79d7b505e5 100644 --- a/patches/server/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit -+ // Paper start - Set origin location when the entity is being added to the world ++ // Paper start - Entity origin API + if (entity.getOriginVector() == null) { + entity.setOrigin(entity.getBukkitEntity().getLocation()); + } @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (entity.getOriginWorld() == null) { + entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); + } -+ // Paper end ++ // Paper end - Entity origin API } public void onTrackingEnd(Entity entity) { @@ -32,17 +32,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public long activatedTick = Integer.MIN_VALUE; public void inactiveTick() { } // Spigot end -+ // Paper start ++ // Paper start - Entity origin API + @javax.annotation.Nullable + private org.bukkit.util.Vector origin; + @javax.annotation.Nullable + private UUID originWorld; -+ + + public void setOrigin(@javax.annotation.Nonnull Location location) { + this.origin = location.toVector(); + this.originWorld = location.getWorld().getUID(); + } - ++ + @javax.annotation.Nullable + public org.bukkit.util.Vector getOriginVector() { + return this.origin != null ? this.origin.clone() : null; @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public UUID getOriginWorld() { + return this.originWorld; + } -+ // Paper end ++ // Paper end - Entity origin API public float getBukkitYaw() { return this.yRot; } @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.bukkitEntity.storeBukkitValues(nbttagcompound); } // CraftBukkit end -+ // Paper start - Save the entity's origin location ++ // Paper start + if (this.origin != null) { + UUID originWorld = this.originWorld != null ? this.originWorld : this.level != null ? this.level.getWorld().getUID() : null; + if (originWorld != null) { @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -+ // Paper start - Restore the entity's origin location ++ // Paper start + ListTag originTag = nbt.getList("Paper.Origin", net.minecraft.nbt.Tag.TAG_DOUBLE); + if (!originTag.isEmpty()) { + UUID originWorld = null; @@ -93,44 +93,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); -diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity { - this.blockState = Blocks.SAND.defaultBlockState(); - } - -+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility -+ if (nbt.contains("SourceLoc_x")) { -+ int srcX = nbt.getInt("SourceLoc_x"); -+ int srcY = nbt.getInt("SourceLoc_y"); -+ int srcZ = nbt.getInt("SourceLoc_z"); -+ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); -+ } -+ // Paper end - } - - public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) { -diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -@@ -0,0 +0,0 @@ public class PrimedTnt extends Entity implements TraceableEntity { - this.setBlockState(NbtUtils.readBlockState(this.level().holderLookup(Registries.BLOCK), nbt.getCompound("block_state"))); - } - -+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility -+ if (nbt.contains("SourceLoc_x")) { -+ int srcX = nbt.getInt("SourceLoc_x"); -+ int srcY = nbt.getInt("SourceLoc_y"); -+ int srcZ = nbt.getInt("SourceLoc_z"); -+ this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); -+ } -+ // Paper end - } - - @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/patches/server/Entity-fromMobSpawner.patch b/patches/server/Entity-fromMobSpawner.patch index 0048fc9744..fe2ec9b8fa 100644 --- a/patches/server/Entity-fromMobSpawner.patch +++ b/patches/server/Entity-fromMobSpawner.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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, EntityAccess, CommandSource, S + public void inactiveTick() { } // Spigot end - // Paper start protected int numCollisions = 0; // Paper - Cap entity collisions + public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one + // Paper start - Entity origin API @javax.annotation.Nullable private org.bukkit.util.Vector origin; - @javax.annotation.Nullable @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); diff --git a/patches/server/Entity-getEntitySpawnReason.patch b/patches/server/Entity-getEntitySpawnReason.patch index 6ea9bc5b1a..00e631591e 100644 --- a/patches/server/Entity-getEntitySpawnReason.patch +++ b/patches/server/Entity-getEntitySpawnReason.patch @@ -70,16 +70,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S - } - nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); - } -+ if (spawnReason != null) { -+ nbttagcompound.putString("Paper.SpawnReason", spawnReason.name()); -+ } - // Save entity's from mob spawner status - if (spawnedViaMobSpawner) { - nbttagcompound.putBoolean("Paper.FromMobSpawner", true); @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } diff --git a/patches/server/Execute-chunk-tasks-mid-tick.patch b/patches/server/Execute-chunk-tasks-mid-tick.patch index e67b088742..0d4c269a7e 100644 --- a/patches/server/Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/Execute-chunk-tasks-mid-tick.patch @@ -173,4 +173,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + MinecraftServer.getServer().executeMidTickTasks(); // Paper - execute chunk tasks mid tick } catch (Throwable throwable) { if (throwable instanceof ThreadDeath) throw throwable; // Paper - // Paper start - Prevent tile entity and entity crashes + // Paper start - Prevent block entity and entity crashes diff --git a/patches/server/Expand-FallingBlock-API.patch b/patches/server/Expand-FallingBlock-API.patch index 0afc46fdbc..209296a4b0 100644 --- a/patches/server/Expand-FallingBlock-API.patch +++ b/patches/server/Expand-FallingBlock-API.patch @@ -42,9 +42,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class FallingBlockEntity extends Entity { - this.setOrigin(new org.bukkit.Location(this.level().getWorld(), srcX, srcY, srcZ)); + this.blockState = Blocks.SAND.defaultBlockState(); } - // Paper end + + // Paper start - Expand FallingBlock API + if (nbt.contains("Paper.AutoExpire")) { + this.autoExpire = nbt.getBoolean("Paper.AutoExpire"); diff --git a/patches/server/Expose-LivingEntity-hurt-direction.patch b/patches/server/Expose-LivingEntity-hurt-direction.patch index 10c1339219..ebced81435 100644 --- a/patches/server/Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/Expose-LivingEntity-hurt-direction.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public FishingHook fishing; - protected float hurtDir; + public float hurtDir; // Paper - protected -> public - // Paper start - public boolean affectsSpawning = true; - // Paper end + public boolean affectsSpawning = true; // Paper - Affects Spawning API + + // CraftBukkit start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/patches/server/Fix-sand-duping.patch b/patches/server/Fix-sand-duping.patch index b2f1c4d9dd..94491dcf48 100644 --- a/patches/server/Fix-sand-duping.patch +++ b/patches/server/Fix-sand-duping.patch @@ -26,13 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.move(MoverType.SELF, this.getDeltaMovement()); -+ + // Paper start - fix sand duping + if (this.isRemoved()) { + return; + } + // Paper end - fix sand duping -+ - // Paper start - Configurable EntityFallingBlock height nerf + // Paper start - Configurable falling blocks height nerf if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) { if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { diff --git a/patches/server/Flying-Fall-Damage.patch b/patches/server/Flying-Fall-Damage.patch index 1f62b5381e..356229620c 100644 --- a/patches/server/Flying-Fall-Damage.patch +++ b/patches/server/Flying-Fall-Damage.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { + public FishingHook fishing; public float hurtDir; // Paper - protected -> public - // Paper start - public boolean affectsSpawning = true; + public boolean affectsSpawning = true; // Paper - Affects Spawning API + public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage - // Paper end // CraftBukkit start + public boolean fauxSleeping; @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { @Override diff --git a/patches/server/Further-improve-server-tick-loop.patch b/patches/server/Further-improve-server-tick-loop.patch index 8385424d77..1a574af82d 100644 --- a/patches/server/Further-improve-server-tick-loop.patch +++ b/patches/server/Further-improve-server-tick-loop.patch @@ -16,9 +16,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); @@ -92,8 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Date: Wed, 6 May 2020 05:00:57 -0400 -Subject: [PATCH] Handle Oversized Tile Entities in chunks +Subject: [PATCH] Handle Oversized block entities in chunks Splits out Extra Packets if too many TE's are encountered to prevent creating too large of a packet to sed. diff --git a/patches/server/Improve-death-events.patch b/patches/server/Improve-death-events.patch index 81a21e5e2f..b853c20f4f 100644 --- a/patches/server/Improve-death-events.patch +++ b/patches/server/Improve-death-events.patch @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { private int containerCounter; public boolean wonGame; - private int containerUpdateDelay; // Paper + private int containerUpdateDelay; // Paper - Configurable container update tick rate + // Paper start - cancellable death event -+ public boolean queueHealthUpdatePacket = false; ++ public boolean queueHealthUpdatePacket; + public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; -+ // Paper end ++ // Paper end - cancellable death event // CraftBukkit start public String displayName; diff --git a/patches/server/Improved-Watchdog-Support.patch b/patches/server/Improved-Watchdog-Support.patch index f4003acb0b..9d62d24b48 100644 --- a/patches/server/Improved-Watchdog-Support.patch +++ b/patches/server/Improved-Watchdog-Support.patch @@ -169,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.spigotmc.WatchdogThread.tick(); // Paper org.spigotmc.WatchdogThread.hasStarted = true; // Paper Arrays.fill( this.recentTps, 20 ); - long tickSection = Util.getNanos(), curTime, tickCount = 1; // Paper + long tickSection = Util.getMillis(), tickCount = 1; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop optional = villageplace.getInSquare((holder) -> { - return holder.is(PoiTypes.NETHER_PORTAL); - }, blockposition, i, PoiManager.Occupancy.ANY).filter((villageplacerecord) -> { -- return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - don't teleport into void damage +- return worldborder.isWithinBounds(villageplacerecord.getPos()) && !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> villageplacerecord.getPos().getY() >= v)); // Paper - Configurable nether ceiling damage - }).sorted(Comparator.comparingDouble((PoiRecord villageplacerecord) -> { // CraftBukkit - decompile error - return villageplacerecord.getPos().distSqr(blockposition); - }).thenComparingInt((villageplacerecord) -> { @@ -1028,7 +1028,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // why would we generate the chunk? + return false; + } -+ if (!worldborder.isWithinBounds(pos) || (this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> pos.getY() >= v))) { // Paper - don't teleport into void damage ++ if (!worldborder.isWithinBounds(pos) || (this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> pos.getY() >= v))) { // Paper - Configurable nether ceiling damage + return false; + } + return lowest.getBlockState(pos).hasProperty(BlockStateProperties.HORIZONTAL_AXIS); diff --git a/patches/server/Optimise-random-block-ticking.patch b/patches/server/Optimise-random-block-ticking.patch index a438e2e9d1..d9e71cec80 100644 --- a/patches/server/Optimise-random-block-ticking.patch +++ b/patches/server/Optimise-random-block-ticking.patch @@ -110,14 +110,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 gameprofilerfiller.push("thunder"); + final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change + - if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - disable thunder + if (!this.paperConfig().environment.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder - BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15)); + blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - if (!this.paperConfig().environment.disableIceAndSnow) { // Paper + if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int l = 0; l < randomTickSpeed; ++l) { if (this.random.nextInt(48) == 0) { - this.tickPrecipitation(this.getBlockRandomPos(j, 0, k, 15)); @@ -127,7 +127,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } } - } // Paper + } // Paper - Option to disable ice and snow @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { gameprofilerfiller.popPush("tickBlocks"); timings.chunkTicksBlocks.startTiming(); // Paper diff --git a/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 0683897424..a5208aaca9 100644 --- a/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - // Paper end + // Paper end - Prevent block entity and entity crashes } } + // Paper start - Option to prevent armor stands from doing entity lookups diff --git a/patches/server/Optional-per-player-mob-spawns.patch b/patches/server/Optional-per-player-mob-spawns.patch index 2009e53964..710b6cf8f5 100644 --- a/patches/server/Optional-per-player-mob-spawns.patch +++ b/patches/server/Optional-per-player-mob-spawns.patch @@ -68,9 +68,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - public boolean queueHealthUpdatePacket = false; + public boolean queueHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; - // Paper end + // Paper end - cancellable death event + // Paper start - Optional per player mob spawns + public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length; + public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper diff --git a/patches/server/Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/Pillager-patrol-spawn-settings-and-per-player-option.patch index bb5851fd9c..3d1c141307 100644 --- a/patches/server/Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -15,11 +15,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { public boolean wonGame; - private int containerUpdateDelay; // Paper + private int containerUpdateDelay; // Paper - Configurable container update tick rate public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed + public int patrolSpawnDelay; // Paper - Pillager patrol spawn settings and per player options // Paper start - cancellable death event - public boolean queueHealthUpdatePacket = false; + public boolean queueHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PatrolSpawner.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Player-affects-spawning-API.patch b/patches/server/Player-affects-spawning-API.patch index f67dbe917e..9bca4718ff 100644 --- a/patches/server/Player-affects-spawning-API.patch +++ b/patches/server/Player-affects-spawning-API.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final Predicate CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); private EntitySelector() {} -+ // Paper start ++ // Paper start - Affects Spawning API + public static final Predicate PLAYER_AFFECTS_SPAWNING = (entity) -> { + return !entity.isSpectator() && entity.isAlive() && entity instanceof Player player && player.affectsSpawning; + }; -+ // Paper end ++ // Paper end - Affects Spawning API public static Predicate withinDistance(double x, double y, double z, double max) { double d4 = max * max; @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { - Player entityhuman = this.level().getNearestPlayer(this, -1.0D); -+ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper ++ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); @@ -80,9 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable public FishingHook fishing; protected float hurtDir; -+ // Paper start -+ public boolean affectsSpawning = true; -+ // Paper end ++ public boolean affectsSpawning = true; // Paper - Affects Spawning API // CraftBukkit start public boolean fauxSleeping; @@ -107,11 +105,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ // Paper start ++ // Paper start - Affects Spawning API + default @Nullable Player findNearbyPlayer(Entity entity, double maxDistance, @Nullable Predicate predicate) { + return this.getNearestPlayer(entity.getX(), entity.getY(), entity.getZ(), maxDistance, predicate); + } -+ // Paper end ++ // Paper end - Affects Spawning API @Nullable default Player getNearestPlayer(double x, double y, double z, double maxDistance, @Nullable Predicate targetPredicate) { double d = -1.0D; @@ -119,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getNearestPlayer(x, y, z, maxDistance, predicate); } -+ // Paper start ++ // Paper start - Affects Spawning API + default boolean hasNearbyAlivePlayerThatAffectsSpawning(double x, double y, double z, double range) { + for (Player player : this.players()) { + if (EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // combines NO_SPECTATORS and LIVING_ENTITY_STILL_ALIVE with an "affects spawning" check @@ -131,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + return false; + } -+ // Paper end ++ // Paper end - Affects Spawning API + default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) { for(Player player : this.players()) { diff --git a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 02d92dfad2..2a118f6f55 100644 --- a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit -+ ServerLevel.this.getChunkSource().addEntity(entity); - // Paper start - Set origin location when the entity is being added to the world ++ ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server + // Paper start - Entity origin API if (entity.getOriginVector() == null) { entity.setOrigin(entity.getBukkitEntity().getLocation()); diff --git a/patches/server/Prevent-tile-entity-and-entity-crashes.patch b/patches/server/Prevent-block-entity-and-entity-crashes.patch similarity index 88% rename from patches/server/Prevent-tile-entity-and-entity-crashes.patch rename to patches/server/Prevent-block-entity-and-entity-crashes.patch index c6c5b49a18..8695c85b87 100644 --- a/patches/server/Prevent-tile-entity-and-entity-crashes.patch +++ b/patches/server/Prevent-block-entity-and-entity-crashes.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 1 Mar 2016 23:52:34 -0600 -Subject: [PATCH] Prevent tile entity and entity crashes +Subject: [PATCH] Prevent block entity and entity crashes diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java @@ -17,11 +17,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - entity.fillCrashReportCategory(crashreportsystemdetails); - throw new ReportedException(crashreport); -+ // Paper start - Prevent tile entity and entity crashes ++ // Paper start - Prevent block entity and entity crashes + final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); + MinecraftServer.LOGGER.error(msg, throwable); + entity.discard(); -+ // Paper end ++ // Paper end - Prevent block entity and entity crashes } } @@ -34,12 +34,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }); if (this.level != null) { - CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.getBlockState()); -+ // Paper start - Prevent TileEntity and Entity crashes ++ // Paper start - Prevent block entity and entity crashes + BlockState block = this.getBlockState(); + if (block != null) { + CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, block); + } -+ // Paper end ++ // Paper end - Prevent block entity and entity crashes CrashReportCategory.populateBlockDetails(crashReportSection, this.level, this.worldPosition, this.level.getBlockState(this.worldPosition)); } } @@ -56,11 +56,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - this.blockEntity.fillCrashReportCategory(crashreportsystemdetails); - throw new ReportedException(crashreport); -+ // Paper start - Prevent tile entity and entity crashes ++ // Paper start - Prevent block entity and entity crashes + final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); + net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); + LevelChunk.this.removeBlockEntity(this.getPos()); -+ // Paper end ++ // Paper end - Prevent block entity and entity crashes // Spigot start } finally { this.blockEntity.tickTimer.stopTiming(); diff --git a/patches/server/Prevent-opening-inventories-when-frozen.patch b/patches/server/Prevent-opening-inventories-when-frozen.patch index 6f578fa2f9..e7abf05ec0 100644 --- a/patches/server/Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/Prevent-opening-inventories-when-frozen.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; } - // Paper end + // Paper end - Configurable container update tick rate - if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) { + if (!this.level().isClientSide && this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason diff --git a/patches/server/Replace-OfflinePlayer-getLastPlayed.patch b/patches/server/Replace-OfflinePlayer-getLastPlayed.patch index d4fbe2c502..02ef4d5ecb 100644 --- a/patches/server/Replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/Replace-OfflinePlayer-getLastPlayed.patch @@ -22,10 +22,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { private int containerCounter; public boolean wonGame; - private int containerUpdateDelay; // Paper + private int containerUpdateDelay; // Paper - Configurable container update tick rate + public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed // Paper start - cancellable death event - public boolean queueHealthUpdatePacket = false; + public boolean queueHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index a46534b52e..af1d3afd5a 100644 --- a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @DontObfuscate public String getServerModName() { - return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla! -+ return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! ++ return "Paper"; // Paper } public SystemReport fillSystemReport(SystemReport details) { @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } else { + System.out.println("Unable to read system info"); + } -+ // Paper end ++ // Paper end - Log Java and OS versioning to help with debugging plugin issues + System.out.println("Loading libraries, please wait..."); net.minecraft.server.Main.main(options); diff --git a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch index f1f0f36990..8fc6a6f1f8 100644 --- a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -267,8 +267,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public OptionSet options; public org.bukkit.command.ConsoleCommandSender console; - public ConsoleReader reader; -+ //public ConsoleReader reader; // Paper - public static int currentTick = 0; // Paper - Further improve tick loop + public static int currentTick = (int) (System.currentTimeMillis() / 50); public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop