generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,6 @@ run | |
runs | ||
run-data | ||
|
||
repo | ||
jdk | ||
.env | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.PHONY: build | ||
build: | ||
./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/example/examplemod/events/ModEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")); | ||
} | ||
} |