How do I make mod's blocks burn?

Started by FireWorks_CreepeR on

Topic category: Help with modding (Java Edition)

Last seen on 11:35, 27. Mar 2023
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make mod's blocks burn?

The version of MCreator is 1.9.0, is there any way to make custom blocks burn?

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can by editing the code…
Wed, 08/07/2019 - 09:06

You can by editing the code. You need to add this piece of code to your block constructor (where you see setResistance, setLightLevel etc.)

Blocks.FIRE.setFireInfo(this, 5, 20);

5 is how fast the block catches fire, 20 is how fast the block burns.
There's also a ticket open for this in the tracker, you might want to upvote it if you want burnable blocks in MCreator.

Last seen on 11:35, 27. Mar 2023
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Aha, thanks, I'm gonna do it…
Wed, 08/07/2019 - 11:07

Aha, thanks, I'm gonna do it now!)

Last seen on 11:35, 27. Mar 2023
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunaly, that gave an…
Wed, 08/07/2019 - 11:27

Unfortunaly, that gave an error, anyways thank you for the suggestion)

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What did the error say? Try…
Wed, 08/07/2019 - 17:54

What did the error say? Try pressing ctrl+w after adding the line, then save and recompile.

Last seen on 11:03, 15. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
C:\Users\PC…
Thu, 08/08/2019 - 10:32

C:\Users\PC\MCreatorWorkspaces\levapap_modification\build\sources\main\java\net\mcreator\levapap_modification\MCreatorWandBulletHitsBlock.java:227: error: non-static variable this cannot be referenced from a static context
            Blocks.FIRE.setFireInfo(this, 5, 20);
                                    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 29s
 

Last seen on 11:03, 15. Sep 2020
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  See the comment below…
Thu, 08/08/2019 - 12:15

 

See the comment below…

Last seen on 14:12, 3. Jun 2023
Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The line of code doesn't set…
Thu, 08/08/2019 - 12:30

The line of code doesn't set the block on fire, it makes the block flammable. It's a property of the block, not an action. If you edit the code of a block, you should see something like this:

public BlockCustom() {
	super(Material.PLANTS);
	setRegistryName("lightbulb_lamp");
	setUnlocalizedName("lightbulb_lamp");
	setSoundType(SoundType.PLANT);
	setHarvestLevel("axe", -1);
	setHardness(0F);
	setResistance(0.5F);
	setLightLevel(0.95F);
	setLightOpacity(0);
	setCreativeTab(CreativeTabs.DECORATIONS);
}

This is where the line of code goes.

If you want to set a block on fire with procedures:
1. Make the block flammable by adding the line inside the code of the block;
2. In the procedure, you could use the "Place block at x y z" block to place a fire block above the flammable block