diff --git a/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java b/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java index d69ac21..4f2c45a 100644 --- a/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java +++ b/src/main/java/com/direwolf20/mininggadgets/common/MiningGadgets.java @@ -3,6 +3,7 @@ import com.direwolf20.mininggadgets.common.capabilities.EnergisedItem; import com.direwolf20.mininggadgets.common.items.MiningGadget; import com.direwolf20.mininggadgets.common.network.PacketHandler; +import com.direwolf20.mininggadgets.common.tiles.ModificationTableTileEntity; import com.direwolf20.mininggadgets.setup.ClientSetup; import com.direwolf20.mininggadgets.setup.Config; import com.direwolf20.mininggadgets.setup.ModSetup; @@ -49,6 +50,10 @@ private void registerCapabilities(RegisterCapabilitiesEvent event) { Registration.MININGGADGET_FANCY.get(), Registration.MININGGADGET_SIMPLE.get() ); + event.registerBlock(Capabilities.ItemHandler.BLOCK, + (level, pos, state, be, side) -> ((ModificationTableTileEntity) be).handler, + // blocks to register for + Registration.MODIFICATION_TABLE.get()); } @SubscribeEvent diff --git a/src/main/java/com/direwolf20/mininggadgets/setup/ModSetup.java b/src/main/java/com/direwolf20/mininggadgets/setup/ModSetup.java index 283a1c0..3718e40 100644 --- a/src/main/java/com/direwolf20/mininggadgets/setup/ModSetup.java +++ b/src/main/java/com/direwolf20/mininggadgets/setup/ModSetup.java @@ -23,7 +23,7 @@ public static void init(final FMLCommonSetupEvent event) { public static final String TAB_NAME = "mininggadgets"; public static DeferredRegister TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MiningGadgets.MOD_ID); public static DeferredHolder TAB_MININGGADGETS = TABS.register(TAB_NAME, () -> CreativeModeTab.builder() - .title(Component.literal("MiningGadgets")) + .title(Component.literal("Mining Gadgets")) .icon(() -> new ItemStack(Registration.MININGGADGET.get())) .withTabsBefore(CreativeModeTabs.SPAWN_EGGS) .displayItems((featureFlags, output) -> { @@ -40,6 +40,19 @@ public static void init(final FMLCommonSetupEvent event) { output.accept(stack); } }); + Registration.UPGRADE_ITEMS.getEntries().stream().filter(e -> e != Registration.MINERS_LIGHT_ITEM) + .forEach(e -> { + // Normal + Item item = e.get(); + output.accept(item); + + // Charged + if (item instanceof MiningGadget) { + ItemStack stack = new ItemStack(item); + stack.getOrCreateTag().putInt("energy", UpgradeBatteryLevels.BATTERY.getPower()); + output.accept(stack); + } + }); }) .build()); }