Examples of Block


Examples of net.canarymod.api.world.blocks.Block

    }

    private void player(Player player, String[] args) {
        if (args.length == 2) {
            LineTracer tracer = new LineTracer(player);
            Block b = tracer.getTargetBlock();
            // Spawn a mob with Rider
            if (b != null) {
                b.setY(b.getY() + 1);
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    if (mob.spawn()) {
                        player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned", args[1]));
                    }
                    else {
                        player.notice("mobspawn failed");
                    }
                }
                catch (IllegalArgumentException e) {
                    player.notice("mobspawn failed");
                }
            }
            else {
                player.notice("mobspawn failed");
            }
        }

        if (args.length == 3) {
            if (args[2].matches("^[0-9]+$")) {
                // Spawn X amount of entities
                int amount = Integer.parseInt(args[2]);
                LineTracer tracer = new LineTracer(player);
                Block b = tracer.getTargetBlock();
                if (b == null) {
                    player.notice(Translator.translate("mobspawn failed"));
                    return;
                }
                b.setY(b.getY() + 1);
                boolean spawnSuccess = true;
                for (int i = 0; i < amount; ++i) {
                    try {
                        Entity e = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                        spawnSuccess &= e.spawn();
                    }
                    catch (IllegalArgumentException e) {
                        player.notice(Translator.translate("mobspawn failed"));
                    }
                }
                if (spawnSuccess) {
                    player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned", args[1]));
                }
                else {
                    player.notice(Translator.translate("mobspawn failed"));
                }
            }
            else {
                LineTracer tracer = new LineTracer(player);
                Block b = tracer.getTargetBlock();
                if (b == null) {
                    player.notice(Translator.translate("mobspawn failed"));
                    return;
                }
                b.setY(b.getY() + 1);
                // Spawn a mob with Rider
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    Entity rider = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[2].toUpperCase()));
                    mob.spawn(rider);
                    player.message(Colors.YELLOW + Translator.translateAndFormat("mobspawn spawned rider", args[1], args[2]));
                }
                catch (IllegalArgumentException e) {
                    player.notice(Translator.translate("mobspawn failed"));
                }
            }
        }
        if (args.length == 4) {
            if (!args[3].matches("^[0-9]+$")) {
                player.notice(Translator.translate("mobspawn failed"));
                Canary.help().getHelp(player, "mobspawn");
                return;
            }
            // Spawn X amount of entities
            int amount = Integer.parseInt(args[3]);
            LineTracer tracer = new LineTracer(player);
            Block b = tracer.getTargetBlock();
            if (b == null) {
                player.notice(Translator.translate("mobspawn failed"));
                return;
            }
            b.setY(b.getY() + 1);
            boolean spawnSuccess = true;
            // Spawn a mob with Rider
            for (int i = 0; i < amount; ++i) {
                try {
                    Entity mob = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[1].toUpperCase()), b.getLocation());
                    Entity rider = Canary.factory().getEntityFactory().newEntity(EntityType.valueOf(args[2].toUpperCase()));
                    spawnSuccess &= mob.spawn(rider);
                }
                catch (IllegalArgumentException e) {
                    player.notice(Translator.translate("mobspawn failed"));
View Full Code Here

Examples of net.minecraft.block.Block

        Constants.NBT.TAG_COMPOUND);

    for (int i = 0; i < blocksMapping.tagCount(); ++i) {
      NBTTagCompound sub = blocksMapping.getCompoundTagAt(i);
      String name = sub.getString("name");
      Block b = (Block) Block.blockRegistry.getObject(name);
      registerBlock (b);
    }

    NBTTagList itemsMapping = nbt.getTagList("itemsMapping",
        Constants.NBT.TAG_COMPOUND);
View Full Code Here

Examples of net.minecraft.server.Block

   * @return True if a block got changed, False if not
   */
  public static boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, Material type, int data) {
    boolean result = y >= 0 && y <= chunk.getWorld().getMaxHeight();
    WorldServer world = CommonNMS.getNative(chunk.getWorld());
    Block typeBlock = CommonNMS.getBlock(type);
    if (result) {
      result = ChunkRef.setBlock(Conversion.toChunkHandle.convert(chunk), x, y, z, typeBlock, data);
            world.methodProfiler.a("checkLight");
            world.z(x, y, z);
            world.methodProfiler.b();
View Full Code Here

Examples of net.minecraft.server.v1_4_5.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_4_6.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_4_R1.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_5_R1.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_5_R2.Block

    }
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_5_R3.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here

Examples of net.minecraft.server.v1_6_R1.Block

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.byId[id];
    if (block == null || block.material == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.material.isSolid());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.