How to set a creeper as "lit"

Discussion in 'Spigot Plugin Development' started by Computerdude3, Jun 8, 2017.

  1. I have a creeper instance, but the Creeper class doesn't have a method to start the explosion delay (as if it were lit with a flint & steel, aka un-cancellable). Is there a way to set a creeper as "lit" with NMS?
  2. Looks like this might be in current 1.12 code. Obviously this is going to change with each version, so you may have to just look at the code yourself for whatever version you're targeting.
  3. Works perfectly, thanks.
    • Friendly Friendly x 1
  4. The method .dk() is now hidden 1.12. I need a new answer.
  5. Use reflection and make it accessible.

    That's probably the only answer unless someone PR's some API for this.
  6. Well you can do this without nms,
    Code (Java):
    Which will technically set the creeper on fire.
  7. OP does not want to make the creeper charged (there is an API method for that), they want to "prime" the creeper so it's about to explode.
  8. Whoops! Missread what the op said, sorry.
  9. .dk() is something different now. The method you need is currently .do_()

    Every time an NMS class is changed by Mojang, the obfuscation is redone for that class and all the method and variable names shift. So when new versions come you'll just have to recheck EntityCreeper to make sure what the name of that method is.