How do I make mod's blocks burn?

Started by FireWorks_CreepeR on Wed, 08/07/2019 - 06:50

Topic category: Help with MCreator modding

Last seen on 09:56, 20. Aug 2019
Joined Jun 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How do I make mod's blocks burn?
Wed, 08/07/2019 - 06:50

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

Last seen on 16:00, 23. Sep 2019
Joined Nov 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 09:56, 20. Aug 2019
Joined Jun 2017
User points:

Statistics:

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

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

Last seen on 09:56, 20. Aug 2019
Joined Jun 2017
User points:

Statistics:

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

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

Last seen on 16:00, 23. Sep 2019
Joined Nov 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 08:10, 21. Sep 2019
Joined Dec 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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 08:10, 21. Sep 2019
Joined Dec 2015
User points:

Statistics:

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

 

See the comment below…

Last seen on 16:00, 23. Sep 2019
Joined Nov 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
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