Migrate the Carpet codebase to Mojang Mappings

This commit is contained in:
altrisi committed 2022-01-24 20:33:16 +01:00
1 parent a1a2488bc3
commit 06af9ce8b1
346 files changed
+8353 -8492

No files matched your search

@@ -5,39 +5,39 @@ import carpet.settings.SettingsManager;
import carpet.utils.DistanceCalculator;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.command.argument.Vec3ArgumentType;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.coordinates.Vec3Argument;
import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;
import static net.minecraft.commands.Commands.argument;
import static net.minecraft.commands.Commands.literal;
public class DistanceCommand
{
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
{
LiteralArgumentBuilder<ServerCommandSource> command = literal("distance").
LiteralArgumentBuilder<CommandSourceStack> command = literal("distance").
requires((player) -> SettingsManager.canUseCommand(player, CarpetSettings.commandDistance)).
then(literal("from").
executes( (c) -> DistanceCalculator.setStart(c.getSource(), c.getSource().getPosition())).
then(argument("from", Vec3ArgumentType.vec3()).
then(argument("from", Vec3Argument.vec3()).
executes( (c) -> DistanceCalculator.setStart(
c.getSource(),
Vec3ArgumentType.getVec3(c, "from"))).
Vec3Argument.getVec3(c, "from"))).
then(literal("to").
executes((c) -> DistanceCalculator.distance(
c.getSource(),
Vec3ArgumentType.getVec3(c, "from"),
Vec3Argument.getVec3(c, "from"),
c.getSource().getPosition())).
then(argument("to", Vec3ArgumentType.vec3()).
then(argument("to", Vec3Argument.vec3()).
executes( (c) -> DistanceCalculator.distance(
c.getSource(),
Vec3ArgumentType.getVec3(c, "from"),
Vec3ArgumentType.getVec3(c, "to")
Vec3Argument.getVec3(c, "from"),
Vec3Argument.getVec3(c, "to")
)))))).
then(literal("to").
executes( (c) -> DistanceCalculator.setEnd(c.getSource(), c.getSource().getPosition()) ).
then(argument("to", Vec3ArgumentType.vec3()).
executes( (c) -> DistanceCalculator.setEnd(c.getSource(), Vec3ArgumentType.getVec3(c, "to")))));
then(argument("to", Vec3Argument.vec3()).
executes( (c) -> DistanceCalculator.setEnd(c.getSource(), Vec3Argument.getVec3(c, "to")))));
dispatcher.register(command);
}
}