Package net.minecraft.src

Examples of net.minecraft.src.Item


    }
    else {
      itemstack = is.asNMSItenStack();
    }

    Item rawItem = Item.itemsList[itemstack.itemID];
    List<String> list;
    if (rawItem != null) {
      list = itemstack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
    } else {
      list = new ArrayList<String>();
View Full Code Here


          List<ItemStack> li = new ArrayList<ItemStack>();
          for (ItemStack i : s.recipeItems)
            li.add(i);
          if (li.contains(new ItemStack(b, 1))) {
            blockCraft.put(b, s);
            Item result = Item.itemsList[s.getRecipeOutput().itemID];
            heldItem = new ItemStack(result, 1);
          }
        }
      }
  }
View Full Code Here

  public static ArrayList<Item> ingots = new ArrayList<Item>();

  public static void load() {
    ingots.add(Item.ingotIron);
    for (int x = 0; x < oreList.length; x++) {
      Item i = new ItemIngot(mod_Dragon.LAST_ID + x).setItemName(oreList[x].toLowerCase()
          + "Ingot");
      if (x != 3) {
        int m = ModLoader.addOverride("/terrain.png",
            "/dragons/ores/" + oreList[x].toLowerCase() + ".png");
        Block b = new BlockOre(150 + x, m, Material.rock).setBlockName("ore" + oreList[x]);
        ModLoader.addName(b, oreList[x] + " Ore");
        ModLoader.registerBlock(b);
        ores.add(b);
        ModLoader.addSmelting(b.blockID, new ItemStack(i.shiftedIndex, 1, 0));
      }
      ModLoader.addName(i, oreList[x] + " Ingot");
      if (x != 0)
        ingots.add(i);
      int k = ModLoader.addOverride("/gui/items.png",
          "/dragons/ingots/" + oreList[x].toLowerCase() + ".png");
      i.setIconIndex(k);
    }
    mod_Dragon.LAST_ID = mod_Dragon.LAST_ID + oreList.length;
    Item steel = new ItemIngot(mod_Dragon.LAST_ID).setItemName("steelIngot");
    ModLoader.addName(steel, "Steel Ingot");
    ModLoader.addRecipe(new ItemStack(steel.shiftedIndex, 1, 0),
        new Object[] { "XY", Character.valueOf('X'), ingots.get(0), Character.valueOf('Y'),
            ingots.get(1) });
    ingots.add(1, steel);
    int k = ModLoader.addOverride("/gui/items.png", "/dragons/ingots/steel.png");
    steel.setIconIndex(k);
    mod_Dragon.LAST_ID += 1;
    Item daedric = new ItemIngot(mod_Dragon.LAST_ID).setItemName("daedricIngot");
    ModLoader.addName(daedric, "Daedra Heart");
    ModLoader.addRecipe(new ItemStack(daedric.shiftedIndex, 1, 0), new Object[] { "XX",
        Character.valueOf('X'), ingots.get(7) });
    int j = ModLoader.addOverride("/gui/items.png", "/dragons/ingots/daedric.png");
    daedric.setIconIndex(j);
    ingots.add(daedric);

  }
View Full Code Here

  }

  public static ArrayList<Item> staves = new ArrayList<Item>();

  public static void addStaves() {
    Item mageLight = new ItemStaff(mod_Dragon.LAST_ID++, "Magelight", Block.glowStone.blockID,
        false) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onLoad() {
            int duration = (int) Math.min(Alteration.playerLevel.get(ep), 20);
            Magic.Alteration.mageList(worldObj, this, duration, ep);
          }
        };
        e.particletype = "spell";
        return e;
      }

      public void updateMagic(EntityLiving el) {
        if (Alteration.playerSkill.containsKey(el))
          Alteration.playerSkill.put(el, Alteration.playerSkill.get(el) + 1);
        else
          Alteration.playerSkill.put(el, 1);
      }
    };
    Item atronach = new ItemStaff(mod_Dragon.LAST_ID++, "Atronach", Item.blazeRod.shiftedIndex,
        true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            Magic.Conjuration
                .summonCreature(worldObj, Atronach.class, posX, posY, posZ,
                    (int) Math.max(Magic.Conjuration.playerLevel.get(ep), 60),
                    ep);
          }
        };
        e.particletype = "flame";
        return e;
      }

      public void updateMagic(EntityLiving el) {
        if (Conjuration.playerSkill.containsKey(el))
          Conjuration.playerSkill.put(el, Conjuration.playerSkill.get(el) + 1);
        else
          Conjuration.playerSkill.put(el, 1);
      }
    };
    Item fireball = new ItemStaff(mod_Dragon.LAST_ID++, "Fireball",
        Item.fireballCharge.shiftedIndex, true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            Magic.Destruction.fireball(worldObj, posX, posY, posZ);
          }
        };
        e.particletype = "flame";
        return e;
      }
    };
    Item iceball = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Blast", Item.snowball.shiftedIndex,
        true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            Magic.Destruction.iceball(worldObj, posX, posY, posZ);
          }
        };
        e.particletype = "splash";
        return e;
      }
    };
    Item firebolt = new ItemStaff(mod_Dragon.LAST_ID++, "Firebolt",
        Item.flintAndSteel.shiftedIndex, true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            if (collided != null)
              Magic.Destruction.firebolt(ep, collided);

          }
        };
        e.particletype = "flame";
        return e;
      }

      public void updateMagic(EntityLiving el) {
        if (Destruction.playerSkill.containsKey(el))
          Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
        else
          Destruction.playerSkill.put(el, 1);
      }
    };
    Item icebolt = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Bolt", Block.blockSnow.blockID,
        false) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            if (collided != null)
              Magic.Destruction.icebolt(ep, collided);
          }
        };
        e.particletype = "splash";
        return e;
      }

      public void updateMagic(EntityLiving el) {
        if (Destruction.playerSkill.containsKey(el))
          Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
        else
          Destruction.playerSkill.put(el, 1);
      }
    };
    Item lightningbolt = new ItemStaff(mod_Dragon.LAST_ID++, "Lightning Bolt",
        Item.redstone.shiftedIndex, true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            if (collided != null)
              Magic.Destruction.lightningbolt(ep, collided);
          }
        };
        e.particletype = "reddust";
        return e;
      }

      public void updateMagic(EntityLiving el) {
        if (Destruction.playerSkill.containsKey(el))
          Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
        else
          Destruction.playerSkill.put(el, 1);
      }
    };
    Item icespike = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Spike", Block.ice.blockID, false) {
      public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityLiving e) {
        // ep.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
        if (!(e instanceof EntityPlayer))
          return itemstack;
        EntityPlayer ep = (EntityPlayer) e;
        float f = 1.0F;
        double d = ep.prevPosX + (ep.posX - ep.prevPosX) * (double) f;
        double d1 = (ep.prevPosY + (ep.posY - ep.prevPosY) * (double) f + 1.62D)
            - (double) ep.yOffset;
        double d2 = ep.prevPosZ + (ep.posZ - ep.prevPosZ) * (double) f;
        boolean flag = false;
        MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(
            world, ep, flag);

        if (movingobjectposition == null)
          return itemstack;
        if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
          int i = movingobjectposition.blockX;
          int j = movingobjectposition.blockY;
          int k = movingobjectposition.blockZ;
          if (movingobjectposition.sideHit == 0)
            j--;
          if (movingobjectposition.sideHit == 1)
            j++;
          if (movingobjectposition.sideHit == 2)
            k--;
          if (movingobjectposition.sideHit == 3)
            k++;
          if (movingobjectposition.sideHit == 4)
            i--;
          if (movingobjectposition.sideHit == 5)
            i++;
          if (!ep.canPlayerEdit(i, j, k))
            return itemstack;
          if (world.isAirBlock(i, j, k) || !world.getBlockMaterial(i, j, k).isSolid())
            Magic.Destruction.icespike(world, i, j, k);
        }
        return itemstack;
      }
    };
    Item healing = new ItemStaff(mod_Dragon.LAST_ID++, "Heal", Item.appleRed.shiftedIndex, true) {
      public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityLiving ep) {
        Restoration.heal(world, ep, world.rand);
        itemstack.damageItem(2, ep);
        for(int x = 0; x < 10; x++)
        world.spawnParticle("heart", ep.posX, ep.posY, ep.posZ, 0, 0, 0);
        return itemstack;
      }

      public void updateMagic(EntityLiving el) {
        if (Restoration.playerSkill.containsKey(el))
          Restoration.playerSkill.put(el, Restoration.playerSkill.get(el) + 1);
        else
          Restoration.playerSkill.put(el, 1);
      }
    };
    Item necro = new ItemStaff(mod_Dragon.LAST_ID++, "Raise Undead",
        Item.rottenFlesh.shiftedIndex, true) {
      public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
        StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
          public void onCollide() {
            Magic.Conjuration.summonNecro(worldObj, posX, posY, posZ, ep, null);
View Full Code Here

    TileUsefullEngine tile = (TileUsefullEngine) world.getBlockTileEntity(i, j, k);

    if (entityplayer.isSneaking()) return false;

    // Switch orientation if whacked with a wrench.
    Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
    if (equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(entityplayer, i, j, k)) {
      tile.switchOrientation();
      ((IToolWrench) equipped).wrenchUsed(entityplayer, i, j, k);
      return true;
View Full Code Here

                for (int i = size - 1; i >= 0; i--) {
                    ItemStack  from = containerMgr.getItemStack(i);
                    if (from != null) {

                        // Move armor parts
                      Item fromItem = getItem(from);
                      if (isDamageable(fromItem)) {
                          if (sortArmorParts) {
                               if (isItemArmor(fromItem)) {
                                 ItemArmor fromItemArmor = asItemArmor(fromItem);
                                   if (globalContainer.hasSection(InvTweaksContainerSection.ARMOR)) {
                                       List<Slot> armorSlots = globalContainer.getSlots(InvTweaksContainerSection.ARMOR);
                                       for (Slot slot : armorSlots) {
                                        boolean move = false;
                                        if (!hasStack(slot)) {
                                          move = true;
                                        }
                                        else {
                                                Item currentArmor = getItem(getStack(slot));
                                                if(isItemArmor(currentArmor)) {
                                                    int armorLevel = getArmorLevel(asItemArmor(currentArmor));
                                                    if (armorLevel < getArmorLevel(fromItemArmor)
                                                            || (armorLevel == getArmorLevel(fromItemArmor)
                                                                    && getItemDamage(getStack(slot)) < getItemDamage(from))) {
View Full Code Here

TOP

Related Classes of net.minecraft.src.Item

Copyright © 2018 www.massapicom. 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.