Merge the duplicate configuration items (#151)

* do not release & push repo before finished

* langs update

* updateSuppression config moved up

* redirect tick command option to carpet config system

* optimizedDragonRespawn

* diff in files

* counter rules transformed

* oops!

* some fakeplayer options moved up

* simplify

* creative no clip moved

* pre remove core module

* pre update luminol to further fix a bug that config not saved to real file

* fix up transform

* fix up transform

* fix up

* fix up some problem in PR

* redirect forgotten moved config

* fix bugs in PR

* refix

* switch for final merge
This commit is contained in:
Helvetica Volubi
2026-06-15 20:27:41 +08:00
committed by GitHub
parent cfc73efc9a
commit 4df4d07ae9
39 changed files with 576 additions and 315 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ release=true
# true for push to repo, false for skip push repo, auto for detect by release value # true for push to repo, false for skip push repo, auto for detect by release value
pushRepo=auto pushRepo=auto
luminolRef=b672b2fbed8d0f1f7de84dfcf373482dd2e5ee51 luminolRef=6dbf8f3ee48c8fcb791be55706a33a8f29c5a042
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.caching=true org.gradle.caching=true
+1 -1
View File
@@ -50,7 +50,7 @@
+ implementation(project(":lophine-api")) + implementation(project(":lophine-api"))
// Luminol start - Dependenices insert // Luminol start - Dependenices insert
implementation("net.objecthunter:exp4j:0.4.8") implementation("net.objecthunter:exp4j:0.4.8")
implementation("com.electronwill.night-config:toml:3.8.3") // Night config implementation("com.electronwill.night-config:toml:3.9.0") // Night config
@@ -234,14 +_,14 @@ @@ -234,14 +_,14 @@
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes( attributes(
@@ -5,14 +5,14 @@ Subject: [PATCH] Rebrand to Lophine
diff --git a/src/main/java/me/earthme/luminol/config/ConfigManager.java b/src/main/java/me/earthme/luminol/config/ConfigManager.java diff --git a/src/main/java/me/earthme/luminol/config/ConfigManager.java b/src/main/java/me/earthme/luminol/config/ConfigManager.java
index 490316c7d5cbb77e988039cfa7a7cc0aa3849730..f5fb4e210c07f32e52eb8c1ba166d1571a6778c7 100644 index a2f5a99ee45a0810fd338ccf6f71df3a077ca62b..05e1aa84586284ac0389e7023f975bfb08438535 100644
--- a/src/main/java/me/earthme/luminol/config/ConfigManager.java --- a/src/main/java/me/earthme/luminol/config/ConfigManager.java
+++ b/src/main/java/me/earthme/luminol/config/ConfigManager.java +++ b/src/main/java/me/earthme/luminol/config/ConfigManager.java
@@ -24,6 +24,7 @@ public class ConfigManager { @@ -24,6 +24,7 @@ public class ConfigManager {
public static void initConfigs() { public static void initConfigs() {
configfiles.put("luminol", ConfigsInstance.of("luminol", "me.earthme.luminol.config.modules")); registerConfig("luminol", ConfigsInstance.of("luminol", "me.earthme.luminol.config.modules"));
+ configfiles.put("lophine", ConfigsInstance.of("lophine", "fun.bm.lophine.config.modules")); // add lophine global config + registerConfig("lophine", ConfigsInstance.of("lophine", "fun.bm.lophine.config.modules")); // add lophine global config
preLoad(); preLoad();
} }
@@ -5,7 +5,7 @@ Subject: [PATCH] Leaves: Fakeplayer
diff --git a/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java b/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java diff --git a/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java b/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java
index 0a20c6f03625391201e5ced167707e54ed27daa1..2872b22e44cba48442c526f0a53e1fc6c5ce760f 100644 index 0a20c6f03625391201e5ced167707e54ed27daa1..dc983bcb8d2e90ad27a693dfcd6debb4b2c2b86b 100644
--- a/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java --- a/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java
+++ b/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java +++ b/src/main/java/me/earthme/luminol/utils/FoliaServerWaypointManager.java
@@ -46,6 +46,12 @@ public class FoliaServerWaypointManager implements WaypointManager<@NotNull Wayp @@ -46,6 +46,12 @@ public class FoliaServerWaypointManager implements WaypointManager<@NotNull Wayp
@@ -21,21 +21,19 @@ index 0a20c6f03625391201e5ced167707e54ed27daa1..2872b22e44cba48442c526f0a53e1fc6
this.waypoints.add(waypoint); this.waypoints.add(waypoint);
for (ServerPlayer toCreateFor : this.trackingPlayers) { for (ServerPlayer toCreateFor : this.trackingPlayers) {
@@ -101,7 +107,13 @@ public class FoliaServerWaypointManager implements WaypointManager<@NotNull Wayp @@ -101,6 +107,12 @@ public class FoliaServerWaypointManager implements WaypointManager<@NotNull Wayp
scheduleIfOffTarget(player, () -> { scheduleIfOffTarget(player, () -> {
this.trackingPlayers.add(player); this.trackingPlayers.add(player);
- for (WaypointTransmitter transmitter : this.waypoints) {
+ // Leaves start - fakeplayer + // Leaves start - fakeplayer
+ if (player instanceof org.leavesmc.leaves.bot.ServerBot) { + if (player instanceof org.leavesmc.leaves.bot.ServerBot) {
+ return; + return;
+ } + }
+ // Leaves end - fakeplayer + // Leaves end - fakeplayer
+ +
+ for (WaypointTransmitter transmitter : this.waypoints) { for (WaypointTransmitter transmitter : this.waypoints) {
this.createConnection(player, transmitter); this.createConnection(player, transmitter);
} }
diff --git a/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java b/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java diff --git a/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java b/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java
index 063cc27df9c8f3ad5c8db5cedcaa3d2bccf6dc24..5ad6aab5e72e27bb402494873770ab5822601939 100644 index 063cc27df9c8f3ad5c8db5cedcaa3d2bccf6dc24..5ad6aab5e72e27bb402494873770ab5822601939 100644
--- a/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java --- a/src/main/java/org/leavesmc/leaves/plugin/ServerFeatureManager.java
@@ -5,14 +5,14 @@ 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 diff --git a/src/main/java/me/earthme/luminol/config/ConfigManager.java b/src/main/java/me/earthme/luminol/config/ConfigManager.java
index f5fb4e210c07f32e52eb8c1ba166d1571a6778c7..e990c147e1b632ef5a33e4f3c37b5cd608040ac7 100644 index 05e1aa84586284ac0389e7023f975bfb08438535..da9ff49be1c7a12ea93d665c37e828afd24d7070 100644
--- a/src/main/java/me/earthme/luminol/config/ConfigManager.java --- a/src/main/java/me/earthme/luminol/config/ConfigManager.java
+++ b/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,13 @@ public class ConfigManager {
public static void initConfigs() { public static void initConfigs() {
configfiles.put("luminol", ConfigsInstance.of("luminol", "me.earthme.luminol.config.modules")); registerConfig("luminol", ConfigsInstance.of("luminol", "me.earthme.luminol.config.modules"));
configfiles.put("lophine", ConfigsInstance.of("lophine", "fun.bm.lophine.config.modules")); // add lophine global config registerConfig("lophine", ConfigsInstance.of("lophine", "fun.bm.lophine.config.modules")); // add lophine global config
+ configfiles.put("lophine_carpet", ConfigsInstance.of( + registerConfig("lophine_carpet", ConfigsInstance.of(
+ new java.io.File("lophine_config"), + new java.io.File("lophine_config"),
+ "lophine_carpet", + "lophine_carpet",
+ "lophine_carpet_config.toml", + "lophine_carpet_config.toml",
@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 5 Jun 2026 16:10:25 +0800
Subject: [PATCH] Carpet Features Compatible
diff --git a/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java b/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
index f079a1cd99d648dc7ca97fb65406b7a42ad5a74e..30f78cbae7aea3e9fcee6d97f229ddf8e8344299 100644
--- a/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
@@ -23,9 +23,4 @@ public class CommandConfig implements IConfigModule {
""")
@HotReloadUnsupported
public static boolean waypointsAndWaypointCommand = false;
- @ConfigInfo(name = "enable_tick_command", comments = """
- Only freeze/unfreeze/step/query command is allowed if you enabled it.
- WARN: This should disabled in production environment!
- """)
- public static boolean tick = false;
}
diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/OptimizedDragonRespawnConfig.java b/src/main/java/me/earthme/luminol/config/modules/optimizations/OptimizedDragonRespawnConfig.java
deleted file mode 100644
index f791feed92abd750ac10775c05150f122ecbe886..0000000000000000000000000000000000000000
--- a/src/main/java/me/earthme/luminol/config/modules/optimizations/OptimizedDragonRespawnConfig.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package me.earthme.luminol.config.modules.optimizations;
-
-import me.earthme.luminol.config.IConfigModule;
-import me.earthme.luminol.config.flags.ConfigClassInfo;
-import me.earthme.luminol.config.flags.ConfigInfo;
-import me.earthme.luminol.enums.EnumConfigCategory;
-
-@ConfigClassInfo(category = EnumConfigCategory.OPTIMIZATIONS, name = "end_dragon")
-public class OptimizedDragonRespawnConfig implements IConfigModule {
- @ConfigInfo(name = "optimized_dragon_respawn")
- public static boolean optimizedRespawn = false;
-}
@@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 5 Jun 2026 16:10:25 +0800
Subject: [PATCH] Tick command transform
diff --git a/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java b/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
index f079a1cd99d648dc7ca97fb65406b7a42ad5a74e..e8ac356822a11ca2cf03363c93afd5abe01a2563 100644
--- a/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/CommandConfig.java
@@ -4,6 +4,7 @@ import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.HotReloadUnsupported;
+import me.earthme.luminol.config.flags.TransformedConfig;
import me.earthme.luminol.enums.EnumConfigCategory;
@ConfigClassInfo(category = EnumConfigCategory.EXPERIMENT, name = "command")
@@ -22,9 +23,10 @@ public class CommandConfig implements IConfigModule {
WARN: Still under testing
""")
@HotReloadUnsupported
+ @TransformedConfig(name = "tick_command_enabled", directory = {"experiment", "command"}, originInstance = "lophine")
public static boolean waypointsAndWaypointCommand = false;
@ConfigInfo(name = "enable_tick_command", comments = """
- Only freeze/unfreeze/step/query command is allowed if you enabled it.
+ Only freeze/unfreeze/step/query/rate command is allowed if you enabled it.
WARN: This should disabled in production environment!
""")
public static boolean tick = false;
@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Mon, 15 Jun 2026 01:33:32 +0800
Subject: [PATCH] TEMP: Temporarily transform config between different config
system
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
--- 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 {
CompletableFuture.allOf(futures).join();
CommandRegister.register(); // register command after config loaded to enable some command didn't depend on config files
initialized = true;
+
+ reApplyStagedConfigs();
+ saveConfigs();
+ configfiles.values().forEach((config) -> config.reload(true, false));
}
public static void registerRunnableBeforeFinalLoad(Runnable runnable) {
@@ -5,7 +5,7 @@ Subject: [PATCH] Add tick rate support
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
index 981f63b75584dbcb4bb0d5672e8c8bb140c52f9d..0a7a23b996d1380ea7ff4a28422fab82f748c5cb 100644 index 981f63b75584dbcb4bb0d5672e8c8bb140c52f9d..6e8ee04967afa410ce9dccff34bf9a43201694fd 100644
--- a/io/papermc/paper/threadedregions/RegionizedServer.java --- a/io/papermc/paper/threadedregions/RegionizedServer.java
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java +++ b/io/papermc/paper/threadedregions/RegionizedServer.java
@@ -371,6 +371,14 @@ public final class RegionizedServer { @@ -371,6 +371,14 @@ public final class RegionizedServer {
@@ -13,7 +13,7 @@ index 981f63b75584dbcb4bb0d5672e8c8bb140c52f9d..0a7a23b996d1380ea7ff4a28422fab82
} }
+ // Lophine start - Add a config to enable tick command + // Lophine start - Add a config to enable tick command
+ if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick) {
+ net.minecraft.server.ServerTickRateManager rateManager = MinecraftServer.getServer().tickRateManager(); + net.minecraft.server.ServerTickRateManager rateManager = MinecraftServer.getServer().tickRateManager();
+ rateManager.reduceSprintTicks(); + rateManager.reduceSprintTicks();
+ rateManager.endTickWork(); + rateManager.endTickWork();
@@ -24,7 +24,7 @@ index 981f63b75584dbcb4bb0d5672e8c8bb140c52f9d..0a7a23b996d1380ea7ff4a28422fab82
this.tickConnections(); this.tickConnections();
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
index f60b3b40c7dc5820abc726abc8d094ed873edf6c..6be8f4862e62a021602f7fc4ba5bdd6d3759d71e 100644 index f60b3b40c7dc5820abc726abc8d094ed873edf6c..917d6965e91527fc79d545c041765f78a357eac2 100644
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java --- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java +++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
@@ -40,8 +40,8 @@ public final class TickRegionScheduler { @@ -40,8 +40,8 @@ public final class TickRegionScheduler {
@@ -46,7 +46,7 @@ index f60b3b40c7dc5820abc726abc8d094ed873edf6c..6be8f4862e62a021602f7fc4ba5bdd6d
- final long tickCount = Math.max(1L, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart)); - final long tickCount = Math.max(1L, this.tickSchedule.getPeriodsAhead(TIME_BETWEEN_TICKS, tickStart));
+ // Lophine start - Add a config to enable tick command + // Lophine start - Add a config to enable tick command
+ final long tickCount; + final long tickCount;
+ if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick) {
+ net.minecraft.server.ServerTickRateManager rateManager = MinecraftServer.getServer().tickRateManager(); + net.minecraft.server.ServerTickRateManager rateManager = MinecraftServer.getServer().tickRateManager();
+ if (rateManager.isSprinting() && rateManager.checkShouldSprintThisTick()) { + if (rateManager.isSprinting() && rateManager.checkShouldSprintThisTick()) {
+ TICK_RATE = net.minecraft.server.commands.TickCommand.MAX_TICKRATE; + TICK_RATE = net.minecraft.server.commands.TickCommand.MAX_TICKRATE;
@@ -21,7 +21,7 @@ index e302c6198d71782b524391329aa5c89d2b3e0ccf..2312803297321f66c9057bc54ce56dd1
} else { } else {
this.followingPlayer = null; this.followingPlayer = null;
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 38689fa466a20c64f9916ee32a57a9fdb58d9403..7d514537ee38f9b9366692bc969ff503d883aa16 100644 index 38689fa466a20c64f9916ee32a57a9fdb58d9403..ea5de9aca4908ed972c4f44bff635f2cc423a04f 100644
--- a/net/minecraft/world/entity/player/Player.java --- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java
@@ -279,8 +279,8 @@ public abstract class Player extends Avatar implements ContainerUser { @@ -279,8 +279,8 @@ public abstract class Player extends Avatar implements ContainerUser {
@@ -59,7 +59,7 @@ index 38689fa466a20c64f9916ee32a57a9fdb58d9403..7d514537ee38f9b9366692bc969ff503
+ // Leaves start - creative no clip + // Leaves start - creative no clip
+ public boolean isCreativeFlyOrSpectator() { + public boolean isCreativeFlyOrSpectator() {
+ return isSpectator() || (fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig.enabled && isCreative() && getAbilities().flying); + return isSpectator() || (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoClip && isCreative() && getAbilities().flying);
+ } + }
+ +
+ public boolean canSpectatingPlace(final net.minecraft.world.level.LevelReader world, final BlockState state, final BlockPos pos, final net.minecraft.world.phys.shapes.CollisionContext context) { + public boolean canSpectatingPlace(final net.minecraft.world.level.LevelReader world, final BlockState state, final BlockPos pos, final net.minecraft.world.phys.shapes.CollisionContext context) {
@@ -81,7 +81,7 @@ index 38689fa466a20c64f9916ee32a57a9fdb58d9403..7d514537ee38f9b9366692bc969ff503
public boolean isPickable() { public boolean isPickable() {
return !this.isSpectator() && super.isPickable(); return !this.isSpectator() && super.isPickable();
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index 2e2a8af12f249ec5bd0935fd13f5acbd0a777b5f..06160c24f1ffbe1445284bc81598cabb3ad20477 100644 index 2e2a8af12f249ec5bd0935fd13f5acbd0a777b5f..07b84bd0144e133d13e8e033a8998f3cf674f746 100644
--- a/net/minecraft/world/item/BlockItem.java --- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java
@@ -158,8 +158,9 @@ public class BlockItem extends Item { @@ -158,8 +158,9 @@ public class BlockItem extends Item {
@@ -91,12 +91,12 @@ index 2e2a8af12f249ec5bd0935fd13f5acbd0a777b5f..06160c24f1ffbe1445284bc81598cabb
+ CollisionContext collisionContext = player == null ? CollisionContext.empty() : CollisionContext.placementContext(player); // Leaves - creative no clip + CollisionContext collisionContext = player == null ? CollisionContext.empty() : CollisionContext.placementContext(player); // Leaves - creative no clip
boolean canBuild = (!this.mustSurvive() || stateForPlacement.canSurvive(world, context.getClickedPos())) boolean canBuild = (!this.mustSurvive() || stateForPlacement.canSurvive(world, context.getClickedPos()))
- && world.checkEntityCollision(stateForPlacement, player, CollisionContext.placementContext(player), context.getClickedPos(), true); // Paper - Cancel hit for vanished players - && world.checkEntityCollision(stateForPlacement, player, CollisionContext.placementContext(player), context.getClickedPos(), true); // Paper - Cancel hit for vanished players
+ && ((fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig.enabled && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext) : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip + && ((fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoClip && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext) : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip
org.bukkit.entity.Player bukkitPlayer = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null; org.bukkit.entity.Player bukkitPlayer = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null;
org.bukkit.event.block.BlockCanBuildEvent event = new org.bukkit.event.block.BlockCanBuildEvent( org.bukkit.event.block.BlockCanBuildEvent event = new org.bukkit.event.block.BlockCanBuildEvent(
diff --git a/net/minecraft/world/item/StandingAndWallBlockItem.java b/net/minecraft/world/item/StandingAndWallBlockItem.java diff --git a/net/minecraft/world/item/StandingAndWallBlockItem.java b/net/minecraft/world/item/StandingAndWallBlockItem.java
index cb0a4a9865df69e5504a86de6c144bc4450bd19a..a40a98bb48bb14c49670ba55d2a2e8d7e9d0d178 100644 index cb0a4a9865df69e5504a86de6c144bc4450bd19a..596fb91fccb4c8d6854fa859f9ee357c6d22a81e 100644
--- a/net/minecraft/world/item/StandingAndWallBlockItem.java --- a/net/minecraft/world/item/StandingAndWallBlockItem.java
+++ b/net/minecraft/world/item/StandingAndWallBlockItem.java +++ b/net/minecraft/world/item/StandingAndWallBlockItem.java
@@ -44,7 +44,7 @@ public class StandingAndWallBlockItem extends BlockItem { @@ -44,7 +44,7 @@ public class StandingAndWallBlockItem extends BlockItem {
@@ -104,7 +104,7 @@ index cb0a4a9865df69e5504a86de6c144bc4450bd19a..a40a98bb48bb14c49670ba55d2a2e8d7
// CraftBukkit start // CraftBukkit start
if (stateForPlacement != null) { if (stateForPlacement != null) {
- boolean defaultReturn = level.isUnobstructed(stateForPlacement, pos, CollisionContext.empty()); - boolean defaultReturn = level.isUnobstructed(stateForPlacement, pos, CollisionContext.empty());
+ boolean defaultReturn = (fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig.enabled && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(level, stateForPlacement, pos, CollisionContext.empty()) : level.isUnobstructed(stateForPlacement, pos, CollisionContext.empty()); // Leaves - creative no clip + boolean defaultReturn = (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoClip && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(level, stateForPlacement, pos, CollisionContext.empty()) : level.isUnobstructed(stateForPlacement, pos, CollisionContext.empty()); // Leaves - creative no clip
org.bukkit.entity.Player player = (context.getPlayer() instanceof net.minecraft.server.level.ServerPlayer serverPlayer) ? serverPlayer.getBukkitEntity() : null; org.bukkit.entity.Player player = (context.getPlayer() instanceof net.minecraft.server.level.ServerPlayer serverPlayer) ? serverPlayer.getBukkitEntity() : null;
org.bukkit.event.block.BlockCanBuildEvent event = new org.bukkit.event.block.BlockCanBuildEvent(org.bukkit.craftbukkit.block.CraftBlock.at(context.getLevel(), pos), player, stateForPlacement.asBlockData(), defaultReturn, org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(context.getHand())); // Paper - Expose hand in BlockCanBuildEvent org.bukkit.event.block.BlockCanBuildEvent event = new org.bukkit.event.block.BlockCanBuildEvent(org.bukkit.craftbukkit.block.CraftBlock.at(context.getLevel(), pos), player, stateForPlacement.asBlockData(), defaultReturn, org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(context.getHand())); // Paper - Expose hand in BlockCanBuildEvent
@@ -66,7 +66,7 @@ index 3b9a4f4b5794faa4955018858c94fd5c2d6ada3d..19bef18e606d873308d08987d90e2987
profiler.pop(); profiler.pop();
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 54011666a2f358fe38ca03bc39d68d122011c796..003d0330956b75d93d62e0c0caed56f2408984fc 100644 index 54011666a2f358fe38ca03bc39d68d122011c796..3496696c6b023e7df95027917b3391557dddd8d0 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -967,7 +967,16 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet @@ -967,7 +967,16 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
@@ -74,7 +74,7 @@ index 54011666a2f358fe38ca03bc39d68d122011c796..003d0330956b75d93d62e0c0caed56f2
profiler.push("tick"); profiler.push("tick");
- this.guardEntityTick(this::tickNonPassenger, entity); - this.guardEntityTick(this::tickNonPassenger, entity);
+ if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) {
+ try { + try {
+ this.guardEntityTick(this::tickNonPassenger, entity); + this.guardEntityTick(this::tickNonPassenger, entity);
+ } catch (org.leavesmc.leaves.util.UpdateSuppressionException exception) { + } catch (org.leavesmc.leaves.util.UpdateSuppressionException exception) {
@@ -124,7 +124,7 @@ index 07c5fed7b0bf3ecefb54ccb0bfb922c2f11f7939..8a92d1748464ef8d1d33e51163a3e0d7
return true; return true;
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index 08ad9f418fbe733b788ec27e13b61994c3a5f09d..80d10b42106749254eb5f757986838acc1c064d2 100644 index 08ad9f418fbe733b788ec27e13b61994c3a5f09d..c0b086fd5084fc0e39b91d3f6bd6904ef19f4157 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -181,7 +181,14 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @@ -181,7 +181,14 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@@ -135,7 +135,7 @@ index 08ad9f418fbe733b788ec27e13b61994c3a5f09d..80d10b42106749254eb5f757986838ac
+ try { + try {
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos)); + return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
+ } catch (ClassCastException ex) { + } catch (ClassCastException ex) {
+ if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) {
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, null, this, null, ex); + throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, null, this, null, ex);
+ } + }
+ throw ex; + throw ex;
@@ -144,7 +144,7 @@ index 08ad9f418fbe733b788ec27e13b61994c3a5f09d..80d10b42106749254eb5f757986838ac
public @Nullable DyeColor getColor() { public @Nullable DyeColor getColor() {
diff --git a/net/minecraft/world/level/block/state/StateHolder.java b/net/minecraft/world/level/block/state/StateHolder.java diff --git a/net/minecraft/world/level/block/state/StateHolder.java b/net/minecraft/world/level/block/state/StateHolder.java
index b72861c0164ebb13b6fc3e78cd7ce0a2c484f22d..a359d9ce555b9c8ec01ed71b305ab8efa80c3892 100644 index b72861c0164ebb13b6fc3e78cd7ce0a2c484f22d..6d3af2481e81795771ac8f82d984681ec8c9e0b9 100644
--- a/net/minecraft/world/level/block/state/StateHolder.java --- a/net/minecraft/world/level/block/state/StateHolder.java
+++ b/net/minecraft/world/level/block/state/StateHolder.java +++ b/net/minecraft/world/level/block/state/StateHolder.java
@@ -118,7 +118,14 @@ public abstract class StateHolder<O, S> implements ca.spottedleaf.moonrise.patch @@ -118,7 +118,14 @@ public abstract class StateHolder<O, S> implements ca.spottedleaf.moonrise.patch
@@ -153,7 +153,7 @@ index b72861c0164ebb13b6fc3e78cd7ce0a2c484f22d..a359d9ce555b9c8ec01ed71b305ab8ef
} }
- throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); - throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner);
+ IllegalArgumentException iae = new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); + IllegalArgumentException iae = new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner);
+ if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { + 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); + org.leavesmc.leaves.util.UpdateSuppressionException exception = new org.leavesmc.leaves.util.UpdateSuppressionException(null, null, null, null, iae);
+ if (exception.getStackTrace()[1].getClassName().startsWith("net.minecraft")) { + if (exception.getStackTrace()[1].getClassName().startsWith("net.minecraft")) {
+ throw exception; + throw exception;
@@ -187,20 +187,20 @@ index 3708f9ffc46a5b1c038c0e7b2ce84802e2b22397..7760a711f4c49fc3499bf71fabb59ee8
} }
} }
diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java
index 9b8d63f69ed1101f1b7b2728690e35165b9aeb99..44731e230869f0df058f6a426277befbb0d559e4 100644 index 9b8d63f69ed1101f1b7b2728690e35165b9aeb99..6d25139a94df7c0442cc9fea96d5839ce8a23d54 100644
--- a/net/minecraft/world/level/redstone/NeighborUpdater.java --- a/net/minecraft/world/level/redstone/NeighborUpdater.java
+++ b/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,20 @@ public interface NeighborUpdater {
} finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG } finally { if (levelChunk != null) levelChunk.getChunkHot().stopTickingAndCount(); } // KioCG
// Spigot start // Spigot start
} catch (StackOverflowError ex) { } catch (StackOverflowError ex) {
+ if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) {
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, level, changedBlock, null, ex); + throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, level, changedBlock, null, ex);
+ } + }
level.lastPhysicsProblem = pos.immutable(); level.lastPhysicsProblem = pos.immutable();
// Spigot end // Spigot end
} catch (Throwable var9) { } catch (Throwable var9) {
+ if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) {
+ if (var9 instanceof org.leavesmc.leaves.util.UpdateSuppressionException exception) { + if (var9 instanceof org.leavesmc.leaves.util.UpdateSuppressionException exception) {
+ exception.provideBlock(level, pos, changedBlock); + exception.provideBlock(level, pos, changedBlock);
+ throw exception; + throw exception;
@@ -8,7 +8,7 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 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 diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index 80d10b42106749254eb5f757986838acc1c064d2..ffa76dc1338c6c892a42b2148f9f01c933660b98 100644 index c0b086fd5084fc0e39b91d3f6bd6904ef19f4157..8259f530ec50554906c254b60f1e964b52c02852 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -182,7 +182,9 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @@ -182,7 +182,9 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@@ -16,9 +16,9 @@ index 80d10b42106749254eb5f757986838acc1c064d2..ffa76dc1338c6c892a42b2148f9f01c9
protected int getAnalogOutputSignal(final BlockState state, final Level level, final BlockPos pos, final Direction direction) { protected int getAnalogOutputSignal(final BlockState state, final Level level, final BlockPos pos, final Direction direction) {
try { try {
- return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos)); - return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
+ return fun.bm.lophine.config.modules.experiment.RedStoneConfig.cce + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.shulkerBoxCCEReintroduced
+ ? AbstractContainerMenu.getRedstoneSignalFromContainer((net.minecraft.world.Container)level.getBlockEntity(pos)) + ? AbstractContainerMenu.getRedstoneSignalFromContainer((net.minecraft.world.Container)level.getBlockEntity(pos))
+ : AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos)); + : AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
} catch (ClassCastException ex) { } catch (ClassCastException ex) {
if (fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig.enabled) { if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.mergedUpdateSuppressionCrashEnabled()) {
throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, null, this, null, ex); throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, null, this, null, ex);
@@ -3,26 +3,28 @@ From: Bacteriawa <A3167717663@hotmail.com>
Date: Wed, 14 Jun 2023 12:07:07 +0800 Date: Wed, 14 Jun 2023 12:07:07 +0800
Subject: [PATCH] Leaves: Redstone ignore upwards update Subject: [PATCH] Leaves: Redstone ignore upwards update
(Carpet: dustTrapdoorReintroduced)
Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com> Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
As a part of : Leaves (https://github.com/LeavesMC/Leaves) As a part of : Leaves (https://github.com/LeavesMC/Leaves)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 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 diff --git a/net/minecraft/world/level/block/ComparatorBlock.java b/net/minecraft/world/level/block/ComparatorBlock.java
index 45e11737bc2558a4ebfffe133d43111f45dd7d16..b6005e5e60ac571396d584c7f4dec3975a6f9923 100644 index 45e11737bc2558a4ebfffe133d43111f45dd7d16..d3bcef3fa3228c3869041754b2c18dfc987aac35 100644
--- a/net/minecraft/world/level/block/ComparatorBlock.java --- a/net/minecraft/world/level/block/ComparatorBlock.java
+++ b/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,9 @@ public class ComparatorBlock extends DiodeBlock implements EntityBlock {
final BlockState neighbourState, final BlockState neighbourState,
final RandomSource random final RandomSource random
) { ) {
+ if (fun.bm.lophine.config.modules.experiment.RedStoneConfig.redstoneIgnoreUpwardsUpdate && directionToNeighbour == Direction.DOWN) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && directionToNeighbour == Direction.DOWN) {
+ return state; + return state;
+ } + }
return directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState) return directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState)
? Blocks.AIR.defaultBlockState() ? Blocks.AIR.defaultBlockState()
: super.updateShape(state, level, ticks, pos, directionToNeighbour, neighbourPos, neighbourState, random); : 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 diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index 759eb347299813c20226cc2fc5dc7718d12b7f56..66a05f099a263b0c9220f1416f3cf1221422cc20 100644 index 759eb347299813c20226cc2fc5dc7718d12b7f56..619f5e37919693fc5976aedefed3bb5428395439 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/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,9 @@ public class RedStoneWireBlock extends Block {
@@ -30,7 +32,7 @@ index 759eb347299813c20226cc2fc5dc7718d12b7f56..66a05f099a263b0c9220f1416f3cf122
) { ) {
if (directionToNeighbour == Direction.DOWN) { if (directionToNeighbour == Direction.DOWN) {
- return !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state; - return !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state;
+ return fun.bm.lophine.config.modules.experiment.RedStoneConfig.redstoneIgnoreUpwardsUpdate + return fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced
+ ? state + ? state
+ : !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state; + : !this.canSurviveOn(level, neighbourPos, neighbourState) ? Blocks.AIR.defaultBlockState() : state;
} else if (directionToNeighbour == Direction.UP) { } else if (directionToNeighbour == Direction.UP) {
@@ -41,20 +43,20 @@ index 759eb347299813c20226cc2fc5dc7718d12b7f56..66a05f099a263b0c9220f1416f3cf122
BlockState relativeState = level.getBlockState(relativePos); BlockState relativeState = level.getBlockState(relativePos);
if (canConnectUp) { if (canConnectUp) {
- boolean isPlaceableAbove = relativeState.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(level, relativePos, relativeState); - boolean isPlaceableAbove = relativeState.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(level, relativePos, relativeState);
+ boolean isPlaceableAbove = (!fun.bm.lophine.config.modules.experiment.RedStoneConfig.redstoneIgnoreUpwardsUpdate && relativeState.getBlock() instanceof TrapDoorBlock) + boolean isPlaceableAbove = (!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && relativeState.getBlock() instanceof TrapDoorBlock)
+ || this.canSurviveOn(level, relativePos, relativeState); + || this.canSurviveOn(level, relativePos, relativeState);
if (isPlaceableAbove && shouldConnectTo(level.getBlockState(relativePos.above()))) { if (isPlaceableAbove && shouldConnectTo(level.getBlockState(relativePos.above()))) {
if (relativeState.isFaceSturdy(level, relativePos, direction.getOpposite())) { if (relativeState.isFaceSturdy(level, relativePos, direction.getOpposite())) {
return RedstoneSide.UP; return RedstoneSide.UP;
diff --git a/net/minecraft/world/level/block/RepeaterBlock.java b/net/minecraft/world/level/block/RepeaterBlock.java diff --git a/net/minecraft/world/level/block/RepeaterBlock.java b/net/minecraft/world/level/block/RepeaterBlock.java
index d301ca4c91e75d715998aa7ed155fd44ccd64785..13928e667cfa36e2ebf45b30caf4c5be28f2f725 100644 index d301ca4c91e75d715998aa7ed155fd44ccd64785..cc2694d0fc3c9bbe5e91771b3aef8ffb749515b4 100644
--- a/net/minecraft/world/level/block/RepeaterBlock.java --- a/net/minecraft/world/level/block/RepeaterBlock.java
+++ b/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,9 @@ public class RepeaterBlock extends DiodeBlock {
final BlockState neighbourState, final BlockState neighbourState,
final RandomSource random final RandomSource random
) { ) {
+ if (fun.bm.lophine.config.modules.experiment.RedStoneConfig.redstoneIgnoreUpwardsUpdate && directionToNeighbour == Direction.DOWN) { + if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.dustTrapdoorReintroduced && directionToNeighbour == Direction.DOWN) {
+ return state; + return state;
+ } + }
if (directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState)) { if (directionToNeighbour == Direction.DOWN && !this.canSurviveOn(level, neighbourPos, neighbourState)) {
@@ -5,39 +5,30 @@ Subject: [PATCH] Instant Block Updater
diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java diff --git a/io/papermc/paper/threadedregions/RegionizedWorldData.java b/io/papermc/paper/threadedregions/RegionizedWorldData.java
index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..dad62b80578f27cc39985ee6ded705bf3cc5d117 100644 index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..1a426e1aa456a8ea432f62483c3be5c328b97953 100644
--- a/io/papermc/paper/threadedregions/RegionizedWorldData.java --- a/io/papermc/paper/threadedregions/RegionizedWorldData.java
+++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java +++ b/io/papermc/paper/threadedregions/RegionizedWorldData.java
@@ -44,6 +44,8 @@ import net.minecraft.world.level.chunk.LevelChunk; @@ -506,7 +506,7 @@ public final class RegionizedWorldData {
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.pathfinder.PathTypeCache;
import net.minecraft.world.level.redstone.CollectingNeighborUpdater;
+import net.minecraft.world.level.redstone.InstantNeighborUpdater;
+import net.minecraft.world.level.redstone.NeighborUpdater;
import net.minecraft.world.level.saveddata.WanderingTraderData;
import net.minecraft.world.ticks.LevelTicks;
import org.bukkit.craftbukkit.block.CraftBlockState;
@@ -506,7 +508,7 @@ public final class RegionizedWorldData {
public long lastMidTickExecuteFailure; public long lastMidTickExecuteFailure;
// From Level // From Level
public boolean populating; public boolean populating;
- public final CollectingNeighborUpdater neighborUpdater; - public final CollectingNeighborUpdater neighborUpdater;
+ public final NeighborUpdater neighborUpdater; + public final net.minecraft.world.level.redstone.NeighborUpdater neighborUpdater;
public boolean captureBlockStates = false; public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false; public boolean captureTreeGeneration = false;
public final Map<BlockPos, CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper public final Map<BlockPos, CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper
@@ -567,7 +569,9 @@ public final class RegionizedWorldData { @@ -567,7 +567,9 @@ public final class RegionizedWorldData {
this.world = world; this.world = world;
this.blockLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, true); this.blockLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, true);
this.fluidLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, false); this.fluidLevelTicks = new LevelTicks<>(world::isPositionTickingWithEntitiesLoaded, world, false);
- this.neighborUpdater = new CollectingNeighborUpdater(world, world.neighbourUpdateMax); - this.neighborUpdater = new CollectingNeighborUpdater(world, world.neighbourUpdateMax);
+ this.neighborUpdater = fun.bm.lophine.config.modules.experiment.RedStoneConfig.instantBlockUpdater + this.neighborUpdater = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.instantBlockUpdaterReintroduced
+ ? new InstantNeighborUpdater(world) + ? new net.minecraft.world.level.redstone.InstantNeighborUpdater(world)
+ : new CollectingNeighborUpdater(world, world.neighbourUpdateMax); + : new CollectingNeighborUpdater(world, world.neighbourUpdateMax);
this.nearbyPlayers = new NearbyPlayers(world); this.nearbyPlayers = new NearbyPlayers(world);
this.wireHandler = new alternate.current.wire.WireHandler(world); this.wireHandler = new alternate.current.wire.WireHandler(world);
this.turbo = new io.papermc.paper.redstone.RedstoneWireTurbo((RedStoneWireBlock)Blocks.REDSTONE_WIRE); this.turbo = new io.papermc.paper.redstone.RedstoneWireTurbo((RedStoneWireBlock)Blocks.REDSTONE_WIRE);
@@ -896,4 +900,4 @@ public final class RegionizedWorldData { @@ -896,4 +898,4 @@ public final class RegionizedWorldData {
public int getChunkCount() { public int getChunkCount() {
return this.chunks.size(); return this.chunks.size();
} }
@@ -45,7 +36,7 @@ index 64d407c5a6140a7e5dc47a8e304b4c00602e2bdd..dad62b80578f27cc39985ee6ded705bf
\ No newline at end of file \ No newline at end of file
+} +}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 003d0330956b75d93d62e0c0caed56f2408984fc..7dfcf2bed9446fcf0804e304bc88d0fd44521228 100644 index 3496696c6b023e7df95027917b3391557dddd8d0..d8718805a965db11dfce8ed7f5ea65a638cc4510 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/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 @@ -999,11 +999,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ServerEntityGet
@@ -9,7 +9,7 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index 06160c24f1ffbe1445284bc81598cabb3ad20477..ca3f31a72060f797115787302d32a019fa8243e0 100644 index 07b84bd0144e133d13e8e033a8998f3cf674f746..9c016e7d93e4c44ddf2df520e5c57d92a0e085b3 100644
--- a/net/minecraft/world/item/BlockItem.java --- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java
@@ -69,20 +69,8 @@ public class BlockItem extends Item { @@ -69,20 +69,8 @@ public class BlockItem extends Item {
@@ -522,7 +522,7 @@ index 6a3413ca875ce78f48cd8d3ce2cfe7798be1a19e..be572eff561ffdd961a9602eaa613676
protected void affectNeighborsAfterRemoval(final BlockState state, final ServerLevel level, final BlockPos pos, final boolean movedByPiston) { protected void affectNeighborsAfterRemoval(final BlockState state, final ServerLevel level, final BlockPos pos, final boolean movedByPiston) {
if (state.getValue(POWERED) && level.getBlockTicks().hasScheduledTick(pos, this)) { 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 diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index 66a05f099a263b0c9220f1416f3cf1221422cc20..1de86856f4a27346d7003ca9eb24a36074a2a4a3 100644 index 619f5e37919693fc5976aedefed3bb5428395439..ed190e16df7c6b80fd90561e7c2fdd53c745e54a 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -378,6 +378,28 @@ public class RedStoneWireBlock extends Block { @@ -378,6 +378,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) { protected void tick(final BlockState state, final ServerLevel level, final BlockPos pos, final RandomSource random) {
if (state.getValue(SHRIEKING)) { if (state.getValue(SHRIEKING)) {
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index ffa76dc1338c6c892a42b2148f9f01c933660b98..7bf2cde59c112f4babb87476585207dacebef341 100644 index 8259f530ec50554906c254b60f1e964b52c02852..59ad645785bc99758f4bc124c56e39d87c4b75c2 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -150,6 +150,20 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @@ -150,6 +150,20 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@@ -5,7 +5,7 @@ Subject: [PATCH] Carpet features
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
index 0a7a23b996d1380ea7ff4a28422fab82f748c5cb..196b84489b25142b4368ca39ff118077c4d66dab 100644 index 6e8ee04967afa410ce9dccff34bf9a43201694fd..8b05860d2787a40495f8a025bc0bc43789d6a6af 100644
--- a/io/papermc/paper/threadedregions/RegionizedServer.java --- a/io/papermc/paper/threadedregions/RegionizedServer.java
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java +++ b/io/papermc/paper/threadedregions/RegionizedServer.java
@@ -337,6 +337,7 @@ public final class RegionizedServer { @@ -337,6 +337,7 @@ public final class RegionizedServer {
@@ -443,7 +443,7 @@ index 459a05ca83583538f995f45c4d2c977c6d6fcd00..474004edeae737873db88b3cce79408e
} }
} }
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 7d514537ee38f9b9366692bc969ff503d883aa16..da0c648cafec4cb4fe1bbb31037204b180fcf4ce 100644 index ea5de9aca4908ed972c4f44bff635f2cc423a04f..04707a48b1ad9f0c580213e5837e93ad849d1b47 100644
--- a/net/minecraft/world/entity/player/Player.java --- a/net/minecraft/world/entity/player/Player.java
+++ b/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,13 @@ public abstract class Player extends Avatar implements ContainerUser {
@@ -506,7 +506,7 @@ index 7d514537ee38f9b9366692bc969ff503d883aa16..da0c648cafec4cb4fe1bbb31037204b1
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), sound, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
} }
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index ca3f31a72060f797115787302d32a019fa8243e0..8d13dab5dcc3a500f9e4faf8168f6d25697ea99f 100644 index 9c016e7d93e4c44ddf2df520e5c57d92a0e085b3..3413fe84a40b00e98565cdf7aa93fc1c7da6f128 100644
--- a/net/minecraft/world/item/BlockItem.java --- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java
@@ -147,8 +147,12 @@ public class BlockItem extends Item { @@ -147,8 +147,12 @@ public class BlockItem extends Item {
@@ -515,9 +515,9 @@ index ca3f31a72060f797115787302d32a019fa8243e0..8d13dab5dcc3a500f9e4faf8168f6d25
CollisionContext collisionContext = player == null ? CollisionContext.empty() : CollisionContext.placementContext(player); // Leaves - creative no clip CollisionContext collisionContext = player == null ? CollisionContext.empty() : CollisionContext.placementContext(player); // Leaves - creative no clip
+ boolean ignoreEntityCollision = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.blockPlacementIgnoreEntity && player != null && player.isCreative(); + boolean ignoreEntityCollision = fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.blockPlacementIgnoreEntity && player != null && player.isCreative();
boolean canBuild = (!this.mustSurvive() || stateForPlacement.canSurvive(world, context.getClickedPos())) boolean canBuild = (!this.mustSurvive() || stateForPlacement.canSurvive(world, context.getClickedPos()))
- && ((fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig.enabled && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext) : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip - && ((fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoClip && context.getPlayer() != null) ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext) : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip
+ && (ignoreEntityCollision + && (ignoreEntityCollision
+ || ((fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig.enabled && context.getPlayer() != null) + || ((fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.creativeNoClip && context.getPlayer() != null)
+ ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext) + ? context.getPlayer().canSpectatingPlace(world, stateForPlacement, context.getClickedPos(), collisionContext)
+ : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true))); // Paper - Cancel hit for vanished players // Leaves - creative no clip + : world.checkEntityCollision(stateForPlacement, player, collisionContext, context.getClickedPos(), true))); // Paper - Cancel hit for vanished players // Leaves - creative no clip
org.bukkit.entity.Player bukkitPlayer = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null; org.bukkit.entity.Player bukkitPlayer = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null;
@@ -538,19 +538,10 @@ index cf66ce7cf737b2abd45c76218db55c8d0fc109d4..4da0768c14918d13b7137daa74142a54
final io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent( final io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(
this.player.getBukkitEntity(), this.player.getBukkitEntity(),
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
index 298908003d5422b8b58de631145fad381e8294c1..b825035f937863c4d485e9534e7b6780788f20de 100644 index 298908003d5422b8b58de631145fad381e8294c1..becd64cb00dddda42a9494f6ab36362466e5f18a 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java --- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -28,6 +28,8 @@ import net.minecraft.server.packs.resources.ResourceManager; @@ -55,6 +55,9 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener;
import net.minecraft.server.packs.resources.SimplePreparableReloadListener;
import net.minecraft.util.profiling.ProfilerFiller;
+import net.minecraft.world.item.ItemStackTemplate;
+import net.minecraft.world.item.Items;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.crafting.display.RecipeDisplay;
import net.minecraft.world.item.crafting.display.RecipeDisplayEntry;
@@ -55,6 +57,9 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
forSingleInput(RecipeType.CAMPFIRE_COOKING) forSingleInput(RecipeType.CAMPFIRE_COOKING)
); );
private static final FileToIdConverter RECIPE_LISTER = FileToIdConverter.registry(Registries.RECIPE); private static final FileToIdConverter RECIPE_LISTER = FileToIdConverter.registry(Registries.RECIPE);
@@ -560,7 +551,7 @@ index 298908003d5422b8b58de631145fad381e8294c1..b825035f937863c4d485e9534e7b6780
private final HolderLookup.Provider registries; private final HolderLookup.Provider registries;
public RecipeMap recipes = RecipeMap.EMPTY; public RecipeMap recipes = RecipeMap.EMPTY;
private Map<ResourceKey<RecipePropertySet>, RecipePropertySet> propertySets = Map.of(); private Map<ResourceKey<RecipePropertySet>, RecipePropertySet> propertySets = Map.of();
@@ -83,10 +88,73 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp @@ -83,10 +86,73 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp
@Override @Override
protected void apply(final RecipeMap recipes, final ResourceManager manager, final ProfilerFiller profiler) { protected void apply(final RecipeMap recipes, final ResourceManager manager, final ProfilerFiller profiler) {
@@ -592,8 +583,8 @@ index 298908003d5422b8b58de631145fad381e8294c1..b825035f937863c4d485e9534e7b6780
+ new ShapedRecipe( + new ShapedRecipe(
+ new Recipe.CommonInfo(true), + new Recipe.CommonInfo(true),
+ new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.BUILDING, "carpet_ams_better_bone_block"), + new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.BUILDING, "carpet_ams_better_bone_block"),
+ ShapedRecipePattern.of(Map.of('#', Ingredient.of(Items.BONE)), "###", "###", "###"), + ShapedRecipePattern.of(Map.of('#', Ingredient.of(net.minecraft.world.item.Items.BONE)), "###", "###", "###"),
+ new ItemStackTemplate(Items.BONE_BLOCK, 3) + new net.minecraft.world.item.ItemStackTemplate(net.minecraft.world.item.Items.BONE_BLOCK, 3)
+ ) + )
+ ); + );
+ } + }
@@ -605,12 +596,12 @@ index 298908003d5422b8b58de631145fad381e8294c1..b825035f937863c4d485e9534e7b6780
+ new Recipe.CommonInfo(true), + new Recipe.CommonInfo(true),
+ new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.REDSTONE, "carpet_ams_better_dispenser"), + new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.REDSTONE, "carpet_ams_better_dispenser"),
+ ShapedRecipePattern.of( + ShapedRecipePattern.of(
+ Map.of('S', Ingredient.of(Items.STICK), 'D', Ingredient.of(Items.DROPPER), 'X', Ingredient.of(Items.STRING)), + Map.of('S', Ingredient.of(net.minecraft.world.item.Items.STICK), 'D', Ingredient.of(net.minecraft.world.item.Items.DROPPER), 'X', Ingredient.of(net.minecraft.world.item.Items.STRING)),
+ " SX", + " SX",
+ "SDX", + "SDX",
+ " SX" + " SX"
+ ), + ),
+ new ItemStackTemplate(Items.DISPENSER) + new net.minecraft.world.item.ItemStackTemplate(net.minecraft.world.item.Items.DISPENSER)
+ ) + )
+ ); + );
+ } + }
@@ -621,8 +612,8 @@ index 298908003d5422b8b58de631145fad381e8294c1..b825035f937863c4d485e9534e7b6780
+ new ShapelessRecipe( + new ShapelessRecipe(
+ new Recipe.CommonInfo(true), + new Recipe.CommonInfo(true),
+ new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.REDSTONE, "carpet_ams_better_dispenser"), + new CraftingRecipe.CraftingBookInfo(CraftingBookCategory.REDSTONE, "carpet_ams_better_dispenser"),
+ new ItemStackTemplate(Items.DISPENSER), + new net.minecraft.world.item.ItemStackTemplate(net.minecraft.world.item.Items.DISPENSER),
+ List.of(Ingredient.of(Items.BOW), Ingredient.of(Items.DROPPER)) + List.of(Ingredient.of(net.minecraft.world.item.Items.BOW), Ingredient.of(net.minecraft.world.item.Items.DROPPER))
+ ) + )
+ ); + );
+ } + }
@@ -867,7 +858,7 @@ index be572eff561ffdd961a9602eaa6136761c4d48a4..f11f0669bfbd5bb037cd172985636943
ticks.scheduleTick(pos, this, 2); ticks.scheduleTick(pos, this, 2);
} }
diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index 1de86856f4a27346d7003ca9eb24a36074a2a4a3..e8291bb18e24a2a1772a91404403f902e301107a 100644 index ed190e16df7c6b80fd90561e7c2fdd53c745e54a..0fcba821dc2500b7f88e87bca315ad504ebd8a62 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -288,7 +288,8 @@ public class RedStoneWireBlock extends Block { @@ -288,7 +288,8 @@ public class RedStoneWireBlock extends Block {
@@ -921,7 +912,7 @@ index 1de86856f4a27346d7003ca9eb24a36074a2a4a3..e8291bb18e24a2a1772a91404403f902
} else } else
// Paper end - optimize redstone (Alternate Current) // Paper end - optimize redstone (Alternate Current)
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index 7bf2cde59c112f4babb87476585207dacebef341..fac01e0398f1042b6bc680e967c101063a3023cd 100644 index 59ad645785bc99758f4bc124c56e39d87c4b75c2..13176ae2b2feb8d78b24f6c40901b030accb09be 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java --- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -74,9 +74,10 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @@ -74,9 +74,10 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@@ -1118,7 +1109,7 @@ index 3fdf80e32bdcaab4daac8f1c7329a2bc7b2bd625..284cec8401eb75076b2d80581059f489
for (BlockPos pos : BlockPos.betweenClosed( for (BlockPos pos : BlockPos.betweenClosed(
diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java
index 44731e230869f0df058f6a426277befbb0d559e4..a74b13bdd9145e3c54340aa959ee138c044ee433 100644 index 6d25139a94df7c0442cc9fea96d5839ce8a23d54..a6a85a8eccff59c8cedab70341baba06dad687be 100644
--- a/net/minecraft/world/level/redstone/NeighborUpdater.java --- a/net/minecraft/world/level/redstone/NeighborUpdater.java
+++ b/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,10 @@ public interface NeighborUpdater {
@@ -0,0 +1,142 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Wed, 21 Jan 2026 21:28:21 +0800
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
--- 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();
++this.tickCount;
// Luminol start - Add a config to enable tick command
- if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) {
+ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick) { // Lophine - redirect
MinecraftServer.getServer().tickRateManager().tick();
}
// Luminol end - Add a config to enable tick command
@@ -529,7 +529,7 @@ public final class RegionizedServer {
}
private void tickTime(final ServerLevel world, final long tickCount) {
- if ((!me.earthme.luminol.config.modules.experiment.CommandConfig.tick || world.tickRateManager().runsNormally()) && world.tickTime) { // Luminol - Add a config to enable tick command
+ if ((!fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick || world.tickRateManager().runsNormally()) && world.tickTime) { // Luminol - Add a config to enable tick command // Lophine - redirect
world.serverLevelData.setGameTime(world.serverLevelData.getGameTime() + tickCount);
}
}
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
index 917d6965e91527fc79d545c041765f78a357eac2..19ddbee489e9b17ef0bf794fa6cc3c10cc0ed565 100644
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
@@ -595,7 +595,7 @@ public final class TickRegionScheduler {
// next start isn't updated until the end of this tick
this.tickRegion(tickCount, tickStart, scheduledEnd);
// Luminol start - Add a config to enable tick command
- if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) {
+ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick) { // Lophine - redirect
MinecraftServer.getServer().tickRateManager().endTickWork();
}
// 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
--- a/net/minecraft/commands/Commands.java
+++ b/net/minecraft/commands/Commands.java
@@ -266,7 +266,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
- if (me.earthme.luminol.config.modules.experiment.CommandConfig.tick) {
+ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.commandTick) { // Lophine - redirect
TickCommand.register(this.dispatcher); // Folia - region threading - TODO later
}
// 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 5ebff729bb7e75e1c84449c0e3021b972ad0d936..d35cc60b1f4a59ab1b74da5d8d55d63c94a9055b 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
this.lastSentFood = -1;
this.teleportSpectators(transition, oldLevel);
// Leaves start - bot support
- if (fun.bm.lophine.config.modules.function.FakeplayerConfig.enable) {
+ if (fun.bm.lophine.config.modules.function.FakeplayerConfig.checkEnabled()) {
this.server.getBotList().bots.forEach(bot -> bot.sendFakeDataIfNeed(this, true)); // Leaves - render bot
}
// Leaves end - bot support
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index baa295f3dd8cf10bf7347ee4d1c249b1f82c9279..1d5376650d0f5eeb23fde8d7116b47cfae37576f 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -280,7 +280,7 @@ public abstract class PlayerList {
// org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
// Leaves start - bot support
- if (fun.bm.lophine.config.modules.function.FakeplayerConfig.enable) {
+ if (fun.bm.lophine.config.modules.function.FakeplayerConfig.checkEnabled()) {
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
if (bot != null) {
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
@@ -441,7 +441,7 @@ public abstract class PlayerList {
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
// Leaves start - bot support
- if (fun.bm.lophine.config.modules.function.FakeplayerConfig.enable) {
+ if (fun.bm.lophine.config.modules.function.FakeplayerConfig.checkEnabled()) {
org.leavesmc.leaves.bot.ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
if (bot != null) {
this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false, false);
@@ -969,7 +969,7 @@ public abstract class PlayerList {
).callEvent();
// Paper end
// Leaves start - bot support
- if (fun.bm.lophine.config.modules.function.FakeplayerConfig.enable) {
+ if (fun.bm.lophine.config.modules.function.FakeplayerConfig.checkEnabled()) {
this.server.getBotList().bots.forEach(bot -> bot.sendFakeDataIfNeed(player, true)); // Leaves - render bot
}
// 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
--- 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
}
// Leaves start - Wool hopper counter
- if (fun.bm.lophine.config.modules.function.WoolHopperCounterConfig.unlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled()) {
+ if (fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig.hopperCountersUnlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled()) {
net.minecraft.world.item.DyeColor woolColor = org.leavesmc.leaves.util.WoolUtils.getWoolColorAtPosition(level, entity.getBlockPos().relative(state.getValue(HopperBlock.FACING)));
if (woolColor != null) {
for (int i = 0; i < Short.MAX_VALUE; i++) {
@@ -258,7 +258,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
if (changed) {
entity.setCooldown(level.spigotConfig.hopperTransfer); // Spigot
// Leaves start - Wool hopper counter
- if (fun.bm.lophine.config.modules.function.WoolHopperCounterConfig.unlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled() && woolHopperCounter(level, pos, state, HopperBlockEntity.getContainerAt(level, pos))) {
+ if (fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig.hopperCountersUnlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled() && woolHopperCounter(level, pos, state, HopperBlockEntity.getContainerAt(level, pos))) {
entity.setCooldown(0);
return true;
}
@@ -664,7 +664,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
}
public static boolean addItem(final Container container, final ItemEntity entity) {
- if (fun.bm.lophine.config.modules.function.WoolHopperCounterConfig.unlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled() && entity.isRemoved()) return false; // Leaves - Wool hopper counter
+ if (fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig.hopperCountersUnlimitedSpeed && org.leavesmc.leaves.util.HopperCounter.isEnabled() && entity.isRemoved()) return false; // Leaves - Wool hopper counter
boolean changed = false;
// 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
--- 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 {
private int cachePortalOriginIteratorY = -1;
public BlockPattern.@Nullable BlockPatternMatch findExitPortal() {
- if (me.earthme.luminol.config.modules.optimizations.OptimizedDragonRespawnConfig.optimizedRespawn) {
+ if (fun.bm.lophine.carpet.config.modules.GeneralCompatConfig.optimizedDragonRespawn) {
int i, j;
for (i = cachePortalChunkIteratorX; i <= 8; ++i) {
for (j = cachePortalChunkIteratorZ; j <= 8; ++j) {
@@ -8,7 +8,7 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index 9180f23529a31b6b0a5b38bb7cda3e32d487f691..e1f456b31ffda9370b63e51f343847d6f9f62263 100644 index 9180f23529a31b6b0a5b38bb7cda3e32d487f691..d0b763f07aee56f69a67c87d7dd15a44b6f44db7 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -36,6 +36,15 @@ class PaperEventManager { @@ -36,6 +36,15 @@ class PaperEventManager {
@@ -16,7 +16,7 @@ index 9180f23529a31b6b0a5b38bb7cda3e32d487f691..e1f456b31ffda9370b63e51f343847d6
// SimplePluginManager // SimplePluginManager
public void callEvent(@NotNull Event event) { public void callEvent(@NotNull Event event) {
+ // Leaves start - process bot load/save + // Leaves start - process bot load/save
+ if (fun.bm.lophine.config.modules.function.FakeplayerConfig.enable && fun.bm.lophine.config.modules.function.FakeplayerConfig.canResident) { + if (fun.bm.lophine.config.modules.function.FakeplayerConfig.checkEnabled() && fun.bm.lophine.carpet.config.modules.FakePlayerCompatConfig.fakePlayerResident) {
+ if (event instanceof org.bukkit.event.world.WorldLoadEvent worldLoadEvent) { + if (event instanceof org.bukkit.event.world.WorldLoadEvent worldLoadEvent) {
+ org.leavesmc.leaves.bot.BotList.INSTANCE.loadResume(worldLoadEvent.getWorld().getUID().toString()); + org.leavesmc.leaves.bot.BotList.INSTANCE.loadResume(worldLoadEvent.getWorld().getUID().toString());
+ } else if (event instanceof org.bukkit.event.world.WorldUnloadEvent worldUnloadEvent) { + } else if (event instanceof org.bukkit.event.world.WorldUnloadEvent worldUnloadEvent) {
@@ -8,7 +8,7 @@ As a part of : Leaves (https://github.com/LeavesMC/Leaves)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index e1f456b31ffda9370b63e51f343847d6f9f62263..8a0f85241cc1530aacccc8b6ea24b9dec86fad66 100644 index d0b763f07aee56f69a67c87d7dd15a44b6f44db7..bd301425f4c3cdf2b2bd22c1775b7ca9be1d4248 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -57,7 +57,7 @@ class PaperEventManager { @@ -57,7 +57,7 @@ class PaperEventManager {
@@ -1,19 +1,10 @@
package fun.bm.lophine.carpet; package fun.bm.lophine.carpet;
import fun.bm.lophine.carpet.config.modules.CoreConfig;
import fun.bm.lophine.carpet.config.modules.CounterCompatConfig;
import fun.bm.lophine.carpet.config.modules.FakePlayerCompatConfig; import fun.bm.lophine.carpet.config.modules.FakePlayerCompatConfig;
import fun.bm.lophine.carpet.config.modules.GeneralCompatConfig; import fun.bm.lophine.carpet.config.modules.GeneralCompatConfig;
import fun.bm.lophine.config.modules.experiment.RedStoneConfig; import fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig;
import fun.bm.lophine.config.modules.fixes.UpdateSuppressionCrashFixConfig;
import fun.bm.lophine.config.modules.function.CreativeFlyNoClipConfig;
import fun.bm.lophine.config.modules.function.FakeplayerConfig; import fun.bm.lophine.config.modules.function.FakeplayerConfig;
import fun.bm.lophine.config.modules.function.LanguageConfig;
import fun.bm.lophine.config.modules.function.WoolHopperCounterConfig;
import fun.bm.lophine.protocol.CarpetLoggerProtocol; import fun.bm.lophine.protocol.CarpetLoggerProtocol;
import me.earthme.luminol.config.modules.experiment.CommandConfig;
import me.earthme.luminol.config.modules.optimizations.OptimizedDragonRespawnConfig;
import org.leavesmc.leaves.bot.ServerBot;
import org.leavesmc.leaves.protocol.CarpetServerProtocol; import org.leavesmc.leaves.protocol.CarpetServerProtocol;
import java.util.List; import java.util.List;
@@ -23,42 +14,11 @@ public final class CarpetCompatSync {
private static boolean init = false; private static boolean init = false;
public static void apply() { public static void apply() {
if (init) return;
if (CoreConfig.enabled) {
applyGeneralRules();
applyFakePlayerRules();
applyCounterRules();
}
CarpetLoggerProtocol.refreshConfiguredDefaults(!init); CarpetLoggerProtocol.refreshConfiguredDefaults(!init);
registerProtocolRules(); registerProtocolRules();
init = true; init = true;
} }
private static void applyGeneralRules() {
LanguageConfig.lang = GeneralCompatConfig.language;
UpdateSuppressionCrashFixConfig.enabled = GeneralCompatConfig.amsUpdateSuppressionCrashFix || GeneralCompatConfig.yeetUpdateSuppressionCrash;
RedStoneConfig.redstoneIgnoreUpwardsUpdate = GeneralCompatConfig.dustTrapdoorReintroduced;
RedStoneConfig.cce = GeneralCompatConfig.shulkerBoxCCEReintroduced;
RedStoneConfig.instantBlockUpdater = GeneralCompatConfig.instantBlockUpdaterReintroduced;
CommandConfig.tick = GeneralCompatConfig.commandTick;
CreativeFlyNoClipConfig.enabled = GeneralCompatConfig.creativeNoClip;
OptimizedDragonRespawnConfig.optimizedRespawn = GeneralCompatConfig.optimizedDragonRespawn;
}
private static void applyFakePlayerRules() {
FakeplayerConfig.enable = FakePlayerCompatConfig.commandBot || FakePlayerCompatConfig.commandPlayer;
FakeplayerConfig.canResident = FakePlayerCompatConfig.fakePlayerResident;
FakeplayerConfig.canOpenInventory = FakePlayerCompatConfig.openFakePlayerInventory;
FakeplayerConfig.tickType = FakePlayerCompatConfig.fakePlayerTicksLikeRealPlayer
? ServerBot.TickType.NETWORK
: ServerBot.TickType.ENTITY_LIST;
}
private static void applyCounterRules() {
WoolHopperCounterConfig.enabled = CounterCompatConfig.hopperCounters;
WoolHopperCounterConfig.unlimitedSpeed = CounterCompatConfig.hopperCountersUnlimitedSpeed;
}
private static List<String> sanitizeDefaultLoggers(List<String> configuredLoggers) { private static List<String> sanitizeDefaultLoggers(List<String> configuredLoggers) {
return configuredLoggers == null ? List.of() : List.copyOf(configuredLoggers); return configuredLoggers == null ? List.of() : List.copyOf(configuredLoggers);
} }
@@ -119,7 +79,7 @@ public final class CarpetCompatSync {
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpettisaddition", "tntFuseDuration", GeneralCompatConfig.normalizedTntFuseDuration())); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpettisaddition", "tntFuseDuration", GeneralCompatConfig.normalizedTntFuseDuration()));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "defaultLoggers", CarpetLoggerProtocol.serializeConfiguredDefaults(sanitizeDefaultLoggers(GeneralCompatConfig.defaultLoggers)))); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "defaultLoggers", CarpetLoggerProtocol.serializeConfiguredDefaults(sanitizeDefaultLoggers(GeneralCompatConfig.defaultLoggers))));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "commandBot", FakePlayerCompatConfig.commandBot)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "commandBot", FakeplayerConfig.enable));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "commandPlayer", FakePlayerCompatConfig.commandPlayer)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "commandPlayer", FakePlayerCompatConfig.commandPlayer));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerResident", FakePlayerCompatConfig.fakePlayerResident)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerResident", FakePlayerCompatConfig.fakePlayerResident));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "openFakePlayerInventory", FakePlayerCompatConfig.openFakePlayerInventory)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "openFakePlayerInventory", FakePlayerCompatConfig.openFakePlayerInventory));
@@ -132,7 +92,7 @@ public final class CarpetCompatSync {
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerAutoFish", FakePlayerCompatConfig.fakePlayerAutoFish)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerAutoFish", FakePlayerCompatConfig.fakePlayerAutoFish));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerReloadAction", FakePlayerCompatConfig.fakePlayerReloadAction)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("lophine", "fakePlayerReloadAction", FakePlayerCompatConfig.fakePlayerReloadAction));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "hopperCounters", CounterCompatConfig.hopperCounters)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "hopperCounters", WoolHopperCounterConfig.hopperCounters));
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpettisaddition", "hopperCountersUnlimitedSpeed", CounterCompatConfig.hopperCountersUnlimitedSpeed)); CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpettisaddition", "hopperCountersUnlimitedSpeed", WoolHopperCounterConfig.hopperCountersUnlimitedSpeed));
} }
} }
@@ -0,0 +1,162 @@
package fun.bm.lophine.carpet;
import fun.bm.lophine.carpet.config.modules.GeneralCompatConfig;
import fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig;
import fun.bm.lophine.config.modules.function.FakeplayerConfig;
import me.earthme.luminol.config.ConfigManager;
import me.earthme.luminol.config.ConfigsInstance;
public class RedirectedConfigs {
public static void redirect() {
updateSuppressionCrashFix();
commandTick();
optimizedDragonRespawn();
woolHopperCounter();
fakeplayer();
creativeFlyNoClip();
redstoneChanges();
}
private static void updateSuppressionCrashFix() {
ConfigsInstance config = ConfigManager.getConfigs("lophine");
try {
boolean updateSuppressionCrashFixEnabled = config.getConfigOrigin("fixes.update-suppression-crash-fix.enabled");
if (updateSuppressionCrashFixEnabled) {
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
GeneralCompatConfig.amsUpdateSuppressionCrashFix = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "amsUpdateSuppressionCrashFix"}, true);
GeneralCompatConfig.yeetUpdateSuppressionCrash = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "yeetUpdateSuppressionCrash"}, true);
}
config.removeConfig(new String[]{"fixes", "update-suppression-crash-fix", "enabled"});
} catch (Exception ignored) {
}
}
private static void commandTick() {
try {
boolean shouldEnabled = false;
// first check lophine
try {
ConfigsInstance config = ConfigManager.getConfigs("lophine");
shouldEnabled = config.getConfigOrigin("experiment.command.tick_command_enabled");
config.removeConfig(new String[]{"experiment", "command", "tick_command_enabled"});
} catch (Exception ignored) {
}
// then check luminol
try {
ConfigsInstance config = ConfigManager.getConfigs("luminol");
shouldEnabled = shouldEnabled || (boolean) config.getConfigOrigin("experiment.command.enable_tick_command");
config.removeConfig(new String[]{"experiment", "command", "enable_tick_command"});
} catch (Exception ignored) {
}
if (shouldEnabled) {
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
GeneralCompatConfig.commandTick = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "commandTick"}, true);
}
} catch (Exception ignored) {
}
}
private static void optimizedDragonRespawn() {
ConfigsInstance config = ConfigManager.getConfigs("luminol");
try {
boolean optimizedDragonRespawnEnabled = config.getConfigOrigin("optimizations.end_dragon.optimized_dragon_respawn");
if (optimizedDragonRespawnEnabled) {
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
GeneralCompatConfig.optimizedDragonRespawn = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "optimizedDragonRespawn"}, true);
}
config.removeConfig(new String[]{"optimizations", "end_dragon", "optimized_dragon_respawn"});
} catch (Exception ignored) {
}
}
private static void woolHopperCounter() {
ConfigsInstance config = ConfigManager.getConfigs("lophine");
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
try {
boolean woolHopperCounterEnabled = config.getConfigOrigin("function.wool-hopper-counter.enabled");
if (woolHopperCounterEnabled) {
WoolHopperCounterConfig.hopperCounters = true;
carpetConfig.setConfig(new String[]{"carpet", "hopper_counter", "hopperCounters"}, true);
}
config.removeConfig(new String[]{"function", "wool-hopper-counter", "enabled"});
} catch (Exception ignored) {
}
try {
boolean woolHopperCounterUnlimitedSpeed = config.getConfigOrigin("function.wool-hopper-counter.unlimited-speed");
if (woolHopperCounterUnlimitedSpeed) {
WoolHopperCounterConfig.hopperCountersUnlimitedSpeed = true;
carpetConfig.setConfig(new String[]{"carpet", "hopper_counter", "hopperCountersUnlimitedSpeed"}, true);
}
config.removeConfig(new String[]{"function", "wool-hopper-counter", "unlimited-speed"});
} catch (Exception ignored) {
}
}
private static void fakeplayer() {
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
try {
boolean bot = carpetConfig.getConfigOrigin("carpet.fakeplayer.commandBot");
if (bot) {
try {
ConfigsInstance lophineConfig = ConfigManager.getConfigs("lophine");
FakeplayerConfig.enable = true;
lophineConfig.setConfig(new String[]{"function", "fakeplayer", "enable"}, true);
} catch (Exception ignored) {
}
}
} catch (Exception ignored) {
}
carpetConfig.removeConfig(new String[]{"carpet", "fakeplayer", "commandBot"});
}
private static void creativeFlyNoClip() {
ConfigsInstance config = ConfigManager.getConfigs("lophine");
try {
boolean creativeFlyNoClipEnabled = config.getConfigOrigin("function.creative_fly_no_clip.enabled");
if (creativeFlyNoClipEnabled) {
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
GeneralCompatConfig.creativeNoClip = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "creativeNoClip"}, true);
}
config.removeConfig(new String[]{"function", "creative_fly_no_clip", "enabled"});
} catch (Exception ignored) {
}
}
private static void redstoneChanges() {
ConfigsInstance config = ConfigManager.getConfigs("lophine");
ConfigsInstance carpetConfig = ConfigManager.getConfigs("lophine_carpet");
try {
boolean dustTrapdoorReintroduced = config.getConfigOrigin("experiment.redstone.redstone-ignore-upwards-update");
if (dustTrapdoorReintroduced) {
GeneralCompatConfig.dustTrapdoorReintroduced = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "dustTrapdoorReintroduced"}, true);
}
config.removeConfig(new String[]{"experiment", "redstone", "redstone-ignore-upwards-update"});
} catch (Exception ignored) {
}
try {
boolean shulkerBoxCCEReintroduced = config.getConfigOrigin("experiment.redstone.cce-update-suppression");
if (shulkerBoxCCEReintroduced) {
GeneralCompatConfig.shulkerBoxCCEReintroduced = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "shulkerBoxCCEReintroduced"}, true);
}
config.removeConfig(new String[]{"experiment", "redstone", "cce-update-suppression"});
} catch (Exception ignored) {
}
try {
boolean instantBlockUpdaterReintroduced = config.getConfigOrigin("experiment.redstone.instant-block-updater");
if (instantBlockUpdaterReintroduced) {
GeneralCompatConfig.instantBlockUpdaterReintroduced = true;
carpetConfig.setConfig(new String[]{"carpet", "general", "instantBlockUpdaterReintroduced"}, true);
}
config.removeConfig(new String[]{"experiment", "redstone", "instant-block-updater"});
} catch (Exception ignored) {
}
}
}
@@ -1,29 +0,0 @@
package fun.bm.lophine.carpet.config.modules;
import fun.bm.lophine.carpet.CarpetCompatSync;
import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.enums.EnumConfigCategory;
@ConfigClassInfo(
category = EnumConfigCategory.ROOT,
name = "core",
directory = {"carpet"}
)
public class CoreConfig implements IConfigModule {
@ConfigInfo(name = "enabled", comments = """
Enable carpet features.
If you want to use some function from Carpet modifier,
you need to enable it.
(some function is not managed by this option)
ONLY GENERAL DIRECTORY WAS CONTROLLED BY THIS OPTION.
WARNING: IF YOU ENABLED IT, ORIGINAL CONFIG IN LOPHINE CONFIG WILL BE OVERWRITTEN.""")
public static boolean enabled = false;
@Override
public void beforeFinalLoad() {
CarpetCompatSync.apply();
}
}
@@ -1,24 +0,0 @@
package fun.bm.lophine.carpet.config.modules;
import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.enums.EnumConfigCategory;
@ConfigClassInfo(
category = EnumConfigCategory.ROOT,
name = "hopper_counter",
directory = {"carpet"},
comments = """
Hopper counter compatibility mapped onto Lophine's wool hopper counter implementation."""
)
public class CounterCompatConfig implements IConfigModule {
@ConfigInfo(name = "hopperCounters", comments = """
Enable the existing wool hopper counter implementation.""")
public static boolean hopperCounters = false;
@ConfigInfo(name = "hopperCountersUnlimitedSpeed", comments = """
Remove the hopper transfer speed limit for counters.
Only effective when hopperCounters is enabled.""")
public static boolean hopperCountersUnlimitedSpeed = false;
}
@@ -1,9 +1,15 @@
package fun.bm.lophine.carpet.config.modules; package fun.bm.lophine.carpet.config.modules;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import me.earthme.luminol.config.IConfigModule; import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo; import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo; import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.DoNotLoad;
import me.earthme.luminol.enums.EnumConfigCategory; import me.earthme.luminol.enums.EnumConfigCategory;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.command.bot.BotCommand;
import java.util.Set;
@ConfigClassInfo( @ConfigClassInfo(
category = EnumConfigCategory.ROOT, category = EnumConfigCategory.ROOT,
@@ -14,12 +20,9 @@ import me.earthme.luminol.enums.EnumConfigCategory;
commandPlayer is currently backed by Lophine's /bot command surface.""" commandPlayer is currently backed by Lophine's /bot command surface."""
) )
public class FakePlayerCompatConfig implements IConfigModule { public class FakePlayerCompatConfig implements IConfigModule {
@ConfigInfo(name = "commandBot", comments = """
Enable Lophine's /bot command.""")
public static boolean commandBot = false;
@ConfigInfo(name = "commandPlayer", comments = """ @ConfigInfo(name = "commandPlayer", comments = """
Map Carpet's commandPlayer rule to the same fakeplayer command surface used by /bot.""") Enable /player command.(not remapped)
If you want to enable bot command, please see lophine global config.""")
public static boolean commandPlayer = false; public static boolean commandPlayer = false;
@ConfigInfo(name = "fakePlayerResident", comments = """ @ConfigInfo(name = "fakePlayerResident", comments = """
@@ -61,4 +64,23 @@ public class FakePlayerCompatConfig implements IConfigModule {
@ConfigInfo(name = "fakePlayerReloadAction", comments = """ @ConfigInfo(name = "fakePlayerReloadAction", comments = """
Persist queued fakeplayer actions across save and reload.""") Persist queued fakeplayer actions across save and reload.""")
public static boolean fakePlayerReloadAction = false; public static boolean fakePlayerReloadAction = false;
@DoNotLoad
private BotCommand command = null;
@Override
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) {
if (commandPlayer) {
command = new BotCommand("player");
command.register();
}
}
@Override
public void onUnloaded(CommentedFileConfig configInstance) {
if (command != null) {
command.unregister();
command = null;
}
}
} }
@@ -1,8 +1,11 @@
package fun.bm.lophine.carpet.config.modules; package fun.bm.lophine.carpet.config.modules;
import fun.bm.lophine.carpet.CarpetCompatSync;
import fun.bm.lophine.carpet.RedirectedConfigs;
import me.earthme.luminol.config.IConfigModule; import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo; import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo; import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.TransformedConfig;
import me.earthme.luminol.enums.EnumConfigCategory; import me.earthme.luminol.enums.EnumConfigCategory;
import java.util.List; import java.util.List;
@@ -16,40 +19,47 @@ import java.util.List;
Only rules that already have a working server-side implementation are exposed here.""" Only rules that already have a working server-side implementation are exposed here."""
) )
public class GeneralCompatConfig implements IConfigModule { public class GeneralCompatConfig implements IConfigModule {
@TransformedConfig(name = "language", directory = {"carpet", "general"}, transformComments = false)
@ConfigInfo(name = "language", comments = """ @ConfigInfo(name = "language", comments = """
Carpet language value forwarded to lophine.function.language.lang.""") Carpet language value.
ATTENTION: This config will not update in Lophine global now!""")
public static String language = "en_us"; public static String language = "en_us";
@ConfigInfo(name = "amsUpdateSuppressionCrashFix", comments = """ @ConfigInfo(name = "amsUpdateSuppressionCrashFix", comments = """
Map AMS update suppression crash protection to Lophine's existing crash fix.""") Update suppression crash protection.""")
public static boolean amsUpdateSuppressionCrashFix = false; public static boolean amsUpdateSuppressionCrashFix = false;
@ConfigInfo(name = "yeetUpdateSuppressionCrash", comments = """ @ConfigInfo(name = "yeetUpdateSuppressionCrash", comments = """
Map TIS update suppression crash yeeting to the same Lophine crash fix.""") Update suppression crash yeeting.""")
public static boolean yeetUpdateSuppressionCrash = false; public static boolean yeetUpdateSuppressionCrash = false;
@ConfigInfo(name = "dustTrapdoorReintroduced", comments = """ @ConfigInfo(name = "dustTrapdoorReintroduced", comments = """
Map dust-on-open-trapdoor behavior to Lophine's redstone-ignore-upwards-update option.""") Should the pre-1.20 mechanism be reintroduced:
Redstone dust does not connect to adjacent redstone dust on trapdoors that are open
Pre-1.20.2 mechanism: Redstone dust, redstone repeaters,
and redstone comparators do not check for attachment when receiving status updates from below.""")
public static boolean dustTrapdoorReintroduced = false; public static boolean dustTrapdoorReintroduced = false;
@ConfigInfo(name = "shulkerBoxCCEReintroduced", comments = """ @ConfigInfo(name = "shulkerBoxCCEReintroduced", comments = """
Map shulker-box CCE update suppression to Lophine's cce-update-suppression option.""") Use ClassCastException for update suppression.""")
public static boolean shulkerBoxCCEReintroduced = false; public static boolean shulkerBoxCCEReintroduced = false;
@ConfigInfo(name = "instantBlockUpdaterReintroduced", comments = """ @ConfigInfo(name = "instantBlockUpdaterReintroduced", comments = """
Enable the existing instant block updater patch already carried by Lophine.""") Instant block updater.""")
public static boolean instantBlockUpdaterReintroduced = false; public static boolean instantBlockUpdaterReintroduced = false;
@ConfigInfo(name = "commandTick", comments = """ @ConfigInfo(name = "commandTick", comments = """
Enable the tick command support already patched into Lophine.""") Enable the tick command support.""")
public static boolean commandTick = false; public static boolean commandTick = false;
@ConfigInfo(name = "creativeNoClip", comments = """ @ConfigInfo(name = "creativeNoClip", comments = """
Enable the existing creative fly no clip implementation.""") Whether to enable creative fly no clip.
When enabled, players in creative mode will not collide with blocks while flying.
This allows them to pass through blocks without obstruction.""")
public static boolean creativeNoClip = false; public static boolean creativeNoClip = false;
@ConfigInfo(name = "optimizedDragonRespawn", comments = """ @ConfigInfo(name = "optimizedDragonRespawn", comments = """
Enable the existing optimized dragon respawn implementation from Luminol.""") Enable optimized dragon respawn.""")
public static boolean optimizedDragonRespawn = false; public static boolean optimizedDragonRespawn = false;
@ConfigInfo(name = "antiSpamDisabled", comments = """ @ConfigInfo(name = "antiSpamDisabled", comments = """
@@ -245,6 +255,10 @@ public class GeneralCompatConfig implements IConfigModule {
Examples: ["tps", "mob_caps", "counter white"]""") Examples: ["tps", "mob_caps", "counter white"]""")
public static List<String> defaultLoggers = List.of(); public static List<String> defaultLoggers = List.of();
public static boolean mergedUpdateSuppressionCrashEnabled() {
return amsUpdateSuppressionCrashFix || yeetUpdateSuppressionCrash;
}
public static int normalizedTntFuseDuration() { public static int normalizedTntFuseDuration() {
return Math.clamp(tntFuseDuration, 0, Short.MAX_VALUE); return Math.clamp(tntFuseDuration, 0, Short.MAX_VALUE);
} }
@@ -252,4 +266,13 @@ public class GeneralCompatConfig implements IConfigModule {
public static int normalizedTickCommandPermission() { public static int normalizedTickCommandPermission() {
return Math.clamp(tickCommandPermission, 0, 4); return Math.clamp(tickCommandPermission, 0, 4);
} }
@Override
public void beforeFinalLoad() {
// Should remove in next Minecraft version update
RedirectedConfigs.redirect();
// after all config updated, send changes to client
CarpetCompatSync.apply();
}
} }
@@ -0,0 +1,16 @@
package fun.bm.lophine.carpet.config.modules;
import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.TransformedConfig;
import me.earthme.luminol.enums.EnumConfigCategory;
@ConfigClassInfo(category = EnumConfigCategory.REMOVED, name = "removed_config")
public class RemovedConfig implements IConfigModule {
@TransformedConfig(name = "enabled", directory = {"carpet", "core"})
@ConfigInfo(name = "removed", comments =
"""
RemovedConfig redirect to here, no any function.""")
public static boolean enabled = true;
}
@@ -1,4 +1,4 @@
package fun.bm.lophine.config.modules.function; package fun.bm.lophine.carpet.config.modules;
import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import fun.bm.lophine.command.counter.CounterCommand; import fun.bm.lophine.command.counter.CounterCommand;
@@ -11,20 +11,29 @@ import org.jetbrains.annotations.Nullable;
import java.util.Set; import java.util.Set;
@ConfigClassInfo(category = EnumConfigCategory.FUNCTION, name = "wool-hopper-counter") @ConfigClassInfo(
category = EnumConfigCategory.ROOT,
name = "hopper_counter",
directory = {"carpet"},
comments = """
Hopper counter functions."""
)
public class WoolHopperCounterConfig implements IConfigModule { public class WoolHopperCounterConfig implements IConfigModule {
@ConfigInfo(name = "enabled") @ConfigInfo(name = "hopperCounters", comments = """
public static boolean enabled = false; Enable the existing wool hopper counter implementation.""")
public static boolean hopperCounters = false;
@ConfigInfo(name = "unlimited-speed") @ConfigInfo(name = "hopperCountersUnlimitedSpeed", comments = """
public static boolean unlimitedSpeed = false; Remove the hopper transfer speed limit for counters.
Only effective when hopperCounters is enabled.""")
public static boolean hopperCountersUnlimitedSpeed = false;
@DoNotLoad @DoNotLoad
private static CounterCommand counterCommand = null; private static CounterCommand counterCommand = null;
@Override @Override
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) { public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) {
if (enabled) { if (hopperCounters) {
if (counterCommand == null) { if (counterCommand == null) {
counterCommand = new CounterCommand(); counterCommand = new CounterCommand();
} }
@@ -3,7 +3,6 @@ package fun.bm.lophine.config.modules.experiment;
import me.earthme.luminol.config.IConfigModule; import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo; import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo; import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.HotReloadUnsupported;
import me.earthme.luminol.enums.EnumConfigCategory; import me.earthme.luminol.enums.EnumConfigCategory;
/* /*
@@ -12,19 +11,6 @@ import me.earthme.luminol.enums.EnumConfigCategory;
*/ */
@ConfigClassInfo(category = EnumConfigCategory.EXPERIMENT, name = "redstone") @ConfigClassInfo(category = EnumConfigCategory.EXPERIMENT, name = "redstone")
public class RedStoneConfig implements IConfigModule { public class RedStoneConfig implements IConfigModule {
@ConfigInfo(name = "redstone-ignore-upwards-update", comments = """
Should the pre-1.20 mechanism be reintroduced:
Redstone dust does not connect to adjacent redstone dust on trapdoors that are open
Pre-1.20.2 mechanism: Redstone dust, redstone repeaters, and redstone comparators do not check for attachment when receiving status updates from below""")
public static boolean redstoneIgnoreUpwardsUpdate = false;
@ConfigInfo(name = "cce-update-suppression", comments = """
Is it permissible to use ClassCastException for update suppression?""")
public static boolean cce = false;
@HotReloadUnsupported
@ConfigInfo(name = "instant-block-updater")
public static boolean instantBlockUpdater = false;
@ConfigInfo(name = "old-block-remove-behaviour") @ConfigInfo(name = "old-block-remove-behaviour")
public static boolean oldBlockRemoveBehaviour = false; public static boolean oldBlockRemoveBehaviour = false;
@@ -1,25 +0,0 @@
package fun.bm.lophine.config.modules.function;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.enums.EnumConfigCategory;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.protocol.CarpetServerProtocol;
import java.util.Set;
@ConfigClassInfo(name = "creative_fly_no_clip", category = EnumConfigCategory.FUNCTION)
public class CreativeFlyNoClipConfig implements IConfigModule {
@ConfigInfo(name = "enabled", comments = """
Whether to enable creative fly no clip.
When enabled, players in creative mode will not collide with blocks while flying.
This allows them to pass through blocks without obstruction.""")
public static boolean enabled = false;
@Override
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> e) {
CarpetServerProtocol.CarpetRules.register(CarpetServerProtocol.CarpetRule.of("carpet", "creativeNoClip", enabled));
}
}
@@ -1,9 +1,11 @@
package fun.bm.lophine.config.modules.function; package fun.bm.lophine.config.modules.function;
import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import fun.bm.lophine.carpet.config.modules.FakePlayerCompatConfig;
import me.earthme.luminol.config.IConfigModule; import me.earthme.luminol.config.IConfigModule;
import me.earthme.luminol.config.flags.ConfigClassInfo; import me.earthme.luminol.config.flags.ConfigClassInfo;
import me.earthme.luminol.config.flags.ConfigInfo; import me.earthme.luminol.config.flags.ConfigInfo;
import me.earthme.luminol.config.flags.DoNotLoad;
import me.earthme.luminol.enums.EnumConfigCategory; import me.earthme.luminol.enums.EnumConfigCategory;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.bot.ServerBot; import org.leavesmc.leaves.bot.ServerBot;
@@ -15,7 +17,7 @@ import java.util.Set;
@ConfigClassInfo(category = EnumConfigCategory.FUNCTION, name = "fakeplayer") @ConfigClassInfo(category = EnumConfigCategory.FUNCTION, name = "fakeplayer")
public class FakeplayerConfig implements IConfigModule { public class FakeplayerConfig implements IConfigModule {
@ConfigInfo(name = "enable", comments = """ @ConfigInfo(name = "enable", comments = """
Enable fakeplayer functionality""") Enable fakeplayer functionality (/bot command)""")
public static boolean enable = true; public static boolean enable = true;
@ConfigInfo(name = "unable-fakeplayer-names", comments = """ @ConfigInfo(name = "unable-fakeplayer-names", comments = """
@@ -38,14 +40,6 @@ public class FakeplayerConfig implements IConfigModule {
Regeneration amount for fakeplayers""") Regeneration amount for fakeplayers""")
public static double regenAmount = 0.0; public static double regenAmount = 0.0;
@ConfigInfo(name = "resident-fakeplayer", comments = """
Allow fakeplayers to be resident""")
public static boolean canResident = false;
@ConfigInfo(name = "open-fakeplayer-inventory", comments = """
Allow opening fakeplayer inventory""")
public static boolean canOpenInventory = false;
@ConfigInfo(name = "use-action", comments = """ @ConfigInfo(name = "use-action", comments = """
Allow fakeplayers to use actions""") Allow fakeplayers to use actions""")
public static boolean canUseAction = true; public static boolean canUseAction = true;
@@ -81,28 +75,35 @@ public class FakeplayerConfig implements IConfigModule {
@ConfigInfo(name = "enable-locator-bar", comments = """ @ConfigInfo(name = "enable-locator-bar", comments = """
Enable locator bar for fakeplayers""") Enable locator bar for fakeplayers""")
public static boolean enableLocatorBar = false; public static boolean enableLocatorBar = false;
public static ServerBot.TickType tickType = ServerBot.TickType.ENTITY_LIST;
@DoNotLoad
private BotCommand command = null; private BotCommand command = null;
private boolean registered = false;
public static int getSimulationDistance(ServerBot bot) { public static int getSimulationDistance(ServerBot bot) {
return simulationDistance == -1 ? bot.getBukkitEntity().getSimulationDistance() : simulationDistance; return simulationDistance == -1 ? bot.getBukkitEntity().getSimulationDistance() : simulationDistance;
} }
public static ServerBot.TickType tickType() {
return FakePlayerCompatConfig.fakePlayerTicksLikeRealPlayer
? ServerBot.TickType.NETWORK
: ServerBot.TickType.ENTITY_LIST;
}
public static boolean checkEnabled() {
return enable || FakePlayerCompatConfig.commandPlayer;
}
@Override @Override
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) { public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) {
if (enable) { if (enable) {
command = new BotCommand(); command = new BotCommand("bot");
command.register(); command.register();
registered = true;
} }
} }
@Override @Override
public void onUnloaded(CommentedFileConfig configInstance) { public void onUnloaded(CommentedFileConfig configInstance) {
if (registered) { if (command != null) {
command.unregister(); command.unregister();
command = null; command = null;
} }
@@ -11,7 +11,9 @@ public class LanguageConfig implements IConfigModule {
@HotReloadUnsupported @HotReloadUnsupported
@ConfigInfo(name = "lang", comments = """ @ConfigInfo(name = "lang", comments = """
Please use the key from https://minecraft.wiki/w/Language Please use the key from https://minecraft.wiki/w/Language
Sample of format: en_us zh_cn zh_hk zh_tw""") Sample of format: en_us zh_cn zh_hk zh_tw
ATTENTION: If you want to edit language for carpet ststem,
please edit it in carpet config file.""")
public static String lang = "en_us"; public static String lang = "en_us";
@ConfigInfo(name = "full_blocking_load", comments = """ @ConfigInfo(name = "full_blocking_load", comments = """
@@ -22,6 +22,7 @@ import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;
import fun.bm.lophine.carpet.config.modules.FakePlayerCompatConfig;
import fun.bm.lophine.config.modules.function.FakeplayerConfig; import fun.bm.lophine.config.modules.function.FakeplayerConfig;
import fun.bm.lophine.config.modules.function.OldFeatureConfig; import fun.bm.lophine.config.modules.function.OldFeatureConfig;
import io.papermc.paper.adventure.PaperAdventure; import io.papermc.paper.adventure.PaperAdventure;
@@ -102,7 +103,7 @@ public class BotList {
} }
public void saveAllResumeBots() { public void saveAllResumeBots() {
if (!FakeplayerConfig.enable || !FakeplayerConfig.canResident) { if (!FakeplayerConfig.checkEnabled() || !FakePlayerCompatConfig.fakePlayerResident) {
return; return;
} }
for (ServerBot bot : this.bots) { for (ServerBot bot : this.bots) {
@@ -353,7 +354,7 @@ public class BotList {
for (String fullName : this.botsNameByWorldUuid.getOrDefault(worldUuid, new HashSet<>())) { for (String fullName : this.botsNameByWorldUuid.getOrDefault(worldUuid, new HashSet<>())) {
ServerBot bot = this.getBotByName(fullName); ServerBot bot = this.getBotByName(fullName);
if (bot != null) { if (bot != null) {
this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakeplayerConfig.canResident, FakeplayerConfig.canResident); this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakePlayerCompatConfig.fakePlayerResident, FakePlayerCompatConfig.fakePlayerResident);
} }
} }
} }
@@ -363,9 +364,9 @@ public class BotList {
AtomicInteger check = new AtomicInteger(); AtomicInteger check = new AtomicInteger();
AtomicInteger received = new AtomicInteger(); AtomicInteger received = new AtomicInteger();
for (ServerBot bot : this.bots) { for (ServerBot bot : this.bots) {
bot.resume = FakeplayerConfig.canResident; bot.resume = FakePlayerCompatConfig.fakePlayerResident;
if (TickThread.isTickThreadFor(bot.level(), bot.getX(), bot.getZ())) { if (TickThread.isTickThreadFor(bot.level(), bot.getX(), bot.getZ())) {
this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakeplayerConfig.canResident, FakeplayerConfig.canResident); this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakePlayerCompatConfig.fakePlayerResident, FakePlayerCompatConfig.fakePlayerResident);
} else { } else {
finished = false; finished = false;
check.getAndIncrement(); check.getAndIncrement();
@@ -382,7 +383,7 @@ public class BotList {
} }
counter.getAndIncrement(); counter.getAndIncrement();
try { try {
this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakeplayerConfig.canResident, FakeplayerConfig.canResident); this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, FakePlayerCompatConfig.fakePlayerResident, FakePlayerCompatConfig.fakePlayerResident);
received.getAndIncrement(); received.getAndIncrement();
} catch (Exception e) { } catch (Exception e) {
this.removeBot(bot, check, received, counter); this.removeBot(bot, check, received, counter);
@@ -395,7 +396,7 @@ public class BotList {
} }
public void loadResumeBotInfo() { public void loadResumeBotInfo() {
if (!FakeplayerConfig.enable || !FakeplayerConfig.canResident) { if (!FakeplayerConfig.checkEnabled() || !FakePlayerCompatConfig.fakePlayerResident) {
return; return;
} }
CompoundTag savedBotList = this.getResumeBotList().copy(); CompoundTag savedBotList = this.getResumeBotList().copy();
@@ -431,7 +432,7 @@ public class BotList {
} }
public void loadResume(String worldUuid) { public void loadResume(String worldUuid) {
if (!FakeplayerConfig.enable || !FakeplayerConfig.canResident) { if (!FakeplayerConfig.checkEnabled() || !FakePlayerCompatConfig.fakePlayerResident) {
return; return;
} }
new HashSet<>(this.botsNameByWorldUuid.getOrDefault(worldUuid, new HashSet<>())).forEach(this::loadNewResumeBot); new HashSet<>(this.botsNameByWorldUuid.getOrDefault(worldUuid, new HashSet<>())).forEach(this::loadNewResumeBot);
@@ -358,7 +358,7 @@ public class ServerBot extends ServerPlayer {
@Override @Override
public @NotNull InteractionResult interact(@NotNull Player player, @NotNull InteractionHand hand, @NotNull net.minecraft.world.phys.Vec3 location) { // Leaves - Paper 26.1: Entity#interact now takes Vec3 public @NotNull InteractionResult interact(@NotNull Player player, @NotNull InteractionHand hand, @NotNull net.minecraft.world.phys.Vec3 location) { // Leaves - Paper 26.1: Entity#interact now takes Vec3
if (FakeplayerConfig.canOpenInventory) { if (FakePlayerCompatConfig.openFakePlayerInventory) {
if (player instanceof ServerPlayer player1 && player.getMainHandItem().isEmpty()) { if (player instanceof ServerPlayer player1 && player.getMainHandItem().isEmpty()) {
BotInventoryOpenEvent event = new BotInventoryOpenEvent(this.getBukkitEntity(), player1.getBukkitEntity()); BotInventoryOpenEvent event = new BotInventoryOpenEvent(this.getBukkitEntity(), player1.getBukkitEntity());
getServer().server.getPluginManager().callEvent(event); getServer().server.getPluginManager().callEvent(event);
@@ -31,7 +31,7 @@ public class TickTypeConfig extends AbstractBotConfig<ServerBot.TickType, TickTy
public TickTypeConfig() { public TickTypeConfig() {
super("tick_type", EnumArgumentType.fromEnum(ServerBot.TickType.class), TickTypeConfig::new); super("tick_type", EnumArgumentType.fromEnum(ServerBot.TickType.class), TickTypeConfig::new);
this.value = FakeplayerConfig.tickType; this.value = FakeplayerConfig.tickType();
} }
@Override @Override
@@ -59,7 +59,7 @@ public class TickTypeConfig extends AbstractBotConfig<ServerBot.TickType, TickTy
@Override @Override
public void load(@NotNull CompoundTag nbt) { public void load(@NotNull CompoundTag nbt) {
String raw = nbt.getStringOr(getName(), FakeplayerConfig.tickType.name()); String raw = nbt.getStringOr(getName(), FakeplayerConfig.tickType().name());
this.setValue(switch (raw.toLowerCase(Locale.ROOT)) { this.setValue(switch (raw.toLowerCase(Locale.ROOT)) {
case "network" -> ServerBot.TickType.NETWORK; case "network" -> ServerBot.TickType.NETWORK;
case "entity_list" -> ServerBot.TickType.ENTITY_LIST; case "entity_list" -> ServerBot.TickType.ENTITY_LIST;
@@ -29,8 +29,8 @@ import static org.leavesmc.leaves.command.CommandUtils.registerPermissions;
public class BotCommand extends RootNode { public class BotCommand extends RootNode {
private static final String PERM_BASE = "bukkit.command.bot"; private static final String PERM_BASE = "bukkit.command.bot";
public BotCommand() { public BotCommand(String key) {
super("bot", PERM_BASE); super(key, PERM_BASE);
this.children( this.children(
ListCommand::new, ListCommand::new,
ConfigCommand::new, ConfigCommand::new,
@@ -20,7 +20,6 @@ package org.leavesmc.leaves.protocol.servux.litematics.container;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Objects;
public class LitematicaBitArray { public class LitematicaBitArray {
/** /**
@@ -42,7 +42,10 @@ import org.leavesmc.leaves.protocol.servux.litematics.selection.Box;
import org.leavesmc.leaves.protocol.servux.litematics.utils.*; import org.leavesmc.leaves.protocol.servux.litematics.utils.*;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.*; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -17,7 +17,7 @@
package org.leavesmc.leaves.util; package org.leavesmc.leaves.util;
import fun.bm.lophine.config.modules.function.WoolHopperCounterConfig; import fun.bm.lophine.carpet.config.modules.WoolHopperCounterConfig;
import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongMap;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -351,6 +351,6 @@ public class HopperCounter {
} }
public static boolean isEnabled() { public static boolean isEnabled() {
return WoolHopperCounterConfig.enabled && enabled; return WoolHopperCounterConfig.hopperCounters && enabled;
} }
} }