Tsunami?

Discussion in 'Plugin Development' started by Connor2weirdness, Mar 24, 2014.

Thread Status:
Not open for further replies.
  1. I'm trying to create a tsunami, but I'm not exactly sure how :/

    I have this code so far:
    Code:
    @EventHandler
        public void onBlockPlace(final BlockPlaceEvent event){
            this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
                @Override
                public void run() {
                    Block b = event.getBlock();
                    b.getRelative(BlockFace.DOWN).setType(Material.WATER);
                    b.getRelative(BlockFace.UP).setType(Material.WATER);
                    b.getRelative(BlockFace.NORTH).setType(Material.WATER);
                    b.getRelative(BlockFace.SOUTH).setType(Material.WATER);
                    b.getRelative(BlockFace.WEST).setType(Material.WATER);
                    b.getRelative(BlockFace.EAST).setType(Material.WATER);
                }
            }, 1000, 1000);
        }
    }
     
  2. Offline

    LucasEmanuel

    Why are you setting all 6 blocks around the block to air in the block place event? It makes no sense.
     
  3. Sorry, that was a mistake. It was supposed to set it to water.
     
  4. Offline

    Garris0n

    What exactly are you trying to do then? You have code that places water around a block, what else do you want it to do?
     
  5. I want it to infinitely spread :)
     
  6. Offline

    Garris0n

    Then make it recursive. Sounds laggy, though...
     
    snivell likes this.
  7. Offline

    Blah1

    This sound pretty complex, actually. LucasEmanuel made a tornado resource, he could probably make a tsunami one too.
     
  8. Offline

    LucasEmanuel

    Haha, well, spreading water at a specific height in all directions is not that hard. It will be laggy if it is not handled with several schedulers combined with the MassBlockUpdate, and keeping track of everything will be more tricky. But if you are used to recursive functions etc it will be rather simple.

    It might be something I could take a look on in the future, but I don't have the time for it right now. I have not worked with Java in several months now due to school, and I will probably not for some time. But if you need anything coded in MIPS-assembly, just give me a tag ;)
     
Thread Status:
Not open for further replies.

Share This Page