安装Java 和 IDEA(略过)
Latest Releases | Adoptium
Download IntelliJ IDEA – The Leading Java and Kotlin IDE (jetbrains.com)
下载MDK
2.点击code,下载zip
解压
解压压缩包,我这里还换了个文件夹的名称
构建
用Idea打开文件夹。等待build完成。
构建完成
运行
运行此task获得idea的配置
选中run client 启动
正常启动游戏
配置模组信息
调整包结构
调整类的内容
ExampleMod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| package net.flandre923.examplemod;
import com.mojang.logging.LogUtils; import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.server.ServerStartingEvent; import org.slf4j.Logger;
@Mod(ExampleMod.MODID) public class ExampleMod { public static final String MODID = "examplemod"; private static final Logger LOGGER = LogUtils.getLogger(); public ExampleMod(IEventBus modEventBus) { modEventBus.addListener(this::commonSetup); NeoForge.EVENT_BUS.register(this); }
private void commonSetup(final FMLCommonSetupEvent event) { }
@SubscribeEvent public void onServerStarting(ServerStartingEvent event) { }
}
|
配置模组显示信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
org.gradle.daemon=false org.gradle.debug=false
neogradle.subsystems.parchment.minecraftVersion=1.20.3 neogradle.subsystems.parchment.mappingsVersion=2023.12.31
minecraft_version=1.20.4
minecraft_version_range=[1.20.4,1.21)
neo_version=20.4.80-beta
neo_version_range=[20.4,)
loader_version_range=[2,)
mod_id=examplemod
mod_name=Example Mod
mod_license=All Rights Reserved
mod_version=1.0.0
mod_group_id=net.flandre923.examplemod
mod_authors=YourNameHere, OtherNameHere
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
重新构建项目