From 43aacfa2e1f9cf0886a2b457042e8360a4f3191e Mon Sep 17 00:00:00 2001 From: Jika Date: Mon, 21 Jul 2025 10:57:03 +0200 Subject: [PATCH] Correct mod id and add simple item --- build.gradle | 13 ----------- gradle.properties | 2 +- src/main/java/com/imbgt/ibg/Config.java | 2 +- .../java/com/imbgt/ibg/{IBS.java => IBG.java} | 15 +++++++++---- .../java/com/imbgt/ibg/item/ModItems.java | 21 ++++++++++++++++++ src/main/resources/assets/ibg/lang/en_us.json | 3 +++ .../assets/ibg/models/item/lathe.json | 6 +++++ .../assets/ibg/textures/item/lathe.png | Bin 0 -> 392 bytes 8 files changed, 43 insertions(+), 19 deletions(-) rename src/main/java/com/imbgt/ibg/{IBS.java => IBG.java} (86%) create mode 100644 src/main/java/com/imbgt/ibg/item/ModItems.java create mode 100644 src/main/resources/assets/ibg/lang/en_us.json create mode 100644 src/main/resources/assets/ibg/models/item/lathe.json create mode 100644 src/main/resources/assets/ibg/textures/item/lathe.png diff --git a/build.gradle b/build.gradle index c6807f3..76a6341 100644 --- a/build.gradle +++ b/build.gradle @@ -25,19 +25,6 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // official MCVersion Official field/method names from Mojang mapping files - // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official - // - // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started - // - // Use non-default mappings at your own risk. They may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. diff --git a/gradle.properties b/gradle.properties index a44cb77..2f05487 100644 --- a/gradle.properties +++ b/gradle.properties @@ -42,7 +42,7 @@ mapping_version=2023.09.03-1.20.1 # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} # Must match the String constant located in the main mod class annotated with @Mod. -mod_id=ibs +mod_id=ibg # The human-readable display name for the mod. mod_name=Immersed by Greg # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. diff --git a/src/main/java/com/imbgt/ibg/Config.java b/src/main/java/com/imbgt/ibg/Config.java index 55ee4bc..3f82b3b 100644 --- a/src/main/java/com/imbgt/ibg/Config.java +++ b/src/main/java/com/imbgt/ibg/Config.java @@ -15,7 +15,7 @@ import java.util.stream.Collectors; // An example config class. This is not required, but it's a good idea to have one to keep your config organized. // Demonstrates how to use Forge's config APIs -@Mod.EventBusSubscriber(modid = IBS.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +@Mod.EventBusSubscriber(modid = IBG.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class Config { private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); diff --git a/src/main/java/com/imbgt/ibg/IBS.java b/src/main/java/com/imbgt/ibg/IBG.java similarity index 86% rename from src/main/java/com/imbgt/ibg/IBS.java rename to src/main/java/com/imbgt/ibg/IBG.java index 4a1e111..ea17623 100644 --- a/src/main/java/com/imbgt/ibg/IBS.java +++ b/src/main/java/com/imbgt/ibg/IBG.java @@ -1,7 +1,9 @@ package com.imbgt.ibg; +import com.imbgt.ibg.item.ModItems; import com.mojang.logging.LogUtils; import net.minecraft.client.Minecraft; +import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; @@ -18,16 +20,18 @@ import net.minecraftforge.registries.ForgeRegistries; import org.slf4j.Logger; // The value here should match an entry in the META-INF/mods.toml file -@Mod(IBS.MOD_ID) -public class IBS { +@Mod(IBG.MOD_ID) +public class IBG { // Define mod id in a common place for everything to reference - public static final String MOD_ID = "ibs"; + public static final String MOD_ID = "ibg"; // Directly reference a slf4j logger private static final Logger LOGGER = LogUtils.getLogger(); - public IBS(FMLJavaModLoadingContext context) { + public IBG(FMLJavaModLoadingContext context) { IEventBus modEventBus = context.getModEventBus(); + ModItems.register(modEventBus); + // Register the commonSetup method for modloading modEventBus.addListener(this::commonSetup); @@ -47,6 +51,9 @@ public class IBS { // Add the example block item to the building blocks tab private void addCreative(BuildCreativeModeTabContentsEvent event) { + if(event.getTabKey() == CreativeModeTabs.REDSTONE_BLOCKS) { + event.accept(ModItems.LATHE); + } } // You can use SubscribeEvent and let the Event Bus discover methods to call diff --git a/src/main/java/com/imbgt/ibg/item/ModItems.java b/src/main/java/com/imbgt/ibg/item/ModItems.java new file mode 100644 index 0000000..87f13e8 --- /dev/null +++ b/src/main/java/com/imbgt/ibg/item/ModItems.java @@ -0,0 +1,21 @@ +package com.imbgt.ibg.item; + +import com.imbgt.ibg.IBG; + +import net.minecraft.world.item.Item; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class ModItems { + + public static final DeferredRegister ITEMS_REGISTER = DeferredRegister.create(ForgeRegistries.ITEMS, IBG.MOD_ID); + + + public static final RegistryObject LATHE = ITEMS_REGISTER.register("lathe",() -> new Item(new Item.Properties())); + + public static void register(IEventBus eventBus) { + ITEMS_REGISTER.register(eventBus); + } +} diff --git a/src/main/resources/assets/ibg/lang/en_us.json b/src/main/resources/assets/ibg/lang/en_us.json new file mode 100644 index 0000000..ea9e045 --- /dev/null +++ b/src/main/resources/assets/ibg/lang/en_us.json @@ -0,0 +1,3 @@ +{ + "item.ibg.lathe": "Lathe" +} diff --git a/src/main/resources/assets/ibg/models/item/lathe.json b/src/main/resources/assets/ibg/models/item/lathe.json new file mode 100644 index 0000000..452cc0d --- /dev/null +++ b/src/main/resources/assets/ibg/models/item/lathe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "ibg:item/lathe" + } +} diff --git a/src/main/resources/assets/ibg/textures/item/lathe.png b/src/main/resources/assets/ibg/textures/item/lathe.png new file mode 100644 index 0000000000000000000000000000000000000000..54bfb78575b3cd11c1212c0daa777d13947730ca GIT binary patch literal 392 zcmV;30eAk1P)Px$LPX_1|S2z%65YFF}~>sYe3cvV&nA! zSR*tb?`?n0pe}Qi;nsyyaD&h_gVkfp3&@5jd5VISpgSF=4|gUJR{SsEx{Cp10D9ab mTZ%U~f?NVpj2vj_E(QP~qNx$a8!|rt0000