Exemplo n.º 1
0
 /**
  * Get a pattern that creates pumpkins with different faces.
  *
  * @return a pumpkin pattern
  */
 public static Pattern getPumpkinPattern() {
   RandomPattern pattern = new RandomPattern();
   for (int i = 0; i < 4; i++) {
     pattern.add(new BlockPattern(new BaseBlock(BlockID.PUMPKIN, i)), 100);
   }
   return pattern;
 }
Exemplo n.º 2
0
 @SuppressWarnings("deprecation")
 @Override
 protected void execute(Event e) {
   Location pos1 = location1.getSingle(e);
   Location pos2 = location2.getSingle(e);
   EditSession session = editSession.getSingle(e);
   ItemStack[] blocks = blockList.getAll(e);
   RandomPattern random = new RandomPattern();
   if (session == null) return;
   for (ItemStack b : blocks) {
     if (b.getType().isBlock()) {
       random.add(new BlockPattern(new BaseBlock(b.getTypeId(), b.getDurability())), 50);
     }
   }
   try {
     session.makeWalls(
         new CuboidRegion(
             (World) BukkitUtil.getLocalWorld(pos1.getWorld()),
             BukkitUtil.toVector(pos1),
             BukkitUtil.toVector(pos2)),
         Patterns.wrap(random));
     session.flushQueue();
   } catch (WorldEditException ex) {
     if (ex instanceof MaxChangedBlocksException) return;
     else ex.printStackTrace();
   }
 }