diff --git a/.gitignore b/.gitignore index 31d2550..e0a8f35 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ run runs run-data -repo \ No newline at end of file +jdk +.env +.vscode \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1f4726a --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: build +build: + ./gradlew build \ No newline at end of file diff --git a/README.md b/README.md index b421122..0a2f050 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,7 @@ +# WIP CodeBio -Installation information -======= +## build -This template repository can be directly cloned to get you started with a new -mod. Simply create a new repository cloned from this one, by following the -instructions provided by [GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). +如何构建: -Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse. - -If at any point you are missing libraries in your IDE, or you've run into problems you can -run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything -{this does not affect your code} and then start the process again. - -Mapping Names: -============ -By default, the MDK is configured to use the official mapping names from Mojang for methods and fields -in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this -license. For the latest license text, refer to the mapping file itself, or the reference copy here: -https://github.com/NeoForged/NeoForm/blob/main/Mojang.md - -Additional Resources: -========== -Community Documentation: https://docs.neoforged.net/ -NeoForged Discord: https://discord.neoforged.net/ +`make build` 或者: `.gradle build` diff --git a/src/main/java/com/example/examplemod/events/ModEvents.java b/src/main/java/com/example/examplemod/events/ModEvents.java new file mode 100644 index 0000000..8207e13 --- /dev/null +++ b/src/main/java/com/example/examplemod/events/ModEvents.java @@ -0,0 +1,34 @@ +package com.example.examplemod.events; + +import org.slf4j.Logger; + +import com.example.examplemod.ExampleMod; +import com.mojang.logging.LogUtils; + +import net.minecraft.commands.Commands; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.RegisterCommandsEvent; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; +import net.neoforged.neoforge.server.command.ConfigCommand; + +@EventBusSubscriber(modid = ExampleMod.MODID) +public class ModEvents { + private static final Logger LOGGER = LogUtils.getLogger(); + + @SubscribeEvent + public static void onCommandsRegister(RegisterCommandsEvent event) { + event.getDispatcher().register(Commands.literal("hello") + .then(Commands.literal("io").executes((command) -> { + LOGGER.info("OIOIOI!"); + return 0; + }))); + ConfigCommand.register(event.getDispatcher()); + } + + @SubscribeEvent + public static void onPlayerCloneEvent(PlayerEvent.Clone event) { + event.getOriginal().getPersistentData().putIntArray(ExampleMod.MODID + "homepos", + event.getOriginal().getPersistentData().getIntArray(ExampleMod.MODID + "homepos")); + } +} \ No newline at end of file