diff --git a/gradle.properties b/gradle.properties index cfbd74b..14d3518 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ mod_name=Networked Chests # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ -mod_version=0.1.0 +mod_version=0.1.1 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/com/jenny/networked_chests/Networked_chests.java b/src/main/java/com/jenny/networked_chests/Networked_chests.java index 7581a15..cbc0897 100644 --- a/src/main/java/com/jenny/networked_chests/Networked_chests.java +++ b/src/main/java/com/jenny/networked_chests/Networked_chests.java @@ -17,5 +17,6 @@ public class Networked_chests { MinecraftForge.EVENT_BUS.register(this); items.register(modEventBus); + creativeTab.register(modEventBus); } } diff --git a/src/main/java/com/jenny/networked_chests/creativeTab.java b/src/main/java/com/jenny/networked_chests/creativeTab.java new file mode 100644 index 0000000..e3c2180 --- /dev/null +++ b/src/main/java/com/jenny/networked_chests/creativeTab.java @@ -0,0 +1,37 @@ +package com.jenny.networked_chests; + +import com.jenny.networked_chests.items.items; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +import java.util.Arrays; + +import static com.jenny.networked_chests.Networked_chests.MODID; + +public class creativeTab { + public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); + public static final RegistryObject CREATIVE_TAB = CREATIVE_MODE_TABS.register("networked_chests", () -> CreativeModeTab.builder().withTabsBefore(CreativeModeTabs.SPAWN_EGGS).icon(() -> items.CHEST_INTERFACE.get().getDefaultInstance()).displayItems((parameters, output) -> { + output.acceptAll(Arrays.stream(getItems()).toList()); + }).title(Component.literal("Networked Chests")).build()); + + public static void register(IEventBus bus) { + CREATIVE_MODE_TABS.register(bus); + } + + public static ItemStack[] getItems() { + ItemStack[] ret = new ItemStack[items.ITEMS.getEntries().size()]; + int i = 0; + for (RegistryObject item : items.ITEMS.getEntries()) { + ret[i] = item.get().getDefaultInstance(); + i++; + } + return ret; + } +}