How to get flammability?(procidures)

Started by JarikTSM on

Topic category: Help with modding (Java Edition)

Last seen on 22:31, 13. Jan 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to get flammability?(procidures)

How do i get the flammability of block/item using proceedures?
If i cant normaly then what custom code snippet i need to use?

Last seen on 15:39, 20. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
       Code in the snippet: …
Thu, 01/11/2024 - 09:52

       Code in the snippet:
        BlockPos pos = BlockPos.containing(x, y, z); // Get the block position
        BlockGetter blockGetter = (BlockGetter) world; // Cast LevelAccessor to BlockGetter
        flammability = blockGetter.getBlockState(pos).getFlammability(blockGetter, pos, Direction.UP); 

 

I had to use the get hardness first just to get it to generate the code so it was getting the block position. If you lock the code you can make it neater. I bound this to the when block placed and it accurately displayed the blocks flammability each time. ChatGPT and BingAi are your friends here I did this in like 10minutes using those.