Spawning Blocks

Discussion in 'Plugin Development' started by kmccmk9, Jun 29, 2011.

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

    kmccmk9

    Hello, I'm trying to spawn some blocks at some locations. However I can't find any documentation in the javadoc's.
     
  2. Offline

    phondeux

    Do you want the blocks to drop so players can pick them up or do you want the be stacked at a particular location?
     
  3. Offline

    kmccmk9

    Like an actual breakable block.
     
  4. Offline

    Weltall 7

    location.getBlock().setType(...) will "spawn" a block at a given location (it will replace the block at the location)
     
  5. Offline

    kmccmk9

    Awesome thank you. I will try to implement right now.
     
  6. Offline

    lilkoopa

    You don't spawn blocks, you change blocks, and all the blocks you ever need are there. In empty places there's a block called "air," so to create a block you would do

    Code:
    location.getBlock().setType(material)
    Hope I helped [pig]

    Oh rats, you beat me to it.
     
  7. Offline

    kmccmk9

    Thank you all, well I have a new problem now. Ever since adding this block code, my monsters spawn for like half a second then disappear. Any ideas why?

    Code:
    if (argument.equalsIgnoreCase("start"))
                        {
                            player.sendMessage(ChatColor.GOLD + "The invasion has been started!");
                            checkfor = true;
                            currentworld = player.getWorld();
                            blockspawnpoint = entrancepoint;
                            blockspawnpoint.add(0, 1, 0);
                            zombie = CreatureType.ZOMBIE;
                            for (int i = 0; i < 10; i++)
                            {
                            currentworld.spawnCreature(entrancepoint, zombie);
                            }
                            blockspawnpoint.getBlock().setTypeId(52);
                        }
    
     
  8. Offline

    nisovin

    Do you have monsters turned off in server.properties?
     
  9. Offline

    kmccmk9

    Ah now I did not think of that, duh! Ya my bad, I will go to my other world and see if it works thanks.
     
Thread Status:
Not open for further replies.

Share This Page