提供: Minecraft Modding Wiki
11行目: | 11行目: | ||
public static final Item sample_item = new Item(new Item.Properties() | public static final Item sample_item = new Item(new Item.Properties() | ||
− | .group(ItemGroup. | + | .group(ItemGroup.MATERIALS)) |
.setRegistryName(new ResourceRocation(SampleMod.MOD_ID, "sample_item")); | .setRegistryName(new ResourceRocation(SampleMod.MOD_ID, "sample_item")); | ||
− | @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.MOD) | + | @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) |
public static class Eventhandler{ | public static class Eventhandler{ | ||
@SubscribeEvent | @SubscribeEvent |
2021年10月22日 (金) 17:22時点における版
この記事は"Minecraft Forge 1.14-28.0.x~"を前提MODとしています。 |
ソース
SampleMod.java
/*パッケージ・インポートは省略*/ @Mod(SampleMod.MOD_ID) public class SampleMod { public static final String MOD_ID = "sample"; public static final Item sample_item = new Item(new Item.Properties() .group(ItemGroup.MATERIALS)) .setRegistryName(new ResourceRocation(SampleMod.MOD_ID, "sample_item")); @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class Eventhandler{ @SubscribeEvent public void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry.register(sample_item); } } }