### Mixin Integration for EntityPlayer in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt Demonstrates how to use Mixin to inject code into the EntityPlayer class. This example adds a print statement to the 'jump' method. It requires the Mixin library and a compatible Minecraft Forge environment. ```java package mymod.mixin; import net.minecraft.entity.player.EntityPlayer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(EntityPlayer.class) public abstract class MixinEntityPlayer { @Inject(method = "jump", at = @At("HEAD")) private void onJump(CallbackInfo ci) { EntityPlayer self = (EntityPlayer)(Object)this; System.out.println(self.getName() + " jumped!"); } } ``` -------------------------------- ### Register Custom World Generator in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt Implements the IWorldGenerator interface to add custom world generation features like ores and terrain. Generators are weighted for execution order. This example generates custom ore in the Overworld and Nether. ```java package mymod; import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModWorldGen implements IWorldGenerator { private final WorldGenMinable customOreGen; public ModWorldGen() { IBlockState oreState = ModBlocks.CUSTOM_ORE.getDefaultState(); // Generate veins of 8 blocks, replacing stone customOreGen = new WorldGenMinable(oreState, 8, state -> state.getBlock() == Blocks.STONE); } public static void register() { // Weight 0 = runs early, higher = runs later GameRegistry.registerWorldGenerator(new ModWorldGen(), 0); } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { int dim = world.provider.getDimension(); if (dim == 0) { // Overworld generateOverworld(random, chunkX, chunkZ, world); } else if (dim == -1) { // Nether generateNether(random, chunkX, chunkZ, world); } } private void generateOverworld(Random random, int chunkX, int chunkZ, World world) { // Generate custom ore: 10 veins per chunk between Y=5 and Y=64 for (int i = 0; i < 10; i++) { int x = chunkX * 16 + random.nextInt(16); int y = 5 + random.nextInt(59); int z = chunkZ * 16 + random.nextInt(16); customOreGen.generate(world, random, new BlockPos(x, y, z)); } } private void generateNether(Random random, int chunkX, int chunkZ, World world) { // Nether-specific generation for (int i = 0; i < 5; i++) { int x = chunkX * 16 + random.nextInt(16); int y = 10 + random.nextInt(108); int z = chunkZ * 16 + random.nextInt(16); BlockPos pos = new BlockPos(x, y, z); if (world.getBlockState(pos).getBlock() == Blocks.NETHERRACK) { world.setBlockState(pos, ModBlocks.NETHER_ORE.getDefaultState()); } } } } ``` -------------------------------- ### Initialize and Send Network Packets in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt This Java code demonstrates the initialization of a SimpleNetworkWrapper and provides methods for sending custom network packets. It includes functions to send messages to specific players, all players in a dimension, players around a certain point, and to the server. Dependencies include Netty and Forge's network API. ```java package mymod; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.relauncher.Side; public class ModNetwork { public static SimpleNetworkWrapper INSTANCE; private static int packetId = 0; public static void init() { INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("myawesomemod"); // Register packets INSTANCE.registerMessage( SyncDataMessage.Handler.class, SyncDataMessage.class, packetId++, Side.CLIENT ); INSTANCE.registerMessage( ActionRequestMessage.Handler.class, ActionRequestMessage.class, packetId++, Side.SERVER ); } // Send to specific player public static void sendToPlayer(IMessage message, EntityPlayerMP player) { INSTANCE.sendTo(message, player); } // Send to all players in dimension public static void sendToDimension(IMessage message, int dimensionId) { INSTANCE.sendToDimension(message, dimensionId); } // Send to all players near a point public static void sendToAllAround(IMessage message, int dim, double x, double y, double z, double range) { INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(dim, x, y, z, range)); } // Send to server public static void sendToServer(IMessage message) { INSTANCE.sendToServer(message); } } // Server -> Client message public class SyncDataMessage implements IMessage { private BlockPos pos; private int value; public SyncDataMessage() {} public SyncDataMessage(BlockPos pos, int value) { this.pos = pos; this.value = value; } @Override public void fromBytes(ByteBuf buf) { pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); value = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(pos.getX()); buf.writeInt(pos.getY()); buf.writeInt(pos.getZ()); buf.writeInt(value); } public static class Handler implements IMessageHandler { @Override public IMessage onMessage(SyncDataMessage message, MessageContext ctx) { // Schedule on main thread Minecraft.getMinecraft().addScheduledTask(() -> { // Handle message on client System.out.println("Received sync: " + message.pos + " = " + message.value); }); return null; } } } // Client -> Server message public class ActionRequestMessage implements IMessage { private int actionId; public ActionRequestMessage() {} public ActionRequestMessage(int actionId) { this.actionId = actionId; } @Override public void fromBytes(ByteBuf buf) { actionId = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(actionId); } public static class Handler implements IMessageHandler { @Override public IMessage onMessage(ActionRequestMessage message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().player; player.getServerWorld().addScheduledTask(() -> { // Handle action on server System.out.println("Player " + player.getName() + " requested action " + message.actionId); }); return null; } } } ``` -------------------------------- ### Initialize and Load Configuration - Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt This Java code snippet demonstrates how to initialize and load a configuration file for a Minecraft mod using the CleanroomMC Configuration system. It defines properties for boolean, integer, double, and string array types, assigns them to categories, and sets default values and comments. The configuration is loaded from a file and saved if any changes are detected. ```java package mymod; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.io.File; public class ModConfig { public static Configuration config; // Config values public static boolean enableFeature; public static int maxStackSize; public static double damageMultiplier; public static String[] allowedDimensions; public static void init(FMLPreInitializationEvent event) { File configFile = new File(event.getModConfigurationDirectory(), "myawesomemod.cfg"); config = new Configuration(configFile, "1.0.0"); try { config.load(); // Boolean property enableFeature = config.getBoolean( "enableFeature", Configuration.CATEGORY_GENERAL, true, "Enable the main mod feature" ); // Integer property with bounds maxStackSize = config.getInt( "maxStackSize", Configuration.CATEGORY_GENERAL, 64, 1, 64, "Maximum stack size for custom items" ); // Double property with bounds damageMultiplier = config.getFloat( "damageMultiplier", "combat", 1.5f, 0.1f, 10.0f, "Damage multiplier for custom weapons" ); // String array property allowedDimensions = config.getStringList( "allowedDimensions", "world", new String[]{"0", "-1", "1"}, "List of dimension IDs where mod features are enabled" ); // Add category comments config.setCategoryComment(Configuration.CATEGORY_GENERAL, "General mod settings"); config.setCategoryComment("combat", "Combat-related settings"); config.setCategoryComment("world", "World generation settings"); } finally { if (config.hasChanged()) { config.save(); } } } public static void syncConfig() { // Re-read values (useful for in-game config changes) enableFeature = config.get(Configuration.CATEGORY_GENERAL, "enableFeature", true).getBoolean(); maxStackSize = config.get(Configuration.CATEGORY_GENERAL, "maxStackSize", 64).getInt(); if (config.hasChanged()) { config.save(); } } } ``` -------------------------------- ### Implement Energy Storage and Transfer in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt Demonstrates a TileEntity implementing IEnergyStorage to generate and transfer energy. It customizes EnergyStorage for specific capacity and transfer rates, handles energy generation per tick, and pushes energy to adjacent machines via capabilities. Includes NBT saving and loading for energy state. ```java package mymod; import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.energy.IEnergyStorage; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; public class TileEntityGenerator extends TileEntity implements ITickable { // Custom energy storage with 100,000 FE capacity, 1000 FE/t max transfer private final EnergyStorage energyStorage = new EnergyStorage(100000, 1000, 1000) { @Override public int receiveEnergy(int maxReceive, boolean simulate) { int received = super.receiveEnergy(maxReceive, simulate); if (!simulate && received > 0) markDirty(); return received; } @Override public int extractEnergy(int maxExtract, boolean simulate) { int extracted = super.extractEnergy(maxExtract, simulate); if (!simulate && extracted > 0) markDirty(); return extracted; } }; @Override public void update() { if (!world.isRemote) { // Generate 50 FE per tick energyStorage.receiveEnergy(50, false); // Push energy to adjacent machines for (EnumFacing facing : EnumFacing.values()) { TileEntity neighbor = world.getTileEntity(pos.offset(facing)); if (neighbor != null && neighbor.hasCapability(CapabilityEnergy.ENERGY, facing.getOpposite())) { IEnergyStorage neighborStorage = neighbor.getCapability(CapabilityEnergy.ENERGY, facing.getOpposite()); if (neighborStorage != null && neighborStorage.canReceive()) { int toTransfer = energyStorage.extractEnergy(1000, true); int transferred = neighborStorage.receiveEnergy(toTransfer, false); energyStorage.extractEnergy(transferred, false); } } } } } @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing); } @Override public T getCapability(Capability capability, EnumFacing facing) { if (capability == CapabilityEnergy.ENERGY) { return (T) energyStorage; } return super.getCapability(capability, facing); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("energy", energyStorage.getEnergyStored()); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); energyStorage.receiveEnergy(compound.getInteger("energy"), false); } } ``` -------------------------------- ### Mixin Configuration File Source: https://context7.com/cleanroommc/cleanroom/llms.txt Defines the configuration for Mixin, specifying the package for mixins, compatibility level, refmap, and which mixins to apply to client, server, or all environments. This JSON file is essential for the Mixin loader to function. ```json // resources/myawesomemod.mixins.json { "required": true, "package": "mymod.mixin", "compatibilityLevel": "JAVA_8", "refmap": "myawesomemod.refmap.json", "mixins": [ "MixinEntityPlayer" ], "client": [ "MixinMinecraft" ], "server": [ "MixinMinecraftServer" ], "injectors": { "defaultRequire": 1 } } ``` -------------------------------- ### Define and Implement Mana Capability in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt This Java code defines an IMana interface for mana-related operations, a ManaStorage class as a default implementation, and a ManaCapability class for registering and accessing the capability. It also includes a ManaProvider class to attach this capability to entities. ```java package mymod; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilitySerializable; // Define capability interface public interface IMana { int getMana(); void setMana(int mana); int getMaxMana(); void consumeMana(int amount); } // Default implementation public class ManaStorage implements IMana { private int mana = 0; private int maxMana = 100; @Override public int getMana() { return mana; } @Override public void setMana(int mana) { this.mana = Math.min(mana, maxMana); } @Override public int getMaxMana() { return maxMana; } @Override public void consumeMana(int amount) { mana = Math.max(0, mana - amount); } } // Capability holder class public class ManaCapability { @CapabilityInject(IMana.class) public static Capability MANA_CAP = null; public static final ResourceLocation ID = new ResourceLocation("myawesomemod", "mana"); public static void register() { CapabilityManager.INSTANCE.register( IMana.class, new Capability.IStorage() { @Override public NBTBase writeNBT(Capability capability, IMana instance, EnumFacing side) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("mana", instance.getMana()); return nbt; } @Override public void readNBT(Capability capability, IMana instance, EnumFacing side, NBTBase nbt) { instance.setMana(((NBTTagCompound) nbt).getInteger("mana")); } }, ManaStorage::new ); } } // Capability provider for attaching to entities public class ManaProvider implements ICapabilitySerializable { private final IMana mana = new ManaStorage(); @Override public boolean hasCapability(Capability capability, EnumFacing facing) { return capability == ManaCapability.MANA_CAP; } @Override public T getCapability(Capability capability, EnumFacing facing) { return capability == ManaCapability.MANA_CAP ? (T) mana : null; } @Override public NBTTagCompound serializeNBT() { return (NBTTagCompound) ManaCapability.MANA_CAP.getStorage() .writeNBT(ManaCapability.MANA_CAP, mana, null); } @Override public void deserializeNBT(NBTTagCompound nbt) { ManaCapability.MANA_CAP.getStorage() .readNBT(ManaCapability.MANA_CAP, mana, null, nbt); } } ``` -------------------------------- ### Register Blocks and Items using RegistryEvent - Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt This Java code demonstrates how to register custom blocks and items during mod loading using Forge's RegistryEvent.Register. It includes registering an ItemBlock for a custom block and a standalone item. Dependencies include Forge's event handling system and Minecraft's registry objects. ```java package mymod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; @ObjectHolder("myawesomemod") public class ModBlocks { public static final Block CUSTOM_BLOCK = null; // Injected by Forge public static final Item CUSTOM_ITEM = null; // Injected by Forge } @Mod.EventBusSubscriber(modid = "myawesomemod") public class RegistryHandler { @SubscribeEvent public static void onBlockRegistry(RegistryEvent.Register event) { Block customBlock = new Block(Material.ROCK) .setRegistryName(new ResourceLocation("myawesomemod", "custom_block")) .setUnlocalizedName("myawesomemod.custom_block") .setHardness(3.0f) .setResistance(5.0f) .setCreativeTab(CreativeTabs.BUILDING_BLOCKS); event.getRegistry().register(customBlock); } @SubscribeEvent public static void onItemRegistry(RegistryEvent.Register event) { // Register ItemBlock for custom block Item customBlockItem = new ItemBlock(ModBlocks.CUSTOM_BLOCK) .setRegistryName(ModBlocks.CUSTOM_BLOCK.getRegistryName()); // Register standalone item Item customItem = new Item() .setRegistryName(new ResourceLocation("myawesomemod", "custom_item")) .setUnlocalizedName("myawesomemod.custom_item") .setMaxStackSize(64) .setCreativeTab(CreativeTabs.MISC); event.getRegistry().registerAll(customBlockItem, customItem); } } ``` -------------------------------- ### Manifest Entry for Mixin Configuration Source: https://context7.com/cleanroommc/cleanroom/llms.txt Specifies the Mixin configuration file to be loaded by the Mixin bootstrapper. This entry is placed within the META-INF/MANIFEST.MF file of the mod's JAR. ```properties // Manifest entry (META-INF/MANIFEST.MF) MixinConfigs: myawesomemod.mixins.json ``` -------------------------------- ### Register Custom Fluid and Block in Java (Forge) Source: https://context7.com/cleanroommc/cleanroom/llms.txt This Java code demonstrates how to register a custom fluid (Molten Steel) and its corresponding block using the Forge API. It defines fluid properties such as density, viscosity, temperature, and luminosity, and registers the fluid and its block for in-world use. Dependencies include Forge's fluid system and Minecraft's block and item registration events. ```java package mymod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ModFluids { public static Fluid MOLTEN_STEEL; public static BlockFluidClassic MOLTEN_STEEL_BLOCK; public static void registerFluids() { MOLTEN_STEEL = new Fluid( "molten_steel", new ResourceLocation("myawesomemod", "blocks/molten_steel_still"), new ResourceLocation("myawesomemod", "blocks/molten_steel_flow") ) .setDensity(7000) // Heavier than water (1000) .setViscosity(6000) // Flows slower than water (1000) .setTemperature(1800) // Very hot (kelvin) .setLuminosity(15) // Emits maximum light .setUnlocalizedName("myawesomemod.molten_steel"); FluidRegistry.registerFluid(MOLTEN_STEEL); FluidRegistry.addBucketForFluid(MOLTEN_STEEL); } @Mod.EventBusSubscriber(modid = "myawesomemod") public static class RegistryHandler { @SubscribeEvent public static void onBlockRegistry(RegistryEvent.Register event) { MOLTEN_STEEL_BLOCK = (BlockFluidClassic) new BlockFluidClassic(MOLTEN_STEEL, Material.LAVA) .setRegistryName(new ResourceLocation("myawesomemod", "molten_steel")) .setUnlocalizedName("myawesomemod.molten_steel"); // Link fluid to block MOLTEN_STEEL.setBlock(MOLTEN_STEEL_BLOCK); event.getRegistry().register(MOLTEN_STEEL_BLOCK); } } } // Enable universal bucket in mod constructor @Mod(modid = "myawesomemod", name = "My Awesome Mod", version = "1.0.0") public class MyAwesomeMod { static { FluidRegistry.enableUniversalBucket(); } @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { ModFluids.registerFluids(); } } ``` -------------------------------- ### Register and Handle Events with EventBus (Java) Source: https://context7.com/cleanroommc/cleanroom/llms.txt The EventBus system allows mods to subscribe to and handle game events. Methods annotated with @SubscribeEvent are automatically registered when the containing class is registered to the event bus. Events can be cancelled if they implement ICancelable. ```java package mymod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraft.init.Items; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; // Option 1: Auto-registration via annotation on class @Mod.EventBusSubscriber(modid = "myawesomemod") public class ModEventHandler { @SubscribeEvent(priority = EventPriority.NORMAL) public static void onLivingDrops(LivingDropsEvent event) { // Add bonus diamond drops when killing mobs if (!event.getEntity().world.isRemote) { EntityItem drop = new EntityItem( event.getEntity().world, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(Items.DIAMOND) ); event.getDrops().add(drop); } } @SubscribeEvent public static void onBlockBreak(BlockEvent.BreakEvent event) { // Cancel block breaking in certain conditions if (event.getState().getBlock().getHardness() > 50.0f) { event.setCanceled(true); } } } // Option 2: Manual registration in mod init public class ManualEventHandler { public void register() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onBlockPlace(BlockEvent.PlaceEvent event) { System.out.println("Block placed: " + event.getPlacedBlock()); } } ``` -------------------------------- ### Register Crafting Recipes in Java Source: https://context7.com/cleanroommc/cleanroom/llms.txt Registers shaped, shapeless, and smelting recipes using Forge's GameRegistry. Recipes are registered during the RegistryEvent.Register event. Supports item stacks, ingredients, and ore dictionary entries. ```java package mymod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreIngredient; @Mod.EventBusSubscriber(modid = "myawesomemod") public class ModRecipes { @SubscribeEvent public static void onRecipeRegistry(RegistryEvent.Register event) { // Shaped recipe: 3x3 pattern GameRegistry.addShapedRecipe( new ResourceLocation("myawesomemod", "custom_block"), new ResourceLocation("myawesomemod"), new ItemStack(ModBlocks.CUSTOM_BLOCK), "III", "IDI", "III", 'I', Items.IRON_INGOT, 'D', Items.DIAMOND ); // Shapeless recipe GameRegistry.addShapelessRecipe( new ResourceLocation("myawesomemod", "custom_item"), new ResourceLocation("myawesomemod"), new ItemStack(ModItems.CUSTOM_ITEM, 4), Ingredient.fromItem(Items.GOLD_INGOT), Ingredient.fromItem(Items.REDSTONE), new OreIngredient("gemDiamond") // Ore dictionary support ); // Smelting recipe GameRegistry.addSmelting( ModBlocks.CUSTOM_ORE, // Input new ItemStack(ModItems.CUSTOM_INGOT), // Output 1.0f // Experience ); // Smelting with ItemStack input GameRegistry.addSmelting( new ItemStack(Items.GOLDEN_APPLE, 1, 1), // Enchanted golden apple new ItemStack(Items.GOLD_INGOT, 8), 0.5f ); } } ``` -------------------------------- ### Declare Mod with @Mod Annotation (Java) Source: https://context7.com/cleanroommc/cleanroom/llms.txt The @Mod annotation is used to declare a class as a Forge mod, specifying its ID, name, version, dependencies, and accepted Minecraft versions. This is essential for FML to recognize and load the mod. ```java package mymod; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @Mod( modid = "myawesomemod", name = "My Awesome Mod", version = "1.0.0", dependencies = "required:forge@[14.23.5.2847,);after:jei@[4.15.0,)", acceptedMinecraftVersions = "[1.12.2]", updateJSON = "https://example.com/update.json" ) public class MyAwesomeMod { public static final String MODID = "myawesomemod"; @Instance(MODID) public static MyAwesomeMod instance; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Read config, create blocks/items, register with GameRegistry System.out.println("Pre-initialization phase"); } @EventHandler public void init(FMLInitializationEvent event) { // Register recipes, send inter-mod communications System.out.println("Initialization phase"); } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Handle interaction with other mods System.out.println("Post-initialization phase"); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.