Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging 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 gpt-4.1-mini-2025-04-14’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. Mistral Assistant

    I understand the frustration. Let's fix this properly. The issue is that in NeoForge 1.21, the use method signature has changed in the BaseEntityBlock class. The correct signature no longer includes the InteractionHand parameter. Here's the corrected version:

    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.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<ImageFrameBlock> 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
        public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hit) {
            if (level.isClientSide()) {
                return InteractionResult.SUCCESS;
            }
    
            BlockEntity blockEntity = level.getBlockEntity(pos);
            if (blockEntity instanceof ImageFrameBlockEntity imageFrame) {
                // Get the hand from the player's main hand (since we can't get it from hit result anymore)
                ItemStack heldItem = player.getMainHandItem();
    
                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;
        }
    }
    

    Key changes made:

    1. Removed the InteractionHand parameter from the use method signature
    2. Changed player.getItemInHand(hand) to player.getMainHandItem() since we can't get the hand from the hit result anymore
    3. Kept the method as public since that's what the base class expects

    This should now properly override the method from BaseEntityBlock in NeoForge 1.21. The functionality remains the same, but it's now compatible with the current API.

    If you need to handle both hands (main and offhand), you could modify the code to check both hands:

    ItemStack mainHandItem = player.getMainHandItem();
    ItemStack offHandItem = player.getOffhandItem();
    
    if (mainHandItem.is(ModItems.IMAGE_FILM.get())) {
        // Handle main hand
    } else if (offHandItem.is(ModItems.IMAGE_FILM.get())) {
        // Handle offhand
    }
    

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