Break ice naturally

Discussion in 'Spigot Plugin Development' started by xguysprison, May 26, 2018.

  1. Hey guys im trying to make ice instantly break and turn into ice as if it was mined normally.
    But instead when i use
    Code (Java):
    it just removes the block and no water appears
  2. Hm. You can manually set the block of the ice's location to water, allthough I think there is a better way. I'm not sure though
  3. - If it breaks and doesn't place water, you can do breakNaturally() to get the effect, and then do setType() to water.
    - Or, you can set the type to water, and play a "StepSound" effect, which is basically the block particles. See the code sample

    Code (Java):
    e.getClickedBlock().getWorld().playEffect(e.getClickedBlock().getLocation().add(0.5, 0.5, 0.5), Effect.STEP_SOUND, e.getClickedBlock().getTypeId());
    Unfortunately, a deprecated method is required, but it works fine.
  4. Choco


    The former is going to be the better option as you don't have to "fake" that the block was broken. Break it naturally, set it to water.