summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/example/examplemod/ExampleMod.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java
index e4013ff..44199e6 100644
--- a/src/main/java/com/example/examplemod/ExampleMod.java
+++ b/src/main/java/com/example/examplemod/ExampleMod.java
@@ -58,8 +58,7 @@ public class ExampleMod
MinecraftForge.EVENT_BUS.register(this);
// Register the item to a creative tab
- modEventBus.addListener((CreativeModeTabEvent.BuildContents event) -> event.registerSimple(CreativeModeTabs.BUILDING_BLOCKS,
- EXAMPLE_BLOCK_ITEM.get()));
+ modEventBus.addListener(this::addCreative);
}
private void commonSetup(final FMLCommonSetupEvent event)
@@ -69,6 +68,12 @@ public class ExampleMod
LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT));
}
+ private void addCreative(CreativeModeTabEvent.BuildContents event)
+ {
+ if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
+ event.accept(EXAMPLE_BLOCK_ITEM);
+ }
+
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event)