diff --git a/lophine-server/luminol-patches/features/0007-Carpet-features.patch b/lophine-server/luminol-patches/features/0007-Carpet-features.patch index f520934..5b1b734 100644 --- a/lophine-server/luminol-patches/features/0007-Carpet-features.patch +++ b/lophine-server/luminol-patches/features/0007-Carpet-features.patch @@ -5,20 +5,22 @@ Subject: [PATCH] Carpet features diff --git a/src/main/java/me/earthme/luminol/config/ConfigManager.java b/src/main/java/me/earthme/luminol/config/ConfigManager.java -index 05e1aa84586284ac0389e7023f975bfb08438535..da9ff49be1c7a12ea93d665c37e828afd24d7070 100644 +index 05e1aa84586284ac0389e7023f975bfb08438535..5a8c94337e42584ddaf25ef289327777e7ac675e 100644 --- a/src/main/java/me/earthme/luminol/config/ConfigManager.java +++ b/src/main/java/me/earthme/luminol/config/ConfigManager.java -@@ -25,6 +25,13 @@ public class ConfigManager { +@@ -25,6 +25,15 @@ public class ConfigManager { public static void initConfigs() { registerConfig("luminol", ConfigsInstance.of("luminol", "me.earthme.luminol.config.modules")); registerConfig("lophine", ConfigsInstance.of("lophine", "fun.bm.lophine.config.modules")); // add lophine global config ++ // Lophine start - add carpet config + registerConfig("lophine_carpet", ConfigsInstance.of( + new java.io.File("lophine_config"), + "lophine_carpet", + "lophine_carpet_config.toml", + "lophinecarpetconfig", + "fun.bm.lophine.carpet.config.modules" -+ )); // add lophine carpet config ++ )); ++ // Lophine end - add carpet config preLoad(); } diff --git a/lophine-server/luminol-patches/features/0009-TEMP-Temporarily-transform-config-between-different-.patch b/lophine-server/luminol-patches/features/0009-TEMP-Temporarily-transform-config-between-different-.patch index d7f7349..ebedf29 100644 --- a/lophine-server/luminol-patches/features/0009-TEMP-Temporarily-transform-config-between-different-.patch +++ b/lophine-server/luminol-patches/features/0009-TEMP-Temporarily-transform-config-between-different-.patch @@ -7,17 +7,19 @@ Subject: [PATCH] TEMP: Temporarily transform config between different config Should be removed in Minecraft 26.2 Update diff --git a/src/main/java/me/earthme/luminol/config/ConfigManager.java b/src/main/java/me/earthme/luminol/config/ConfigManager.java -index da9ff49be1c7a12ea93d665c37e828afd24d7070..dc6e6d38ebe0c4f7f481da571ab116015fd08cd2 100644 +index 5a8c94337e42584ddaf25ef289327777e7ac675e..b652525f243c23e09c4e13f67617e99a3ce0db04 100644 --- a/src/main/java/me/earthme/luminol/config/ConfigManager.java +++ b/src/main/java/me/earthme/luminol/config/ConfigManager.java -@@ -62,6 +62,10 @@ public class ConfigManager { +@@ -64,6 +64,12 @@ public class ConfigManager { CompletableFuture.allOf(futures).join(); CommandRegister.register(); // register command after config loaded to enable some command didn't depend on config files initialized = true; + ++ // Lophine start - temporarily transform configs + reApplyStagedConfigs(); + saveConfigs(); + configfiles.values().forEach((config) -> config.reload(true, false)); ++ // Lophine end - temporarily transform configs } public static void registerRunnableBeforeFinalLoad(Runnable runnable) { diff --git a/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch b/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch index e971b8d..12545e7 100644 --- a/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch +++ b/lophine-server/minecraft-patches/features/0002-Fix-datapack-command-save-function.patch @@ -26,7 +26,7 @@ index 83178b9a0b017c8945c0f41981838f40263c9a12..ef898f5b60219be00471f9ea227103df final Collection packsToEnable, final io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause ) { diff --git a/net/minecraft/server/commands/DataPackCommand.java b/net/minecraft/server/commands/DataPackCommand.java -index 0c7c829270d3cd3dd05a3dc7dfe82ee01d5c6bd8..04fa1c5bb1c0b025a56941aae7d2151d1087e257 100644 +index 0c7c829270d3cd3dd05a3dc7dfe82ee01d5c6bd8..991e0362e96488b64d994f1bdfb8ed5d66f98666 100644 --- a/net/minecraft/server/commands/DataPackCommand.java +++ b/net/minecraft/server/commands/DataPackCommand.java @@ -98,7 +98,7 @@ public class DataPackCommand { @@ -34,7 +34,7 @@ index 0c7c829270d3cd3dd05a3dc7dfe82ee01d5c6bd8..04fa1c5bb1c0b025a56941aae7d2151d Commands.literal("datapack") .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)) - /*.then( // Luminol - Add back read-only datapack command -+ .then( ++ .then( // Lophine - Fix datapack command save function Commands.literal("enable") .then( Commands.argument("name", StringArgumentType.string()) @@ -57,7 +57,7 @@ index 0c7c829270d3cd3dd05a3dc7dfe82ee01d5c6bd8..04fa1c5bb1c0b025a56941aae7d2151d private static int listPacks(final CommandSourceStack source) { - return listEnabledPacks(source) ;// + listAvailablePacks(source); // Luminol - Add back read-only datapack command -+ return listEnabledPacks(source) + listAvailablePacks(source); ++ return listEnabledPacks(source) + listAvailablePacks(source); // Lophine - Fix datapack command save function } private static int listAvailablePacks(final CommandSourceStack source) { diff --git a/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-function-command.patch b/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-function-command.patch index fbc2e84..0d04f2e 100644 --- a/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-function-command.patch +++ b/lophine-server/minecraft-patches/features/0007-Add-config-to-enable-function-command.patch @@ -5,17 +5,19 @@ Subject: [PATCH] Add config to enable function command diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 2c2487e1c1c65438119a13bd705a9e44697955ed..6d27350cdb2e699fcc541bc96a5af06a09e0dfd5 100644 +index 2c2487e1c1c65438119a13bd705a9e44697955ed..4e0428948d618b0a072679762dc3cb39d6e12c2f 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -217,7 +217,9 @@ public class Commands { +@@ -217,7 +217,11 @@ public class Commands { FillCommand.register(this.dispatcher, context); FillBiomeCommand.register(this.dispatcher, context); ForceLoadCommand.register(this.dispatcher); - //FunctionCommand.register(this.dispatcher); // Folia - region threading - TODO ++ // Lophine start - Add config to enable function command + if (fun.bm.lophine.config.modules.experiment.CommandConfig.function) { + FunctionCommand.register(this.dispatcher); // Folia - region threading - TODO + } ++ // Lophine end - Add config to enable function command GameModeCommand.register(this.dispatcher); GameRuleCommand.register(this.dispatcher, context); GiveCommand.register(this.dispatcher, context); diff --git a/lophine-server/minecraft-patches/features/0008-Add-config-to-enable-scoreboard-command.patch b/lophine-server/minecraft-patches/features/0008-Add-config-to-enable-scoreboard-command.patch index 1689df2..f01ae4e 100644 --- a/lophine-server/minecraft-patches/features/0008-Add-config-to-enable-scoreboard-command.patch +++ b/lophine-server/minecraft-patches/features/0008-Add-config-to-enable-scoreboard-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config to enable scoreboard command diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 6d27350cdb2e699fcc541bc96a5af06a09e0dfd5..01784d3feaa0dce02f0c26b9a635877b735e6abf 100644 +index 4e0428948d618b0a072679762dc3cb39d6e12c2f..87ffca5ff0c2775cb85a6058c9be66e00c94f01f 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -244,7 +244,11 @@ public class Commands { +@@ -246,7 +246,11 @@ public class Commands { RotateCommand.register(this.dispatcher); SayCommand.register(this.dispatcher); //ScheduleCommand.register(this.dispatcher); // Folia - region threading @@ -17,7 +17,7 @@ index 6d27350cdb2e699fcc541bc96a5af06a09e0dfd5..01784d3feaa0dce02f0c26b9a635877b + if (fun.bm.lophine.config.modules.experiment.CommandConfig.scoreboard) { + ScoreboardCommand.register(this.dispatcher, context); // Folia - region threading + } -+ // Lophine start - Add a config to enable scoreboard command ++ // Lophine end - Add a config to enable scoreboard command SeedCommand.register(this.dispatcher, commandSelection != Commands.CommandSelection.INTEGRATED); VersionCommand.register(this.dispatcher, commandSelection != Commands.CommandSelection.INTEGRATED); SetBlockCommand.register(this.dispatcher, context); diff --git a/lophine-server/minecraft-patches/features/0009-Add-config-to-enable-trigger-command.patch b/lophine-server/minecraft-patches/features/0009-Add-config-to-enable-trigger-command.patch index 3331fea..1c8bfe2 100644 --- a/lophine-server/minecraft-patches/features/0009-Add-config-to-enable-trigger-command.patch +++ b/lophine-server/minecraft-patches/features/0009-Add-config-to-enable-trigger-command.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config to enable trigger command diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 01784d3feaa0dce02f0c26b9a635877b735e6abf..bb5059a77741bf1d9e73bd8c7f0da6681ec63f67 100644 +index 87ffca5ff0c2775cb85a6058c9be66e00c94f01f..74ef76058e5a410d12f88aa09450e7d90f63b5e6 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -272,7 +272,11 @@ public class Commands { +@@ -274,7 +274,11 @@ public class Commands { // Luminol end - Add a config to enable tick command TimeCommand.register(this.dispatcher, context); TitleCommand.register(this.dispatcher, context); diff --git a/lophine-server/minecraft-patches/features/0010-Add-config-to-enable-raytracing-tracker.patch b/lophine-server/minecraft-patches/features/0010-Add-config-to-enable-raytracing-tracker.patch index 9a89a72..3191f98 100644 --- a/lophine-server/minecraft-patches/features/0010-Add-config-to-enable-raytracing-tracker.patch +++ b/lophine-server/minecraft-patches/features/0010-Add-config-to-enable-raytracing-tracker.patch @@ -18,7 +18,7 @@ index 0c0775bbb0c0ba0c37d1b884bb106b5250e94750..0dfb25ad032429a2aea7aa441dd5fd18 double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1); if (rangeY != -1) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 552fd994ee30deb6e9f4228b17a2883cf26b164c..6f7e5d62901733df08c6beafbda2e54bc1c5f917 100644 +index 552fd994ee30deb6e9f4228b17a2883cf26b164c..f090b8d77bd2731debfc61c263bd77550f52212b 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -167,7 +167,7 @@ public abstract class Entity @@ -30,10 +30,11 @@ index 552fd994ee30deb6e9f4228b17a2883cf26b164c..6f7e5d62901733df08c6beafbda2e54b // CraftBukkit start private static final int CURRENT_LEVEL = 2; static boolean isLevelAtLeast(ValueInput input, int level) { -@@ -6432,4 +6432,46 @@ public abstract class Entity +@@ -6432,4 +6432,48 @@ public abstract class Entity // Paper end - Expose entity id counter public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG ++ // Lophine start - Add config to enable raytracing tracker + + private long lasttime = 0; + private boolean culled = false; @@ -76,18 +77,21 @@ index 552fd994ee30deb6e9f4228b17a2883cf26b164c..6f7e5d62901733df08c6beafbda2e54b + return this.outOfCamera; + } + ++ // Lophine end - Add config to enable raytracing tracker } diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java -index cb0a52dc3795e1cf54069bcbe82abf7877a658b8..1440946665f41ebf534d701515f982bbbf4c9686 100644 +index cb0a52dc3795e1cf54069bcbe82abf7877a658b8..0d743a01ae70baa789cd0e0bb9abd4c4f8310b99 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1252,6 +1252,9 @@ public class EntityType implements EntityTypeTest, +@@ -1252,6 +1252,11 @@ public class EntityType implements EntityTypeTest, public final int passengerTickTimerId; public final int passengerInactiveTickTimerId; // Folia end - profiler ++ // Lophine start - Add config to enable raytracing tracker + // Luminol - Raytracing entity tracker + public boolean skipRaytracningCheck = false; + // Luminol end ++ // Lophine end - Add config to enable raytracing tracker public EntityType( final EntityType.EntityFactory factory, diff --git a/lophine-server/minecraft-patches/features/0011-Add-tick-rate-support.patch b/lophine-server/minecraft-patches/features/0011-Add-tick-rate-support.patch index 212be19..bfe7463 100644 --- a/lophine-server/minecraft-patches/features/0011-Add-tick-rate-support.patch +++ b/lophine-server/minecraft-patches/features/0011-Add-tick-rate-support.patch @@ -24,7 +24,7 @@ index 981f63b75584dbcb4bb0d5672e8c8bb140c52f9d..6e8ee04967afa410ce9dccff34bf9a43 this.tickConnections(); diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java -index 86c51506c518ee445d00f7eef36ee2c9adbd9b4c..6fe5107751fe448ab374bf57b1ef6859f481f17e 100644 +index 86c51506c518ee445d00f7eef36ee2c9adbd9b4c..a37f392146ccc0319cf56ee0058ae8782b598fe3 100644 --- a/io/papermc/paper/threadedregions/TickRegionScheduler.java +++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java @@ -40,8 +40,8 @@ public final class TickRegionScheduler { @@ -61,7 +61,7 @@ index 86c51506c518ee445d00f7eef36ee2c9adbd9b4c..6fe5107751fe448ab374bf57b1ef6859 + // use max(), don't assume that tickStart >= scheduledStart + tickCount = Math.max(1L, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart)); + } -+ // Lophine end - Add tick command support ++ // Lophine end - Add a config to enable tick command if (!this.tryMarkTicking()) { if (!this.cancelled.get()) { @@ -92,7 +92,7 @@ index 8d0f810100a4eac65831913feeb9a9eeb0e6006a..ca35415e152dc63cb9f4ae8da8b06766 this.sprintTimeSpend = this.sprintTimeSpend + (System.nanoTime() - this.sprintTickStartTime); } diff --git a/net/minecraft/server/commands/TickCommand.java b/net/minecraft/server/commands/TickCommand.java -index cae943bae4701f74b46a49d68da83ae797841590..d8f5f1b2f75a4e23556fb016ad47f2cefe1309ce 100644 +index cae943bae4701f74b46a49d68da83ae797841590..9f43eff6160ac6855c2e5dd9c23c384b03b7e96c 100644 --- a/net/minecraft/server/commands/TickCommand.java +++ b/net/minecraft/server/commands/TickCommand.java @@ -14,7 +14,7 @@ import net.minecraft.server.ServerTickRateManager; @@ -109,7 +109,7 @@ index cae943bae4701f74b46a49d68da83ae797841590..d8f5f1b2f75a4e23556fb016ad47f2ce .requires(Commands.hasPermission(Commands.LEVEL_ADMINS)) .then(Commands.literal("query").executes(c -> tickQuery(c.getSource()))) -/* .then( -+ .then( ++ .then( // Lophine - Add tick rate support Commands.literal("rate") .then( Commands.argument("rate", FloatArgumentType.floatArg(1.0F, 10000.0F)) diff --git a/lophine-server/minecraft-patches/features/0030-Leaves-Fakeplayer.patch b/lophine-server/minecraft-patches/features/0030-Leaves-Fakeplayer.patch index f3bcf04..2b6d4fb 100644 --- a/lophine-server/minecraft-patches/features/0030-Leaves-Fakeplayer.patch +++ b/lophine-server/minecraft-patches/features/0030-Leaves-Fakeplayer.patch @@ -529,7 +529,7 @@ index ebd2f2887780d9c6c3c44983bac23eab732cf43f..14be3d21cc1a613b1d9164ecc699073f public @Nullable ServerPlayer getPlayer(final String playerName) { diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 6f7e5d62901733df08c6beafbda2e54bc1c5f917..07c5fed7b0bf3ecefb54ccb0bfb922c2f11f7939 100644 +index f090b8d77bd2731debfc61c263bd77550f52212b..03c155140da7300f6f934aff323e0daed1b63366 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -1257,7 +1257,7 @@ public abstract class Entity diff --git a/lophine-server/minecraft-patches/features/0034-Global-Entities-Counter.patch b/lophine-server/minecraft-patches/features/0034-Global-Entities-Counter.patch index 17db05d..939d28c 100644 --- a/lophine-server/minecraft-patches/features/0034-Global-Entities-Counter.patch +++ b/lophine-server/minecraft-patches/features/0034-Global-Entities-Counter.patch @@ -114,7 +114,7 @@ index 8d6a5d2ab4589f81abdd4ae939f197051e9523fc..54011666a2f358fe38ca03bc39d68d12 final ca.spottedleaf.leafprofiler.RegionizedProfiler.Handle foliaProfiler = io.papermc.paper.threadedregions.TickRegionScheduler.getProfiler(); // Folia - profiler ProfilerFiller profiler = Profiler.get(); diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index fc29654dd7ee3329edf1ccf705f45631d0ecc079..5cad076041ed008670cfd8e51a3601c2ef972ad1 100644 +index fc29654dd7ee3329edf1ccf705f45631d0ecc079..9b8ee2df5a0b6d76d9bfc747187f6cd51bb4a520 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -813,6 +813,44 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs @@ -158,7 +158,7 @@ index fc29654dd7ee3329edf1ccf705f45631d0ecc079..5cad076041ed008670cfd8e51a3601c2 + } + } + } -+ // Lophine end ++ // Lophine end - fix some bug if player is cross scheduler >> to remove monster if the region don't have any valid player this.noActionTime = 0; } } diff --git a/lophine-server/minecraft-patches/features/0035-Leaves-Catch-update-suppression-crash.patch b/lophine-server/minecraft-patches/features/0035-Leaves-Catch-update-suppression-crash.patch index dc1acaf..3b9f4d4 100644 --- a/lophine-server/minecraft-patches/features/0035-Leaves-Catch-update-suppression-crash.patch +++ b/lophine-server/minecraft-patches/features/0035-Leaves-Catch-update-suppression-crash.patch @@ -8,19 +8,22 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/network/PacketProcessor.java b/net/minecraft/network/PacketProcessor.java -index 24f5b890b0126fc817863f99b676da1a548f7608..78bea975c15130c91c90f48c868ac32e2db7433f 100644 +index 24f5b890b0126fc817863f99b676da1a548f7608..a25bc31c04778bf12e3b6301ffcfb2275fcc2d90 100644 --- a/net/minecraft/network/PacketProcessor.java +++ b/net/minecraft/network/PacketProcessor.java -@@ -106,7 +106,19 @@ public class PacketProcessor implements AutoCloseable { +@@ -106,7 +106,23 @@ public class PacketProcessor implements AutoCloseable { final int packetTimerId = profiler.getOrCreateTimerAndStart(() -> "Packet Handler: ".concat(ListenerAndPacket.this.packet.getClass().getName())); try { // Folia - profiler this.packet.handle(this.listener); } finally { profiler.stopTimer(packetTimerId); } // Folia - profiler ++ // Lophine start - catch update suppression crash + } catch (org.leavesmc.leaves.util.UpdateSuppressionException exception) { + if (this.listener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl gamePacketListener) { + exception.providePlayer(gamePacketListener.player); + } + exception.consume(); ++ // Lophine end - catch update suppression crash } catch (Exception var3) { ++ // Lophine start - catch update suppression crash + if (var3.getCause() instanceof org.leavesmc.leaves.util.UpdateSuppressionException exception) { + if (this.listener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl gamePacketListener) { + exception.providePlayer(gamePacketListener.player); @@ -28,25 +31,29 @@ index 24f5b890b0126fc817863f99b676da1a548f7608..78bea975c15130c91c90f48c868ac32e + exception.consume(); + } + ++ // Lophine end - catch update suppression crash if (var3 instanceof ReportedException re && re.getCause() instanceof OutOfMemoryError) { throw PacketUtils.makeReportedException(var3, this.packet, this.listener); } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 3b9a4f4b5794faa4955018858c94fd5c2d6ada3d..19bef18e606d873308d08987d90e298703efb574 100644 +index 3b9a4f4b5794faa4955018858c94fd5c2d6ada3d..0b7e704210c4bc01797a33a9c0da609a844d8489 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2019,11 +2019,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ca.spottedleaf.moonrise.patch +@@ -118,7 +118,16 @@ public abstract class StateHolder implements ca.spottedleaf.moonrise.patch if (ret != null) { return ret; } - throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); ++ // Lophine start - catch update suppression crash + IllegalArgumentException iae = new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) { + org.leavesmc.leaves.util.UpdateSuppressionException exception = new org.leavesmc.leaves.util.UpdateSuppressionException(null, null, null, null, iae); @@ -160,22 +177,24 @@ index b72861c0164ebb13b6fc3e78cd7ce0a2c484f22d..6d3af2481e81795771ac8f82d984681e + } + } + throw iae; ++ // Lophine end - catch update suppression crash // Paper end - optimise blockstate property access } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 3708f9ffc46a5b1c038c0e7b2ce84802e2b22397..7760a711f4c49fc3499bf71fabb59ee8b4c85083 100644 +index 3708f9ffc46a5b1c038c0e7b2ce84802e2b22397..241c43170b5020c1521f43d349813586ba1f69a5 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -400,6 +400,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -400,6 +400,8 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot return null; } else { Block newBlock = state.getBlock(); ++ // Lophine start - catch update suppression crash + try { this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING).update(localX, y, localZ, state); this.heightmaps.get(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES).update(localX, y, localZ, state); this.heightmaps.get(Heightmap.Types.OCEAN_FLOOR).update(localX, y, localZ, state); -@@ -468,6 +469,10 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -468,6 +470,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot this.markUnsaved(); return oldState; } @@ -183,23 +202,27 @@ index 3708f9ffc46a5b1c038c0e7b2ce84802e2b22397..7760a711f4c49fc3499bf71fabb59ee8 + exception.provideBlock(this.level, pos, newBlock); + throw exception; + } ++ // Lophine end - catch update suppression crash } } } diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java -index 9b8d63f69ed1101f1b7b2728690e35165b9aeb99..6d25139a94df7c0442cc9fea96d5839ce8a23d54 100644 +index 9b8d63f69ed1101f1b7b2728690e35165b9aeb99..6358787f3c7dcfa599b2949613236fa8de025096 100644 --- a/net/minecraft/world/level/redstone/NeighborUpdater.java +++ b/net/minecraft/world/level/redstone/NeighborUpdater.java -@@ -87,9 +87,20 @@ public interface NeighborUpdater { +@@ -87,9 +87,24 @@ public interface NeighborUpdater { } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG // Spigot start } catch (StackOverflowError ex) { ++ // Lophine start - catch update suppression crash + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) { + throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, level, changedBlock, null, ex); + } ++ // Lophine end - catch update suppression crash level.lastPhysicsProblem = pos.immutable(); // Spigot end } catch (Throwable var9) { ++ // Lophine start - catch update suppression crash + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) { + if (var9 instanceof org.leavesmc.leaves.util.UpdateSuppressionException exception) { + exception.provideBlock(level, pos, changedBlock); @@ -208,6 +231,7 @@ index 9b8d63f69ed1101f1b7b2728690e35165b9aeb99..6d25139a94df7c0442cc9fea96d5839c + throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, level, changedBlock, null, var9); + } + ++ // Lophine end - catch update suppression crash CrashReport report = CrashReport.forThrowable(var9, "Exception while updating neighbours"); CrashReportCategory category = report.addCategory("Block being updated"); category.setDetail( diff --git a/lophine-server/minecraft-patches/features/0036-Leaves-CCE-update-suppression.patch b/lophine-server/minecraft-patches/features/0036-Leaves-CCE-update-suppression.patch index b86c0e0..5d85af9 100644 --- a/lophine-server/minecraft-patches/features/0036-Leaves-CCE-update-suppression.patch +++ b/lophine-server/minecraft-patches/features/0036-Leaves-CCE-update-suppression.patch @@ -8,17 +8,19 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java -index c0b086fd5084fc0e39b91d3f6bd6904ef19f4157..8259f530ec50554906c254b60f1e964b52c02852 100644 +index f9dacc278200b05acb385e1f1cbf858e43d0d9f4..722ce78461b2303f99493c309345697cfc98fb99 100644 --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java -@@ -182,7 +182,9 @@ public class ShulkerBoxBlock extends BaseEntityBlock { - @Override +@@ -183,7 +183,11 @@ public class ShulkerBoxBlock extends BaseEntityBlock { protected int getAnalogOutputSignal(final BlockState state, final Level level, final BlockPos pos, final Direction direction) { + // Lophine start - catch update suppression crash try { - return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos)); ++ // Lophine start - configurable shulker CCE + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.shulkerBoxCCEReintroduced + ? AbstractContainerMenu.getRedstoneSignalFromContainer((net.minecraft.world.Container)level.getBlockEntity(pos)) + : AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos)); ++ // Lophine end - configurable shulker CCE } catch (ClassCastException ex) { if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) { throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, null, this, null, ex); diff --git a/lophine-server/minecraft-patches/features/0037-Leaves-Redstone-ignore-upwards-update.patch b/lophine-server/minecraft-patches/features/0037-Leaves-Redstone-ignore-upwards-update.patch index f427cac..ac86fb5 100644 --- a/lophine-server/minecraft-patches/features/0037-Leaves-Redstone-ignore-upwards-update.patch +++ b/lophine-server/minecraft-patches/features/0037-Leaves-Redstone-ignore-upwards-update.patch @@ -10,55 +10,63 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/block/ComparatorBlock.java b/net/minecraft/world/level/block/ComparatorBlock.java -index 45e11737bc2558a4ebfffe133d43111f45dd7d16..d3bcef3fa3228c3869041754b2c18dfc987aac35 100644 +index 45e11737bc2558a4ebfffe133d43111f45dd7d16..db80f0b400c7356c5524ea799354e6c44de14700 100644 --- a/net/minecraft/world/level/block/ComparatorBlock.java +++ b/net/minecraft/world/level/block/ComparatorBlock.java -@@ -59,6 +59,9 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock { +@@ -59,6 +59,11 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock { final BlockState neighbourState, final RandomSource random ) { ++ // Lophine start - redstone ignore upwards update + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && directionToNeighbour == Direction.DOWN) { + return state; + } ++ // Lophine end - redstone ignore upwards update return directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, level, ticks, pos, directionToNeighbour, neighbourPos, neighbourState, random); diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 759eb347299813c20226cc2fc5dc7718d12b7f56..619f5e37919693fc5976aedefed3bb5428395439 100644 +index 759eb347299813c20226cc2fc5dc7718d12b7f56..30a7208a698a8bd3ba8a08ace6f23b206d90f6a3 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -179,7 +179,9 @@ public class RedStoneWireBlock extends Block { +@@ -179,7 +179,11 @@ public class RedStoneWireBlock extends Block { final RandomSource random ) { if (directionToNeighbour == Direction.DOWN) { - return !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state; ++ // Lophine start - redstone ignore upwards update + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced + ? state + : !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state; ++ // Lophine end - redstone ignore upwards update } else if (directionToNeighbour == Direction.UP) { return this.getConnectionState(level, state, pos); } else { -@@ -243,7 +245,8 @@ public class RedStoneWireBlock extends Block { +@@ -243,7 +247,10 @@ public class RedStoneWireBlock extends Block { BlockPos relativePos = pos.relative(direction); BlockState relativeState = level.getBlockState(relativePos); if (canConnectUp) { - boolean isPlaceableAbove = relativeState.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(level, relativePos, relativeState); ++ // Lophine start - redstone ignore upwards update + boolean isPlaceableAbove = (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && relativeState.getBlock() instanceof TrapDoorBlock) + || this.canSurviveOn(level, relativePos, relativeState); ++ // Lophine end - redstone ignore upwards update if (isPlaceableAbove && shouldConnectTo(level.getBlockState(relativePos.above()))) { if (relativeState.isFaceSturdy(level, relativePos, direction.getOpposite())) { return RedstoneSide.UP; diff --git a/net/minecraft/world/level/block/RepeaterBlock.java b/net/minecraft/world/level/block/RepeaterBlock.java -index d301ca4c91e75d715998aa7ed155fd44ccd64785..cc2694d0fc3c9bbe5e91771b3aef8ffb749515b4 100644 +index d301ca4c91e75d715998aa7ed155fd44ccd64785..1985602b11a584fc70b1bb9ca4c643757d4c0ed3 100644 --- a/net/minecraft/world/level/block/RepeaterBlock.java +++ b/net/minecraft/world/level/block/RepeaterBlock.java -@@ -70,6 +70,9 @@ public class RepeaterBlock extends DiodeBlock { +@@ -70,6 +70,11 @@ public class RepeaterBlock extends DiodeBlock { final BlockState neighbourState, final RandomSource random ) { ++ // Lophine start - redstone ignore upwards update + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && directionToNeighbour == Direction.DOWN) { + return state; + } ++ // Lophine end - redstone ignore upwards update if (directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState)) { return Blocks.AIR.defaultBlockState(); } else { diff --git a/lophine-server/minecraft-patches/features/0038-Instant-Block-Updater.patch b/lophine-server/minecraft-patches/features/0038-Instant-Block-Updater.patch index e3c3fd6..817839a 100644 --- a/lophine-server/minecraft-patches/features/0038-Instant-Block-Updater.patch +++ b/lophine-server/minecraft-patches/features/0038-Instant-Block-Updater.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Instant Block Updater diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java -index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..1a426e1aa456a8ea432f62483c3be5c328b97953 100644 +index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..9911c70d89cfb43b803cab9bbe6eedd1142f59d6 100644 --- a/io/papermc/paper/threadedregions/RegionizedWorldData.java +++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java @@ -506,7 +506,7 @@ public final class RegionizedWorldData { @@ -13,22 +13,24 @@ index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..1a426e1aa456a8ea432f62483c3be5c3 // From Level public boolean populating; - public final CollectingNeighborUpdater neighborUpdater; -+ public final net.minecraft.world.level.redstone.NeighborUpdater neighborUpdater; ++ public final net.minecraft.world.level.redstone.NeighborUpdater neighborUpdater; // Lophine - Instant Block Updater public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; public final Map capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper -@@ -567,7 +567,9 @@ public final class RegionizedWorldData { +@@ -567,7 +567,11 @@ public final class RegionizedWorldData { this.world = world; this.blockLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, true); this.fluidLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, false); - this.neighborUpdater = new CollectingNeighborUpdater(world, world.neighbourUpdateMax); ++ // Lophine start - Instant Block Updater + this.neighborUpdater = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.instantBlockUpdaterReintroduced + ? new net.minecraft.world.level.redstone.InstantNeighborUpdater(world) + : new CollectingNeighborUpdater(world, world.neighbourUpdateMax); ++ // Lophine end - Instant Block Updater this.nearbyPlayers = new NearbyPlayers(world); this.wireHandler = new alternate.current.wire.WireHandler(world); this.turbo = new io.papermc.paper.redstone.RedstoneWireTurbo((RedStoneWireBlock)Blocks.REDSTONE_WIRE); -@@ -896,4 +898,4 @@ public final class RegionizedWorldData { +@@ -896,4 +900,4 @@ public final class RegionizedWorldData { public int getChunkCount() { return this.chunks.size(); } @@ -36,10 +38,10 @@ index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..1a426e1aa456a8ea432f62483c3be5c3 \ No newline at end of file +} diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3496696c6b023e7df95027917b3391557dddd8d0..d8718805a965db11dfce8ed7f5ea65a638cc4510 100644 +index 3f7b3a07a6f65b231de16d5bc1e68d5b90f41311..ad36f4bace2bf6eaf28f3ca26bf07369eddbfe38 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -999,11 +999,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet +@@ -1001,11 +1001,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet // Paper - rewrite chunk system profiler.pop(); profiler.push("debugSynchronizers"); @@ -48,6 +50,7 @@ index 3496696c6b023e7df95027917b3391557dddd8d0..d8718805a965db11dfce8ed7f5ea65a6 - .setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos)); - } else { - regionizedWorldData.neighborUpdater.setDebugListener(null); // Folia - region threading ++ // Lophine start - Instant Block Updater + if (regionizedWorldData.neighborUpdater instanceof net.minecraft.world.level.redstone.CollectingNeighborUpdater neighborUpdater) { + if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) { + neighborUpdater // Folia - region threading @@ -55,6 +58,7 @@ index 3496696c6b023e7df95027917b3391557dddd8d0..d8718805a965db11dfce8ed7f5ea65a6 + } else { + neighborUpdater.setDebugListener(null); // Folia - region threading + } ++ // Lophine end - Instant Block Updater } this.debugSynchronizers.tick(this.server.debugSubscribers()); diff --git a/lophine-server/minecraft-patches/features/0039-Revert-TrapDoorBlock-changes-form-Paper.patch b/lophine-server/minecraft-patches/features/0039-Revert-TrapDoorBlock-changes-form-Paper.patch index f3b0a76..adb0a79 100644 --- a/lophine-server/minecraft-patches/features/0039-Revert-TrapDoorBlock-changes-form-Paper.patch +++ b/lophine-server/minecraft-patches/features/0039-Revert-TrapDoorBlock-changes-form-Paper.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Revert TrapDoorBlock changes form Paper diff --git a/net/minecraft/world/level/block/TrapDoorBlock.java b/net/minecraft/world/level/block/TrapDoorBlock.java -index cfc8b668980e0cba74b3f0d42c4902eb6aa8b01e..da4a39e3e8bf9672614a04fae9834a54555cc9f1 100644 +index cfc8b668980e0cba74b3f0d42c4902eb6aa8b01e..f01894c230b1ae4add3e20329e8dc87571d2c793 100644 --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java @@ -133,31 +133,7 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW @@ -37,7 +37,7 @@ index cfc8b668980e0cba74b3f0d42c4902eb6aa8b01e..da4a39e3e8bf9672614a04fae9834a54 - } - if (open) { - // Paper end - break redstone on trapdoors early -+ if (state.getValue(OPEN) != signal) { ++ if (state.getValue(OPEN) != signal) { // Lophine - revert Paper trapdoor redstone handling state = state.setValue(OPEN, signal); this.playSound(null, level, pos, signal); } diff --git a/lophine-server/minecraft-patches/features/0040-Leaves-Prevent-loss-of-item-drops-due-to-update-supp.patch b/lophine-server/minecraft-patches/features/0040-Leaves-Prevent-loss-of-item-drops-due-to-update-supp.patch index 81abc43..fee315f 100644 --- a/lophine-server/minecraft-patches/features/0040-Leaves-Prevent-loss-of-item-drops-due-to-update-supp.patch +++ b/lophine-server/minecraft-patches/features/0040-Leaves-Prevent-loss-of-item-drops-due-to-update-supp.patch @@ -9,14 +9,15 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/ea91106ae57fc4cc1 Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java -index e1de10e1a0ec221a1109a03d86fddf47b1c06a5f..d8cba057be61005d75b8c66910096aec148e2e2a 100644 +index e1de10e1a0ec221a1109a03d86fddf47b1c06a5f..71cc37515c268abd698896d514b66cb49859691c 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -392,7 +392,16 @@ public class ServerPlayerGameMode { +@@ -392,7 +392,18 @@ public class ServerPlayerGameMode { this.level.getCurrentWorldData().captureDrops = new java.util.ArrayList<>(); // Folia - region threading // CraftBukkit end BlockState adjustedState = block.playerWillDestroy(this.level, pos, state, this.player); - boolean changed = this.level.removeBlock(pos, false); ++ // Lophine start - preserve drops before update suppression + boolean changed; + org.leavesmc.leaves.util.UpdateSuppressionException updateSuppressionException = null; + try { @@ -27,16 +28,19 @@ index e1de10e1a0ec221a1109a03d86fddf47b1c06a5f..d8cba057be61005d75b8c66910096aec + updateSuppressionException.providePlayer(this.player); + changed = false; + } ++ // Lophine end - preserve drops before update suppression if (SharedConstants.DEBUG_BLOCK_BREAK) { LOGGER.info("server broke {} {} -> {}", pos, adjustedState, this.level.getBlockState(pos)); } -@@ -424,6 +433,9 @@ public class ServerPlayerGameMode { +@@ -424,6 +435,11 @@ public class ServerPlayerGameMode { if (event.isDropItems()) { org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, bState, this.player, itemsToDrop); // Paper - capture all item additions to the world } ++ // Lophine start - preserve drops before update suppression + if (updateSuppressionException != null) { + throw updateSuppressionException; + } ++ // Lophine end - preserve drops before update suppression // Drop event experience if (changed) { diff --git a/lophine-server/minecraft-patches/features/0041-Leaves-Do-not-reset-placed-block-on-exception-Do-not.patch b/lophine-server/minecraft-patches/features/0041-Leaves-Do-not-reset-placed-block-on-exception-Do-not.patch index 84c95b0..5a54d51 100644 --- a/lophine-server/minecraft-patches/features/0041-Leaves-Do-not-reset-placed-block-on-exception-Do-not.patch +++ b/lophine-server/minecraft-patches/features/0041-Leaves-Do-not-reset-placed-block-on-exception-Do-not.patch @@ -34,10 +34,10 @@ index 07b84bd0144e133d13e8e033a8998f3cf674f746..9c016e7d93e4c44ddf2df520e5c57d92 // CraftBukkit start - special case for handling block placement with water lilies, frog spawn and snow buckets if (player != null && (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem)) { diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 7760a711f4c49fc3499bf71fabb59ee8b4c85083..ef3508dc4c8b3a9c8a6c7ff520cf51a68d6a13d9 100644 +index 241c43170b5020c1521f43d349813586ba1f69a5..316b8d45b0902b1bf01a77307e24fc9a47d1283b 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1015,12 +1015,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -1017,12 +1017,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot profiler.pop(); } catch (Throwable var5) { diff --git a/lophine-server/minecraft-patches/features/0042-Leaves-Old-Block-remove-behaviour.patch b/lophine-server/minecraft-patches/features/0042-Leaves-Old-Block-remove-behaviour.patch index f6c29c4..3658271 100644 --- a/lophine-server/minecraft-patches/features/0042-Leaves-Old-Block-remove-behaviour.patch +++ b/lophine-server/minecraft-patches/features/0042-Leaves-Old-Block-remove-behaviour.patch @@ -522,10 +522,10 @@ index 6a3413ca875ce78f48cd8d3ce2cfe7798be1a19e..be572eff561ffdd961a9602eaa613676 protected void affectNeighborsAfterRemoval(final BlockState state, final ServerLevel level, final BlockPos pos, final boolean movedByPiston) { if (state.getValue(POWERED) && level.getBlockTicks().hasScheduledTick(pos, this)) { diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 619f5e37919693fc5976aedefed3bb5428395439..ed190e16df7c6b80fd90561e7c2fdd53c745e54a 100644 +index 30a7208a698a8bd3ba8a08ace6f23b206d90f6a3..7f5b77cd9cb78e693bbe1efd3d5fd7256d7700c5 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -378,6 +378,28 @@ public class RedStoneWireBlock extends Block { +@@ -382,6 +382,28 @@ public class RedStoneWireBlock extends Block { } } @@ -622,7 +622,7 @@ index d7e5ec23c64b60c47ab6b54cbf282e88c3a4a045..037aa3592a963bbb142465d31040f60e protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) { if (state.getValue(SHRIEKING)) { diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java -index 8259f530ec50554906c254b60f1e964b52c02852..59ad645785bc99758f4bc124c56e39d87c4b75c2 100644 +index 722ce78461b2303f99493c309345697cfc98fb99..45dc3e8484842265b26d387d518831ff23da4b5e 100644 --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -150,6 +150,20 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @@ -797,10 +797,10 @@ index 0fbdf810c785c8a596d461e7651361fdedbb6217..ff1471f40b73582df68efbf2996a854c this.getBlock().affectNeighborsAfterRemoval(this.asState(), level, pos, movedByPiston); } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index ef3508dc4c8b3a9c8a6c7ff520cf51a68d6a13d9..11f0f5e1b8ee9ce7e6833d46ccb557d896674431 100644 +index 316b8d45b0902b1bf01a77307e24fc9a47d1283b..9b3775b0cbca782964e03935331d1bfdd1af140d 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -423,22 +423,28 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -424,22 +424,28 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot boolean blockChanged = !oldState.is(newBlock); boolean movedByPiston = (flags & Block.UPDATE_MOVE_BY_PISTON) != 0; boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0; diff --git a/lophine-server/minecraft-patches/features/0044-Carpet-features.patch b/lophine-server/minecraft-patches/features/0044-Carpet-features.patch index 12e974c..3e4ea0f 100644 --- a/lophine-server/minecraft-patches/features/0044-Carpet-features.patch +++ b/lophine-server/minecraft-patches/features/0044-Carpet-features.patch @@ -5,43 +5,47 @@ Subject: [PATCH] Carpet features diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java -index 6e8ee04967afa410ce9dccff34bf9a43201694fd..8b05860d2787a40495f8a025bc0bc43789d6a6af 100644 +index 6e8ee04967afa410ce9dccff34bf9a43201694fd..4bd923b42d1c98ce7178e05f9324f46d99ffc933 100644 --- a/io/papermc/paper/threadedregions/RegionizedServer.java +++ b/io/papermc/paper/threadedregions/RegionizedServer.java @@ -337,6 +337,7 @@ public final class RegionizedServer { } this.randomWalk(); */ -+ final long tickStartNanos = System.nanoTime(); ++ final long tickStartNanos = System.nanoTime(); // Lophine - Carpet features ++this.tickCount; // Luminol start - Add a config to enable tick command if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) { -@@ -379,6 +380,8 @@ public final class RegionizedServer { +@@ -379,6 +380,10 @@ public final class RegionizedServer { } // Lophine end - Add a config to enable tick command ++ // Lophine start - Carpet features + fun.bm.lophine.protocol.tiscm.TISCMProtocol.broadcastMsptSample(this.tickCount, System.nanoTime() - tickStartNanos); + ++ // Lophine end - Carpet features // tick connections this.tickConnections(); diff --git a/net/minecraft/commands/arguments/blocks/BlockInput.java b/net/minecraft/commands/arguments/blocks/BlockInput.java -index a4b38651340aff56bb3e3ffd85dea0da538a7532..ed0800548e008142ec94875b0de4c4a8ed3e9d26 100644 +index a4b38651340aff56bb3e3ffd85dea0da538a7532..95f5254b2e84b34b93e53b1aa356ba58cee6b0a9 100644 --- a/net/minecraft/commands/arguments/blocks/BlockInput.java +++ b/net/minecraft/commands/arguments/blocks/BlockInput.java -@@ -65,7 +65,9 @@ public class BlockInput implements Predicate { +@@ -65,7 +65,11 @@ public class BlockInput implements Predicate { } public boolean place(final ServerLevel level, final BlockPos pos, @Block.UpdateFlags final int update) { - BlockState state = (update & Block.UPDATE_KNOWN_SHAPE) != 0 ? this.state : Block.updateFromNeighbourShapes(this.state, level, pos); ++ // Lophine start - Carpet features + BlockState state = (update & Block.UPDATE_KNOWN_SHAPE) != 0 || fun.bm.lophine.carpet.InteractionUpdateCompatHelper.shouldSkipUpdates() + ? this.state + : Block.updateFromNeighbourShapes(this.state, level, pos); ++ // Lophine end - Carpet features if (state.isAir()) { state = this.state; } diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java -index 240fb1346b721e4aaf8517b01fa205760cee4bbd..327d6c7e0f18a88f8c9b9cfc9a972266db03842d 100644 +index 240fb1346b721e4aaf8517b01fa205760cee4bbd..4879223a54108d1dd1d38b05de96f586f7659ffa 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java @@ -136,7 +136,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa @@ -49,27 +53,29 @@ index 240fb1346b721e4aaf8517b01fa205760cee4bbd..327d6c7e0f18a88f8c9b9cfc9a972266 public static Direction[] orderedByNearest(final Entity entity) { float pitch = entity.getViewXRot(1.0F) * Mth.DEG_TO_RAD; - float yaw = -entity.getViewYRot(1.0F) * Mth.DEG_TO_RAD; -+ float yaw = -(fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.placementRotationFix ? entity.getYRot(1.0F) : entity.getViewYRot(1.0F)) * Mth.DEG_TO_RAD; ++ float yaw = -(fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.placementRotationFix ? entity.getYRot(1.0F) : entity.getViewYRot(1.0F)) * Mth.DEG_TO_RAD; // Lophine - Carpet features float pitchSin = Mth.sin(pitch); float pitchCos = Mth.cos(pitch); float yawSin = Mth.sin(yaw); diff --git a/net/minecraft/network/chat/SignedMessageValidator.java b/net/minecraft/network/chat/SignedMessageValidator.java -index 5cb693319169dbd95d87ffdc450bf60bab4021aa..4095c0a6bf24a734945cbf3011271e1a9d0c39f7 100644 +index 5cb693319169dbd95d87ffdc450bf60bab4021aa..8fc4cd2f30e97c1a2d37d87c0d3584a2f6aae4ed 100644 --- a/net/minecraft/network/chat/SignedMessageValidator.java +++ b/net/minecraft/network/chat/SignedMessageValidator.java -@@ -31,7 +31,9 @@ public interface SignedMessageValidator { +@@ -31,7 +31,11 @@ public interface SignedMessageValidator { private boolean validateChain(final PlayerChatMessage message) { if (message.equals(this.lastMessage)) { return true; - } else if (this.lastMessage != null && !message.link().isDescendantOf(this.lastMessage.link())) { ++ // Lophine start - Carpet features + } else if (this.lastMessage != null + && !fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.yeetOutOfOrderChatKick + && !message.link().isDescendantOf(this.lastMessage.link())) { ++ // Lophine end - Carpet features LOGGER.error( "Received out-of-order chat message from {}: expected index > {} for session {}, but was {} for session {}", message.sender(), diff --git a/net/minecraft/server/commands/TickCommand.java b/net/minecraft/server/commands/TickCommand.java -index d8f5f1b2f75a4e23556fb016ad47f2cefe1309ce..c065084dd4b308d405b1ece04a727ca834cf89fc 100644 +index 9f43eff6160ac6855c2e5dd9c23c384b03b7e96c..049b6a2ae0a1d1bc3ad6d15c884903487d119e0f 100644 --- a/net/minecraft/server/commands/TickCommand.java +++ b/net/minecraft/server/commands/TickCommand.java @@ -20,7 +20,7 @@ public class TickCommand { @@ -77,35 +83,39 @@ index d8f5f1b2f75a4e23556fb016ad47f2cefe1309ce..c065084dd4b308d405b1ece04a727ca8 dispatcher.register( Commands.literal("tick") - .requires(Commands.hasPermission(Commands.LEVEL_ADMINS)) -+ .requires(Commands.hasPermission(tickCommandPermissionCheck())) ++ .requires(Commands.hasPermission(tickCommandPermissionCheck())) // Lophine - Carpet features .then(Commands.literal("query").executes(c -> tickQuery(c.getSource()))) - .then( + .then( // Lophine - Add tick rate support Commands.literal("rate") -@@ -106,8 +106,12 @@ public class TickCommand { +@@ -106,8 +106,14 @@ public class TickCommand { return 1; } - private static int setFreeze(final CommandSourceStack source, final boolean freeze) { -+ private static int setFreeze(final CommandSourceStack source, boolean freeze) { ++ private static int setFreeze(final CommandSourceStack source, boolean freeze) { // Lophine - Carpet features ServerTickRateManager manager = source.getServer().tickRateManager(); ++ // Lophine start - Carpet features + if (freeze && fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.tickFreezeCommandToggleable && manager.isFrozen()) { + freeze = false; + } + ++ // Lophine end - Carpet features if (freeze) { if (manager.isSprinting()) { manager.stopSprinting(); -@@ -163,4 +167,8 @@ public class TickCommand { +@@ -163,4 +169,10 @@ public class TickCommand { return 0; } } ++ // Lophine start - Carpet features + + private static net.minecraft.server.permissions.PermissionCheck tickCommandPermissionCheck() { + return new net.minecraft.server.permissions.PermissionCheck.Require(new net.minecraft.server.permissions.Permission.HasCommandLevel(net.minecraft.server.permissions.PermissionLevel.byId(fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.normalizedTickCommandPermission()))); + } ++ // Lophine end - Carpet features } diff --git a/net/minecraft/server/dedicated/DedicatedPlayerList.java b/net/minecraft/server/dedicated/DedicatedPlayerList.java -index 1a2b57a100c997b39f8f25ad3da121e04700d5d2..be345feecfa5b4e27a7b8a88ab5a5e5b18f23cf0 100644 +index 1a2b57a100c997b39f8f25ad3da121e04700d5d2..6b0d0a2c0067065b4a995a9f127910666d80011e 100644 --- a/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/net/minecraft/server/dedicated/DedicatedPlayerList.java @@ -14,7 +14,7 @@ public class DedicatedPlayerList extends PlayerList { @@ -113,51 +123,56 @@ index 1a2b57a100c997b39f8f25ad3da121e04700d5d2..be345feecfa5b4e27a7b8a88ab5a5e5b public DedicatedPlayerList(final DedicatedServer server, final LayeredRegistryAccess registries, final PlayerDataStorage playerDataStorage) { super(server, registries, playerDataStorage, server.notificationManager()); - this.setViewDistance(server.viewDistance()); -+ this.setViewDistance(Math.max(2, fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.viewDistance)); ++ this.setViewDistance(Math.max(2, fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.viewDistance)); // Lophine - Carpet features this.setSimulationDistance(server.simulationDistance()); // Paper start - fix converting txt to json file; moved from constructor } diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 83e14731a591063a38b14a7d7490efb56dda5403..3e4d035890b24483aefe664efff92f23b7c537b7 100644 +index 627af751fcd905c60f2d09eb066ac53dba607d85..be948a57431dcd4bb3b23a742e71957be58cee2d 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -257,6 +257,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc private int requestedViewDistance = 2; public String language = null; // Paper - default to null public java.util.Locale adventure$locale = java.util.Locale.US; // Paper -+ private @Nullable ClientInformation lastKnownClientInformation; ++ private @Nullable ClientInformation lastKnownClientInformation; // Lophine - Carpet features private @Nullable Vec3 startingToFallPosition; private @Nullable Vec3 enteredNetherPosition; private @Nullable Vec3 enteredLavaOnVehiclePosition; -@@ -2826,6 +2827,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -2828,6 +2829,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.setShoulderEntityRight(oldPlayer.getShoulderEntityRight()); this.setLastDeathLocation(oldPlayer.getLastDeathLocation()); this.waypointIcon().copyFrom(oldPlayer.waypointIcon()); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.clientSettingsLostOnRespawnFix && oldPlayer.lastKnownClientInformation != null) { + this.updateOptions(oldPlayer.lastKnownClientInformation); + } ++ // Lophine end - Carpet features } private void transferInventoryXpAndScore(final Player oldPlayer) { -@@ -3109,6 +3113,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -3111,6 +3117,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.particleStatus = information.particleStatus(); this.getEntityData().set(DATA_PLAYER_MODE_CUSTOMISATION, (byte)information.modelCustomisation()); this.getEntityData().set(DATA_PLAYER_MAIN_HAND, information.mainHand()); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.clientSettingsLostOnRespawnFix) { + this.lastKnownClientInformation = information; + } ++ // Lophine end - Carpet features } public ClientInformation clientInformation() { diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a83733bfc 100644 +index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..348885252c3bc01bdef0a1224c7546701500de8b 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2099,7 +2099,13 @@ public class ServerGamePacketListenerImpl +@@ -2099,7 +2099,15 @@ public class ServerGamePacketListenerImpl this.player.gameMode.capturedBlockEntity = false; this.player.gameMode.captureSentBlockEntities = true; // Paper end - Send block entities after destroy prediction - this.player.gameMode.handleBlockBreakAction(pos, action, packet.getDirection(), this.player.level().getMaxY(), packet.getSequence()); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.interactionUpdates) { + this.player.gameMode.handleBlockBreakAction(pos, action, packet.getDirection(), this.player.level().getMaxY(), packet.getSequence()); + } else { @@ -165,10 +180,11 @@ index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a + () -> this.player.gameMode.handleBlockBreakAction(pos, action, packet.getDirection(), this.player.level().getMaxY(), packet.getSequence()) + ); + } ++ // Lophine end - Carpet features this.ackBlockChangesUpTo(packet.getSequence()); // Paper start - Send block entities after destroy prediction this.player.gameMode.captureSentBlockEntities = false; -@@ -2202,7 +2208,9 @@ public class ServerGamePacketListenerImpl +@@ -2202,7 +2210,9 @@ public class ServerGamePacketListenerImpl if (!me.earthme.luminol.config.modules.fixes.ItemMultitaskConfig.enabled) { // Luminol - Add item multitask config this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 } // Luminol - Add item multitask config @@ -179,20 +195,23 @@ index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a if (interactionResult.consumesAction()) { CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, blockHit.getBlockPos(), itemStack); } -@@ -2307,7 +2315,8 @@ public class ServerGamePacketListenerImpl +@@ -2307,7 +2317,10 @@ public class ServerGamePacketListenerImpl } // CraftBukkit end - if (this.player.gameMode.useItem(this.player, level, itemStack, hand) instanceof InteractionResult.Success success ++ // Lophine start - Carpet features + ItemStack itemStackToUse = itemStack; + if (this.runInteractionWithConfiguredUpdates(() -> this.player.gameMode.useItem(this.player, level, itemStackToUse, hand)) instanceof InteractionResult.Success success ++ // Lophine end - Carpet features && success.swingSource() == InteractionResult.SwingSource.SERVER) { this.player.swing(hand, true); } -@@ -2315,6 +2324,14 @@ public class ServerGamePacketListenerImpl +@@ -2315,6 +2328,16 @@ public class ServerGamePacketListenerImpl } } ++ // Lophine start - Carpet features + private T runInteractionWithConfiguredUpdates(final java.util.function.Supplier action) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.interactionUpdates) { + return action.get(); @@ -201,19 +220,22 @@ index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a + return fun.bm.lophine.carpet.InteractionUpdateCompatHelper.supplyWithSuppressedUpdates(action); + } + ++ // Lophine end - Carpet features @Override public void handleTeleportToEntityPacket(final ServerboundTeleportToEntityPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); -@@ -2695,6 +2712,8 @@ public class ServerGamePacketListenerImpl +@@ -2695,6 +2718,10 @@ public class ServerGamePacketListenerImpl if (true) throw new UnsupportedOperationException(); // Folia - region threading final String conversationInput = rawMessage; this.server.processQueue.add(() -> ServerGamePacketListenerImpl.this.getCraftPlayer().acceptConversationInput(conversationInput)); ++ // Lophine start - Carpet features + } else if (fun.bm.lophine.carpet.CarpetCalculatorCompatHelper.handleChat(this.player, rawMessage)) { + return; ++ // Lophine end - Carpet features } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check this.send(new ClientboundSystemChatPacket(Component.translatable("chat.cannotSend").withStyle(ChatFormatting.RED), false)); } else { -@@ -2707,6 +2726,9 @@ public class ServerGamePacketListenerImpl +@@ -2707,6 +2734,9 @@ public class ServerGamePacketListenerImpl // Spigot start - spam exclusions private void detectRateSpam(String message) { @@ -223,7 +245,7 @@ index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a if (me.earthme.luminol.config.modules.misc.PaperPacketLimiterConfig.forceDisable) return; // Leaves - disable // CraftBukkit start - replaced with thread safe throttle if (org.spigotmc.SpigotConfig.enableSpamExclusions) { -@@ -3642,8 +3664,10 @@ public class ServerGamePacketListenerImpl +@@ -3642,8 +3672,10 @@ public class ServerGamePacketListenerImpl if (org.leavesmc.leaves.util.ItemOverstackUtils.hasOverstackingItem()) this.player.containerMenu.sendSingleSlot(packet.slotNum(), itemStack); // Leaves - item over-stack util - force send carried item if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdates(); // Paper - Force update attributes. } else if (drop && validData) { @@ -237,19 +259,22 @@ index 83c9418ea45b8d7f639c6bf5e134bad90d9ac039..a60d664ce93bc56f2a518a79a5602b0a } else { LOGGER.warn("Player {} was dropping items too fast in creative mode, ignoring.", this.player.getPlainTextName()); diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java -index 2312803297321f66c9057bc54ce56dd17ecb6f1f..5327a5e33147cde1b0b26083c14433d9e6e5b575 100644 +index 2312803297321f66c9057bc54ce56dd17ecb6f1f..27163558d967eed2035fd167fa51542055fa89fa 100644 --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java -@@ -351,8 +351,23 @@ public class ExperienceOrb extends Entity { +@@ -351,8 +351,27 @@ public class ExperienceOrb extends Entity { @Override public void playerTouch(final Player player) { if (player instanceof ServerPlayer serverPlayer) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.xpNoCooldown) { + player.takeXpDelay = 0; + } + ++ // Lophine end - Carpet features if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent - player.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(player, 2, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entity.takeXpDelay = 2; ++ // Lophine start - Carpet features + int newCooldown = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(player, 2, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entity.takeXpDelay = 2; + player.takeXpDelay = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.xpNoCooldown ? 0 : newCooldown; + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.xpNoCooldown) { @@ -262,24 +287,28 @@ index 2312803297321f66c9057bc54ce56dd17ecb6f1f..5327a5e33147cde1b0b26083c14433d9 + } + } + ++ // Lophine end - Carpet features player.take(this, 1); int remaining = this.repairPlayerItems(serverPlayer, this.getValue()); if (remaining > 0) { -@@ -368,6 +383,10 @@ public class ExperienceOrb extends Entity { +@@ -368,6 +387,12 @@ public class ExperienceOrb extends Entity { } private int repairPlayerItems(final ServerPlayer player, final int amount) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.powerfulExpMending) { + return this.repairAllPlayerItems(player, amount); + } + ++ // Lophine end - Carpet features Optional selected = EnchantmentHelper.getRandomItemWith(EnchantmentEffectComponents.REPAIR_WITH_XP, player, ItemStack::isDamaged); if (selected.isPresent()) { ItemStack itemStack = selected.get().itemStack(); -@@ -397,6 +416,76 @@ public class ExperienceOrb extends Entity { +@@ -397,6 +422,78 @@ public class ExperienceOrb extends Entity { } } ++ // Lophine start - Carpet features + private int repairAllPlayerItems(ServerPlayer player, int value) { + List candidates = new java.util.ArrayList<>(); + net.minecraft.world.entity.player.Inventory inventory = player.getInventory(); @@ -350,73 +379,80 @@ index 2312803297321f66c9057bc54ce56dd17ecb6f1f..5327a5e33147cde1b0b26083c14433d9 + private record MendingCandidate(ItemStack stack, @Nullable EquipmentSlot slot) { + } + ++ // Lophine end - Carpet features public int getValue() { return this.entityData.get(DATA_VALUE); } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 5389f974eb688021f131f73d6d74f989906ef3d4..9a80c25944e203775f976afb7d14d0abb8cd4d71 100644 +index 5389f974eb688021f131f73d6d74f989906ef3d4..cabf724eb0a2521bda329d8cfc042dcee3da81f3 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -601,7 +601,8 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -601,7 +601,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin public boolean broadcastedDeath = false; // Folia - region threading protected void tickDeath() { this.deathTime++; - if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { ++ // Lophine start - Carpet features + int removalDelay = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.entityInstantDeathRemoval ? 1 : 20; + if (this.deathTime >= removalDelay && !this.level().isClientSide() && !this.isRemoved()) { ++ // Lophine end - Carpet features this.level().broadcastEntityEvent(this, EntityEvent.POOF); this.broadcastedDeath = true; // Folia - region threading - death has been broadcasted if (!(this instanceof ServerPlayer)) this.remove(Entity.RemovalReason.KILLED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause // Folia - region threading - don't remove, we want the tick scheduler to be running if ((this instanceof ServerPlayer)) this.unRide(); // Folia - region threading - unmount player when dead diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java -index 42aff39d537aa6b138bc4a76304d49f423212acd..475e5abeeb29fce0f8ae0abc127f2023300ca186 100644 +index 42aff39d537aa6b138bc4a76304d49f423212acd..5b5717a886dab57b2fe9ad926a8ae7b3d4f30155 100644 --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -70,8 +70,12 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -70,8 +70,14 @@ public class PrimedTnt extends Entity implements TraceableEntity { this(EntityType.TNT, level); this.setPos(x, y, z); double rot = this.getRandom().nextDouble() * (float) (Math.PI * 2); // Paper - Don't use level random in entity constructors - this.setDeltaMovement(-Math.sin(rot) * 0.02, 0.2F, -Math.cos(rot) * 0.02); - this.setFuse(80); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.tntPrimerMomentumRemoved) { + this.setDeltaMovement(0.0, 0.20000000298023224, 0.0); + } else { + this.setDeltaMovement(-Math.sin(rot) * 0.02, 0.2F, -Math.cos(rot) * 0.02); + } + this.setFuse(getConfiguredFuseTime()); ++ // Lophine end - Carpet features this.xo = x; this.yo = y; this.zo = z; -@@ -80,7 +84,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -80,7 +86,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @Override protected void defineSynchedData(final SynchedEntityData.Builder entityData) { - entityData.define(DATA_FUSE_ID, 80); -+ entityData.define(DATA_FUSE_ID, getConfiguredFuseTime()); ++ entityData.define(DATA_FUSE_ID, getConfiguredFuseTime()); // Lophine - Carpet features entityData.define(DATA_BLOCK_STATE_ID, DEFAULT_BLOCK_STATE); } -@@ -177,7 +181,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -177,7 +183,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @Override protected void readAdditionalSaveData(final ValueInput input) { - this.setFuse(input.getShortOr("fuse", (short)80)); -+ this.setFuse(input.getShortOr("fuse", (short)getConfiguredFuseTime())); ++ this.setFuse(input.getShortOr("fuse", (short)getConfiguredFuseTime())); // Lophine - Carpet features this.setBlockState(input.read("block_state", BlockState.CODEC).orElse(DEFAULT_BLOCK_STATE)); this.explosionPower = Mth.clamp(input.getFloatOr("explosion_power", 4.0F), 0.0F, 128.0F); this.owner = EntityReference.read(input, "owner"); -@@ -200,6 +204,10 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -200,6 +206,12 @@ public class PrimedTnt extends Entity implements TraceableEntity { this.entityData.set(DATA_FUSE_ID, time); } ++ // Lophine start - Carpet features + private static int getConfiguredFuseTime() { + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.normalizedTntFuseDuration(); + } + ++ // Lophine end - Carpet features public int getFuse() { return this.entityData.get(DATA_FUSE_ID); } diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java -index 459a05ca83583538f995f45c4d2c977c6d6fcd00..474004edeae737873db88b3cce79408e10cccbf4 100644 +index 459a05ca83583538f995f45c4d2c977c6d6fcd00..35a275ff953a271a2769a18af8163e81d8634ee2 100644 --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java @@ -643,7 +643,7 @@ public class EnderMan extends Monster implements NeutralMob { @@ -424,14 +460,15 @@ index 459a05ca83583538f995f45c4d2c977c6d6fcd00..474004edeae737873db88b3cce79408e BlockHitResult result = level.clip(new ClipContext(from, to, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); boolean reachable = result.getBlockPos().equals(pos); - if (blockState.is(BlockTags.ENDERMAN_HOLDABLE) && reachable) { -+ if (canPickupBlock(blockState) && reachable) { ++ if (canPickupBlock(blockState) && reachable) { // Lophine - Carpet features if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, pos, blockState.getFluidState().createLegacyBlock())) { // Paper - Place event level.removeBlock(pos, false); level.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(this.enderman, blockState)); -@@ -651,5 +651,13 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -651,5 +651,15 @@ public class EnderMan extends Monster implements NeutralMob { } // CraftBukkit } } ++ // Lophine start - Carpet features + + private static boolean canPickupBlock(BlockState state) { + if (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.sensibleEnderman) { @@ -440,17 +477,19 @@ index 459a05ca83583538f995f45c4d2c977c6d6fcd00..474004edeae737873db88b3cce79408e + + return state.is(Blocks.MELON) || state.is(Blocks.PUMPKIN); + } ++ // Lophine end - Carpet features } } diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 5e7e99410c7597ec5330cc82e441fa30c53c9532..049fcf9ce2806cd0ae270cdfbe63a830912d3d5a 100644 +index 5e7e99410c7597ec5330cc82e441fa30c53c9532..f34631cd7d5d1c76f2b1522200e5c9f6bf5406f5 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -555,7 +555,13 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -555,7 +555,15 @@ public abstract class Player extends Avatar implements ContainerUser { } if (!orbs.isEmpty()) { - this.touch(Util.getRandom(orbs, this.random)); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.xpNoCooldown) { + for (Entity orb : orbs) { + this.touch(orb); @@ -458,13 +497,15 @@ index 5e7e99410c7597ec5330cc82e441fa30c53c9532..049fcf9ce2806cd0ae270cdfbe63a830 + } else { + this.touch(Util.getRandom(orbs, this.random)); + } ++ // Lophine end - Carpet features } } -@@ -1066,6 +1072,26 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -1066,6 +1074,28 @@ public abstract class Player extends Avatar implements ContainerUser { if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable. // Paper end - PlayerAttackEntityEvent ++ // Lophine start - Carpet features + if (this.level() instanceof ServerLevel serverLevel + && fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeOneHitKill + && this.isCreative() @@ -485,13 +526,15 @@ index 5e7e99410c7597ec5330cc82e441fa30c53c9532..049fcf9ce2806cd0ae270cdfbe63a830 + return; + } + ++ // Lophine end - Carpet features float baseDamage = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); ItemStack attackingItemStack = this.getWeaponItem(); DamageSource damageSource = this.createAttackSource(attackingItemStack); final DamageSource dmgSourceFinal = damageSource; // Paper - damage events -@@ -1123,6 +1149,16 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -1123,6 +1153,18 @@ public abstract class Player extends Avatar implements ContainerUser { } } ++ // Lophine start - Carpet features + private void creativeInstantKill(final ServerLevel level, final Entity target) { + if (target instanceof EnderDragonPart enderDragonPart) { + java.util.Arrays.stream(enderDragonPart.parentMob.getSubEntities()).forEach(part -> part.kill(level)); @@ -502,6 +545,7 @@ index 5e7e99410c7597ec5330cc82e441fa30c53c9532..049fcf9ce2806cd0ae270cdfbe63a830 + target.kill(level); + } + ++ // Lophine end - Carpet features private void playServerSideSound(final SoundEvent sound) { sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility } @@ -524,42 +568,47 @@ index 9c016e7d93e4c44ddf2df520e5c57d92a0e085b3..3413fe84a40b00e98565cdf7aa93fc1c org.bukkit.event.block.BlockCanBuildEvent event = new org.bukkit.event.block.BlockCanBuildEvent( diff --git a/net/minecraft/world/item/ServerItemCooldowns.java b/net/minecraft/world/item/ServerItemCooldowns.java -index cf66ce7cf737b2abd45c76218db55c8d0fc109d4..4da0768c14918d13b7137daa74142a544cf857cb 100644 +index cf66ce7cf737b2abd45c76218db55c8d0fc109d4..1fa560f184786620ee8a5a0bb3c67e858bf7fdfc 100644 --- a/net/minecraft/world/item/ServerItemCooldowns.java +++ b/net/minecraft/world/item/ServerItemCooldowns.java -@@ -22,6 +22,9 @@ public class ServerItemCooldowns extends ItemCooldowns { +@@ -22,6 +22,11 @@ public class ServerItemCooldowns extends ItemCooldowns { @Override public void addCooldown(ItemStack item, int duration) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoItemCooldown && this.player.isCreative()) { + return; + } ++ // Lophine end - Carpet features final Identifier cooldownGroup = this.getCooldownGroup(item); final io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent( this.player.getBukkitEntity(), diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index 298908003d5422b8b58de631145fad381e8294c1..becd64cb00dddda42a9494f6ab36362466e5f18a 100644 +index 298908003d5422b8b58de631145fad381e8294c1..2e5519813260033daff127fef2598cd10b0d9c90 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -55,6 +55,9 @@ public class RecipeManager extends SimplePreparableReloadListener imp +@@ -55,6 +55,11 @@ public class RecipeManager extends SimplePreparableReloadListener imp forSingleInput(RecipeType.CAMPFIRE_COOKING) ); private static final FileToIdConverter RECIPE_LISTER = FileToIdConverter.registry(Registries.RECIPE); ++ // Lophine start - Carpet features + private static final ResourceKey> BETTER_CRAFTABLE_BONE_BLOCK_RECIPE = compatRecipeKey("better_craftable_bone_block"); + private static final ResourceKey> BETTER_CRAFTABLE_DISPENSER_SHAPED_RECIPE = compatRecipeKey("better_craftable_dispenser_shaped"); + private static final ResourceKey> BETTER_CRAFTABLE_DISPENSER_SHAPELESS_RECIPE = compatRecipeKey("better_craftable_dispenser_shapeless"); ++ // Lophine end - Carpet features private final HolderLookup.Provider registries; public RecipeMap recipes = RecipeMap.EMPTY; private Map, RecipePropertySet> propertySets = Map.of(); -@@ -83,10 +86,73 @@ public class RecipeManager extends SimplePreparableReloadListener imp +@@ -83,10 +88,75 @@ public class RecipeManager extends SimplePreparableReloadListener imp @Override protected void apply(final RecipeMap recipes, final ResourceManager manager, final ProfilerFiller profiler) { -+ this.injectCompatRecipes(recipes); ++ this.injectCompatRecipes(recipes); // Lophine - Carpet features this.recipes = recipes; LOGGER.info("Loaded {} recipes", recipes.values().size()); } ++ // Lophine start - Carpet features + private void injectCompatRecipes(final RecipeMap recipeMap) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.betterCraftableBoneBlock) { + addCompatRecipe(recipeMap, createBetterCraftableBoneBlockRecipe()); @@ -622,71 +671,81 @@ index 298908003d5422b8b58de631145fad381e8294c1..becd64cb00dddda42a9494f6ab363624 + return ResourceKey.create(Registries.RECIPE, Identifier.fromNamespaceAndPath("lophine", path)); + } + ++ // Lophine end - Carpet features // CraftBukkit start public void addRecipe(RecipeHolder holder) { org.spigotmc.AsyncCatcher.catchOp("Recipe Add"); // Spigot diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index f0ae87545bd38c38cffbc2217acb9008a4183531..9df41fe63e3b3b502ba7a62b13febddb29861ccd 100644 +index f0ae87545bd38c38cffbc2217acb9008a4183531..95ec0e3b78a8740dd593c80d5dd8f1bf693c35af 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -1176,6 +1176,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1176,6 +1176,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl BlockState state = newState; BlockState blockState = oldState; BlockState blockState1 = currentState; ++ // Lophine start - Carpet features + boolean skipInteractionUpdates = fun.bm.lophine.carpet.InteractionUpdateCompatHelper.shouldSkipUpdates(); + if (skipInteractionUpdates) { + flags &= ~Block.UPDATE_NEIGHBORS; + } ++ // Lophine end - Carpet features if (blockState1 == state) { if (blockState != blockState1) { this.setBlocksDirty(pos, blockState, blockState1); -@@ -1192,7 +1196,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1192,7 +1198,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } } - if ((flags & Block.UPDATE_KNOWN_SHAPE) == 0 && recursionLeft > 0) { -+ if (!skipInteractionUpdates && (flags & Block.UPDATE_KNOWN_SHAPE) == 0 && recursionLeft > 0) { ++ if (!skipInteractionUpdates && (flags & Block.UPDATE_KNOWN_SHAPE) == 0 && recursionLeft > 0) { // Lophine - Carpet features int i = flags & ~(Block.UPDATE_SUPPRESS_DROPS | Block.UPDATE_NEIGHBORS); // CraftBukkit start diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index cd20d10ee4cd2fe98131c9a93367ae133f96b8d4..b9443bd4a7ee46fa9faea9f7db6352e4c6a6bd0f 100644 +index cd20d10ee4cd2fe98131c9a93367ae133f96b8d4..c99c66563192629e399d1d904cb654c624fe9837 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -292,6 +292,10 @@ public final class NaturalSpawner { +@@ -292,6 +292,12 @@ public final class NaturalSpawner { Player nearestPlayer = level.getNearestPlayer(xx, yStart, zz, -1.0, false); if (nearestPlayer != null) { double nearestPlayerDistanceSqr = nearestPlayer.distanceToSqr(xx, yStart, zz); ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning) { + nearestPlayerDistanceSqr = fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.limitDistanceSq(mobCategory, nearestPlayerDistanceSqr); + } + ++ // Lophine end - Carpet features if (level.isLoadedAndInBounds(pos) && isRightDistanceToPlayerAndSpawnPoint(level, chunk, pos, nearestPlayerDistanceSqr)) { // Paper - don't load chunks for mob spawn if (currentSpawnData == null) { Optional nextSpawnData = getRandomSpawnMobAt( -@@ -332,6 +336,10 @@ public final class NaturalSpawner { +@@ -332,6 +338,12 @@ public final class NaturalSpawner { // SPIGOT-7045: Give ocelot babies back their special spawn reason. Note: This is the only modification required as ocelots count as monsters which means they only spawn during normal chunk ticking and do not spawn during chunk generation as starter mobs. level.addFreshEntityWithPassengers(mob, (mob instanceof net.minecraft.world.entity.animal.feline.Ocelot && !((org.bukkit.entity.Ageable) mob.getBukkitEntity()).isAdult()) ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OCELOT_BABY : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); if (!mob.isRemoved()) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning) { + fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.markSpawned(level, mob.getType()); + } + ++ // Lophine end - Carpet features clusterSize++; groupSize++; spawnCallback.run(mob, chunk); -@@ -411,11 +419,20 @@ public final class NaturalSpawner { +@@ -411,11 +423,24 @@ public final class NaturalSpawner { && canSpawnMobAt(level, structureManager, generator, mobCategory, currentSpawnData, pos) && SpawnPlacements.isSpawnPositionOk(type, level, pos) && SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.NATURAL, pos, level.random) - && level.noCollision(type.getSpawnAABB(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)); ++ // Lophine start - Carpet features + && (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning + ? fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.hasNoCollision(level, type.getSpawnAABB(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)) + : level.noCollision(type.getSpawnAABB(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5))); ++ // Lophine end - Carpet features return success ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent } private static @Nullable Mob getMobForSpawn(final ServerLevel level, final EntityType type) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning) { + Mob cachedMob = fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.getOrCreateMob(level, type); + if (cachedMob != null) { @@ -694,72 +753,84 @@ index cd20d10ee4cd2fe98131c9a93367ae133f96b8d4..b9443bd4a7ee46fa9faea9f7db6352e4 + } + } + ++ // Lophine end - Carpet features try { if (type.create(level, EntitySpawnReason.NATURAL) instanceof Mob mob) { return mob; -@@ -536,7 +553,9 @@ public final class NaturalSpawner { +@@ -536,7 +561,11 @@ public final class NaturalSpawner { float width = spawnerData.type().getWidth(); double fx = Mth.clamp((double)x, (double)xo + width, xo + 16.0 - width); double fz = Mth.clamp((double)z, (double)zo + width, zo + 16.0 - width); - if (!level.noCollision(spawnerData.type().getSpawnAABB(fx, pos.getY(), fz)) ++ // Lophine start - Carpet features + if (!(fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning + ? fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.hasNoCollision(level.getLevel(), spawnerData.type().getSpawnAABB(fx, pos.getY(), fz)) + : level.noCollision(spawnerData.type().getSpawnAABB(fx, pos.getY(), fz))) ++ // Lophine end - Carpet features || !SpawnPlacements.checkSpawnRules( spawnerData.type(), level, -@@ -568,6 +587,9 @@ public final class NaturalSpawner { +@@ -568,6 +597,11 @@ public final class NaturalSpawner { level, level.getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CHUNK_GENERATION, groupSpawnData ); level.addFreshEntityWithPassengers(mob, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.lagFreeSpawning) { + fun.bm.lophine.carpet.LagFreeSpawningCompatHelper.markSpawned(level.getLevel(), mob.getType()); + } ++ // Lophine end - Carpet features success = true; } } diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 9fc97e8b01f66ada6af1fe76f4e27c9bb1a5dcfc..3d5bb6a0893db1cac5cff61e4a3607de9536c9a3 100644 +index 9fc97e8b01f66ada6af1fe76f4e27c9bb1a5dcfc..69d436268492183ae41fb9a60e61ed1f58a674d9 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -371,6 +371,10 @@ public class ServerExplosion implements Explosion { +@@ -371,6 +371,12 @@ public class ServerExplosion implements Explosion { } private List calculateExplodedPositions() { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.explosionNoBlockDamage) { + return List.of(); + } + ++ // Lophine end - Carpet features // Paper start - collision optimisations final ObjectArrayList ret = new ObjectArrayList<>(); diff --git a/net/minecraft/world/level/block/CarvedPumpkinBlock.java b/net/minecraft/world/level/block/CarvedPumpkinBlock.java -index a63dddd01ced6ba23067a113d871f2351bb690fc..6f67b18005ad9b877d7f680ff9b4afc7abed62d1 100644 +index a63dddd01ced6ba23067a113d871f2351bb690fc..ffa6cc05b163df8ee0291f2b80846eebee3fb914 100644 --- a/net/minecraft/world/level/block/CarvedPumpkinBlock.java +++ b/net/minecraft/world/level/block/CarvedPumpkinBlock.java -@@ -59,7 +59,8 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { +@@ -59,7 +59,10 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { public boolean canSpawnGolem(final LevelReader level, final BlockPos topPos) { return this.getOrCreateSnowGolemBase().find(level, topPos) != null || this.getOrCreateIronGolemBase().find(level, topPos) != null - || this.getOrCreateCopperGolemBase().find(level, topPos) != null; ++ // Lophine start - Carpet features + || this.getOrCreateCopperGolemBase().find(level, topPos) != null + || this.canSpawnShulkerGolem(level, topPos); ++ // Lophine end - Carpet features } private void trySpawnGolem(final Level level, final BlockPos topPos) { -@@ -92,6 +93,8 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { +@@ -92,6 +95,10 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { copperGolem.spawn(this.getWeatherStateFromPattern(copperGolemMatch)); } } ++ // Lophine start - Carpet features + + this.trySpawnShulkerGolem(level, topPos); ++ // Lophine end - Carpet features } private WeatheringCopper.WeatherState getWeatherStateFromPattern(final BlockPattern.BlockPatternMatch copperGolemMatch) { -@@ -159,6 +162,42 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { +@@ -159,6 +166,44 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock { builder.add(FACING); } ++ // Lophine start - Carpet features + private boolean canSpawnShulkerGolem(LevelReader level, BlockPos pos) { + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.shulkerGolem + && PUMPKINS_PREDICATE.test(level.getBlockState(pos)) @@ -796,82 +867,93 @@ index a63dddd01ced6ba23067a113d871f2351bb690fc..6f67b18005ad9b877d7f680ff9b4afc7 + } + } + ++ // Lophine end - Carpet features private BlockPattern getOrCreateSnowGolemBase() { if (this.snowGolemBase == null) { this.snowGolemBase = BlockPatternBuilder.start() diff --git a/net/minecraft/world/level/block/ChestBlock.java b/net/minecraft/world/level/block/ChestBlock.java -index b5595d87339e4d313c5691a06c2b1b3d1b40b6de..cceb2e8170bf56c6d34520e69968ea6568a5878e 100644 +index b5595d87339e4d313c5691a06c2b1b3d1b40b6de..6be78cd1faea90e6c38079e2f09a7f11378ca4c2 100644 --- a/net/minecraft/world/level/block/ChestBlock.java +++ b/net/minecraft/world/level/block/ChestBlock.java -@@ -276,7 +276,8 @@ public class ChestBlock extends AbstractChestBlock implements +@@ -276,7 +276,10 @@ public class ChestBlock extends AbstractChestBlock implements final BlockState state, final Level level, final BlockPos pos, final Player player, final BlockHitResult hitResult ) { if (level instanceof ServerLevel serverLevel) { - MenuProvider menuProvider = this.getMenuProvider(state, level, pos); ++ // Lophine start - Carpet features + boolean ignoreObstructions = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeOpenContainerForcibly && player.isCreative(); + MenuProvider menuProvider = this.getMenuProvider(state, level, pos, ignoreObstructions); ++ // Lophine end - Carpet features if (menuProvider != null && player.openMenu(menuProvider).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(this.getOpenChestStat()); PiglinAi.angerNearbyPiglins(serverLevel, player, true); diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java -index a9f511a549681a76a962855c26b9af5980f36df7..26a5330b53f3381896e64c0b65147d69f6369773 100644 +index a9f511a549681a76a962855c26b9af5980f36df7..6163f498a55ede634a704a78307a0debd8f3f1f5 100644 --- a/net/minecraft/world/level/block/EnderChestBlock.java +++ b/net/minecraft/world/level/block/EnderChestBlock.java -@@ -82,7 +82,8 @@ public class EnderChestBlock extends AbstractChestBlock i +@@ -82,7 +82,10 @@ public class EnderChestBlock extends AbstractChestBlock i PlayerEnderChestContainer container = player.getEnderChestInventory(); if (container != null && level.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChest) { BlockPos above = pos.above(); - if (level.getBlockState(above).isRedstoneConductor(level, above)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic ++ // Lophine start - Carpet features + boolean canOpenForcibly = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeOpenContainerForcibly && player.isCreative(); + if (!canOpenForcibly && level.getBlockState(above).isRedstoneConductor(level, above)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic ++ // Lophine end - Carpet features return InteractionResult.SUCCESS; } else { // Paper start - Fix InventoryOpenEvent cancellation - moved up; diff --git a/net/minecraft/world/level/block/FarmlandBlock.java b/net/minecraft/world/level/block/FarmlandBlock.java -index ef55faf83e39c8dfd6bbe33c4943ed88bc473715..3d083f390f4dffc43e1a7f09fad87b05f296e6b8 100644 +index ef55faf83e39c8dfd6bbe33c4943ed88bc473715..f91a8608ba4948217fce4a62affe1e4e6cfb7bf2 100644 --- a/net/minecraft/world/level/block/FarmlandBlock.java +++ b/net/minecraft/world/level/block/FarmlandBlock.java -@@ -132,7 +132,9 @@ public class FarmlandBlock extends Block { +@@ -132,7 +132,11 @@ public class FarmlandBlock extends Block { return; } // CraftBukkit end - turnToDirt(entity, state, level, pos); ++ // Lophine start - Carpet features + if (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.farmlandTrampledDisabled) { + turnToDirt(entity, state, level, pos); + } ++ // Lophine end - Carpet features } // super.fallOn(level, state, pos, entity, fallDistance); // CraftBukkit - moved up diff --git a/net/minecraft/world/level/block/ObserverBlock.java b/net/minecraft/world/level/block/ObserverBlock.java -index be572eff561ffdd961a9602eaa6136761c4d48a4..f11f0669bfbd5bb037cd17298563694316597772 100644 +index be572eff561ffdd961a9602eaa6136761c4d48a4..49b12425a3bb7bb10999939ca5eedab01a1c6b93 100644 --- a/net/minecraft/world/level/block/ObserverBlock.java +++ b/net/minecraft/world/level/block/ObserverBlock.java -@@ -89,6 +89,10 @@ public class ObserverBlock extends DirectionalBlock { +@@ -89,6 +89,12 @@ public class ObserverBlock extends DirectionalBlock { } private void startSignal(final LevelReader level, final ScheduledTickAccess ticks, final BlockPos pos) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.observerNoDetection) { + return; + } + ++ // Lophine end - Carpet features if (!level.isClientSide() && !ticks.getBlockTicks().hasScheduledTick(pos, this)) { ticks.scheduleTick(pos, this, 2); } diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad504ebd8a62 100644 +index 7f5b77cd9cb78e693bbe1efd3d5fd7256d7700c5..6d09ab985c48366742b4e57aec63536872d9f1a0 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -288,7 +288,8 @@ public class RedStoneWireBlock extends Block { +@@ -292,7 +292,10 @@ public class RedStoneWireBlock extends Block { * Note: Added 'source' argument so as to help determine direction of information flow */ private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, @Nullable Orientation orientation, boolean blockAdded) { - if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) { ++ // Lophine start - Carpet features + if (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.fastRedstoneDust + && worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) { ++ // Lophine end - Carpet features // since 24w33a the source pos is no longer given, but instead an Orientation parameter // when this is not null, it can be used to find the source pos, which the turbo uses // to find the direction of information flow -@@ -363,7 +364,8 @@ public class RedStoneWireBlock extends Block { +@@ -367,7 +370,8 @@ public class RedStoneWireBlock extends Block { protected void onPlace(final BlockState state, final Level level, final BlockPos pos, final BlockState oldState, final boolean movedByPiston) { if (!oldState.is(state.getBlock()) && !level.isClientSide()) { // Paper start - optimize redstone - replace call to updatePowerStrength @@ -881,7 +963,7 @@ index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad50 level.getWireHandler().onWireAdded(pos, state); // Alternate Current } else { this.updateSurroundingRedstone(level, pos, state, null, true); // Vanilla/Eigencraft -@@ -388,7 +390,8 @@ public class RedStoneWireBlock extends Block { +@@ -392,7 +396,8 @@ public class RedStoneWireBlock extends Block { } // Paper start - optimize redstone - replace call to updatePowerStrength @@ -891,7 +973,7 @@ index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad50 level.getWireHandler().onWireRemoved(pos, state); // Alternate Current } else { this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft -@@ -408,7 +411,8 @@ public class RedStoneWireBlock extends Block { +@@ -412,7 +417,8 @@ public class RedStoneWireBlock extends Block { } // Paper start - optimize redstone - replace call to updatePowerStrength @@ -901,7 +983,7 @@ index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad50 level.getWireHandler().onWireRemoved(pos, state); // Alternate Current } else { this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft -@@ -440,7 +444,8 @@ public class RedStoneWireBlock extends Block { +@@ -444,7 +450,8 @@ public class RedStoneWireBlock extends Block { if (!level.isClientSide()) { // Paper start - optimize redstone (Alternate Current) // Alternate Current handles breaking of redstone wires in the WireHandler. @@ -912,14 +994,14 @@ index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad50 } else // Paper end - optimize redstone (Alternate Current) diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java -index 59ad645785bc99758f4bc124c56e39d87c4b75c2..13176ae2b2feb8d78b24f6c40901b030accb09be 100644 +index 45dc3e8484842265b26d387d518831ff23da4b5e..ce8bd4a7e8850c25c8c4f1e90361e44be543de16 100644 --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -74,9 +74,10 @@ public class ShulkerBoxBlock extends BaseEntityBlock { protected InteractionResult useWithoutItem( final BlockState state, final Level level, final BlockPos pos, final Player player, final BlockHitResult hitResult ) { -+ boolean canOpenForcibly = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeOpenContainerForcibly && player.isCreative(); ++ boolean canOpenForcibly = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeOpenContainerForcibly && player.isCreative(); // Lophine - Carpet features if (level instanceof ServerLevel serverLevel && level.getBlockEntity(pos) instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity - && canOpen(state, level, pos, shulkerBoxBlockEntity) // Paper - Fix InventoryOpenEvent cancellation - expand if for belows check @@ -928,67 +1010,76 @@ index 59ad645785bc99758f4bc124c56e39d87c4b75c2..13176ae2b2feb8d78b24f6c40901b030 player.awardStat(Stats.OPEN_SHULKER_BOX); PiglinAi.angerNearbyPiglins(serverLevel, player, true); diff --git a/net/minecraft/world/level/block/TntBlock.java b/net/minecraft/world/level/block/TntBlock.java -index 58142c276c976b16100e14ee9adb547f74e4cb41..7a6a05813216d0a0dcc1f4a546b51c021b07714a 100644 +index 58142c276c976b16100e14ee9adb547f74e4cb41..59ace6af88bb73ffdb254881dedf069e80a0cbaa 100644 --- a/net/minecraft/world/level/block/TntBlock.java +++ b/net/minecraft/world/level/block/TntBlock.java -@@ -47,7 +47,8 @@ public class TntBlock extends Block { +@@ -47,7 +47,10 @@ public class TntBlock extends Block { @Override protected void onPlace(final BlockState state, final Level level, final BlockPos pos, final BlockState oldState, final boolean movedByPiston) { if (!oldState.is(state.getBlock())) { - if (level.hasNeighborSignal(pos) && prime(level, pos, () -> org.bukkit.craftbukkit.event.CraftEventFactory.callTNTPrimeEvent(level, pos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.REDSTONE, null, null))) { // CraftBukkit - TNTPrimeEvent ++ // Lophine start - Carpet features + if (shouldPrimeFromRedstone(level, pos) + && prime(level, pos, () -> org.bukkit.craftbukkit.event.CraftEventFactory.callTNTPrimeEvent(level, pos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.REDSTONE, null, null))) { // CraftBukkit - TNTPrimeEvent ++ // Lophine end - Carpet features level.removeBlock(pos, false); } } -@@ -57,7 +58,9 @@ public class TntBlock extends Block { +@@ -57,7 +60,11 @@ public class TntBlock extends Block { protected void neighborChanged( final BlockState state, final Level level, final BlockPos pos, final Block block, final @Nullable Orientation orientation, final boolean movedByPiston ) { - if (level.hasNeighborSignal(pos) && prime(level, pos, () -> org.bukkit.craftbukkit.event.CraftEventFactory.callTNTPrimeEvent(level, pos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.REDSTONE, null, null))) { // CraftBukkit - TNTPrimeEvent ++ // Lophine start - Carpet features + if (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.tntIgnoreRedstoneSignal + && level.hasNeighborSignal(pos) + && prime(level, pos, () -> org.bukkit.craftbukkit.event.CraftEventFactory.callTNTPrimeEvent(level, pos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.REDSTONE, null, null))) { // CraftBukkit - TNTPrimeEvent ++ // Lophine end - Carpet features level.removeBlock(pos, false); } } -@@ -76,7 +79,7 @@ public class TntBlock extends Block { +@@ -76,7 +83,7 @@ public class TntBlock extends Block { if (level.getGameRules().get(GameRules.TNT_EXPLODES)) { PrimedTnt primed = new PrimedTnt(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, explosion.getIndirectSourceEntity()); int fuse = primed.getFuse(); - primed.setFuse((short)(level.getRandom().nextInt(fuse / 4) + fuse / 8)); -+ primed.setFuse(level.getRandom().nextInt(Math.max(fuse / 4, 1)) + fuse / 8); ++ primed.setFuse(level.getRandom().nextInt(Math.max(fuse / 4, 1)) + fuse / 8); // Lophine - Carpet features level.addFreshEntity(primed); } } -@@ -156,4 +159,10 @@ public class TntBlock extends Block { +@@ -156,4 +163,12 @@ public class TntBlock extends Block { protected void createBlockStateDefinition(final StateDefinition.Builder builder) { builder.add(UNSTABLE); } ++ // Lophine start - Carpet features + + private static boolean shouldPrimeFromRedstone(final Level level, final BlockPos pos) { + return !fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.tntDoNotUpdate + && !fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.tntIgnoreRedstoneSignal + && level.hasNeighborSignal(pos); + } ++ // Lophine end - Carpet features } diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index aa782c6441cdce3eb39aefb28d40f3b1970d4e62..3e4fae7a5ae7f8a26bf78727e81c4a87e8fed332 100644 +index aa782c6441cdce3eb39aefb28d40f3b1970d4e62..ac5b419169f8574f92ff7195bfa76c9978bc8a63 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -296,6 +296,8 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -296,6 +296,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen private static boolean hopperPush(final Level level, final Container destination, final Direction direction, final HopperBlockEntity hopper) { io.papermc.paper.threadedregions.RegionizedWorldData worldData = level.getCurrentWorldData(); // Folia - region threading worldData.skipPushModeEventFire = worldData.skipHopperEvents; // Folia - region threading ++ // Lophine start - Carpet features + boolean noItemCost = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.hopperNoItemCost + && org.leavesmc.leaves.util.WoolUtils.getWoolColorAtPosition(level, hopper.getBlockPos().above()) != null; ++ // Lophine end - Carpet features boolean foundItem = false; for (int i = 0; i < hopper.getContainerSize(); ++i) { final ItemStack item = hopper.getItem(i); -@@ -321,6 +323,13 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -321,6 +325,15 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen final ItemStack remainingItem = addItem(hopper, destination, movedItem, direction); final int remainingItemCount = remainingItem.getCount(); if (remainingItemCount != movedItemCount) { ++ // Lophine start - Carpet features + if (noItemCost) { + origItemStack.setCount(originalItemCount); + hopper.setItem(i, origItemStack); @@ -996,6 +1087,7 @@ index aa782c6441cdce3eb39aefb28d40f3b1970d4e62..3e4fae7a5ae7f8a26bf78727e81c4a87 + return true; + } + ++ // Lophine end - Carpet features origItemStack = origItemStack.copy(true); origItemStack.setCount(originalItemCount); if (!origItemStack.isEmpty()) { @@ -1013,29 +1105,31 @@ index 5ae07ece1046dda464f284c1dd13b2780f831e02..a4d8ed890fc6bea1e961df814c00d22a BlockPos pos = oldPos; BlockState blockState = allowDesync ? level.getBlockState(oldPos) : null; diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index ff1471f40b73582df68efbf2996a854c6aa37d65..668f59f94efb34490bdd7d6aac62fb37dd64a485 100644 +index ff1471f40b73582df68efbf2996a854c6aa37d65..a223e3de5d6d302feaff2afbcb858286673be643 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -848,6 +848,10 @@ public abstract class BlockBehaviour implements FeatureElement, org.leavesmc.lea +@@ -848,6 +848,12 @@ public abstract class BlockBehaviour implements FeatureElement, org.leavesmc.lea } public Vec3 getOffset(final BlockPos pos) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.bambooModelNoOffset && (this.getBlock() == Blocks.BAMBOO || this.getBlock() == Blocks.BAMBOO_SAPLING)) { + return Vec3.ZERO; + } + ++ // Lophine end - Carpet features BlockBehaviour.OffsetFunction function = this.offsetFunction; return function != null ? function.evaluate(this.asState(), pos) : Vec3.ZERO; } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 11f0f5e1b8ee9ce7e6833d46ccb557d896674431..5a0271b29589db3e02f87b935a787d180b3696f0 100644 +index 9b3775b0cbca782964e03935331d1bfdd1af140d..a1789d7425fa8b50f9d3656b4dcd6b76af78caec 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -423,10 +423,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -424,10 +424,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot boolean blockChanged = !oldState.is(newBlock); boolean movedByPiston = (flags & Block.UPDATE_MOVE_BY_PISTON) != 0; boolean sideEffects = (flags & Block.UPDATE_SKIP_BLOCK_ENTITY_SIDEEFFECTS) == 0; -+ boolean skipInteractionUpdates = fun.bm.lophine.carpet.InteractionUpdateCompatHelper.shouldSkipUpdates(); ++ boolean skipInteractionUpdates = fun.bm.lophine.carpet.InteractionUpdateCompatHelper.shouldSkipUpdates(); // Lophine - Carpet features // Leaves start - behaviour 1.21.1- if (!fun.bm.lophine.config.modules.experiment.RedStoneConfig.oldBlockRemoveBehaviour) { if (blockChanged && oldState.hasBlockEntity() && !state.shouldChangedStateKeepBlockEntity(oldState)) { @@ -1044,7 +1138,7 @@ index 11f0f5e1b8ee9ce7e6833d46ccb557d896674431..5a0271b29589db3e02f87b935a787d18 BlockEntity blockEntity = this.level.getBlockEntity(pos); if (blockEntity != null) { blockEntity.preRemoveSideEffects(pos, oldState); -@@ -438,6 +439,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -439,6 +440,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot if ((blockChanged || newBlock instanceof BaseRailBlock) && this.level instanceof ServerLevel serverLevel @@ -1052,7 +1146,7 @@ index 11f0f5e1b8ee9ce7e6833d46ccb557d896674431..5a0271b29589db3e02f87b935a787d18 && ((flags & Block.UPDATE_NEIGHBORS) != 0 || movedByPiston)) { oldState.affectNeighborsAfterRemoval(serverLevel, pos, movedByPiston); } -@@ -449,7 +451,10 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -450,7 +452,10 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot if (!section.getBlockState(localX, localY, localZ).is(newBlock)) { return null; } else { @@ -1065,14 +1159,15 @@ index 11f0f5e1b8ee9ce7e6833d46ccb557d896674431..5a0271b29589db3e02f87b935a787d18 } diff --git a/net/minecraft/world/level/dimension/end/DragonRespawnStage.java b/net/minecraft/world/level/dimension/end/DragonRespawnStage.java -index e02f5432d90866a06c48a58895908f7178ef1051..5573df701aef5e1fb77d1ff57c1459c142dad638 100644 +index e02f5432d90866a06c48a58895908f7178ef1051..d9d07b0ea5a78b8862bdc5826c2e01618023a855 100644 --- a/net/minecraft/world/level/dimension/end/DragonRespawnStage.java +++ b/net/minecraft/world/level/dimension/end/DragonRespawnStage.java -@@ -55,16 +55,17 @@ public enum DragonRespawnStage implements StringRepresentable { +@@ -55,16 +55,19 @@ public enum DragonRespawnStage implements StringRepresentable { respawnCrystal.setBeamTarget(new BlockPos(spike.getCenterX(), spike.getHeight() + 1, spike.getCenterZ())); } } else { - int radius = 10; ++ // Lophine start - Carpet features + if (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.preventEndSpikeRespawn) { + for (BlockPos pos : BlockPos.betweenClosed( + new BlockPos(spike.getCenterX() - 10, spike.getHeight() - 10, spike.getCenterZ() - 10), @@ -1080,13 +1175,14 @@ index e02f5432d90866a06c48a58895908f7178ef1051..5573df701aef5e1fb77d1ff57c1459c1 + )) { + level.removeBlock(pos, false); + } ++ // Lophine end - Carpet features - for (BlockPos pos : BlockPos.betweenClosed( - new BlockPos(spike.getCenterX() - 10, spike.getHeight() - 10, spike.getCenterZ() - 10), - new BlockPos(spike.getCenterX() + 10, spike.getHeight() + 10, spike.getCenterZ() + 10) - )) { - level.removeBlock(pos, false); -+ level.explode(null, spike.getCenterX() + 0.5F, spike.getHeight(), spike.getCenterZ() + 0.5F, 5.0F, Level.ExplosionInteraction.BLOCK); ++ level.explode(null, spike.getCenterX() + 0.5F, spike.getHeight(), spike.getCenterZ() + 0.5F, 5.0F, Level.ExplosionInteraction.BLOCK); // Lophine - Carpet features } - level.explode(null, spike.getCenterX() + 0.5F, spike.getHeight(), spike.getCenterZ() + 0.5F, 5.0F, Level.ExplosionInteraction.BLOCK); @@ -1094,43 +1190,49 @@ index e02f5432d90866a06c48a58895908f7178ef1051..5573df701aef5e1fb77d1ff57c1459c1 Feature.END_SPIKE .place( diff --git a/net/minecraft/world/level/levelgen/feature/EndSpikeFeature.java b/net/minecraft/world/level/levelgen/feature/EndSpikeFeature.java -index 3fdf80e32bdcaab4daac8f1c7329a2bc7b2bd625..284cec8401eb75076b2d80581059f489aa4022f9 100644 +index 3fdf80e32bdcaab4daac8f1c7329a2bc7b2bd625..792ca2756edb780cabcbdde65b0fee68e7ce1689 100644 --- a/net/minecraft/world/level/levelgen/feature/EndSpikeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/EndSpikeFeature.java -@@ -68,6 +68,10 @@ public class EndSpikeFeature extends Feature { +@@ -68,6 +68,12 @@ public class EndSpikeFeature extends Feature { private void placeSpike( final ServerLevelAccessor level, final RandomSource random, final EndSpikeConfiguration config, final EndSpikeFeature.EndSpike spike ) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.preventEndSpikeRespawn && config.getCrystalBeamTarget() != null) { + return; + } + ++ // Lophine end - Carpet features int radius = spike.getRadius(); for (BlockPos pos : BlockPos.betweenClosed( diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java -index 6d25139a94df7c0442cc9fea96d5839ce8a23d54..a6a85a8eccff59c8cedab70341baba06dad687be 100644 +index 6358787f3c7dcfa599b2949613236fa8de025096..c1af4530c68a1f050a64720b2139d99c143d7d7b 100644 --- a/net/minecraft/world/level/redstone/NeighborUpdater.java +++ b/net/minecraft/world/level/redstone/NeighborUpdater.java -@@ -42,6 +42,10 @@ public interface NeighborUpdater { +@@ -42,6 +42,12 @@ public interface NeighborUpdater { @Block.UpdateFlags final int updateFlags, final int updateLimit ) { ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.totallyNoBlockUpdate) { + return; + } + ++ // Lophine end - Carpet features BlockState currentState = level.getBlockState(pos); if ((updateFlags & Block.UPDATE_SKIP_SHAPE_UPDATE_ON_WIRE) == 0 || !currentState.is(Blocks.REDSTONE_WIRE)) { try { -@@ -72,6 +76,10 @@ public interface NeighborUpdater { +@@ -72,6 +78,12 @@ public interface NeighborUpdater { static void executeUpdate(Level level, BlockState state, BlockPos pos, Block changedBlock, @Nullable Orientation orientation, boolean movedByPiston, BlockPos sourcePos) { // Paper end - Add source block to BlockPhysicsEvent ++ // Lophine start - Carpet features + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.totallyNoBlockUpdate) { + return; + } + ++ // Lophine end - Carpet features try { // CraftBukkit start org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), state.asBlockData(), org.bukkit.craftbukkit.block.CraftBlock.at(level, sourcePos)); // Paper - Add source block to BlockPhysicsEvent diff --git a/lophine-server/minecraft-patches/features/0045-Carpet-Features-Compatible.patch b/lophine-server/minecraft-patches/features/0045-Carpet-Features-Compatible.patch index bd769af..b7dad17 100644 --- a/lophine-server/minecraft-patches/features/0045-Carpet-Features-Compatible.patch +++ b/lophine-server/minecraft-patches/features/0045-Carpet-Features-Compatible.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Carpet Features Compatible diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java -index 8b05860d2787a40495f8a025bc0bc43789d6a6af..2ef6a7fb5a9c3452dfff70a67542e2ca2531c897 100644 +index 4bd923b42d1c98ce7178e05f9324f46d99ffc933..55bd9581c8c4bd3b1b7ba75cc80c94cf7548638a 100644 --- a/io/papermc/paper/threadedregions/RegionizedServer.java +++ b/io/papermc/paper/threadedregions/RegionizedServer.java @@ -340,7 +340,7 @@ public final class RegionizedServer { - final long tickStartNanos = System.nanoTime(); + final long tickStartNanos = System.nanoTime(); // Lophine - Carpet features ++this.tickCount; // Luminol start - Add a config to enable tick command - if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) { @@ -17,7 +17,7 @@ index 8b05860d2787a40495f8a025bc0bc43789d6a6af..2ef6a7fb5a9c3452dfff70a67542e2ca MinecraftServer.getServer().tickRateManager().tick(); } // Luminol end - Add a config to enable tick command -@@ -529,7 +529,7 @@ public final class RegionizedServer { +@@ -531,7 +531,7 @@ public final class RegionizedServer { } private void tickTime(final ServerLevel world, final long tickCount) { @@ -27,7 +27,7 @@ index 8b05860d2787a40495f8a025bc0bc43789d6a6af..2ef6a7fb5a9c3452dfff70a67542e2ca } } diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java -index 6fe5107751fe448ab374bf57b1ef6859f481f17e..b8d01d95bc44bd70f2c85ca2b923d16dc705161f 100644 +index a37f392146ccc0319cf56ee0058ae8782b598fe3..2223f0b38e8f628af64d1c916fb2310c4704a407 100644 --- a/io/papermc/paper/threadedregions/TickRegionScheduler.java +++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java @@ -576,7 +576,7 @@ public final class TickRegionScheduler { @@ -40,10 +40,10 @@ index 6fe5107751fe448ab374bf57b1ef6859f481f17e..b8d01d95bc44bd70f2c85ca2b923d16d } // Luminol end - Add a config to enable tick command diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index bb5059a77741bf1d9e73bd8c7f0da6681ec63f67..270ee3c01ad0b351bee068a507b09a9d0041ae9c 100644 +index 74ef76058e5a410d12f88aa09450e7d90f63b5e6..1761167da363cd074a26499caadeaeb916461706 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -266,7 +266,7 @@ public class Commands { +@@ -268,7 +268,7 @@ public class Commands { TellRawCommand.register(this.dispatcher, context); //TestCommand.register(this.dispatcher, context); // Folia - region threading // Luminol start - Add a config to enable tick command @@ -53,10 +53,10 @@ index bb5059a77741bf1d9e73bd8c7f0da6681ec63f67..270ee3c01ad0b351bee068a507b09a9d } // Luminol end - Add a config to enable tick command diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 3e4d035890b24483aefe664efff92f23b7c537b7..7cb190b61661c31e6fd5c0a6fbec98f55ef94f12 100644 +index be948a57431dcd4bb3b23a742e71957be58cee2d..d3b24d2f94b1edeb02a4bd4fb2271093c7597a09 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -2186,7 +2186,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -2188,7 +2188,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.lastSentFood = -1; this.teleportSpectators(transition, oldLevel); // Leaves start - bot support @@ -97,7 +97,7 @@ index baa295f3dd8cf10bf7347ee4d1c249b1f82c9279..1d5376650d0f5eeb23fde8d7116b47cf } // Leaves end - bot support diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 3e4fae7a5ae7f8a26bf78727e81c4a87e8fed332..1340ef0ba7660a0e3c4cce105a90fcc4eadcf559 100644 +index ac5b419169f8574f92ff7195bfa76c9978bc8a63..8066cdcaba8d2fcfa2e9ba3b040a2867dbbc6978 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -240,7 +240,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @@ -118,7 +118,7 @@ index 3e4fae7a5ae7f8a26bf78727e81c4a87e8fed332..1340ef0ba7660a0e3c4cce105a90fcc4 entity.setCooldown(0); return true; } -@@ -664,7 +664,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -668,7 +668,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } public static boolean addItem(final Container container, final ItemEntity entity) { @@ -128,7 +128,7 @@ index 3e4fae7a5ae7f8a26bf78727e81c4a87e8fed332..1340ef0ba7660a0e3c4cce105a90fcc4 // CraftBukkit start if (org.bukkit.event.inventory.InventoryPickupItemEvent.getHandlerList().getRegisteredListeners().length > 0) { // Paper - optimize hoppers diff --git a/net/minecraft/world/level/dimension/end/EnderDragonFight.java b/net/minecraft/world/level/dimension/end/EnderDragonFight.java -index 5ca008b3dca83c00f2ae86a608d726972a8d9f9d..4274f22710035b547f5aca617c80c5c99f3a4dc8 100644 +index 5ca008b3dca83c00f2ae86a608d726972a8d9f9d..125d5f59bdfdee5aa4bae2aa4756db363ee17f4b 100644 --- a/net/minecraft/world/level/dimension/end/EnderDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EnderDragonFight.java @@ -323,7 +323,7 @@ public class EnderDragonFight extends SavedData { @@ -136,7 +136,7 @@ index 5ca008b3dca83c00f2ae86a608d726972a8d9f9d..4274f22710035b547f5aca617c80c5c9 public BlockPattern.@Nullable BlockPatternMatch findExitPortal() { - if (me.earthme.luminol.config.modules.optimizations.OptimizedDragonRespawnConfig.optimizedRespawn) { -+ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.optimizedDragonRespawn) { ++ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.optimizedDragonRespawn) { // Lophine - Carpet Features Compatible int i, j; for (i = cachePortalChunkIteratorX; i <= 8; ++i) { for (j = cachePortalChunkIteratorZ; j <= 8; ++j) { diff --git a/lophine-server/paper-patches/features/0001-Rebrand-to-Lophine.patch b/lophine-server/paper-patches/features/0001-Rebrand-to-Lophine.patch index 3f56ee6..39e824f 100644 --- a/lophine-server/paper-patches/features/0001-Rebrand-to-Lophine.patch +++ b/lophine-server/paper-patches/features/0001-Rebrand-to-Lophine.patch @@ -50,7 +50,7 @@ index a5f2e4454258886536251288c3694f58386c7420..28371ecf31d5fc280aaa03ed9a86f5b5 private static final String USER_AGENT = BUILD_INFO.brandName() + "/" + BUILD_INFO.asString(VERSION_SIMPLE) + " (https://papermc.io)"; private static final Gson GSON = new Gson(); diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java -index 4ada790812957657d580cb748077c4961987d0cb..3a539df860305e777e85ed6dc72b5effe76734b4 100644 +index 4ada790812957657d580cb748077c4961987d0cb..ddf3ad20e7ce967d9e096345f99c55abf066c3b3 100644 --- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java +++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java @@ -31,7 +31,7 @@ public record ServerBuildInfoImpl( @@ -58,7 +58,7 @@ index 4ada790812957657d580cb748077c4961987d0cb..3a539df860305e777e85ed6dc72b5eff private static final String BRAND_PAPER_NAME = "Paper"; - private static final String BRAND_LUMINOL_NAME = "Luminol"; -+ private static final String BRAND_LOPHINE_NAME = "Lophine"; ++ private static final String BRAND_LOPHINE_NAME = "Lophine"; // Lophine - Rebrand to Lophine private static final String BUILD_DEV = "DEV";