Advertisement
Guest User

Untitled

a guest
Apr 10th, 2023
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import net.minecraft.text.Text;
  2. import org.quiltmc.loader.api.ModContainer;
  3. import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
  4. import org.quiltmc.qsl.command.api.CommandRegistrationCallback;
  5. import org.slf4j.Logger;
  6. import org.slf4j.LoggerFactory;
  7.  
  8. import static net.minecraft.server.command.CommandManager.literal;
  9.  
  10. public class ExampleMod implements ModInitializer {
  11.     public static final Logger LOGGER = LoggerFactory.getLogger("Example Mod");
  12.     @Override
  13.     public void onInitialize(ModContainer mod) {
  14.         CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal("foo")
  15.                 .executes(context -> {
  16.                     // For versions below 1.19, replace "Text.literal" with "new LiteralText".
  17.                     context.getSource().sendFeedback(Text.literal("Hello There"), false);
  18.  
  19.                     return 1;
  20.                 })));
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement