Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
stringlengths
7
9
module
stringclasses
5 values
instruction
stringlengths
74
360
context
stringlengths
0
1.01k
golden_reference
stringlengths
317
3.56k
eval_criteria
dict
API_001
api
In NeoForge 1.21.1, register a mod item `example_item` with an EPIC rarity using DeferredRegister, and bind the registry to the correct event bus from the mod constructor. The mod id is `examplemod`.
package com.example.examplemod; import net.minecraft.world.item.Item; import net.minecraft.world.item.Rarity; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredRegister; @Mod(ExampleMod.M...
{ "must_compile": true, "required_annotations": [ "@Mod" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_002
api
NeoForge 1.21.1: register a simple block `example_block` and its BlockItem under the same name using DeferredRegister.Blocks and DeferredRegister.Items. Bind both registries in the mod constructor.
package com.example.examplemod; import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MapColor; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import n...
{ "must_compile": true, "required_annotations": [ "@Mod" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_003
api
NeoForge 1.21.1: register a `BlockEntityType` named `example_block_entity` that is valid for the block `ExampleMod.EXAMPLE_BLOCK`, bound to the mod event bus. Use BlockEntityType.Builder with a supplier.
public class ExampleBlockEntity extends BlockEntity { public ExampleBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.EXAMPLE_BLOCK_ENTITY.get(), pos, state); } }
package com.example.examplemod; import com.example.examplemod.block.ExampleBlockEntity; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.D...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_004
api
NeoForge 1.21.1: register a creative mode tab `example_tab` titled 'Example Tab' whose icon is `ExampleMod.EXAMPLE_ITEM` and which displays that item. Bind the registry to the mod event bus.
Existing item registry: public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID); public static final DeferredItem<Item> EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item");
package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neo...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_005
api
NeoForge 1.21.1: register a `DataComponentType<Integer>` named `charge` with an INT persistent codec and VAR_INT network codec. Use DeferredRegister over Registries.DATA_COMPONENT_TYPE and DeferredRegister#registerComponent.
package com.example.examplemod; import com.mojang.serialization.Codec; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.Registries; import net.minecraft.network.codec.ByteBufCodecs; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neofor...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_006
api
NeoForge 1.21.1: register an `AttachmentType<Integer>` named `mana` that defaults to 50, is serialized with Codec.INT and survives player death (copyOnDeath). Show how to read/write it on an Entity.
package com.example.examplemod; import com.mojang.serialization.Codec; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.attachment.AttachmentType; import net.neoforged.neoforge.registries.DeferredRegister; import net.neoforged.neoforge.registries.NeoForgeRegist...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_007
api
NeoForge 1.21.1: a mod constructor receives `IEventBus modEventBus`. Explain with code which events go on the mod event bus and which go on `NeoForge.EVENT_BUS`, and demonstrate registering a `RegisterCapabilitiesEvent` listener on the correct bus from the constructor.
package com.example.examplemod; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event....
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_008
api
NeoForge 1.21.1: register a creature entity `example_creature` (EntityType) and give it attributes (MAX_HEALTH 20, MOVEMENT_SPEED 0.25) via EntityAttributeCreationEvent. Show both the registry and the correct event-bus subscription.
public class ExampleCreature extends PathfinderMob { public ExampleCreature(EntityType<? extends PathfinderMob> type, Level level) { super(type, level); } }
package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecra...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_009
api
NeoForge 1.21.1: register a `MenuType` for `ExampleMenu` (constructor `(int containerId, Inventory playerInv, FriendlyByteBuf data)`) using `IMenuTypeExtension.create`, and register its screen on the correct client event. Use mod id `examplemod`.
public class ExampleMenu extends AbstractContainerMenu { public ExampleMenu(int containerId, Inventory playerInv, FriendlyByteBuf data) { super(ModMenuTypes.EXAMPLE_MENU.get(), containerId); } @Override public ItemStack quickMoveStack(Player player, int index) { return ItemStack.EMPTY; } @Ov...
package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.world.inventory.MenuType; import net.neoforged.api.Dist; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; import net.neo...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_010
api
NeoForge 1.21.1: define a serverbound custom payload `UseWandPayload(int x, int y, int z)` implementing CustomPacketPayload with a VAR_INT StreamCodec, and register a server-side handler via RegisterPayloadHandlersEvent. Mod id `examplemod`.
package com.example.examplemod.net; import com.example.examplemod.ExampleMod; import io.netty.buffer.ByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.ResourceLocation; public record UseWandPayload(int x, in...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_011
api
NeoForge 1.21.1: register a `SoundEvent` named `example_sound` using SoundEvent.createVariableRangeEvent and a fixed-range variant `example_fixed_sound` with a 32-tick range. Bind to the mod event bus.
package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.DeferredHolder; import net.neof...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_012
api
NeoForge 1.21.1: register a particle type `sparkle` as a `SimpleParticleType` and expose a `ParticleOptions` for spawning. Bind to the mod event bus; only registration and holder are required.
package com.example.examplemod; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.SimpleParticleType; import net.minecraft.core.registries.Registries; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.DeferredHolder...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_013
api
NeoForge 1.21.1: register a recipe serializer for `ExampleRecipe implements Recipe<RecipeInput>` using `SimpleCraftingRecipeSerializer`, and register the matching RecipeType. Bind both to the mod event bus.
public class ExampleRecipe implements Recipe<RecipeInput> { // 1.21.1 Recipe<T> methods: matches(RecipeInput, Level), assemble(RecipeInput, HolderLookup.Provider), // canCraftInDimensions(int, int), getResultItem(HolderLookup.Provider), getSerializer(), getType() }
package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; import net.neoforged.bus.api.IEventBus; import net.ne...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_014
api
NeoForge 1.21.1: create a tool item `example_pickaxe` with Tiers.IRON, durability override 512, and an `Item.Properties` that also stores a custom data component `ExampleMod.CHARGE` defaulting to 0. Show the registration only.
package com.example.examplemod; import net.minecraft.world.item.Item; import net.minecraft.world.item.PickaxeItem; import net.minecraft.world.item.Tiers; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.reg...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_015
api
NeoForge 1.21.1: register a game-bus event handler class for `LivingDeathEvent` that prints the dead entity name, using @Mod.EventBusSubscriber with the correct bus, and a mod-bus class for `FMLCommonSetupEvent`. Show both classes.
package com.example.examplemod; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; // GAME bus (NeoForge.EVENT...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent", "@Mod.EventBusSubscriber" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_016
api
NeoForge 1.21.1: register a command `/example hello` that replies 'Hello from examplemod!' via RegisterCommandsEvent. Put the handler on the correct event bus and use Brigadier's literal().
package com.example.examplemod; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.network.chat.Component; import net.neoforged.bus.api.SubscribeEvent; ...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_017
api
NeoForge 1.21.1: define a `ModConfigSpec` with a boolean `enabled=true` and an int `maxRange=32`, register it as a COMMON config from the mod constructor, and add a reload listener on the mod bus.
package com.example.examplemod; import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.ModContainer; import net.neoforged.fml.config.ModConfig; import net.neoforged.fml.event.config.ModConfigEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_018
api
NeoForge 1.21.1: register a `PoiType` named `example_poi` bound to `ExampleMod.EXAMPLE_BLOCK` with maxTickets 1 and validRange 16, and register the matching `VillagerProfession` `example_prof`. Bind to the mod event bus.
package com.example.examplemod; import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.entity.npc.VillagerP...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_019
api
NeoForge 1.21.1 client: register a `KeyMapping` (key R, category 'key.categories.examplemod') via RegisterKeyMappingsEvent and poll `consumeClick()` in a ClientTickEvent.Post handler. Both handlers belong on which bus? Write the class with the correct annotations.
package com.example.examplemod.client; import com.example.examplemod.ExampleMod; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.client.KeyMapping; import net.neoforged.api.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.clie...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent", "RegisterKeyMappingsEvent", "ClientTickEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
API_020
api
NeoForge 1.21.1: an event handler must run ONLY on the physical client. Show a @Mod.EventBusSubscriber with dist filtering using the correct NeoForge `Dist` import, and explain why @OnlyIn must not be used.
package com.example.examplemod.client; import com.example.examplemod.ExampleMod; import net.neoforged.api.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.client.event.RenderLevelStageEvent; // NeoForge: Dist lives in net.neoforged.api.Dist. // @Onl...
{ "must_compile": true, "required_annotations": [ "@Mod.EventBusSubscriber", "Dist.CLIENT" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text" ], "gametest_required": false }
MIXIN_001
mixin
Write a Mixin that logs the player's position at the END of every Player#tick(). Use @Inject at TAIL. Vanilla target (Mojang mappings): net.minecraft.world.entity.player.Player#tick()V.
Vanilla target (Mojang mappings): package net.minecraft.world.entity.player; public abstract class Player extends LivingEntity { public void tick() { ... } }
package com.example.examplemod.mixin; import net.minecraft.world.entity.player.Player; 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(Player.class...
{ "must_compile": true, "required_annotations": [ "@Inject", "@Mixin" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_002
mixin
Write a Mixin that cancels ALL fire damage in LivingEntity#hurt. Target (Mojang mappings): net.minecraft.world.entity.LivingEntity#hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z. Cancel only when the DamageSource type is IN_FIRE.
package com.example.examplemod.mixin; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.LivingEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin....
{ "must_compile": true, "required_annotations": [ "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_003
mixin
Write a @Redirect Mixin inside LivingEntity#hurt that skips the call to actuallyHurt(...) when the incoming amount is 0. Give the exact INVOKE target string in Mojang mappings.
Decompiled call site (Mojang mappings): public boolean hurt(DamageSource source, float amount) { ... this.actuallyHurt(source, amount); ... }
package com.example.examplemod.mixin; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.LivingEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(LivingEntity.class) publi...
{ "must_compile": true, "required_annotations": [ "@Redirect" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_004
mixin
Use @ModifyVariable to double the food parameter passed into FoodData#eat(IF)V (Mojang mappings). Modify only the first int argument, not any fields.
Vanilla target: package net.minecraft.world.food; public class FoodData { public void eat(int food, float saturation) { ... } }
package com.example.examplemod.mixin; import net.minecraft.world.food.FoodData; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(FoodData.class) public abstract class FoodDataMixin { // argsOnly = true r...
{ "must_compile": true, "required_annotations": [ "@ModifyVariable" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_005
mixin
Use @ModifyConstant to raise the hardcoded saturation cap `20` inside FoodData#eat(IF)V (Mojang mappings) to 40.
Decompiled snippet: public void eat(int food, float saturation) { this.foodLevel = Math.min(food + this.foodLevel, 20); ... }
package com.example.examplemod.mixin; import net.minecraft.world.food.FoodData; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; @Mixin(FoodData.class) public abstract class FoodDataConstantMixin { @Modif...
{ "must_compile": true, "required_annotations": [ "@ModifyConstant" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_006
mixin
Fill in the missing pieces (FIM) of this Mixin so it shadows the private final field `cooldowns` of net.minecraft.world.entity.player.Player and prints the cooldown item count at Player#tick TAIL. The private field is declared as `private final ItemCooldowns cooldowns;`.
Partial mixin (incomplete): package com.example.examplemod.mixin; @Mixin(Player.class) public abstract class PlayerShadowMixin { // TODO: shadow `private final ItemCooldowns cooldowns` // TODO: inject at TAIL of tick()V and print cooldowns.size() }
package com.example.examplemod.mixin; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemCooldowns; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import or...
{ "must_compile": true, "required_annotations": [ "@Shadow", "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_007
mixin
Write an @Accessor Mixin interface exposing the private field `target` of net.minecraft.world.entity.monster.Mob (declared `private LivingEntity target;`) as a getter, and show how it is called from mod code.
package com.example.examplemod.mixin; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Mob; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(Mob.class) public interface MobAccessor { // The accessor method name must match t...
{ "must_compile": true, "required_annotations": [ "@Accessor" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_008
mixin
Write an @Invoker Mixin exposing Entity's private collision callback `private void touch(Entity entity)` (Mojang mappings) as a public method named `examplemod$tryTouch`, and show a call site.
Vanilla declaration (Mojang mappings): package net.minecraft.world.entity; public abstract class Entity { private void touch(Entity entity) { ... } }
package com.example.examplemod.mixin; import net.minecraft.world.entity.Entity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(Entity.class) public interface EntityInvoker { // @Invoker exposes the private method; the annotation value is the vanilla method name. ...
{ "must_compile": true, "required_annotations": [ "@Invoker" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_009
mixin
Use MixinExtras' @ModifyReturnValue to make Item#use return pass-through logic: if the vanilla result is `success`, return `consume` instead. Target (Mojang mappings): net.minecraft.world.item.Item#use(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/InteractionHand;)Lnet/...
MixinsExtras is bundled with NeoForge 1.21.1 (com.llamalad7.mixinextras).
package com.example.examplemod.mixin; import com.llamalad7.mixinextras.injector.ModifyReturnValue; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemS...
{ "must_compile": true, "required_annotations": [ "@ModifyReturnValue" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_010
mixin
Use MixinExtras' @WrapOperation to double the healing amount that HoneyBottleItem passes to LivingEntity#heal(float) inside finishUsingItem. Give the exact INVOKE target string.
Decompiled call site (Mojang mappings): package net.minecraft.world.item; public class HoneyBottleItem extends Item { public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity entity) { ... entity.heal(6.0F); ... } }
package com.example.examplemod.mixin; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.HoneyBottleItem; import org.spongepowered.asm.mixin.Mixin; impo...
{ "must_compile": true, "required_annotations": [ "@WrapOperation" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_011
mixin
Write an @Inject with LocalCapture.CAPTURE_FAILHARD into Entity#move(MoverType, Vec3) that captures the local `Vec3 vec3 = this.getDeltaMovement();` assigned right after movement starts, and logs it. Provide the exact @At with INVOKE_ASSIGN.
Decompiled opening of the target (Mojang mappings): public void move(MoverType type, Vec3 pos) { ... Vec3 vec3 = this.getDeltaMovement(); ... }
package com.example.examplemod.mixin; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.MoverType; import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.s...
{ "must_compile": true, "required_annotations": [ "@Inject", "LocalCapture" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_012
mixin
Write an @Inject that runs exactly when LivingEntity#tick writes to the field `deathTime` (public int deathTime). Use a FIELD @At with the correct opcode, and complete it with the correct import for Opcodes.
Field: public int deathTime; written as this.deathTime++ inside LivingEntity#tick()V.
package com.example.examplemod.mixin; import net.minecraft.world.entity.LivingEntity; import org.objectweb.asm.Opcodes; 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.C...
{ "must_compile": true, "required_annotations": [ "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_013
mixin
Write `examplemod.mixins.json`: common mixins in the package com.example.examplemod.mixin, CLIENT-only mixins in com.example.examplemod.mixin.client, refmap `examplemod.refmap.json`, Mixin 0.8.7, JAVA_21 compatibility, require=1. Explain why client mixins must go into the `client` section on a NeoForge dedicated server...
{ "required": true, "minVersion": "0.8.5", "package": "com.example.examplemod.mixin", "compatibilityLevel": "JAVA_21", "refmap": "examplemod.refmap.json", "injectors": { "defaultRequire": 1 }, "mixins": [ "PlayerMixin", "LivingEntityMixin", "MobAccessor", "EntityInvoker" ], "clie...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_014
mixin
Register `examplemod.mixins.json` for NeoForge 1.21.1 in `neoforge.mods.toml` (1.21.1 style). Show the exact TOML table. Also state where the mixin config file must be located in the jar.
# neoforge.mods.toml (inside src/main/resources/META-INF/) modLoader = "javafml" loaderVersion = "[4,)" license = "MIT" [[mods]] modId = "examplemod" version = "1.0.0" displayName = "Example Mod" # Mixin configs are registered per config file, one [[mixins]] table each: [[mixins]] config = "examplemod.mixins.json" [...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_015
mixin
Write a cancellable @Inject into net.minecraft.world.item.ItemStack#isEnchantable()Z that returns false when a custom data component `ExampleMod.CURSED` is present on the stack. Explain the required return type of the CallbackInfo for a boolean method.
package com.example.examplemod.mixin; import net.minecraft.world.item.ItemStack; 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.CallbackInfoReturnable; @Mixin(ItemStac...
{ "must_compile": true, "required_annotations": [ "@Inject", "CallbackInfoReturnable" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_016
mixin
Write an @Inject into the HEAD of net.minecraft.world.entity.Entity#setPos(DDD)V that logs position writes only when the entity is a ServerPlayer. Explain why the instanceof check is done on the casted `this`.
package com.example.examplemod.mixin; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; 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.ca...
{ "must_compile": true, "required_annotations": [ "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_017
mixin
FIM: complete the @At("INVOKE_ASSIGN") injection that captures the boolean returned by ItemStack#hurt(int, RandomSource, ServerPlayer) inside ItemStack#hurtAndBreak(int, LivingEntity, EquipmentSlot). Vanilla 1.21.1 uses the EquipmentSlot overload.
Partial mixin: @Mixin(ItemStack.class) public abstract class ItemStackHurtMixin { @Inject( method = "hurtAndBreak(ILnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/entity/EquipmentSlot;)V", at = @At(/* TODO */) ) private void examplemod$onDurabilityDamage(int amount, LivingE...
package com.example.examplemod.mixin; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org....
{ "must_compile": true, "required_annotations": [ "@Inject", "INVOKE_ASSIGN" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_018
mixin
Write a mixin that adds a private helper method `examplemod$isFullMoon(Level)` to Player via @Unique and calls it from a TAIL injection of tick()V. Explain why @Unique is mandatory here.
package com.example.examplemod.mixin; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org....
{ "must_compile": true, "required_annotations": [ "@Unique", "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_019
mixin
Given the decompiled vanilla method below, write the EXACT `method` and `at` target strings for an @Inject that fires when Item#appendHoverText adds its first tooltip line. Vanilla 1.21.1 signature: appendHoverText(ItemStack, Item.TooltipContext, List<Component>, TooltipFlag).
Decompiled (Mojang mappings, 1.21.1): public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> tooltip, TooltipFlag flag) { ... }
package com.example.examplemod.mixin; 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(net.minecraft.world.item.Item.class) public abstract class It...
{ "must_compile": true, "required_annotations": [ "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIXIN_020
mixin
A user reports: `InjectionError: Critical injection failure: @Inject annotation on examplemod$afterHurt could not find any targets matching 'hurt(Lnet/minecraft/world/damagesource/DamageSource;F)V' in net.minecraft.world.entity.LivingEntity`. Diagnose the bug and provide the corrected mixin.
Failing handler: @Inject(method = "hurt(Lnet/minecraft/world/damagesource/DamageSource;F)V", at = @At("TAIL")) private void examplemod$afterHurt(CallbackInfo ci) { ... } Actual vanilla signature (Mojang mappings): public boolean hurt(DamageSource source, float amount) - returns boolean, not void.
/* Diagnosis: * The declared descriptor says the method returns V ('V' = void) but LivingEntity#hurt returns * boolean (Z). Mixin resolves `method` by exact descriptor match when a descriptor is present; * no overload with (DamageSource, float) -> void exists, so the injection target set is EMPTY * and Mixin's defa...
{ "must_compile": true, "required_annotations": [ "@Inject" ], "forbidden_apis": [ "net.minecraftforge" ], "gametest_required": false }
MIG_001
migration
Migrate this Forge 1.20.1 event handler to NeoForge 1.21.1: replace the game event bus and update all imports.
// Forge 1.20.1 import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; @Mod("examplemod") public class ExampleMod { public ExampleMod() { IEventBus bus = Min...
// NeoForge 1.21.1 package com.example.examplemod; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; @Mod(ExampleMod.MODID) public class ExampleMod { public static final St...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_002
migration
Migrate these two @Mod.EventBusSubscriber classes from Forge 1.20.1 to NeoForge 1.21.1 (bus enum values changed).
// Forge 1.20.1 import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.event.entity.playe...
// NeoForge 1.21.1 package com.example.examplemod; import net.neoforged.api.Dist; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; // Forge's Bus.FORGE ...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent", "@Mod.EventBusSubscriber" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJav...
MIG_003
migration
Migrate this Forge 1.20.1 mod entry point (FMLJavaModLoadingContext) to the NeoForge 1.21.1 constructor-injection style.
// Forge 1.20.1 import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod("examplemod") public class ExampleMod { public ExampleMod() { IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.Item; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.Deferr...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_004
migration
Migrate this Forge 1.20.1 item that stores an `energy` value in item NBT to NeoForge 1.21.1 using a registered DataComponentType instead of CompoundTag.
// Forge 1.20.1 public class BatteryItem extends Item { public BatteryItem(Properties props) { super(props); } public int getEnergy(ItemStack stack) { return stack.getOrCreateTag().getInt("energy"); } public void setEnergy(ItemStack stack, int value) { stack.getOrCreateTag().putInt("en...
// NeoForge 1.21.1 package com.example.examplemod; import com.mojang.serialization.Codec; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.Registries; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemS...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_005
migration
Migrate this Forge 1.20.1 config class to NeoForge 1.21.1 (new spec class + new registration path via ModContainer).
// Forge 1.20.1 import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.config.ModConfig; public class Config { public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); public static final ForgeConfigSpec.Boole...
// NeoForge 1.21.1 package com.example.examplemod; import net.neoforged.fml.ModContainer; import net.neoforged.fml.config.ModConfig; import net.neoforged.neoforge.common.ModConfigSpec; public class Config { public static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); public static final Mo...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_006
migration
Migrate this Forge 1.20.1 block entity capability exposure (LazyOptional) to the NeoForge 1.21.1 capability system (RegisterCapabilitiesEvent + BlockCapability, no LazyOptional).
// Forge 1.20.1 public class StorageBlockEntity extends BlockEntity { private final LazyOptional<net.minecraftforge.items.IItemHandler> handler = LazyOptional.of(() -> new net.minecraftforge.items.ItemStackHandler(9)); public StorageBlockEntity(BlockPos pos, BlockState state) { super(ModBlo...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mo...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "Forge...
MIG_007
migration
Migrate this Forge 1.20.1 SimpleChannel packet to NeoForge 1.21.1: CustomPacketPayload record + PayloadRegistrar registration.
// Forge 1.20.1 import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; public final class Net { private static final String VERSION = "1"; public static SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel(...
// NeoForge 1.21.1 package com.example.examplemod.net; import com.example.examplemod.ExampleMod; import io.netty.buffer.ByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraf...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "Forge...
MIG_008
migration
Migrate this Forge 1.20.1 spawn egg registration to NeoForge 1.21.1 (DeferredSpawnEggItem).
// Forge 1.20.1 import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.common.ForgeSpawnEggItem; public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeR...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.world.item.Item; import net.neoforged.neoforge.registries.DeferredItem; import net.neoforged.neoforge.registries.DeferredSpawnEggItem; import net.neoforged.neoforge.registries.DeferredRegister; public class ModItems { public static final Defe...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_009
migration
Migrate this Forge 1.20.1 player tick handler to NeoForge 1.21.1 (TickEvent was split into Pre/Post events).
// Forge 1.20.1 import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = "examplemod") public class TickHandlers { @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) ...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.world.entity.player.Player; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.tick.PlayerTickEvent; @Mod.EventBusSubscriber(modid = ExampleMod.MODID) public class TickHandlers { ...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "Forge...
MIG_010
migration
Migrate this legacy (1.16-era, still compiling on 1.20.1 via old imports) text code to NeoForge 1.21.1 Component/ChatFormatting APIs.
// Legacy Forge (1.16 style retained on 1.20.1) import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; public final class Messages { public static ITextComponent status(String name, boolean ok) { return new StringTex...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; public final class Messages { // net.minecraft.util.text.* was removed long ago; 1.21.1 uses // Component.literal / Componen...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_011
migration
Migrate this Forge 1.20.1 mods.toml to a complete NeoForge 1.21.1 neoforge.mods.toml (file name, loaderVersion range, dependency tables).
# Forge 1.20.1 META-INF/mods.toml modLoader = "javafml" loaderVersion = "[47,)" license = "MIT" [[mods]] modId = "examplemod" version = "1.0.0" displayName = "Example Mod" [[dependencies.examplemod]] modId = "forge" mandatory = true versionRange = "[47,)" ordering = "NONE" side = "BOTH" [[depende...
# NeoForge 1.21.1 META-INF/neoforge.mods.toml # (renamed from mods.toml; `mandatory` was replaced by `type`; `forge` dependency -> `neoforge`) modLoader = "javafml" loaderVersion = "[4,)" license = "MIT" [[mods]] modId = "examplemod" version = "1.0.0" displayName = "Example Mod" [[dependencies.neoforge]] modId = "neo...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistEx...
MIG_012
migration
Migrate this Forge 1.20.1 extended menu opening (NetworkHooks.openScreen) to NeoForge 1.21.1.
// Forge 1.20.1 import net.minecraftforge.network.NetworkHooks; public static void open(BlockPos pos, ServerPlayer player, MachineBlockEntity be) { NetworkHooks.openScreen(player, new SimpleMenuProvider( (id, inv, p) -> new MachineMenu(id, inv, be), Component.literal("Machine")), pos); }
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.SimpleMenuProvider; public final class MachineOpening { // NetworkHooks.openScreen was removed. NeoForge routes extra open-data through //...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_013
migration
Migrate this Forge 1.20.1 IForgeItem#getShareTag implementation to NeoForge 1.21.1 (data components replace share tags; show the component-based equivalent).
// Forge 1.20.1 public class CoolerItem extends Item { public CoolerItem(Properties props) { super(props); } @Override public CompoundTag getShareTag(ItemStack stack) { CompoundTag tag = super.getShareTag(stack); if (tag == null) tag = new CompoundTag(); tag.putInt("temperature", re...
// NeoForge 1.21.1 package com.example.examplemod; import com.mojang.serialization.Codec; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.Registries; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemS...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_014
migration
Migrate this Forge 1.20.1 ResourceLocation construction code to NeoForge 1.21.1 (the public constructor was removed in 1.20.6).
// Forge 1.20.1 import net.minecraft.resources.ResourceLocation; public final class Ids { public static final ResourceLocation TEXTURE = new ResourceLocation("examplemod", "textures/gui/machine.png"); public static ResourceLocation of(String namespace, String path) { return new ResourceLoc...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.resources.ResourceLocation; public final class Ids { // `new ResourceLocation(...)` was removed in 1.20.6; the static factories are mandatory. public static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPa...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_015
migration
Migrate this Forge 1.20.1 MobEffect registration to NeoForge 1.21.1 (the no-arg MobEffect constructor was removed in 1.20.5).
// Forge 1.20.1 import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public static final DeferredRegister<MobEff...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.core.registries.Registries; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; publ...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_016
migration
Migrate this Forge 1.20.1 registry lookup code (ForgeRegistries) to NeoForge 1.21.1 using BuiltInRegistries.
// Forge 1.20.1 import net.minecraftforge.registries.ForgeRegistries; public final class Lookups { public static Item itemById(String id) { return ForgeRegistries.ITEMS.getValue(new ResourceLocation(id)); } public static boolean isRegisteredItem(Item item) { return ForgeRegistries.ITEMS.ge...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; public final class Lookups { // ForgeRegistries is gone; vanilla's BuiltInRegistries is the single source of truth. ...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
MIG_017
migration
Migrate this Forge 1.20.1 EntityJoinWorldEvent handler to NeoForge 1.21.1.
// Forge 1.20.1 import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = "examplemod") public class JoinHandlers { @SubscribeEvent public static void onJoin(EntityJoinWorldEvent ...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.world.entity.monster.Creeper; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; @Mod.EventBusSubscriber(modid = ExampleMod.MODID) public class JoinHa...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "Forge...
MIG_018
migration
Migrate this Forge 1.20.1 event priority subscription to NeoForge 1.21.1 (EventPriority moved packages).
// Forge 1.20.1 import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.event.entity.living.LivingDeathEvent; @Mod.EventBusSubscriber(modid = "examplemod") public class PriorityHandlers { @Subsc...
// NeoForge 1.21.1 package com.example.examplemod; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; @Mod.EventBusSubscriber(modid = ExampleMod.MODID) public class PriorityHa...
{ "must_compile": true, "required_annotations": [ "@SubscribeEvent" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "Forge...
MIG_019
migration
Migrate this Forge 1.20.1 DistExecutor client-only init to NeoForge 1.21.1 (DistExecutor was removed).
// Forge 1.20.1 import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; @Mod("examplemod") public class ExampleMod { public ExampleMod() { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ClientInit.registerSc...
// NeoForge 1.21.1 package com.example.examplemod; import net.neoforged.api.Dist; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.fml.loading.FMLEnvironment; @Mod(ExampleMod.MODID) public class ExampleMod { public static final String MODID = "examplemod"; publ...
{ "must_compile": true, "required_annotations": [ "@Mod" ], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec"...
MIG_020
migration
Migrate this Forge 1.20.1 ItemStack <-> NBT serialization to NeoForge 1.21.1 (registry access is now mandatory; use ItemStack.CODEC).
// Forge 1.20.1 import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; public final class StackIo { public static CompoundTag save(ItemStack stack) { CompoundTag tag = new CompoundTag(); stack.save(tag); return tag; } public static ItemStack load(CompoundT...
// NeoForge 1.21.1 package com.example.examplemod; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; import com.mojang.serialization.Dynamic; import com.mojang.serialization.DynamicOps;...
{ "must_compile": true, "required_annotations": [], "forbidden_apis": [ "net.minecraftforge", "MinecraftForge.EVENT_BUS", "net.minecraft.util.text", "LazyOptional", "getOrCreateTag", "NetworkRegistry", "SimpleChannel", "FMLJavaModLoadingContext", "ForgeConfigSpec", "DistExe...
DEBUG_001
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
---- Minecraft Crash Report ---- // Time: 2026-01-14 19:03:22 CET Description: Initializing game java.lang.NoSuchMethodError: 'void net.minecraft.world.item.Item.<init>(net.minecraft.world.item.Item$Properties)' at TRANSFORMER/fancybattery@1.4.2/net.fancybattery.BatteryItem.<init>(BatteryItem.java:12) at TRANSFORMER...
{ "root_cause": "fancybattery was compiled against Minecraft 1.20.4. In 1.20.4 Item has no-arg-free constructor chain matching Item$Properties - the Item(Properties) constructor signature changed in 1.20.5/1.21 (Item became constructible only through deferred/Item.Properties with DataComponent support and the constru...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_002
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Worker-Main-2/ERROR] [ne.neof.ev.Reg/]: Registry Object not present: examplemod:wand_core java.lang.IllegalStateException: Registry Object not present: examplemod:wand_core at TRANSFORMER/examplemod@1.0.0/net.neoforged.neoforge.registries.DeferredHolder.get(DeferredHolder.java:41) at TRANSFORMER/examplemod@1.0.0/com...
{ "root_cause": "The mod constructor reads DeferredHolder.get() during the CONSTRUCT phase, but registry entries only become available after registry events finish (new registry event system - no 'RegistryEvent.Register' phase gating). Accessing the holder before entries are bound throws 'Registry Object not present'...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_003
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [mixin/]: Mixin apply failed: mixin.examplemod.json:PlayerMixin org.spongepowered.asm.mixin.transformer.MixinApplyError: Mixin [mixin.examplemod.json:PlayerMixin] from phase [DEFAULT] in config [mixin.examplemod.json] FAILED during APPLY Caused by: InjectionError: Critical injection failure: @Inject annota...
{ "root_cause": "The mixin's declared method descriptor declares void ('V') as the return type, but the real LivingEntity#hurt(DamageSource, float) returns boolean ('Z'). With NeoForge 1.21.1 running Mojmap at runtime, `method` strings must match the mapped descriptor exactly; the target set is empty and Mixin's defa...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_004
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Mod 'examplemod' caused an exception during modloading Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/Minecraft for invalid dist DEDICATED_SERVER at TRANSFORMER/examplemod@1.0.0/com.example.ClientProxy.<init>(ClientProxy.java:18) at TRANSFORMER/exampl...
{ "root_cause": "The common code path unconditionally constructs ClientProxy, whose constructor references net.minecraft.client.Minecraft - a client-only class. On a dedicated server (dist DEDICATED_SERVER) the class fails to load with 'invalid dist DEDICATED_SERVER'.", "fix_explanation": "Never touch client classe...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_005
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.mo/]: Mod 'examplemod' failed to load java.lang.RuntimeException: Cannot listen to event net.neoforged.neoforge.event.entity.EntityJoinLevelEvent on the MOD event bus: the event does not implement IModBusEvent at TRANSFORMER/examplemod@1.0.0/net.neoforged.fml.ModLoader.validate(ModLoader.java:212)...
{ "root_cause": "The handler class subscribes a GAME-bus event (EntityJoinLevelEvent, a gameplay event) on the MOD event bus. NeoForge validates bus/event pairing at load: events that do not implement IModBusEvent are rejected on the mod bus.", "fix_explanation": "Either drop the `bus = Bus.MOD` so the class lands ...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_006
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Mod file examplemod-1.0.0.jar is missing mods.toml file net.neoforged.fml.loading.FMLLoader$ModLoadingException: Missing or invalid mod metadata File: examplemod-1.0.0.jar Expected: META-INF/mods.toml or META-INF/neoforge.mods.toml (found neither) Build tool: ForgeGradle 6 (legacy 1.20.1 p...
{ "root_cause": "NeoForge 1.21.1 requires META-INF/neoforge.mods.toml. The jar was built from a 1.20.1 project whose processResources still copies META-INF/mods.toml (and the loader does not accept that legacy file for 21.x).", "fix_explanation": "Rename resources/META-INF/mods.toml to neoforge.mods.toml, migrate i...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_007
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Missing or unsupported mandatory dependencies: Mod File: jei-1.20.1-forge-15.2.0.27.jar Mod: examplemod Required by: examplemod-1.0.0.jar Dependency: jei@[15.20.0.27,) Minecraft:[1.20.1] Reason: dependency 'jei' targets minecraft [1.20.1] but 1.21.1 is present
{ "root_cause": "examplemod declares a mandatory dependency pinned to a JEI build compiled for 1.20.1. The loader's dependency resolution correctly refuses to run: the JEI artifact for 1.21.1 uses a different version line (JEI 19.x.x for 1.21.1 on NeoForge).", "fix_explanation": "Update the dependency entry to the ...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_008
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Exception during mod construction of examplemod java.lang.UnsupportedClassVersionError: com/example/ExampleMod has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime recognizes class versions up to 61.0 at java.base/java....
{ "root_cause": "The mod jar was compiled with Java 21 (class file 65) but the server JVM is Java 17 (class file 61). NeoForge 21.1.x itself targets Java 21, so the environment JVM is wrong for both the loader and the mod.", "fix_explanation": "Run the server (and the client launcher profile) with Java 21+. This is...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_009
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [mixin/]: Mixin apply failed: mixin.examplemod.json:FoodDataMixin org.spongepowered.asm.mixin.injection.modify.InvalidModificationException: @ModifyVariable annotation on examplemod$doubleFood could not find any matching variables in the target method at org.spongepowered.asm.mixin.injection.modify.LocalV...
{ "root_cause": "@ModifyVariable without argsOnly=true scans LOCAL VARIABLES of the target method; at @At(\"RETURN\") the int locals available do not uniquely/deterministically match the selector (no ordinal, no explicit name given), so the discriminator finds no candidate. The intent is to modify the int PARAMETER, ...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_010
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Server thread/ERROR]: Encountered an unexpected exception net.minecraft.ReportedException: Ticking player Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.item.ItemStack.getItem()" because "stack" is null at TRANSFORMER/examplemod@1.0.0/com.example.WandHandler.onRightClick(WandHandler.jav...
{ "root_cause": "The RightClickItem handler dereferences event.getItemStack() without a null check. In NeoForge 1.21.1 PlayerInteractEvent.RightClickItem#getItemStack() can be null when the interaction is triggered with an empty hand.", "fix_explanation": "Guard the handler: fetch the stack once, check for null/EMP...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_011
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Server thread/ERROR]: Failed to save chunk 12,-4 in level "ServerLevel[world]" com.mojang.serialization.ReportedException: Loading NBT data Caused by: net.minecraft.ReportedException: Caught exception encoding ItemStack: java.lang.IllegalStateException: Can't serialize unregistered component examplemod:charge at net....
{ "root_cause": "A DataComponentType was used on ItemStacks but its DeferredRegister was never bound to the mod event bus (or the registration supplier returned null), so the component exists in memory during play but is not present in the built-in registry when ItemStack.save encodes the stack. Unregistered componen...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_012
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Mod 'examplemod' failed during construction java.lang.NoClassDefFoundError: net/minecraftforge/event/TickEvent$PlayerTickEvent at TRANSFORMER/examplemod@1.9.9/com.example.TickHandlers.<clinit>(TickHandlers.java:6) Caused by: java.lang.ClassNotFoundException: net.minecraftforge.event.TickE...
{ "root_cause": "The mod is a straight jar copy from Forge 1.20.1: its TickHandlers class still imports net.minecraftforge.event.TickEvent$PlayerTickEvent. On NeoForge 21.1.x the entire net.minecraftforge namespace is absent (packages are net.neoforged.*), so the class cannot be linked.", "fix_explanation": "Recomp...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_013
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.re.Reg/]: Exception registering examplemod:example_item java.lang.IllegalStateException: Duplicate registry entry: examplemod:example_item (attempted re-registration) at net.neoforged.neoforge.registries.RegisterHelper.register(RegisterHelper.java:88) at TRANSFORMER/examplemod@1.0.0/com.example.ModIt...
{ "root_cause": "The same registry name is registered twice. Typical causes: (1) the mod calls its registration method manually in addition to DeferredRegister binding, (2) two DeferredRegister instances with the same modid register colliding names, or (3) a StaticInit-time call duplicated the register() invocation."...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_014
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Netty Server IO #1/ERROR] [ne.neof.ne.NetworkHandler]: Exception in network handler java.lang.IllegalStateException: Attempted to modify Level 'ServerLevel[world]' from thread 'Netty Server IO #1' - world access must happen on the server thread at net.minecraft.server.level.ServerLevel.checkThread(ServerLevel.java:XX...
{ "root_cause": "The payload handler executed game logic directly on the network thread. NeoForge payload handlers run on the network thread unless you move work onto the main thread; world/level mutations are main-thread-only.", "fix_explanation": "Wrap the game logic in context.enqueueWork(...) (IPayloadContext) ...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_015
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Server thread/ERROR]: Block entity examplemod:storage threw exception during tick java.lang.NullPointerException: Cannot invoke "net.neoforged.neoforge.items.IItemHandler.getSlots()" because the return value of "net.minecraft.world.level.block.entity.BlockEntity.getBlockState()" ... handler is null at TRANSFORMER/exa...
{ "root_cause": "The block entity was half-migrated: tick code still resolves the item handler through the old LazyOptional/ForgeCapabilities path that NeoForge removed, so the lookup returns null and the NPE follows. On NeoForge 1.21.1 capability providers are registered centrally with RegisterCapabilitiesEvent and ...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_016
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Server thread/ERROR] [mixin/]: Mixin apply failed: mixin.examplemod.json:GuiMixin org.spongepowered.asm.mixin.transformer.ClassNotFoundException: The specified target class net.minecraft.client.gui.Gui for mixin [GuiMixin] was not found Dist: DEDICATED_SERVER Config file: mixin.examplemod.json ("mixins" section)
{ "root_cause": "A client-only vanilla target (net.minecraft.client.gui.Gui) is listed in the COMMON `mixins` section of the config. On a dedicated server those classes never load, so Mixin cannot find the target class and the apply fails fatally.", "fix_explanation": "Move the mixin class into the `client` section...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_017
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Failed to create mod instance of examplemod java.lang.RuntimeException: InvokeTargetException while invoking mod constructor Caused by: java.lang.NoSuchMethodException: com.example.ExampleMod.<init>(net.neoforged.neoforge.common.ModConfigSpec) at net.neoforged.fml.ModContainer.construct(M...
{ "root_cause": "FML injects only a fixed set of constructor parameter types: (), (IEventBus), (ModContainer), or (IEventBus, ModContainer). A ModConfigSpec parameter is not an injectable type, so constructor lookup fails with NoSuchMethodException.", "fix_explanation": "Change the constructor to the supported (IEv...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_018
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[Worker-Main-3/ERROR] [ne.fml.mo.Mod/]: Exception during parallel mod construction of jei java.lang.IllegalStateException: Registry Object not present: jei:jei at TRANSFORMER/examplemod@1.0.0/com.example.JeiBridge.<clinit>(JeiBridge.java:9) Note: JeiBridge does `public static final Object PLUGIN = new JeiPlugin()` at ...
{ "root_cause": "During construction mods load in parallel. examplemod's static initializer touches JEI's classes (expecting JEI's registry entries to be present), but JEI's own construction may not have completed - a cross-mod construction-order dependency. Registry holders are only guaranteed after registration eve...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_019
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.mo.Mod/]: Failed to load JEI plugin service java.util.ServiceConfigurationError: mezz.jei.api.IGuiHelper? mezz.jei.api.helpers.IGuiHelper not a provider? Actual line in jar: META-INF/services/mezz.jei.api.IModPlugin Caused by: java.lang.ClassNotFoundException: com.example.MyJeiPlugin Service file...
{ "root_cause": "The JEI plugin is registered through Java's ServiceLoader: META-INF/services/mezz.jei.api.IModPlugin must list the FQCN of the provider class. The service file contains a misspelled class name (MyJeiPlguin), so ClassNotFound aborts service construction.", "fix_explanation": "Correct the FQCN inside...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
DEBUG_020
debug
Analyze the FML crash/log snippet below for a NeoForge 1.21.1 dedicated server. Return ONLY a JSON object with keys root_cause, fix_explanation, code_patch. Reference concrete FML/NeoForge terminology; do not give generic advice such as 'update your Java' unless the log shows a class-version error.
[main/ERROR] [ne.fml.lo.mo/]: Incompatible mod set! Mod 'ancientsword' requires 'minecraft' version [1.20.1], but 1.21.1 is present. Mod file: ancientsword-2.3.jar Mod metadata: META-INF/mods.toml (declared minecraft versionRange "[1.20.1]") Loader: NeoForge 21.1.77 Loaded mods: 47 (examplemod, jei, ancientsword, .....
{ "root_cause": "ancientsword is a 1.20.1 build whose neoforge.mods.toml pins minecraft to [1.20.1]. The loader refuses the mod set before any class loading - this is metadata-level incompatibility, not a runtime bug.", "fix_explanation": "Get ancientsword 2.4+ built for 1.21.1, or (if you maintain it) bump its met...
{ "must_compile": false, "required_annotations": [], "forbidden_apis": [], "gametest_required": false }
BUILD_001
build
Write a complete `build.gradle.kts` for a NeoForge 1.21.1 mod using NeoGradle 7 (userdev), Gradle 8.x, Java 21 toolchain, dependency net.neoforged:neoforge:21.1.77, mod id `examplemod`, with client/server/data run configs.
plugins { id("java-library") id("net.neoforged.gradle.userdev") version "7.0.145" } group = "com.example" version = "1.0.0" java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } base { archivesName = "examplemod" } repositories { mavenCentral() maven("https://maven....
{ "must_compile": false, "required_annotations": [ "plugins {", "net.neoforged.gradle.userdev", "JavaLanguageVersion.of(21)", "neoforge:21.1.77", "runs {", "client()", "server()", "data()" ], "forbidden_apis": [ "net.minecraftforge", "forgegradle", "ForgeGradle" ], ...
BUILD_002
build
Write a complete `neoforge.mods.toml` for NeoForge 1.21.1: mod `examplemod` v1.0.0, MIT license, required NeoForge [21.1.0,) and Minecraft [1.21.1], optional client-side JEI dependency, and a mixin config registration.
# META-INF/neoforge.mods.toml modLoader = "javafml" loaderVersion = "[4,)" license = "MIT" issueTrackerURL = "https://github.com/example/examplemod/issues" [[mods]] modId = "examplemod" version = "1.0.0" displayName = "Example Mod" description = "An example mod for NeoForge 1.21.1." authors = "ExampleTeam" displayURL ...
{ "must_compile": false, "required_annotations": [ "modLoader = \"javafml\"", "loaderVersion = \"[4,)\"", "[[mods]]", "[[dependencies.neoforge]]", "[[dependencies.minecraft]]", "[[mixins]]", "neoforge.mods.toml" ], "forbidden_apis": [], "gametest_required": false }
BUILD_003
build
Add CurseMaven to a NeoForge 1.21.1 `build.gradle.kts` so that CurseForge-ported mods can be declared as `implementation` dependencies, and declare JEI via a curse.maven coordinate. Use content filtering so CurseMaven only serves `curse.maven`.
repositories { exclusiveContent { forRepository { maven { name = "CurseMaven" url = uri("https://cursemaven.com") } } filter { includeGroup("curse.maven") } } mavenCentral() maven("https://maven.neoforged...
{ "must_compile": false, "required_annotations": [ "cursemaven.com", "curse.maven", "exclusiveContent", "includeGroup" ], "forbidden_apis": [], "gametest_required": false }
BUILD_004
build
Configure Modrinth publishing with the Minotaur plugin in `build.gradle.kts` for a NeoForge 1.21.1 mod: project id `examplemod`, game version 1.21.1, loader `neoforge`, release type `release`, uploading the main jar.
plugins { id("com.modrinth.minotaur") version "2.+" } modrinth { token.set(providers.gradleProperty("modrinthToken").orElse(providers.environmentVariable("MODRINTH_TOKEN"))) projectId.set("examplemod") versionNumber.set(project.version.toString()) versionType.set("release") gameVersions.set(lis...
{ "must_compile": false, "required_annotations": [ "com.modrinth.minotaur", "modrinth {", "projectId", "gameVersions", "loaders", "\"1.21.1\"", "\"neoforge\"" ], "forbidden_apis": [], "gametest_required": false }
BUILD_005
build
Configure Jar-in-Jar (JiJ) in NeoGradle 7 for a NeoForge 1.21.1 mod: bundle `org.example:somelib` with a Maven version range [1.2,2.0) pinned to 1.6.1. Show both the dependency block and the task wiring that makes `assemble` produce the JiJ jar.
dependencies { implementation("net.neoforged:neoforge:21.1.77") jarJar(implementation("org.example:somelib:[1.2,2.0)")) { jarJar.pin(it, "1.6.1") } } tasks { // NG7: the jarJar task bundles the pinned dependency inside the mod jar. named("assemble") { dependsOn("jarJar") } }
{ "must_compile": false, "required_annotations": [ "jarJar(", "jarJar.pin", "dependsOn", "[1.2,2.0)" ], "forbidden_apis": [], "gametest_required": false }
BUILD_006
build
Harden a NeoForge 1.21.1 `build.gradle.kts`: force Java 21 for compile/runtime, UTF-8 resources, `-Xlint:deprecation` warnings, and make the build fail on warnings from javac.
java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } tasks.withType<JavaCompile>().configureEach { options.encoding = "UTF-8" options.compilerArgs.addAll(listOf("-Xlint:deprecation", "-Werror")) options.release.set(21) } tasks.withType<ProcessResources>().configureEach { ...
{ "must_compile": false, "required_annotations": [ "JavaLanguageVersion.of(21)", "options.encoding = \"UTF-8\"", "-Xlint:deprecation", "options.release.set(21)" ], "forbidden_apis": [], "gametest_required": false }
BUILD_007
build
A 1.20.1 ForgeGradle project migrates to NeoForge 1.21.1 with ModDevGradle (MDG). Write the complete `build.gradle.kts` using the `net.neoforged.moddev` plugin, including run configs and the neoforge version 21.1.77.
plugins { id("java-library") id("net.neoforged.moddev") version "1.0.24" } group = "com.example" version = "1.0.0" java { toolchain { languageVersion = JavaLanguageVersion.of(21) } } neoForge { version = "21.1.77" parchment { // optional: mappingsArtifact = "..." } run...
{ "must_compile": false, "required_annotations": [ "net.neoforged.moddev", "neoForge {", "version = \"21.1.77\"", "client()", "server()", "data()", "mods {" ], "forbidden_apis": [ "net.minecraftforge", "forgegradle", "ForgeGradle" ], "gametest_required": false }
BUILD_008
build
Wire an access transformer for NeoForge 1.21.1 with NeoGradle 7: register `META-INF/accesstransformer.cfg` in the build and show the AT file using the NEW NeoForge syntax (no leading `#`) to make the private field `net.minecraft.client.Minecraft.soundHandler` public and to make `net.minecraft.world.entity.LivingEntity....
// build.gradle.kts (NeoGradle 7) accessTransformers { file(project.file("src/main/resources/META-INF/accesstransformer.cfg")) } # src/main/resources/META-INF/accesstransformer.cfg # NeoForge 1.20.2+ syntax: <access>[-final-f] <fully.qualified.Class>[ field:|method()|()] public net.minecraft.client.Minecraft sound...
{ "must_compile": false, "required_annotations": [ "accessTransformers {", "accesstransformer.cfg", "public net.minecraft.client.Minecraft soundHandler", "public-f net.minecraft.world.entity.LivingEntity hurtTime" ], "forbidden_apis": [], "gametest_required": false }
BUILD_009
build
Set up repositories for a NeoForge 1.21.1 project that needs: (1) NeoForged maven for the loader, (2) Modrinth maven for runtime mods, (3) CurseMaven, each with content filtering. Write the repositories block.
repositories { mavenCentral() maven("https://maven.neoforged.net/releases") { content { includeGroupByRegex("net\\.neoforged.*") } } exclusiveContent { forRepository { maven("https://api.modrinth.com/maven") { name = "Modrinth" } } ...
{ "must_compile": false, "required_annotations": [ "maven.neoforged.net", "api.modrinth.com/maven", "cursemaven.com", "includeGroup(\"maven.modrinth\")", "includeGroup(\"curse.maven\")" ], "forbidden_apis": [], "gametest_required": false }
BUILD_010
build
Expand `${mod_version}` / `${mc_version}` placeholders into `neoforge.mods.toml` during processResources in a Gradle 8 Kotlin DSL build, handling CRLF safely and enabling template expansion only for that file.
val modVersion = project.version.toString() val mcVersion = "1.21.1" tasks.processResources { inputs.property("mod_version", modVersion) inputs.property("mc_version", mcVersion) filesMatching("META-INF/neoforge.mods.toml") { expand( "mod_version" to modVersion, "mc_version"...
{ "must_compile": false, "required_annotations": [ "filesMatching", "META-INF/neoforge.mods.toml", "expand(", "filteringCharset" ], "forbidden_apis": [], "gametest_required": false }
BUILD_011
build
Make Mixin's annotation processor generate the refmap for a NeoForge 1.21.1 NeoGradle 7 build, and register the mixin config in the mod metadata. Show the dependency line and compiler config.
dependencies { implementation("net.neoforged:neoforge:21.1.77") // Mixin annotation processor -> generates examplemod.refmap.json at compile time annotationProcessor("org.spongepowered:mixin:0.8.7:processor") } // neoforge.mods.toml additionally needs: // [[mixins]] // config = "examplemod.mixins.json" //...
{ "must_compile": false, "required_annotations": [ "annotationProcessor", "org.spongepowered:mixin:0.8.7", "refmap", "[[mixins]]" ], "forbidden_apis": [], "gametest_required": false }
BUILD_012
build
Structure a multi-loader NeoForge 1.21.1 workspace: a `common` source set holding shared code and a `main` (neoforge) source set depending on it. Write the source set configuration and cross-source-set dependency in `build.gradle.kts`.
sourceSets { val common = create("common") { java { srcDir("src/common/java") } resources { srcDir("src/common/resources") } } val main = main { java { srcDir("src/main/java") } resources { srcDir("src/ma...
{ "must_compile": false, "required_annotations": [ "sourceSets {", "create(\"common\")", "compileClasspath", "runtimeClasspath", "modSource" ], "forbidden_apis": [], "gametest_required": false }
BUILD_013
build
Pin the Gradle distribution and configure `settings.gradle.kts` plugin resolution (Gradle Plugin Portal + NeoForged maven) for a NeoForge 1.21.1 project. Show both files.
# gradle/wrapper/gradle-wrapper.properties distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists // settings.gradle.kts plu...
{ "must_compile": false, "required_annotations": [ "gradle-8.9-bin.zip", "pluginManagement {", "gradlePluginPortal()", "maven.neoforged.net/releases", "rootProject.name" ], "forbidden_apis": [], "gametest_required": false }
BUILD_014
build
Configure a data-generation run for NeoGradle 7 / NeoForge 1.21.1 that writes generated resources into `src/generated/resources` while keeping `src/main/resources` readable for `--existing`, then wire the generated folder into the source sets.
sourceSets.main { resources { srcDir("src/generated/resources") } } runs { data { data() programArguments.addAll( "--mod", "examplemod", "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/r...
{ "must_compile": false, "required_annotations": [ "src/generated/resources", "--output", "--existing", "data()" ], "forbidden_apis": [], "gametest_required": false }
BUILD_015
build
Explain and configure jar packaging for NeoForge 1.21.1: why `reobfJar` no longer exists, and make `assemble` depend on the jarJar task so the published jar contains JiJ'd dependencies.
/* * Since NeoForge 1.20.2+ (and 1.21.x), the runtime uses Mojmap classes directly. * There is NO SRG reobfuscation step anymore: `reobfJar` does not exist in NeoGradle 7 / * ModDevGradle, and the plain `jar` task output is the final distributable artifact. */ tasks { named("assemble") { dependsOn("jarJ...
{ "must_compile": false, "required_annotations": [ "reobfJar", "jarJar", "dependsOn", "Mojmap" ], "forbidden_apis": [], "gametest_required": false }
BUILD_016
build
Add CurseForge publishing with `curseforgegradle` for a NeoForge 1.21.1 mod: api key from gradle property/env, project id 111222, game version 1.21.1, java version 21, release type release, uploading the jar.
plugins { id("net.darkhax.curseforgegradle") version "1.1.24" } tasks.create<net.darkhax.curseforgegradle.TaskPublishCurseForge>("publishCurseForge") { apiToken = providers.gradleProperty("curseforgeToken") .orElse(providers.environmentVariable("CURSEFORGE_TOKEN")) .orElse("") val mainFile...
{ "must_compile": false, "required_annotations": [ "net.darkhax.curseforgegradle", "TaskPublishCurseForge", "apiToken", "addGameVersion(\"1.21.1\")", "addModLoader(\"NeoForge\")" ], "forbidden_apis": [], "gametest_required": false }
BUILD_017
build
Write a GitHub Actions workflow that builds a NeoForge 1.21.1 mod on pushes to main: Java 21 (Temurin), Gradle 8 wrapper caching, `./gradlew build`.
name: Build on: push: branches: [ main ] pull_request: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 - name: Setup Gradle ...
{ "must_compile": false, "required_annotations": [ "setup-java@v4", "java-version: 21", "./gradlew build", "upload-artifact@v4", "setup-gradle@v4" ], "forbidden_apis": [], "gametest_required": false }
BUILD_018
build
Write `gradle.properties` tuning for a NeoForge 1.21.1 project: 4 GB daemon heap (NeoForm needs memory), parallel execution, configuration cache, and moddev/userdev-friendly JVM args. Also declare the mod version properties.
# Memory: NeoForm/NeoForge tooling decompiles a lot; 4G heap is the practical floor. org.gradle.jvmargs=-Xmx4G -XX:+UseParallelGC org.gradle.parallel=true org.gradle.caching=true org.gradle.configuration-cache=true # Mod metadata used by processResources expansion mod_version=1.0.0 minecraft_version=1.21.1 neoforge_ve...
{ "must_compile": false, "required_annotations": [ "-Xmx4G", "org.gradle.parallel=true", "org.gradle.caching=true", "mod_version=", "neoforge_version=" ], "forbidden_apis": [], "gametest_required": false }
BUILD_019
build
Write the `neoforge.mods.toml` dependency tables for a mod that (a) REQUIRES neoforge [21.1.0,) and minecraft [1.21.1], (b) hard-requires a companion mod AFTER it loads on both sides, and (c) breaks on a known-broken companion version range. Use the correct `type`, `ordering`, `versionRange` and `side` fields.
[[dependencies.neoforge]] modId = "neoforge" type = "required" versionRange = "[21.1.0,)" ordering = "NONE" side = "BOTH" [[dependencies.minecraft]] modId = "minecraft" type = "required" versionRange = "[1.21.1]" ordering = "NONE" side = "BOTH" [[dependencies.companionlib]] modId = "companionlib" type = "required" ve...
{ "must_compile": false, "required_annotations": [ "type = \"required\"", "type = \"incompatible\"", "ordering = \"AFTER\"", "side = \"BOTH\"", "[21.1.0,)", "[1.21.1]" ], "forbidden_apis": [], "gametest_required": false }
BUILD_020
build
Capstone migration: convert this Forge 1.20.1 Groovy build.gradle (ForgeGradle 6) to a NeoForge 1.21.1 ModDevGradle Kotlin DSL build. Preserve group/version and the client/server runs.
// Forge 1.20.1 build.gradle (Groovy, ForgeGradle 6) plugins { id 'net.minecraftforge.gradle' version '[6.0,6.2)' } version = '1.0.0' group = 'com.example' java { archivesBaseName = 'examplemod' toolchain { languageVersion = JavaLanguageVersion.of(17) } } minecraft { mappings channel: 'official', ver...
// NeoForge 1.21.1 build.gradle.kts (ModDevGradle) plugins { id("java-library") id("net.neoforged.moddev") version "1.0.24" } version = "1.0.0" group = "com.example" base { archivesName = "examplemod" } java { toolchain { languageVersion = JavaLanguageVersion.of(21) // 1.21.1 requires Java 21...
{ "must_compile": false, "required_annotations": [ "net.neoforged.moddev", "neoForge {", "version = \"21.1.77\"", "JavaLanguageVersion.of(21)", "client()", "server()" ], "forbidden_apis": [ "net.minecraftforge", "forgegradle", "ForgeGradle" ], "gametest_required": false }

Check the newer (v4) version

ForgeBench v1 — independent benchmark for Minecraft-modding LLMs

Contamination-free evaluation benchmark for models fine-tuned on the ComerX/forge-neoforge-sft-* dataset family. Targets NeoForge 1.21.1 and Forge 1.20.1 (Mojang mappings). 100 tasks, 5 modules × 20.

Data files (what the Dataset Viewer loads)

Config Split File Rows
forgebench_full tasks data/forgebench_full.jsonl 100
schema_example examples data/schema_example.jsonl 3

Both files are UTF-8 JSONL, one task object per line — loadable with load_dataset("ComerX/forgebench-v1", "forgebench_full") or line-by-line with json.loads. Everything else in the repo (harness/, template/, reports) is tooling, not data.

Task schema (strict)

{
  "task_id": "MIXIN_014",
  "module": "api | mixin | migration | debug | build",
  "instruction": "prompt given to the evaluated LLM",
  "context": "vanilla snippet / crash log / legacy code (may be empty)",
  "golden_reference": "reference answer",
  "eval_criteria": {
    "must_compile": true,
    "required_annotations": ["@Inject"],
    "forbidden_apis": ["net.minecraft.util.text"],
    "gametest_required": false
  }
}

context is "" for tasks that need no reference material (e.g. pure API registration drills); it contains vanilla/legacy code or FML log excerpts for mixin, migration and debug tasks.

Modules

Module Count Task type Grading
api (API & registration) 20 instruction→code compile + AST gate
mixin (Mojmap targets) 20 FIM / translation compile + AST gate
migration (1.20.1→1.21.1) 20 refactoring compile + AST gate (legacy APIs forbidden)
debug (FML crash logs) 20 log analysis → JSON judge + JSON-shape gate
build (Gradle KTS / mods.toml) 20 config generation judge + required-token gate

Layout

data/
  forgebench_full.jsonl    # 100 tasks (single JSONL, one task per line)
  schema_example.jsonl     # 3 complete examples (Mixin / Migration / Crash log)
harness/
  Dockerfile               # sandbox image: JDK 21 + Gradle 8.9 + prebuilt MDK template
  sandbox_runner.py        # injects answer into MDK -> ./gradlew build -x test -> Pass@1
  ast_eval.py              # javalang AST gate: syntax, forbidden APIs, hallucinated
                           # imports, required annotations, version-mix penalties
  gametest_runner.py       # GameTest template generation + headless run
  judge_prompt.txt         # strict LLM-as-a-judge rubric for debug/build tasks
  run_benchmark.py         # driver: aggregates sandbox + AST + judge into a report
  requirements.txt
template/                  # minimal NeoForge 1.21.1 MDK (NeoGradle 7 userdev)
VERIFICATION.md            # benchmark self-verification results (19/19)
verification_result.json   # machine-readable check log
SHA256SUMS.txt             # integrity manifest (sha256 of every repo file)

Running

# 0. build the sandbox image (once)
docker build -t forgebench-sandbox:1.21.1 .

# 1. produce answers.jsonl: {"task_id": ..., "answer": ...} per row

# 2a. offline static gate only
python3 harness/run_benchmark.py --data data/forgebench_full.jsonl \
    --answers answers.jsonl --skip-compile --out report.json

# 2b. full compile evaluation (inside Docker)
python3 harness/run_benchmark.py --data data/forgebench_full.jsonl \
    --answers answers.jsonl --out report.json

# 3. judge-graded tasks (debug/build): run your judge LLM with harness/judge_prompt.txt
#    and pass scores via --scores '{"DEBUG_004": {"score": 9, "verdict": "pass"}, ...}'

Contamination status

Golden references and instructions were screened against the public SFT corpus (ComerX/forge-neoforge-sft-v2.1.0-rc2 + -rc1, sampled shards): 0 hits (normalized 300-char prefix containment). The benchmark tasks are synthetic examples, not derived from any corpus repository.

Integrity

  • Frozen artifact: SHA256SUMS.txt (sha256 of every file in this repo).
  • The benchmark is immutable once published; changes require a new version tag.

License

MIT — applies to the benchmark data (data/), the harness (harness/), and the MDK template (template/).

Downloads last month
154