Erro: Expected

Started by Alpineer on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Erro: Expected

Class:

public class BlockRotate extends BlockBase {

    public static final PropertyDirection FACING = BlockHorizontal.FACING;
    public BlockRotate(String name) {
        super(Material.WOOD, name);
        setSoundType(SoundType.WOOD);
        setHardness(2F);
        setResistance(10F);
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
    }
    @Override
    public BlockRotate setCreativeTab(CreativeTabs.BUILDING_BLOCKS) {
        super.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
        return this;
    }
    @Override
    public BlockStateContainer createBlockState() {
        return new BlockStateContainer(this, FACING);
    }
    // Meta from State
    @Override
    public int getMetaFromState(IBlockState state) {
        return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex();
    }
    // State from Meta
    @Override
    public IBlockState getStateFromMeta(int meta) {
        return getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
    }
    @Override
    public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
        EnumFacing entityFacing = entity.getHorizontalFacing();
        if (!world.isRemote) {
            if (entityFacing == EnumFacing.NORTH) {
                entityFacing = EnumFacing.NORTH;
            } else if (entityFacing == EnumFacing.SOUTH) {
                entityFacing = EnumFacing.SOUTH;
            } else if (entityFacing == EnumFacing.EAST) {
                entityFacing = EnumFacing.EAST;
            } else if (entityFacing == EnumFacing.WEST) {
                entityFacing = EnumFacing.WEST;
            }
            world.setBlockState(pos, state.withProperty(FACING, entityFacing), 2);
        }
    }
}

 

Error:

C:\Pylo\MCreator181\forge\build\sources\main\java\mod\mcreator\mcreator_cabinet.java:221: error:  expected
   public BlockRotate setCreativeTab(CreativeTabs.BUILDING_BLOCKS) {
                                                                                                                   ^

 

Help?

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello, a question, is it a…
Fri, 01/25/2019 - 10:49

Hello, a question, is it a custom block?
I saw the code and for me not to anything wrong!
Try to redo the block, if you did not notice there is the error hint.
Note that there is an arrow pointing to the error at the end of the code, apparently you selected the "BUILDING_BLOCKS" tab for some unknown reason it is with this error, the table name is right!

Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually, that right…
Sun, 01/27/2019 - 22:43

Actually, that right parentheses is the problem.