Jump to content



Recommended Posts


in the documentation of forge (1.16.x) I've found this quote:

"If you are placing a Block, call Block#getDefaultState() to get the “default” state(...)"

Now when I try to use code such as below:

BlockState newBlockState = Blocks.DIRT.getDefaultState();

I get this error:

/home/poison64/dev/mc-forge/first/src/main/java/com/example/examplemod/MyModEventHandler.java:23: error: cannot find symbol
        BlockState newBlockState = Blocks.DIRT.getDefaultState();
  symbol:   method getDefaultState()
  location: variable DIRT of type Block
1 error

Is the documentation wrong or I just don't know something?

I've played around with other stuff, and they work just fine, for example, this one works as expected:

    public void pickupItem(EntityItemPickupEvent event) {
        ItemStack stack = event.getItem().getItem();


Link to comment
Share on other sites

  • 1 year later...
On 4/4/2021 at 12:06 PM, diesieben07 said:

Most documentation has not been updated for the recent switch to Mojang names. The method is now called defaultBlockState.

Please help, how called method .with

public class RotateBlockModel extends HorizontalBlock {
    public RotateBlockModel(Properties builder) {
    public void fillStateContainer(StateContainer.Builder<Block, BlockState> builder){

    public BlockState getStateForPlacement(BlockItemUseContext context) {
        return this.getBlock().defaultBlockState().with;
C:\Users\������\OneDrive\������� ����\����\mod\src\main\java\com\dipcrai\mymod\block\custom\RotateBlockModel.java:23: error: cannot find symbol
        return this.getBlock().defaultBlockState().with();


Link to comment
Share on other sites

  • Guest locked this topic
This topic is now closed to further replies.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.