From 4a014197af090d0976588898429b381978143845 Mon Sep 17 00:00:00 2001 From: CodexAdrian <83074853+CodexAdrian@users.noreply.github.com> Date: Sat, 5 Aug 2023 17:33:55 -0400 Subject: [PATCH] Add Tempad back to the creative menu --- build.gradle.kts | 11 +++---- .../tempad/common/fabric/FabricTempad.java | 9 ++++++ .../tempad/common/forge/ForgeTempad.java | 9 ++++++ templates/embed.json.template | 32 +++++++++++++++++++ 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 templates/embed.json.template diff --git a/build.gradle.kts b/build.gradle.kts index 2d3b1c5..b978006 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -89,14 +89,13 @@ subprojects { if (isCommon) { // "modCompileOnly"(group = "earth.terrarium.prometheus", name = "prometheus-$modLoader-$minecraftVersion", version = prometheusVersion) { isTransitive = false } - "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api", version = reiVersion) - "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin", version = reiVersion) + // "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api", version = reiVersion) + // "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin", version = reiVersion) } else { // "modLocalRuntime"(group = "earth.terrarium.prometheus", name = "prometheus-$modLoader-$minecraftVersion", version = prometheusVersion) - - "modRuntimeOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-$modLoader", version = reiVersion) - "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api-$modLoader", version = reiVersion) - "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin-$modLoader", version = reiVersion) + // "modRuntimeOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-$modLoader", version = reiVersion) + // "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api-$modLoader", version = reiVersion) + // "modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin-$modLoader", version = reiVersion) } "modApi"(group = "earth.terrarium", name = "botarium-$modLoader-$minecraftVersion", version = botariumVersion) diff --git a/fabric/src/main/java/me/codexadrian/tempad/common/fabric/FabricTempad.java b/fabric/src/main/java/me/codexadrian/tempad/common/fabric/FabricTempad.java index 9dc1b11..635c91d 100644 --- a/fabric/src/main/java/me/codexadrian/tempad/common/fabric/FabricTempad.java +++ b/fabric/src/main/java/me/codexadrian/tempad/common/fabric/FabricTempad.java @@ -1,15 +1,20 @@ package me.codexadrian.tempad.common.fabric; +import com.teamresourceful.resourcefullib.common.registry.RegistryEntry; import me.codexadrian.tempad.common.Tempad; import me.codexadrian.tempad.common.compat.fabricwaystones.FabricWaystoneLocationGetter; import me.codexadrian.tempad.common.network.NetworkHandler; import me.codexadrian.tempad.common.registry.TempadRegistry; import me.codexadrian.tempad.common.utils.PlatformUtils; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.storage.loot.BuiltInLootTables; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootItem; @@ -37,5 +42,9 @@ public void onInitialize() { if (PlatformUtils.isModLoaded("fwaystones")) { FabricWaystoneLocationGetter.init(); } + + ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(group -> { + TempadRegistry.ITEMS.stream().map(RegistryEntry::get).forEach(group::accept); + }); } } diff --git a/forge/src/main/java/me/codexadrian/tempad/common/forge/ForgeTempad.java b/forge/src/main/java/me/codexadrian/tempad/common/forge/ForgeTempad.java index 29b5c10..a02ed2b 100644 --- a/forge/src/main/java/me/codexadrian/tempad/common/forge/ForgeTempad.java +++ b/forge/src/main/java/me/codexadrian/tempad/common/forge/ForgeTempad.java @@ -1,13 +1,18 @@ package me.codexadrian.tempad.common.forge; import com.mojang.serialization.Codec; +import com.teamresourceful.resourcefullib.common.registry.RegistryEntry; import me.codexadrian.tempad.common.Tempad; import me.codexadrian.tempad.common.network.NetworkHandler; +import me.codexadrian.tempad.common.registry.TempadRegistry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.loot.IGlobalLootModifier; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; @@ -37,5 +42,9 @@ public ForgeTempad() { NetworkHandler.register(); MinecraftForge.EVENT_BUS.register(this); DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> ForgeTempadClient::registerBlurReloader); + + bus.addListener((BuildCreativeModeTabContentsEvent event) -> { + if (event.getTab() == BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.TOOLS_AND_UTILITIES)) TempadRegistry.ITEMS.stream().map(RegistryEntry::get).forEach(event::accept); + }); } } diff --git a/templates/embed.json.template b/templates/embed.json.template new file mode 100644 index 0000000..340e060 --- /dev/null +++ b/templates/embed.json.template @@ -0,0 +1,32 @@ +{ + "embeds": [ + { + "title": "Tempad", + "description": "**Changelog:**\\n${changelog}", + "color": 5814783, + "fields": [ + { + "name": "Minecraft Version", + "value": "${minecraft}" + }, + { + "name": "Mod Version", + "value": "${version}" + }, + { + "name": "Download", + "value": "<:modrinth:1083795635414773760> [Modrinth](https://modrinth.com/mod/cadmus)\\n<:curseforge:978684543026462790> [Curseforge](https://www.curseforge.com/minecraft/mc-mods/cadmus)" + } + ], + "footer": { + "text": "Want to support us? Check out our Ko-fi! http://kofi.terrarium.earth", + "icon_url": "https://media.discordapp.net/attachments/881367981463072809/1044025688719626250/61e1116779fc0a9bd5bdbcc7_Frame_6.png" + }, + "thumbnail": { + "url": "https://media.forgecdn.net/avatars/500/177/637818622588372032.gif" + } + } + ], + "username": "Terrarium Releases", + "avatar_url": "https://cdn.discordapp.com/avatars/955572264823300096/3c226580b871a57b6da095fea1cccf1e.webp" +} \ No newline at end of file