feat: 初始化icon,去掉Example模组
This commit is contained in:
parent
948d38cbe2
commit
f391f54b3f
52
src/main/java/top/r3944realms/lib39/Lib39.java
Normal file
52
src/main/java/top/r3944realms/lib39/Lib39.java
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
package top.r3944realms.lib39;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.ModContainer;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
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;
|
||||
import top.r3944realms.lib39.contents.Lib39Blocks;
|
||||
import top.r3944realms.lib39.contents.Lib39CreativeModeTab;
|
||||
import top.r3944realms.lib39.contents.Lib39Items;
|
||||
|
||||
@Mod(Lib39.MOD_ID)
|
||||
public class Lib39 {
|
||||
public static final String MOD_ID = "lib39";
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public Lib39(IEventBus modEventBus, ModContainer modContainer) {
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
|
||||
Lib39Items.ITEMS.register(modEventBus);
|
||||
Lib39Blocks.BLOCKS.register(modEventBus);
|
||||
Lib39CreativeModeTab.CREATIVE_MODE_TABS.register(modEventBus);
|
||||
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
LOGGER.info("Lib39 common setup complete");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(ServerStartingEvent event) {
|
||||
LOGGER.info("Lib39 server starting");
|
||||
}
|
||||
|
||||
@EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT)
|
||||
public static class ClientModEvents {
|
||||
@SubscribeEvent
|
||||
static void onClientSetup(FMLClientSetupEvent event) {
|
||||
LOGGER.info("Lib39 client setup");
|
||||
LOGGER.info("Player: {}", Minecraft.getInstance().getUser().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package top.r3944realms.lib39.contents;
|
||||
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import top.r3944realms.lib39.Lib39;
|
||||
|
||||
public class Lib39Blocks {
|
||||
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(Lib39.MOD_ID);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package top.r3944realms.lib39.contents;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import top.r3944realms.lib39.Lib39;
|
||||
|
||||
public class Lib39CreativeModeTab {
|
||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
|
||||
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Lib39.MOD_ID);
|
||||
|
||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> MAIN_TAB = CREATIVE_MODE_TABS.register("main",
|
||||
() -> CreativeModeTab.builder()
|
||||
.title(Component.translatable("itemGroup.lib39"))
|
||||
.icon(() -> Lib39Items.ICON_ITEM.get().getDefaultInstance())
|
||||
.displayItems((params, output) -> {
|
||||
output.accept(Lib39Items.ICON_ITEM.get());
|
||||
})
|
||||
.build());
|
||||
}
|
||||
12
src/main/java/top/r3944realms/lib39/contents/Lib39Items.java
Normal file
12
src/main/java/top/r3944realms/lib39/contents/Lib39Items.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package top.r3944realms.lib39.contents;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import top.r3944realms.lib39.Lib39;
|
||||
|
||||
public class Lib39Items {
|
||||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(Lib39.MOD_ID);
|
||||
|
||||
public static final DeferredItem<Item> ICON_ITEM = ITEMS.registerSimpleItem("icon_item");
|
||||
}
|
||||
16
src/main/resources/lib39.mixins.json
Normal file
16
src/main/resources/lib39.mixins.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "top.r3944realms.lib39.mixin",
|
||||
"compatibilityLevel": "JAVA_25",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user