Jump to content

grvt

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by grvt

  1. 3 minutes ago, Luis_ST said:

    learn basic java, since Block is not and int

    I know. My question was what I should be putting there, because I didn't understand the method properly.

    2 minutes ago, diesieben07 said:

    The 1st parameter is the position to place at. The 2nd parameter is the block state to place. The 3rd parameter are the update flags (Constants.BlockFlags). The 4th parameter is recursion depth.

    You really should not be using this overload. Use setBlockAndUpdate(BlockPos, BlockState) for most cases. If you need to set the flags, use setBlock(BlockPos, BlockState, int).

    Thank you that makes a lot more sense.

  2. I'm attempting to replace grass blocks in a world with a ModBlock I called `scorched_earth`. However, `world.setBlock()` requires a block ID. I've looked for some way to get an ID for the block but can't seem to find any workarounds? Am I just doing it wrong?

    Example (incomplete) code:

    private void scorch(World worldIn, BlockPos pos, Block block) {
         BlockState state = worldIn.getBlockState(pos);
         if(block.isBurning(state, worldIn, pos)) {
             if(block.is(Blocks.GRASS_BLOCK)) worldIn.setBlock(pos, state, 0, ModBlocks.SCORCHED_EARTH.get());
         }
    }
×
×
  • Create New...

Important Information

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