• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Yes but I don't want to use this gamerule
    • Ok i see, i use a commandhandler bc i want to put different subcommands in one. CommandHandler: public class CommandHandler { public static void register(CommandDispatcher<CommandSource> dispatcher) { LiteralCommandNode<CommandSource> command = dispatcher.register( Commands.literal(Main.MODID) .then(PointsCommand.register(dispatcher)) ); dispatcher.register(Commands.literal(Main.MODID).redirect(command)); } } and i call it on my main class @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { CommandHandler.register(event.getCommandDispatcher()); }  
    • Oh dear, I can see multiple issues with your code: What on earth are you trying to achieve with this?   This will never work. If you are on the server (i.e. trying to send a message to the client), you CANNOT use Minecraft.getInstance().   Also, I'm pretty sure most (if not all, I haven't looked in a while) commands run on the server, so you shouldn't need to send packets (unless you need to update the client(s)). Please show where PointsCommand::register is called (just to check that it is being registered on the server).
    • That is a really bad idea. If your mod does nothing, there's no point having it installed. If your mod does something, it should show up in the mod list. Otherwise, if there is a strange interaction between your mod and another one, it becomes very hard to find the problem (because the users don't know they have your mod installed).
    • public class PointsCommand { public static ArgumentBuilder<CommandSource, ?> register(CommandDispatcher<CommandSource> dispatcher){ return Commands.literal("points") .requires(cs -> cs.hasPermissionLevel(3)) .executes(source -> { return run(null, 0);}) .then(Commands.argument("target", EntityArgument.player()) .executes(source -> { return run(EntityArgument.getPlayer(source, "target"), 0);}) .then(Commands.argument("quantity", IntegerArgumentType.integer()) .executes(source -> { return run(EntityArgument.getPlayer(source, "target"), IntegerArgumentType.getInteger(source, "quantity")); })))); } public static int run(PlayerEntity pPlayer, int pQuantity) { if(pPlayer != null) { if(Integer.class.isInstance(pQuantity)) { Handler.INSTANCE.sendToServer(new PacketPoints(pQuantity, pPlayer.getUniqueID())); return 0; } else { Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.error.1")); return 0; } } else { Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.error.2")); return 0; } } }  
  • Topics

  • Who's Online (See full list)