New Block

Discussion in 'Plugin Development' started by GH0STX05, Jan 18, 2011.

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


    How do I create a block and set it at a player's location?
  2. Offline


    If you have the Player variable, try this code:
    import org.bukkit.World;
    //everything in between
    Location loc = player.getLocation();
    World world[] = getServer().getWorlds();
    Block blocktoset = world[0].getBlockAt(loc.getX(),loc.getY(),loc.getZ());
  3. Offline


    I thought "getBlockAt" would get the block, not set it.
  4. Offline


    There are no empty spaces in minecraft. Blocks you can't see are most likely air blocks (TypeId = 0). So just get the (already existing) block at the players position (with getBlockAt) and change the TypeId of it to whatever you want.

    €dit: I think you have to convert the double from getX()/getY()/getZ() to int !? (Haven't tried, just something that came into my mind)

  5. Offline


    It does. You get the block object then you edit the block from what you have.
Thread Status:
Not open for further replies.

Share This Page