Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

1.14.4 Error on Fire Block


Recommended Posts

The FireBlock in Forge ist different in function to the Fire Block in Vanilla.

Details: In Vanilla wenn a Block Catch Fire the Fire will replaced only an Air Blocks on Top of burning Material.
In forge (forge-1.14.4-28.0.100)  the Fire will replace the burning Material.
In this Case Catching fire will not work correctly for  Burning Blocks ( In my Case on Oil).

Some Program Details:

In Function:  public void tick ...

TryCatchFire will be called:

this.tryCatchFire(worldIn, pos.east(), 300 + k, random, i, Direction.WEST);
            this.tryCatchFire(worldIn, pos.west(), 300 + k, random, i, Direction.EAST);
            this.tryCatchFire(worldIn, pos.down(), 250 + k, random, i, Direction.UP);
            this.tryCatchFire(worldIn, pos.up(), 250 + k, random, i, Direction.DOWN);
            this.tryCatchFire(worldIn, pos.north(), 300 + k, random, i, Direction.SOUTH);
            this.tryCatchFire(worldIn, pos.south(), 300 + k, random, i, Direction.NORTH);

In TryCatchFire Fire the Int i will be Filled with Flamability of this Block  and then te block will replaced with the fire Block;

   private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, Direction face) {
      int i = worldIn.getBlockState(pos).getFlammability(worldIn, pos, face);
      if (random.nextInt(chance) < i) {
         BlockState blockstate = worldIn.getBlockState(pos);
         if (random.nextInt(age + 10) < 5 && !worldIn.isRainingAt(pos)) {
            int j = Math.min(age + random.nextInt(5) / 4, 15);
            worldIn.setBlockState(pos, this.getStateForPlacement(worldIn, pos).with(AGE, Integer.valueOf(j)), 3);
         } else {
            worldIn.removeBlock(pos, false);
         }

In get Flamability, the Direction is ignored:

 

See IForgeBlockStatre 

    default int getFlammability(IBlockReader world, BlockPos pos, Direction face)
    {
        return getBlockState().getBlock().getFlammability(getBlockState(), world, pos, face);
    }

And IForgeBlock

    default int getFlammability(BlockState state, IBlockReader world, BlockPos pos, Direction face)
    {
        return ((FireBlock)Blocks.FIRE).func_220274_q(state);
    }

 

 

To Correct Problem it rmay be nessesary to insert 2 Changes:

in In TryCatchFire it might be helpfully to Check the Block for Place a Fire must be an Air Block:

 

   private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, Direction face) {
     if (! worldIn.getBlockState(pos).isAir() return;
    int i = worldIn.getBlockState(pos).getFlammability(worldIn, pos, face);

 

in IForgeBlock Direction may be used: I Downt know if this function will be called elsewhere. So it might be nessesary to allow use direction null

 

    default int getFlammability(BlockState state, IBlockReader world, BlockPos pos, Direction face)
    {

         if (face == null)
              return ((FireBlock)Blocks.FIRE).func_220274_q(state);

         Blockstate,blockstate = world.getBlockState(pos.offset(face));

         return ((FireBlock)Blocks.FIRE).func_220274_q(blockstate);
    }

 

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.