'IntelliJ does not recognize fillStateContainer, getDefaultState(), or getPlacementHorizontalFacing() Forge 1.16.5

I am making a custom two block long model called "littleguys:operating_table" and I watched tutorials to make it face the direction I want when it is placed. I made a custom OperatingTable class here:

package com.soliid.littleguys.blocks;

import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.StateContainer;
import net.minecraftforge.common.ToolType;

public class OperatingTable extends HorizontalBlock
{
    public OperatingTable()
    {
        super(AbstractBlock.Properties.of(Material.STONE)
            .harvestLevel(1)
                .harvestTool(ToolType.PICKAXE)
                .sound(SoundType.STONE)
                .requiresCorrectToolForDrops()
                .strength(3.5f, 4.0f)
        );
    }

    @Override
    protected void fillStateContainer (StateContainer.Builder<Block, BlockState> builder)
    {
        builder.add(FACING);
    }

    @Override
    public BlockState getStateForPlacement(BlockItemUseContext context) {
        return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
    }
}

The @Override gives me an error reading Method does not override method from its superclass, getDefaultState() gives me Cannot resolve method 'getDefaultState' in 'OperatingTable', and getPlacementHorizontalFacing() gives me Cannot resolve method 'getPlacementHorizontalFacing' in 'BlockItemUseContext'.

I now realized that these methods are not in OperatingTables's superclasses (HorizontalBlock and Block) but I want to know which methods are now used instead. There are no errors in the registry of RegistryObject<Block> OPERATING_TABLE or RegistryObject<Item> OPERATING_TABLE_ITEM.

This class is not complete but I cannot continue until I resolve the error.



Solution 1:[1]

There are several possibilities, but most cases are cache issue. Please try invalidate cache and restart IntelliJ. If issue persist, then sync Gradle project manually.

Solution 2:[2]

In build.gradle, on line 34, mappings is defined as channel: 'official', version: '1.16.5'. This should be changed to channel: 'snapshot', version: '[snapshot version]'. The version I used was '20210309-1.16.5'. Then, rebuild the gradle in Terminal using gradlew genIntellijRuns.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user-id-14900042
Solution 2 TherrSpoob