Gravity on Blocks

Discussion in 'Plugin Development' started by MinecraftSped, Jan 5, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    MinecraftSped I steal plugins as my own

    I was thinking, is it possible to add gravity to blocks other than sand and gravel?

    I was just flying through the nether and thought about how stupid soulsand is.
     
  2. Offline

    fireblast709

    You could try setting the block to AIR and spawn a falling block. Not sure if that will appy the gravity correctly
     
  3. Offline

    Bavestry

    I know there's a way to do this, I just don't know how. Though I know someone who does, and I've seen it. The only glitch with it, that I've seen, is that, if you add gravity to leaves, they turn into a gray texture until they hit the ground.
     
  4. Offline

    Wolftic

  5. Offline

    Drew1080

    MinecraftSped
    You could try spawning a falling block whenever a block is placed, eg.

    Code:
        @EventHandler
        public void onBlockPlaceEvent(BlockPlaceEvent event){
            Block block = event.getBlock();
            block.getWorld().spawnFallingBlock(block.getLocation(), block.getType(), block.getData());
            block.setTypeId(0, false);
        }
     
  6. Offline

    skipperguy12

    Code:
    Byte blockData = 0x0;
     
    location.getWorld().spawnFallingBlock(location, Material.Bedrock, blockData);
    ^ Rainin' bedrock!
     
  7. Offline

    orgin_org

    Adding gravity to a single placed block is easy.

    But what is the proper way to affect blocks that are already placed?

    I want to add gravity to snow blocks in my hothgenerator plugin. So if you dig under a snow block then the one above it, and all above that one should fall down.

    I tried doing this by listening to BlockPhysicsEvent but that would easily sink the server since that event seems to be used while new chunks are generated.
     
Thread Status:
Not open for further replies.

Share This Page