Correct mod id and add simple item

This commit is contained in:
2025-07-21 10:57:03 +02:00
parent 0cc3f53636
commit 43aacfa2e1
8 changed files with 43 additions and 19 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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();

View File

@@ -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

View File

@@ -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<Item> ITEMS_REGISTER = DeferredRegister.create(ForgeRegistries.ITEMS, IBG.MOD_ID);
public static final RegistryObject<Item> LATHE = ITEMS_REGISTER.register("lathe",() -> new Item(new Item.Properties()));
public static void register(IEventBus eventBus) {
ITEMS_REGISTER.register(eventBus);
}
}

View File

@@ -0,0 +1,3 @@
{
"item.ibg.lathe": "Lathe"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "ibg:item/lathe"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B