From 65f8f7c2dabd4a598be717eaea7cff975cc2e801 Mon Sep 17 00:00:00 2001 From: SB2DD <45701824+Mrredstone5230@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:30:10 -0400 Subject: [PATCH 1/3] feat: early 1.21.6 --- gradle.properties | 8 +-- gradle/libs.versions.toml | 4 +- gradle/wrapper/gradle-wrapper.properties | 2 +- legitslimepaper-api/build.gradle.kts.patch | 4 +- legitslimepaper-server/build.gradle.kts.patch | 14 ++--- .../brigadier/tree/CommandNode.java.patch | 2 +- .../minecraft/commands/Commands.java.patch | 47 ++++++++++---- .../functions/MacroFunction.java.patch | 2 +- .../minecraft/network/chat/Style.java.patch | 4 +- .../resources/RegistryDataLoader.java.patch | 4 +- .../net/minecraft/server/Main.java.patch | 15 +++-- .../server/commands/ExecuteCommand.java.patch | 10 +-- .../server/commands/ReturnCommand.java.patch | 7 +-- .../server/commands/TickCommand.java.patch | 4 +- .../data/EntityDataAccessor.java.patch | 61 ++++++++++--------- .../server/level/ServerChunkCache.java.patch | 6 +- .../world/entity/player/Player.java.patch | 2 +- .../world/level/ServerExplosion.java.patch | 4 +- .../org/bukkit/craftbukkit/Main.java.patch | 6 +- 19 files changed, 117 insertions(+), 89 deletions(-) diff --git a/gradle.properties b/gradle.properties index a5ab93b..ef2d9f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ group=com.legitimoose.legitslimepaper -version=1.21.4-R0.1-SNAPSHOT -mcVersion=1.21.4 +version=1.21.6-R0.1-SNAPSHOT +mcVersion=1.21.6 #Update with ASP!! (also update gradle/libs.versions.toml) -aspRef=2b60acc0578293049d8837cd716ffd256f2e1090 -apiVersion=4.0.0-SNAPSHOT +aspRef=0575f17f44a345d729fbe50c0d61fc4afeea7ac0 +apiVersion=4.1.0-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 196c89f..8d02bab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -adventure = "4.17.0" +adventure = "4.21.0" annotations = "26.0.1" autoservice = "1.1.1" blossom = "2.1.0" @@ -15,7 +15,7 @@ lettuce = "6.5.1.RELEASE" lombok = "1.18.36" lombok-plugin = "8.11" mongo = "5.2.1" -paperweight = "2.0.0-SNAPSHOT" +paperweight = "2.0.0-beta.17" plugin-yml-paper = "0.6.0" shadow = "8.3.5" slf4j = "2.0.16" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..002b867 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/legitslimepaper-api/build.gradle.kts.patch b/legitslimepaper-api/build.gradle.kts.patch index e783614..6b5c5df 100644 --- a/legitslimepaper-api/build.gradle.kts.patch +++ b/legitslimepaper-api/build.gradle.kts.patch @@ -1,8 +1,8 @@ --- a/aspaper-api/build.gradle.kts +++ b/aspaper-api/build.gradle.kts -@@ -104,17 +_,21 @@ +@@ -102,17 +_,21 @@ java { - srcDir(generatedApiPath) + srcDir(generatedDir) srcDir(file("../paper-api/src/main/java")) + srcDir(file("../aspaper-api/src/main/java")) } diff --git a/legitslimepaper-server/build.gradle.kts.patch b/legitslimepaper-server/build.gradle.kts.patch index c115aee..1b9fcc7 100644 --- a/legitslimepaper-server/build.gradle.kts.patch +++ b/legitslimepaper-server/build.gradle.kts.patch @@ -1,6 +1,6 @@ --- a/aspaper-server/build.gradle.kts +++ b/aspaper-server/build.gradle.kts -@@ -30,7 +_,22 @@ +@@ -33,7 +_,22 @@ } } @@ -23,8 +23,8 @@ + activeFork = legitslimepaper spigot { - buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" -@@ -116,10 +_,14 @@ + enabled = false +@@ -120,10 +_,14 @@ main { java { srcDir("../paper-server/src/main/java") } resources { srcDir("../paper-server/src/main/resources") } @@ -38,17 +38,17 @@ + resources { srcDir("../aspaper-server/src/test/resources") } } } - -@@ -143,7 +_,7 @@ + val log4jPlugins = sourceSets.create("log4jPlugins") { +@@ -150,7 +_,7 @@ } dependencies { - implementation(project(":aspaper-api")) //ASP + implementation(project(":legitslimepaper-api")) //ASP + Moose implementation(project(":core")) //ASP - implementation("commons-io:commons-io:2.11.0") implementation("ca.spottedleaf:concurrentutil:0.0.3") -@@ -215,14 +_,14 @@ + implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ +@@ -227,14 +_,14 @@ val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", diff --git a/legitslimepaper-server/minecraft-patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch b/legitslimepaper-server/minecraft-patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch index f6fe03a..6cc12fb 100644 --- a/legitslimepaper-server/minecraft-patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/com/mojang/brigadier/tree/CommandNode.java.patch @@ -27,7 +27,7 @@ protected CommandNode(final Command command, final Predicate requirement, final CommandNode redirect, final RedirectModifier modifier, final boolean forks) { this.command = command; -@@ -102,6 +_,13 @@ +@@ -92,6 +_,13 @@ } } else { children.put(node.getName(), node); diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/Commands.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/Commands.java.patch index 110ef9b..6caf62f 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/Commands.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/Commands.java.patch @@ -1,14 +1,36 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -1,6 +_,7 @@ +@@ -1,5 +_,6 @@ package net.minecraft.commands; - import com.google.common.collect.Maps; +import com.legitimoose.lsp.MooseConfig; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; -@@ -38,7 +_,6 @@ +@@ -7,18 +_,18 @@ + import com.mojang.brigadier.builder.ArgumentBuilder; + import com.mojang.brigadier.builder.LiteralArgumentBuilder; + import com.mojang.brigadier.builder.RequiredArgumentBuilder; ++import com.mojang.brigadier.context.CommandContext; + import com.mojang.brigadier.context.CommandContextBuilder; + import com.mojang.brigadier.context.ContextChain; ++import com.mojang.brigadier.context.ParsedCommandNode; + import com.mojang.brigadier.exceptions.CommandSyntaxException; + import com.mojang.brigadier.suggestion.SuggestionProvider; + import com.mojang.brigadier.tree.ArgumentCommandNode; + import com.mojang.brigadier.tree.CommandNode; + import com.mojang.brigadier.tree.RootCommandNode; + import com.mojang.logging.LogUtils; +-import java.util.HashMap; +-import java.util.Map; +-import java.util.Optional; +-import java.util.Set; ++ ++import java.util.*; + import java.util.function.Consumer; + import java.util.function.Predicate; + import java.util.function.UnaryOperator; +@@ -40,7 +_,6 @@ import net.minecraft.network.chat.ClickEvent; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -16,7 +38,7 @@ import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.protocol.game.ClientboundCommandsPacket; -@@ -136,6 +_,7 @@ +@@ -143,6 +_,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; @@ -24,22 +46,22 @@ import net.minecraft.world.level.GameRules; import org.slf4j.Logger; -@@ -148,6 +_,7 @@ - public static final int LEVEL_ADMINS = 3; - public static final int LEVEL_OWNERS = 4; +@@ -174,6 +_,7 @@ + } + }; private final CommandDispatcher dispatcher = new CommandDispatcher<>(); + public static CommandDispatcher vanillaCommands = new CommandDispatcher<>(); // Moose public Commands(Commands.CommandSelection selection, CommandBuildContext context) { // Paper start - Brigadier API - modern minecraft overloads that do not use redirects but are copies instead -@@ -256,6 +_,25 @@ +@@ -285,6 +_,25 @@ PublishCommand.register(this.dispatcher); } + // Moose start - Special boolean to track command block allowed commands (allowed to be ran by command blocks and click events). + for (CommandNode node : this.dispatcher.getRoot().getChildren()) { + String cmd = node.getName(); -+ if (!MooseConfig.blacklistedVanillaCommands.contains(cmd)) { ++ if (!com.legitimoose.lsp.MooseConfig.blacklistedVanillaCommands.contains(cmd)) { + node.commandBlockAllowed = true; + } + //this.vanillaCommandNodes.add(node); @@ -58,13 +80,14 @@ // Paper start - Vanilla command permission fixes for (final CommandNode node : this.dispatcher.getRoot().getChildren()) { if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.defaultRequirement()) { -@@ -353,6 +_,14 @@ +@@ -388,6 +_,15 @@ ContextChain contextChain = this.finishParsing(parseResults, command, commandSourceStack, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { + // Moose start - Command block whitelist + if (parseResults.getContext().getSource().source instanceof BaseCommandBlock) { -+ if (!parseResults.getContext().getNodes().get(0).getNode().commandBlockAllowed) { ++ List> context = parseResults.getContext().getNodes(); ++ if (!context.isEmpty() && !context.getFirst().getNode().commandBlockAllowed) { + throw new Exception("Non-vanilla commands cannot be executed in command blocks."); + } + } @@ -73,7 +96,7 @@ if (contextChain != null) { executeCommandInContext( commandSourceStack, -@@ -362,7 +_,7 @@ +@@ -397,7 +_,7 @@ ); } } catch (Exception var12) { diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/functions/MacroFunction.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/functions/MacroFunction.java.patch index e3277b5..6c93ee1 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/functions/MacroFunction.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/commands/functions/MacroFunction.java.patch @@ -8,7 +8,7 @@ import net.minecraft.commands.ExecutionCommandSource; import net.minecraft.commands.FunctionInstantiationException; import net.minecraft.commands.execution.UnboundEntryAction; -@@ -50,6 +_,7 @@ +@@ -51,6 +_,7 @@ @Override public InstantiatedFunction instantiate(@Nullable CompoundTag arguments, CommandDispatcher dispatcher) throws FunctionInstantiationException { diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/network/chat/Style.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/network/chat/Style.java.patch index 2d53697..6337f69 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/network/chat/Style.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/network/chat/Style.java.patch @@ -15,8 +15,8 @@ - this.clickEvent = clickEvent; + // Moose start + boolean blackListedCommand = false; -+ if (clickEvent != null && clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) { -+ String cmd = clickEvent.getValue(); ++ if (clickEvent != null && clickEvent.action() == ClickEvent.Action.RUN_COMMAND) { ++ String cmd = ((ClickEvent.RunCommand) clickEvent).command(); + cmd = cmd.startsWith("/") ? cmd.substring(1) : cmd; + cmd = cmd.split(" ", 2)[0]; + String finalCmd = cmd; diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch index 3c16e45..4d7c00d 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/resources/RegistryDataLoader.java +++ b/net/minecraft/resources/RegistryDataLoader.java -@@ -166,11 +_,12 @@ - map.put(registry.key(), new IllegalStateException("Registry must be non-empty")); +@@ -193,11 +_,12 @@ + map.put(registry.key(), new IllegalStateException("Registry must be non-empty: " + registry.key().location())); } }); + // Moose start - Don't throw an exception on invalid registry diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/Main.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/Main.java.patch index 6deb388..9ac6427 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/Main.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/Main.java.patch @@ -22,15 +22,20 @@ import net.minecraft.SharedConstants; import net.minecraft.SuppressForbidden; import net.minecraft.Util; -@@ -57,7 +_,6 @@ - import net.minecraft.world.level.storage.LevelStorageSource; - import net.minecraft.world.level.storage.LevelSummary; - import net.minecraft.world.level.storage.PrimaryLevelData; +@@ -54,11 +_,7 @@ + import net.minecraft.world.level.levelgen.WorldDimensions; + import net.minecraft.world.level.levelgen.WorldOptions; + import net.minecraft.world.level.levelgen.presets.WorldPresets; +-import net.minecraft.world.level.storage.LevelDataAndDimensions; +-import net.minecraft.world.level.storage.LevelStorageSource; +-import net.minecraft.world.level.storage.LevelSummary; +-import net.minecraft.world.level.storage.PrimaryLevelData; -import net.minecraft.world.level.storage.WorldData; ++import net.minecraft.world.level.storage.*; import org.slf4j.Logger; public class Main { -@@ -139,6 +_,8 @@ +@@ -140,6 +_,8 @@ LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath()); return; } diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ExecuteCommand.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ExecuteCommand.java.patch index d5d6a61..d802c19 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ExecuteCommand.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ExecuteCommand.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/commands/ExecuteCommand.java +++ b/net/minecraft/server/commands/ExecuteCommand.java -@@ -146,7 +_,7 @@ +@@ -142,7 +_,7 @@ dispatcher.register( Commands.literal("execute") - .requires(source -> source.hasPermission(2)) + .requires(Commands.hasPermission(2)) - .then(Commands.literal("run").redirect(dispatcher.getRoot())) + .then(Commands.literal("run").redirect(Commands.vanillaCommands.getRoot())) // Moose - Only run vanilla commands - .then(addConditionals(literalCommandNode, Commands.literal("if"), true, context)) - .then(addConditionals(literalCommandNode, Commands.literal("unless"), false, context)) - .then(Commands.literal("as").then(Commands.argument("targets", EntityArgument.entities()).fork(literalCommandNode, context1 -> { + .then(addConditionals(literalCommandNode, Commands.literal("if"), true, buildContext)) + .then(addConditionals(literalCommandNode, Commands.literal("unless"), false, buildContext)) + .then(Commands.literal("as").then(Commands.argument("targets", EntityArgument.entities()).fork(literalCommandNode, commandContext -> { diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ReturnCommand.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ReturnCommand.java.patch index 7d2875f..aa987b4 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ReturnCommand.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/ReturnCommand.java.patch @@ -1,16 +1,15 @@ --- a/net/minecraft/server/commands/ReturnCommand.java +++ b/net/minecraft/server/commands/ReturnCommand.java -@@ -6,6 +_,9 @@ +@@ -6,6 +_,8 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder; import com.mojang.brigadier.context.ContextChain; import java.util.List; + +import com.mojang.brigadier.tree.CommandNode; -+import net.minecraft.commands.Commands; + import net.minecraft.commands.Commands; import net.minecraft.commands.ExecutionCommandSource; import net.minecraft.commands.execution.ChainModifiers; - import net.minecraft.commands.execution.CustomCommandExecutor; -@@ -25,7 +_,7 @@ +@@ -26,7 +_,7 @@ .executes(new ReturnCommand.ReturnValueCustomExecutor<>()) ) .then(LiteralArgumentBuilder.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>())) diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/TickCommand.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/TickCommand.java.patch index e4de078..6011af9 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/TickCommand.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/TickCommand.java.patch @@ -4,8 +4,8 @@ public static void register(CommandDispatcher dispatcher) { dispatcher.register( Commands.literal("tick") -- .requires(commandSourceStack -> commandSourceStack.hasPermission(3)) -+ .requires(commandSourceStack -> commandSourceStack.hasPermission(2)) +- .requires(Commands.hasPermission(3)) ++ .requires(Commands.hasPermission(2)) .then(Commands.literal("query").executes(commandContext -> tickQuery(commandContext.getSource()))) .then( Commands.literal("rate") diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch index f2e53ef..76443dd 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch @@ -7,7 +7,7 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -@@ -12,11 +_,13 @@ +@@ -13,12 +_,14 @@ import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.NbtPathArgument; @@ -19,12 +19,13 @@ +import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; +import net.minecraft.server.level.ServerPlayer; + import net.minecraft.util.ProblemReporter; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; - - public class EntityDataAccessor implements DataAccessor { -@@ -43,7 +_,65 @@ + import net.minecraft.world.level.storage.TagValueInput; + import org.slf4j.Logger; +@@ -48,7 +_,65 @@ @Override public void setData(CompoundTag other) throws CommandSyntaxException { if (this.entity instanceof Player) { @@ -36,58 +37,58 @@ + CompoundTag oldNbt = NbtPredicate.getEntityTagToCompare(entity); + + ServerPlayer player = (ServerPlayer) entity; -+ for (String key : other.getAllKeys()) { ++ for (String key : other.keySet()) { + if (other.get(key).equals(oldNbt.get(key))) { + continue; + } + switch (key) { -+ case "Air" -> player.setAirSupply(((NumericTag) other.get(key)).getAsInt()); -+ case "Fire" -> player.setRemainingFireTicks(((NumericTag) other.get(key)).getAsInt()); -+ case "Glowing" -> player.setGlowingTag(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "Invulnerable" -> player.setInvulnerable(((NumericTag) other.get(key)).getAsByte() != 0); ++ case "Air" -> player.setAirSupply(((NumericTag) other.get(key)).intValue()); ++ case "Fire" -> player.setRemainingFireTicks(((NumericTag) other.get(key)).intValue()); ++ case "Glowing" -> player.setGlowingTag(((NumericTag) other.get(key)).byteValue() != 0); ++ case "Invulnerable" -> player.setInvulnerable(((NumericTag) other.get(key)).byteValue() != 0); + case "Motion" -> { + ListTag velocity = (ListTag) other.get(key); -+ player.setDeltaMovement(((NumericTag)velocity.get(0)).getAsDouble(), ((NumericTag)velocity.get(1)).getAsDouble(), ((NumericTag)velocity.get(2)).getAsDouble()); ++ player.setDeltaMovement(((NumericTag)velocity.get(0)).doubleValue(), ((NumericTag)velocity.get(1)).doubleValue(), ((NumericTag)velocity.get(2)).doubleValue()); + player.connection.sendPacket(new ClientboundSetEntityMotionPacket(player)); + } -+ case "NoGravity" -> player.setNoGravity(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "PortalCooldown" -> player.setPortalCooldown(((NumericTag) other.get(key)).getAsInt()); -+ case "Silent" -> player.setSilent(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "Health" -> player.setHealth(((NumericTag) other.get(key)).getAsFloat()); ++ case "NoGravity" -> player.setNoGravity(((NumericTag) other.get(key)).byteValue() != 0); ++ case "PortalCooldown" -> player.setPortalCooldown(((NumericTag) other.get(key)).intValue()); ++ case "Silent" -> player.setSilent(((NumericTag) other.get(key)).byteValue() != 0); ++ case "Health" -> player.setHealth(((NumericTag) other.get(key)).floatValue()); + case "abilities" -> { + CompoundTag abilities = (CompoundTag) other.get(key); -+ player.getAbilities().flying = abilities.getBoolean("flying"); -+ player.getAbilities().setFlyingSpeed(abilities.getFloat("flySpeed")); -+ player.getAbilities().instabuild = abilities.getBoolean("instabuild"); -+ player.getAbilities().invulnerable = abilities.getBoolean("invulnerable"); -+ player.getAbilities().mayBuild = abilities.getBoolean("mayBuild"); -+ player.getAbilities().mayfly = abilities.getBoolean("mayfly"); -+ player.getAbilities().setWalkingSpeed(abilities.getFloat("walkSpeed")); ++ abilities.getBoolean("flying").ifPresent( flying -> player.getAbilities().flying = flying); ++ abilities.getFloat("flySpeed").ifPresent( flySpeed -> player.getAbilities().setFlyingSpeed(flySpeed)); ++ abilities.getBoolean("instabuild").ifPresent( instabuild -> player.getAbilities().instabuild = instabuild); ++ abilities.getBoolean("invulnerable").ifPresent( invulnerable -> player.getAbilities().invulnerable = invulnerable); ++ abilities.getBoolean("mayBuild").ifPresent( mayBuild -> player.getAbilities().mayBuild = mayBuild); ++ abilities.getBoolean("mayfly").ifPresent( mayfly -> player.getAbilities().mayfly = mayfly); ++ abilities.getFloat("walkSpeed").ifPresent( walkSpeed -> player.getAbilities().setWalkingSpeed(walkSpeed)); + + player.onUpdateAbilities(); + } + case "SelectedItemSlot" -> { -+ int slot = ((NumericTag) other.get(key)).getAsInt(); ++ int slot = ((NumericTag) other.get(key)).intValue(); + if (Inventory.isHotbarSlot(slot)) { -+ player.getInventory().selected = slot; ++ player.getInventory().setSelectedSlot(slot); + player.connection.sendPacket(new ClientboundSetHeldSlotPacket(slot)); + } + } -+ case "HasVisualFire" -> player.hasVisualFire = (((NumericTag) other.get(key)).getAsByte() != 0); -+ case "TicksFrozen" -> player.setTicksFrozen(((NumericTag) other.get(key)).getAsInt()); ++// case "HasVisualFire" -> player.hasVisualFire = (((NumericTag) other.get(key)).byteValue() != 0); ++ case "TicksFrozen" -> player.setTicksFrozen(((NumericTag) other.get(key)).intValue()); + case "FallFlying" -> { -+ if (((NumericTag) other.get(key)).getAsByte() != 0) { ++ if (((NumericTag) other.get(key)).byteValue() != 0) { + player.startFallFlying(); + } else { + player.stopFallFlying(); + } + } -+ case "FoodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).getAsFloat(); -+ case "FoodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).getAsInt()); -+ case "FoodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).getAsFloat()); ++ case "FoodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).floatValue(); ++ case "FoodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).intValue()); ++ case "FoodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).floatValue()); + } + } + // Moose end - Allow modifying player data } else { UUID uuid = this.entity.getUUID(); - this.entity.load(other); + diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch index 5799d8a..9941af0 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/level/ServerChunkCache.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -208,7 +_,7 @@ +@@ -211,7 +_,7 @@ } //ASP start - No dimension data storage - if(level instanceof com.infernalsuite.asp.level.SlimeLevelInstance) { + if(level instanceof com.infernalsuite.asp.level.SlimeLevelInstance && false) { // Moose - Re-enable dat file storage - this.dataStorage = new com.infernalsuite.asp.level.ReadOnlyDimensionDataStorage(path, fixerUpper, level.registryAccess()); + this.dataStorage = new com.infernalsuite.asp.level.ReadOnlyDimensionDataStorage(new SavedData.Context(level), path, fixerUpper, level.registryAccess()); } else { - this.dataStorage = new DimensionDataStorage(path, fixerUpper, level.registryAccess()); + this.dataStorage = new DimensionDataStorage(new SavedData.Context(level), path, fixerUpper, level.registryAccess()); diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch index 0189c64..8e7c18b 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -2199,7 +_,7 @@ +@@ -2106,7 +_,7 @@ } public boolean canUseGameMasterBlocks() { diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch index b85d158..98e6ea8 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -319,7 +_,7 @@ +@@ -316,7 +_,7 @@ ) { this.level = level; this.source = source; @@ -9,7 +9,7 @@ this.center = center; this.fire = fire; this.blockInteraction = blockInteraction; -@@ -648,11 +_,7 @@ +@@ -637,11 +_,7 @@ } public void explode() { diff --git a/legitslimepaper-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch b/legitslimepaper-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch index 7d1f55d..2b36bf2 100644 --- a/legitslimepaper-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch +++ b/legitslimepaper-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch @@ -1,12 +1,12 @@ --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -183,6 +_,14 @@ +@@ -169,6 +_,14 @@ + .ofType(String.class) .defaultsTo("Unknown Server") .describedAs("Name"); - // Paper end + + // Moose start -+ acceptsAll(Main.asList("M", "moose-settings"), "File for moose settings") ++ acceptsAll(asList("M", "moose-settings"), "File for moose settings") + .withRequiredArg() + .ofType(File.class) + .defaultsTo(new File("moose.yml")) From 46be9d232140a124b6e6fcfd7e42b34910fba224 Mon Sep 17 00:00:00 2001 From: SB2DD <45701824+Mrredstone5230@users.noreply.github.com> Date: Wed, 18 Jun 2025 20:44:57 -0400 Subject: [PATCH 2/3] fix: merge conflicts --- .../data/EntityDataAccessor.java.patch | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch index ddfd265..9da1876 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch @@ -1,13 +1,6 @@ --- a/net/minecraft/server/commands/data/EntityDataAccessor.java +++ b/net/minecraft/server/commands/data/EntityDataAccessor.java -@@ -1,5 +_,6 @@ - package net.minecraft.server.commands.data; - -+import com.legitimoose.lsp.MooseConfig; - import com.mojang.brigadier.builder.ArgumentBuilder; - import com.mojang.brigadier.context.CommandContext; - import com.mojang.brigadier.exceptions.CommandSyntaxException; -@@ -12,11 +_,13 @@ +@@ -13,12 +_,14 @@ import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.NbtPathArgument; @@ -19,75 +12,76 @@ +import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket; +import net.minecraft.network.protocol.game.ClientboundSetHeldSlotPacket; +import net.minecraft.server.level.ServerPlayer; + import net.minecraft.util.ProblemReporter; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; - - public class EntityDataAccessor implements DataAccessor { -@@ -43,7 +_,65 @@ + import net.minecraft.world.level.storage.TagValueInput; + import org.slf4j.Logger; +@@ -48,7 +_,65 @@ @Override public void setData(CompoundTag other) throws CommandSyntaxException { if (this.entity instanceof Player) { - throw ERROR_NO_PLAYERS.create(); + // Moose start - Allow modifying player data -+ if (!MooseConfig.allowPlayerDataModification) ++ if (!com.legitimoose.lsp.MooseConfig.allowPlayerDataModification) + throw ERROR_NO_PLAYERS.create(); + // From - https://github.com/eclipseisoffline/modifyplayerdata/ + CompoundTag oldNbt = NbtPredicate.getEntityTagToCompare(entity); + + ServerPlayer player = (ServerPlayer) entity; -+ for (String key : other.getAllKeys()) { ++ for (String key : other.keySet()) { + if (other.get(key).equals(oldNbt.get(key))) { + continue; + } + switch (key) { -+ case "Air" -> player.setAirSupply(((NumericTag) other.get(key)).getAsInt()); -+ case "Fire" -> player.setRemainingFireTicks(((NumericTag) other.get(key)).getAsInt()); -+ case "Glowing" -> player.setGlowingTag(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "Invulnerable" -> player.setInvulnerable(((NumericTag) other.get(key)).getAsByte() != 0); ++ case "Air" -> player.setAirSupply(((NumericTag) other.get(key)).intValue()); ++ case "Fire" -> player.setRemainingFireTicks(((NumericTag) other.get(key)).intValue()); ++ case "Glowing" -> player.setGlowingTag(((NumericTag) other.get(key)).byteValue() != 0); ++ case "Invulnerable" -> player.setInvulnerable(((NumericTag) other.get(key)).byteValue() != 0); + case "Motion" -> { + ListTag velocity = (ListTag) other.get(key); -+ player.setDeltaMovement(((NumericTag)velocity.get(0)).getAsDouble(), ((NumericTag)velocity.get(1)).getAsDouble(), ((NumericTag)velocity.get(2)).getAsDouble()); ++ player.setDeltaMovement(((NumericTag)velocity.get(0)).doubleValue(), ((NumericTag)velocity.get(1)).doubleValue(), ((NumericTag)velocity.get(2)).doubleValue()); + player.connection.sendPacket(new ClientboundSetEntityMotionPacket(player)); + } -+ case "NoGravity" -> player.setNoGravity(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "PortalCooldown" -> player.setPortalCooldown(((NumericTag) other.get(key)).getAsInt()); -+ case "Silent" -> player.setSilent(((NumericTag) other.get(key)).getAsByte() != 0); -+ case "Health" -> player.setHealth(((NumericTag) other.get(key)).getAsFloat()); ++ case "NoGravity" -> player.setNoGravity(((NumericTag) other.get(key)).byteValue() != 0); ++ case "PortalCooldown" -> player.setPortalCooldown(((NumericTag) other.get(key)).intValue()); ++ case "Silent" -> player.setSilent(((NumericTag) other.get(key)).byteValue() != 0); ++ case "Health" -> player.setHealth(((NumericTag) other.get(key)).floatValue()); + case "abilities" -> { + CompoundTag abilities = (CompoundTag) other.get(key); -+ player.getAbilities().flying = abilities.getBoolean("flying"); -+ player.getAbilities().setFlyingSpeed(abilities.getFloat("flySpeed")); -+ player.getAbilities().instabuild = abilities.getBoolean("instabuild"); -+ player.getAbilities().invulnerable = abilities.getBoolean("invulnerable"); -+ player.getAbilities().mayBuild = abilities.getBoolean("mayBuild"); -+ player.getAbilities().mayfly = abilities.getBoolean("mayfly"); -+ player.getAbilities().setWalkingSpeed(abilities.getFloat("walkSpeed")); ++ abilities.getBoolean("flying").ifPresent( flying -> player.getAbilities().flying = flying); ++ abilities.getFloat("flySpeed").ifPresent( flySpeed -> player.getAbilities().setFlyingSpeed(flySpeed)); ++ abilities.getBoolean("instabuild").ifPresent( instabuild -> player.getAbilities().instabuild = instabuild); ++ abilities.getBoolean("invulnerable").ifPresent( invulnerable -> player.getAbilities().invulnerable = invulnerable); ++ abilities.getBoolean("mayBuild").ifPresent( mayBuild -> player.getAbilities().mayBuild = mayBuild); ++ abilities.getBoolean("mayfly").ifPresent( mayfly -> player.getAbilities().mayfly = mayfly); ++ abilities.getFloat("walkSpeed").ifPresent( walkSpeed -> player.getAbilities().setWalkingSpeed(walkSpeed)); + + player.onUpdateAbilities(); + } + case "SelectedItemSlot" -> { -+ int slot = ((NumericTag) other.get(key)).getAsInt(); ++ int slot = ((NumericTag) other.get(key)).intValue(); + if (Inventory.isHotbarSlot(slot)) { -+ player.getInventory().selected = slot; ++ player.getInventory().setSelectedSlot(slot); + player.connection.sendPacket(new ClientboundSetHeldSlotPacket(slot)); + } + } -+ case "HasVisualFire" -> player.hasVisualFire = (((NumericTag) other.get(key)).getAsByte() != 0); -+ case "TicksFrozen" -> player.setTicksFrozen(((NumericTag) other.get(key)).getAsInt()); ++// case "HasVisualFire" -> player.hasVisualFire = (((NumericTag) other.get(key)).byteValue() != 0); ++ case "TicksFrozen" -> player.setTicksFrozen(((NumericTag) other.get(key)).intValue()); + case "FallFlying" -> { -+ if (((NumericTag) other.get(key)).getAsByte() != 0) { ++ if (((NumericTag) other.get(key)).byteValue() != 0) { + player.startFallFlying(); + } else { + player.stopFallFlying(); + } + } -+ case "foodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).getAsFloat(); -+ case "foodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).getAsInt()); -+ case "foodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).getAsFloat()); ++ case "FoodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).floatValue(); ++ case "FoodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).intValue()); ++ case "FoodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).floatValue()); + } + } + // Moose end - Allow modifying player data } else { UUID uuid = this.entity.getUUID(); - this.entity.load(other); + From 323a656144b32acb54061c68a4c571687d05c464 Mon Sep 17 00:00:00 2001 From: SB2DD <45701824+Mrredstone5230@users.noreply.github.com> Date: Mon, 30 Jun 2025 23:15:42 -0400 Subject: [PATCH 3/3] fix: actually addressed the merge conflicts :skull: actual skill issues --- .../server/commands/data/EntityDataAccessor.java.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch index 9da1876..3cd9f1e 100644 --- a/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch +++ b/legitslimepaper-server/minecraft-patches/sources/net/minecraft/server/commands/data/EntityDataAccessor.java.patch @@ -76,9 +76,9 @@ + player.stopFallFlying(); + } + } -+ case "FoodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).floatValue(); -+ case "FoodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).intValue()); -+ case "FoodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).floatValue()); ++ case "foodExhaustionLevel" -> player.getFoodData().exhaustionLevel = ((NumericTag) other.get(key)).floatValue(); ++ case "foodLevel" -> player.getFoodData().setFoodLevel(((NumericTag) other.get(key)).intValue()); ++ case "foodSaturationLevel" -> player.getFoodData().setSaturation(((NumericTag) other.get(key)).floatValue()); + } + } + // Moose end - Allow modifying player data