Examples of Material


Examples of net.minecraft.block.material.Material

  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe))
      return false;

    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
View Full Code Here

Examples of net.minecraft.block.material.Material

  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick))
      return false;

    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
View Full Code Here

Examples of net.minecraft.block.material.Material

  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel))
      return false;
    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
      return false;
View Full Code Here

Examples of net.minecraft.block.material.Material

    if (block != null && blk != block)
      return;

    int meta = world.getBlockMetadata(x, y, z);
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (blk != null && !blk.isAir(world, x, y, z) && ((blk.getPlayerRelativeBlockHardness(player, world, x, y, z) != 0 || (blk == Blocks.bedrock && (y <= 253 && world.provider instanceof WorldProviderBedrock))))) {
      if (!blk.canHarvestBlock(player, meta) || !isRightMaterial(mat, materialsListing))
        return;
      if (ConfigHandler.bedrockDimensionID != 0 && block == Blocks.bedrock && ((world.provider.isSurfaceWorld() && y < 5) || (y > 253 && world.provider instanceof WorldProviderBedrock))) {
        world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
View Full Code Here

Examples of net.minecraft.block.material.Material

              (y < H && spawnBlock[(x * width + z) * height + (y + 1)]) ||
              (y > 0 && spawnBlock[(x * width + z) * height + (y - 1)]));

          if (flag) {
            if (y >= heightOff) {
              Material material = world.getBlock(xStart + x, yStart + y, zStart + z).getMaterial();
              if (material.isLiquid())
                return false;
            } else {
              if (!canGenerateInBlock(world, xStart + x, yStart + y, zStart + z, genBlock)) {
                return false;
              }
View Full Code Here

Examples of net.minecraft.block.material.Material

      this.setParticleTextureIndex(114);
      this.motionX *= 0.699999988079071D;
      this.motionZ *= 0.699999988079071D;
    }
    if (this.particleGravity > 0) {
      Material material = this.worldObj.getBlock(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ)).getMaterial();

      if (material.isLiquid() || material.isSolid()) {
        double d0 = MathHelper.floor(this.posY)
            + 1
            - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor(this.posX), MathHelper.floor(this.posY),
                MathHelper.floor(this.posZ)));
        if (this.posY < d0) {
          this.setDead();
        }
      }
    } else {
      Material material = this.worldObj.getBlock(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY), MathHelper.ceil(this.posZ)).getMaterial();

      if (material.isLiquid() || material.isSolid()) {
        double d0 = MathHelper.ceil(this.posY)
            + 1
            - BlockLiquid.getLiquidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.ceil(this.posX), MathHelper.ceil(this.posY),
                MathHelper.ceil(this.posZ)));
        if (this.posY > d0) {
View Full Code Here

Examples of org.bukkit.Material

 
  // TODO expand this to enchanting
  public static ItemStack parse(String[] args, CommandSender...senders){
    CommandSender sender = (senders.length > 0 ? senders[0] : null);
   
    Material material;
    int amount = -1;
    short damage = 0;
   
    if (args.length == 0){
      return null;
    }
   
    if (args[0].contains(":")){
      String[] data = args[0].split(":");

      List<Material> materialMatches = ClosestMatches.material(data[0]);
      if (materialMatches.size() > 0){
        material = materialMatches.get(0);
      } else {
        if (sender != null){ LogHelper.showWarning("itemNotFound", sender); }
        return null;
      }
     
      if (data[1].matches(CommandsEX.intRegex)){
        damage = Short.valueOf(data[1]);
      } else {
        List<DyeColor> dyeMatches = ClosestMatches.dyeColor(data[1]);
        if ((material == Material.WOOL || material == Material.INK_SACK) && dyeMatches.size() > 0){
                    damage = dyeMatches.get(0).getDyeData();
                } else {
                    if (sender != null){ LogHelper.showWarning("itemIncorrectDamage", sender); }
                    return null;
                }
      }
    } else {
      List<Material> materialMatches = ClosestMatches.material(args[0]);
      if (materialMatches.size() > 0){
        material = materialMatches.get(0);
      } else {
        if (sender != null){ LogHelper.showWarning("itemNotFound", sender); }
        return null;
      }
    }
   
    if (args.length > 1){
      if (args[1].matches(CommandsEX.intRegex)){
        amount = Integer.valueOf(args[1]);
      } else {
        if (sender != null){ LogHelper.showWarning("itemIncorrectAmount", sender); }
        return null;
      }
    }
   
    if (args.length > 2){
      if (args[2].matches(CommandsEX.intRegex)){
        damage = Short.valueOf(args[2]);
      } else {
        List<DyeColor> dyeMatches = ClosestMatches.dyeColor(args[2]);
        if (dyeMatches.size() > 0){
          damage = dyeMatches.get(0).getDyeData();
        } else {
          if (sender != null){ LogHelper.showWarning("itemIncorrectAmount", sender); }
          return null;
        }
      }
    }
   
    if (amount == -1){
      amount = material.getMaxStackSize();
    }
   
    return new ItemStack(material, amount, damage);
  }
View Full Code Here

Examples of org.bukkit.Material

   
    ItemStack stack = ItemStackParser.parse(listArgs.toArray(new String[]{}), sender);
    if (stack == null){ return; }
    target.getInventory().addItem(stack);

    Material item = stack.getType();
    int amount = stack.getAmount();
    short damage = stack.getDurability();
   
    // Messages will be different if the player spawned the item for himself, or someone else
    if (sender != target){
      LogHelper.showInfo("itemYouGave#####[" + Nicknames.getNick(target.getName()) + " " + amount + " " + Utils.userFriendlyNames(item.name()) + (damage != 0 ? " (" + damage + ")": ""), sender, ChatColor.AQUA);
      LogHelper.showInfo("itemGiveSuccess#####[" + amount + " " + Utils.userFriendlyNames(item.name()) + (damage != 0 ? " (" + damage + ")": "") + " #####itemFrom#####[" + Nicknames.getNick(sender.getName()), target, ChatColor.AQUA);
    } else {
      LogHelper.showInfo("itemGiveSuccess#####[" + amount + " " + Utils.userFriendlyNames(item.name()) + (damage != 0 ? " (" + damage + ")": ""), sender, ChatColor.AQUA);
    }
  }
View Full Code Here

Examples of org.bukkit.Material

      // Get some variables
      Player player = (Player)sender;
      ItemStack itemInHand = player.getItemInHand();
      int itemdura = itemInHand.getDurability();
      Material material = Material.getMaterial(itemInHand.getTypeId());
     
      // Check if it can be repaired
      if (material.isBlock() || material.getMaxDurability() < 1) {
        LogHelper.showWarning("repairCannotRepair", sender);
        return true;
      }
     
      // Check if it can be repaired
View Full Code Here

Examples of org.bukkit.Material

                    LogHelper.showWarning("commandSignInvalid", player);
                    sign.getBlock().breakNaturally();
                } else {
                    String[] data = lines[1].split(":");
                    List<Material> matches = ClosestMatches.material(data[0]);
                    Material material = (matches.size() > 0 ? matches.get(0) : null);
                    if (material == null){
                        LogHelper.showWarning("itemNotFound", player);
                        sign.getBlock().breakNaturally();
                    } else {
                        if (data.length > 0){
                            if (data.length != 2){
                                LogHelper.showWarning("commandSignInvalid", player);
                                sign.getBlock().breakNaturally();
                            } else {
                                if (material == Material.WOOL || material == Material.INK_SACK){
                                    List<DyeColor> dyeMatches = ClosestMatches.dyeColor(data[1]);
                                    DyeColor dye = (dyeMatches.size() > 0 ? dyeMatches.get(0) : null);
                                    if (dye == null){
                                        LogHelper.showWarning("commandSignInvalid", player);
                                        sign.getBlock().breakNaturally();
                                        return;
                                    } else {
                                        e.setLine(1, WordUtils.capitalize(material.name().toLowerCase().replaceAll("_", ""))  + ":" + WordUtils.capitalize(dye.toString().toLowerCase().replaceAll("_", "")));
                                    }
                                } else {
                                    if (!data[1].matches(CommandsEX.intRegex)){
                                        LogHelper.showWarning("commandSignInvalid", player);
                                        sign.getBlock().breakNaturally();
                                        return;
                                    } else {
                                        e.setLine(1, WordUtils.capitalize(material.name().toLowerCase().replaceAll("_", "")));
                                    }
                                }
                            }
                        }
                       
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.