Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

C:\Users\Mattias\Desktop\Mods\CobbleSnapshot\src\main\java\net\mattias\cobblesnapshot\blo…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-medium-2505’s answer.
  1. User

    C:\Users\Mattias\Desktop\Mods\CobbleSnapshot\src\main\java\net\mattias\cobblesnapshot\block\ImageFrameBlock.java:51: error: method does not override or implement a method from a supertype @Override ^

    I tried reloaded gradle and building gradle this is not a intellij error it is a code error

    package net.mattias.cobblesnapshot.block;

    import com.mojang.serialization.MapCodec; import net.mattias.cobblesnapshot.block.entity.ImageFrameBlockEntity; import net.mattias.cobblesnapshot.item.ModItems; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable;

    public class ImageFrameBlock extends BaseEntityBlock { public static final MapCodec CODEC = simpleCodec(ImageFrameBlock::new); private static final VoxelShape SHAPE = box(0, 0, 0, 16, 16, 1);

    public ImageFrameBlock(Properties properties) {
        super(properties);
    }
    
    @Override
    protected MapCodec<? extends BaseEntityBlock> codec() {
        return CODEC;
    }
    
    @Override
    public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
        return SHAPE;
    }
    
    @Override
    public RenderShape getRenderShape(BlockState state) {
        return RenderShape.MODEL;
    }
    
    @Nullable
    @Override
    public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
        return new ImageFrameBlockEntity(pos, state);
    }
    
    @Override
    // Changed method to public as in 1.21 the base method is declared public
    public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
        if (level.isClientSide()) {
            return InteractionResult.SUCCESS;
        }
    
        BlockEntity blockEntity = level.getBlockEntity(pos);
        if (blockEntity instanceof ImageFrameBlockEntity imageFrame) {
            ItemStack heldItem = player.getItemInHand(hand);
    
            if (heldItem.is(ModItems.IMAGE_FILM.get())) {
                boolean success = imageFrame.setImageFromFilm(heldItem);
                if (success && !player.getAbilities().instabuild) {
                    heldItem.shrink(1);
                }
                return InteractionResult.CONSUME;
            }
        }
    
        return InteractionResult.PASS;
    }
    

    }

  2. Assistant

    Thanks for the clarification that this is a compile-time error from javac and not an IDE issue. That means the method signature you are trying to override does not exist in the superclass with that exact signature.


    What’s going on?

    The error:

    method does not override or implement a method from a supertype
    

    means that the method signature you wrote does not match any method in the superclass or interfaces.


    Let's check the actual method signature in Minecraft 1.21 for Block.use

    In Minecraft 1.21 (and NeoForge 1.21), the use method in Block is:

    public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
    

    Note:

    • It is public, not protected.
    • It takes 6 parameters: BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult.

    Your method matches this signature exactly, so it should override.


    Why does the compiler say it doesn't?

    Possible reasons:

    1. Your BaseEntityBlock superclass does NOT have this method declared.

      • BaseEntityBlock extends Block.
      • If BaseEntityBlock does not override use, then your override in ImageFrameBlock should still be valid because it inherits from Block.
      • But if your BaseEntityBlock is from a different version or is a custom class that does not have this method, the compiler will complain.
    2. You are compiling against the wrong Minecraft/NeoForge version.

      • Your Block or BaseEntityBlock class in your classpath might be from an older version that does not have this method signature.
      • For example, in Minecraft 1.20.x, the use method had a different signature (e.g., protected or fewer parameters).

    How to fix this:

    Step 1: Verify your Minecraft/NeoForge dependencies

    Make sure your build.gradle is targeting Minecraft 1.21 and NeoForge 1.21.

    Your build.gradle should have something like:

    minecraft {
        version = "1.21"
        // other config
    }
    

    If you are targeting 1.20.x or earlier, the method signature is different.


    Step 2: Check the BaseEntityBlock class

    If you are extending BaseEntityBlock, check if it overrides use. If it does, what is the signature?

    • If it overrides use with a different signature or does not declare it public, your override will fail.
    • You can fix this by either:
      • Overriding the method in BaseEntityBlock first, or
      • Changing your class to extend Block directly (if possible).

    Step 3: Adjust your override to match the superclass

    If your BaseEntityBlock superclass has a different use method signature, you must match that exactly.

    For example, if BaseEntityBlock declares:

    protected InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
    

    then your override must be:

    @Override
    protected InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit)
    

    Summary of what to do:

    • Check your Minecraft/NeoForge version and ensure it is 1.21.
    • Check the BaseEntityBlock class you are extending and see what use method it declares.
    • Match your override method signature exactly to the one in BaseEntityBlock or Block.
    • If unsure, try extending Block directly and see if the error persists.

    Example fix assuming BaseEntityBlock has protected use method:

    @Override
    protected InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
        // your code here
    }
    

    If you want to be 100% sure, remove @Override and compile:

    • Remove @Override annotation temporarily.
    • Compile.
    • If it compiles, then the method is not overriding anything.
    • Then check the superclass method signature and adjust accordingly.

    Final note:

    If you want me to check your BaseEntityBlock class or your build.gradle Minecraft version, please share those files or relevant parts.


    TL;DR:

    Your method signature is correct for Minecraft 1.21 Block.use. The error means your superclass (BaseEntityBlock) does not have that method with that signature. Fix your project dependencies or adjust the method signature to match the superclass exactly.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.