Ejemplo n.º 1
0
  @SuppressWarnings("incomplete-switch")
  @Override
  public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
    if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());

    if (stack.getItemDamage() >= stack.getMaxDamage() - 2) {
      NBTTagCompound tag = stack.getTagCompound();
      tag.setBoolean("destroyed", true);
      stack.setTagCompound(tag);

      return;
    }

    switch (this.armorType) {
      case HEAD:
        if (stack.getTagCompound().getBoolean("respiration")
            && stack.getItemDamage() < stack.getMaxDamage() - 16)
          if (player.getAir() == 0) {
            player.setAir(150);
            stack.damageItem(16, player);
          }
        break;
      case LEGS:
      case FEET:
        if (stack.getTagCompound().getBoolean("fall")) {
          if (player.fallDistance > 0) player.fallDistance = 0;
        }
    }
  }
  @Override
  public int charge(ItemStack item, int amount, boolean flag) {

    if (item == null) return 0;

    NBTTagCompound nbt = item.getTagCompound();
    int charge = 0;
    int increase = 0;
    if (nbt != null && nbt.hasKey("charge")) {
      charge = nbt.getInteger("charge");
    }

    int i = this.getMaxAmount(item) - charge;
    Math.min(i, 0);

    increase = Math.min(amount, i);

    if (flag) {
      if (nbt != null) {
        nbt.setInteger("charge", (charge + increase));
        item.setTagCompound(nbt);
      } else {
        NBTTagCompound nbt2 = new NBTTagCompound();
        nbt2.setInteger("charge", (charge + increase));
        item.setTagCompound(nbt2);
      }
    }

    return increase;
  }
  @Override
  public int discharge(ItemStack item, int amount, boolean flag) {

    if (item == null) return 0;

    NBTTagCompound nbt = item.getTagCompound();
    int charge = 0;
    int reduce = 0;
    if (nbt != null && nbt.hasKey("charge")) {
      charge = nbt.getInteger("charge");
    }

    reduce = Math.min(amount, charge);

    if (flag) {
      if (nbt != null) {
        nbt.setInteger("charge", (charge - reduce));
        item.setTagCompound(nbt);
      } else {
        NBTTagCompound nbt2 = new NBTTagCompound();
        nbt2.setInteger("charge", (charge - reduce));
        item.setTagCompound(nbt2);
      }
    }

    return reduce;
  }
  public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
    if (tool == 4 || tool == 5) {
      if (stack.getTagCompound() == null) {
        stack.setTagCompound(new NBTTagCompound());
      }
      NBTTagCompound tag = stack.getTagCompound();
      this.currentCharge = tag.getInteger("CurrentCharge");
      if (this.currentCharge > 24) {

        return false;
      } else {

        return true;
      }
    } else {
      if (stack.getTagCompound() == null) {
        stack.setTagCompound(new NBTTagCompound());
      }
      NBTTagCompound tag = stack.getTagCompound();
      this.currentCharge = tag.getInteger("CurrentCharge");
      if (this.currentCharge > 48) {

        return false;
      } else {

        return true;
      }
    }
  }
Ejemplo n.º 5
0
  @Override
  public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {

    EntityPlayer par3EntityPlayer = (EntityPlayer) player;

    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(packet.data));

    ItemStack par1ItemStack;
    try {
      par1ItemStack = Packet.readItemStack(dis);
      Entity entityID = par3EntityPlayer.worldObj.getEntityByID(dis.readInt());

      if (par1ItemStack.getTagCompound() == null)
        par1ItemStack.setTagCompound(new NBTTagCompound());

      if (par1ItemStack.getTagCompound().hasKey(ModBreeds.tag)
          && (!par1ItemStack.getTagCompound().getString(ModBreeds.tag).equals("none"))) {
        par3EntityPlayer.addChatMessage(
            "Pet trap still has a  " + EntityList.getEntityString(entityID) + " inside !");
      } else {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setString(ModBreeds.tag, EntityList.getEntityString(entityID));
        par1ItemStack.setTagCompound(nbt);
        entityID.setDead();
        par3EntityPlayer.setCurrentItemOrArmor(0, par1ItemStack);
        if (!par3EntityPlayer.worldObj.isRemote)
          par3EntityPlayer.addChatMessage(
              "Stored a " + EntityList.getEntityString(entityID) + " in the Animal trap");
      }

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
 public boolean onBlockDestroyed(
     ItemStack par1ItemStack,
     World par2World,
     int par3,
     int par4,
     int par5,
     int par6,
     EntityLivingBase par7EntityLivingBase) {
   if (tool == 4) {
     if (par1ItemStack.getTagCompound() == null) {
       par1ItemStack.setTagCompound(new NBTTagCompound());
     }
     NBTTagCompound tag = par1ItemStack.getTagCompound();
     this.currentCharge = tag.getInteger("CurrentCharge");
     if (this.currentCharge >= 48) {
       this.currentCharge -= 48;
       tag.setInteger("CurrentCharge", this.currentCharge);
       return true;
     } else return false;
   } else {
     if (par1ItemStack.getTagCompound() == null) {
       par1ItemStack.setTagCompound(new NBTTagCompound());
     }
     NBTTagCompound tag = par1ItemStack.getTagCompound();
     this.currentCharge = tag.getInteger("CurrentCharge");
     if (this.currentCharge >= 24) {
       this.currentCharge -= 24;
       tag.setInteger("CurrentCharge", this.currentCharge);
       return true;
     } else return false;
   }
 }
Ejemplo n.º 7
0
 public void setDefaultInfo(ItemStack itemStack, String info) {
   if (itemStack.getTagCompound() == null) {
     itemStack.setTagCompound(new NBTTagCompound());
   }
   NBTTagCompound stackCompound = itemStack.getTagCompound();
   stackCompound.setString("defaultInfo", info);
   itemStack.setTagCompound(stackCompound);
 }
Ejemplo n.º 8
0
 @Override
 public IItemStack withTag(IData tag) {
   ItemStack result = new ItemStack(stack.getItem(), stack.getCount(), stack.getItemDamage());
   if (tag == null) {
     result.setTagCompound(null);
   } else {
     result.setTagCompound((NBTTagCompound) NBTConverter.from(tag));
   }
   return new MCItemStack(result, tag);
 }
 public void spawnFirecode(Vector3f pos, int flightTime, Object func) {
   final IFunction explodeFunc = JSScriptingManager.getInstance().getFunction(func);
   final EntityPlayer owner = _player;
   ItemStack stk = new ItemStack(Item.firework);
   NBTTagCompound baseComp = new NBTTagCompound();
   baseComp.setCompoundTag("Fireworks", new NBTTagCompound("Fireworks"));
   baseComp.getCompoundTag("Fireworks").setByte("Flight", (byte) flightTime);
   stk.setTagCompound(baseComp);
   EntityFireworkRocket fireWork =
       new EntityFireworkRocket(
           _world, (int) pos.getX(), (int) pos.getY(), (int) pos.getZ(), stk) {
         @Override
         public void onUpdate() {
           super.onUpdate();
           if (this.isDead) {
             if (explodeFunc != null && !worldObj.isRemote) {
               try {
                 JSScriptingManager.getInstance()
                     .runFunction(
                         new ScriptRunnerPlayer(owner),
                         explodeFunc,
                         new Vector3f(this.posX, this.posY, this.posZ));
               } catch (InternalScriptingException e) {
                 owner.sendChatToPlayer("Error in firecode: " + e.getMessage());
               }
             }
           }
         }
       };
   _world.spawnEntityInWorld(fireWork);
 }
Ejemplo n.º 10
0
  private void setSpawnerInfo(ItemStack stack, NBTTagCompound nbtSpawner) {
    NBTTagCompound nbtStack = stack.getTagCompound();
    if (nbtStack == null) nbtStack = new NBTTagCompound();

    nbtStack.setTag(NBT_SPAWNER, nbtSpawner);
    stack.setTagCompound(nbtStack);
  }
 public boolean onItemUseFirst(
     GT_MetaBase_Item aItem,
     ItemStack aStack,
     EntityPlayer aPlayer,
     World aWorld,
     int aX,
     int aY,
     int aZ,
     int aSide,
     float hitX,
     float hitY,
     float hitZ) {
   if ((aPlayer instanceof EntityPlayerMP)) {
     TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
     if (((tTileEntity instanceof IInventory))
         && (!((IInventory) tTileEntity).isUseableByPlayer(aPlayer))) {
       return false;
     }
     if (((tTileEntity instanceof IGregTechDeviceInformation))
         && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) {
       GT_Utility.setStack(aStack, ItemList.NC_SensorCard.get(aStack.stackSize, new Object[0]));
       NBTTagCompound tNBT = aStack.getTagCompound();
       if (tNBT == null) {
         tNBT = new NBTTagCompound();
       }
       tNBT.setInteger("x", aX);
       tNBT.setInteger("y", aY);
       tNBT.setInteger("z", aZ);
       aStack.setTagCompound(tNBT);
     }
     return true;
   }
   return false;
 }
Ejemplo n.º 12
0
 @Override
 public void doCommand(ItemStack duplicator, EntityPlayerMP sender, String[] arguments) {
   try {
     String name = arguments.length == 2 ? arguments[1] : sender.getCommandSenderName();
     File file =
         new File(
             DimensionManager.getCurrentSaveRootDirectory().getPath()
                 + File.separator
                 + "managers"
                 + File.separator
                 + name
                 + ".nbt");
     if (!file.exists()) {
       throw new CommandException("Couldn't access file: " + name + ".nbt");
     }
     NBTTagCompound tagCompound = CompressedStreamTools.read(file);
     duplicator.setTagCompound(unstripBaseNBT(tagCompound));
     CommandBase.getCommandSenderAsPlayer(sender)
         .addChatComponentMessage(
             new ChatComponentText(
                 LocalizationHelper.translateFormatted(
                     "stevesaddons.command.loadSuccess", name + ".nbt")));
   } catch (IOException e) {
     throw new CommandException("stevesaddons.command.loadFailed");
   }
 }
Ejemplo n.º 13
0
 @Override
 public IRocketEngine getModule(ItemStack stack) {
   if (stack != null) {
     ItemStack insert = stack.copy();
     insert.stackSize = 1;
     IRocketEngine engine = MissileModuleBuilder.INSTANCE.buildEngine(insert);
     if (engine == null) {
       // Data is invalid TODO see if we can save data if NBT is not null
       engine = Engines.get(insert).newModule();
       stack.setTagCompound(engine.save(new NBTTagCompound()));
       insert.setTagCompound(engine.save(new NBTTagCompound()));
     }
     return engine;
   }
   return null;
 }
Ejemplo n.º 14
0
  @Override
  public boolean matches(InventoryCrafting inventoryCrafting, World world) {
    ItemStack biomeRadar = null;
    ItemStack biomeEssence = null;

    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(j, i);

        if (itemstack != null) {
          if (itemstack.getItem() == BOPItemHelper.get("biomeFinder"))
            biomeRadar = itemstack.copy();
          else if (itemstack.getItem() == BOPItemHelper.get("biomeEssence"))
            biomeEssence = itemstack.copy();
        }
      }
    }

    if (biomeRadar != null && biomeEssence != null) {
      if (!biomeEssence.hasTagCompound() || !biomeEssence.getTagCompound().hasKey("biomeID"))
        return false;

      int biomeID = biomeEssence.getTagCompound().getInteger("biomeID");

      if (!biomeRadar.hasTagCompound()) biomeRadar.setTagCompound(new NBTTagCompound());

      biomeRadar.getTagCompound().setInteger("biomeIDToFind", biomeID);
      biomeRadar.getTagCompound().setBoolean("foundBiome", false);

      recipeOutput = biomeRadar;

      return true;
    } else return false;
  }
  @Override
  public boolean onItemUse(
      ItemStack stack,
      EntityPlayer player,
      World world,
      int x,
      int y,
      int z,
      int meta,
      float f1,
      float f2,
      float f3) {
    if (world.isRemote || stack.hasTagCompound()) {
      return false;
    }

    NBTTagCompound tagCompound = new NBTTagCompound();
    tagCompound.setInteger(ThermalScienceNBTTags.Dim, world.provider.dimensionId);
    tagCompound.setInteger(ThermalScienceNBTTags.XCoord, x);
    tagCompound.setInteger(ThermalScienceNBTTags.YCoord, y + 1);
    tagCompound.setInteger(ThermalScienceNBTTags.ZCoord, z);

    int yaw = (int) player.rotationYaw;

    if (yaw < 0) {
      yaw += 360;
    }

    int i = (yaw + 45) / 90;

    tagCompound.setInteger(ThermalScienceNBTTags.Yaw, (i * 90));

    stack.setTagCompound(tagCompound);
    return true;
  }
Ejemplo n.º 16
0
  public void setBrittle(boolean value) {
    if (itemStack.stackTagCompound == null) {
      itemStack.setTagCompound(new NBTTagCompound());
    }

    itemStack.stackTagCompound.setBoolean("brittle", value);
  }
Ejemplo n.º 17
0
  private void mixPotions() {
    ItemStack resultPotion = new ItemStack(ModItems.mixedPotion, 1);
    int emulsifierLevel = calculateEmulsifierLevel();
    ArrayList<PotionEffect> resultList = new ArrayList<PotionEffect>();
    NBTTagCompound potionEffects = new NBTTagCompound();
    NBTTagList taglist = new NBTTagList();

    for (int i = POTION_START; i < getSizeInventory(); i++) {
      ItemStack potion = getStackInSlot(i);
      ArrayList<PotionEffect> effectList = getPotionEffects(potion);
      if (resultList.size() == emulsifierLevel) {
        break;
      } else if (resultList.size() + effectList.size() > emulsifierLevel) {
        continue;
      } else {
        for (PotionEffect effect : effectList) {
          if (!resultList.contains(effect)) {
            resultList.add(effect);
            NBTTagCompound effectCompound = new NBTTagCompound();
            taglist.appendTag(effect.writeCustomPotionEffectToNBT(effectCompound));
          }
        }
        // since this potion was used, remove it from the inventory
        setInventorySlotContents(i, null);
      }
    }

    potionEffects.setTag("CustomPotionEffects", taglist);
    resultPotion.setTagCompound(potionEffects);
    setInventorySlotContents(EMULSIFIER_INDEX, decrStackSize(EMULSIFIER_INDEX, 1));
    setInventorySlotContents(RESULT_INDEX, resultPotion);
  }
 public static ItemStack getHiddenNetStack() {
   ItemStack s = new ItemStack(MineFactoryReloadedCore.safariNetSingleItem);
   NBTTagCompound c = new NBTTagCompound();
   c.setBoolean("hide", true);
   s.setTagCompound(c);
   return s;
 }
Ejemplo n.º 19
0
  @Override
  public boolean onBlockActivated(
      World world,
      int x,
      int y,
      int z,
      EntityPlayer player,
      int idk,
      float what,
      float these,
      float are) {
    ItemStack playerItem = player.getCurrentEquippedItem();

    if (playerItem != null) {
      if (playerItem.getItem() instanceof TelepositionFocus) {
        SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player);

        if (playerItem.getTagCompound() == null) {
          playerItem.setTagCompound(new NBTTagCompound());
        }

        NBTTagCompound itemTag = playerItem.getTagCompound();
        itemTag.setInteger("xCoord", x);
        itemTag.setInteger("yCoord", y);
        itemTag.setInteger("zCoord", z);
        itemTag.setInteger("dimensionId", world.provider.dimensionId);
        return true;
      }
    }
    player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
    return true;
  }
Ejemplo n.º 20
0
  public static void initialize() {

    iconStack = new ItemStack(RAItems.itemSwordFlux, 1, Short.MAX_VALUE);
    iconStack.setTagCompound(new NBTTagCompound());
    iconStack.stackTagCompound.setBoolean("Empowered", true);
    iconStack.stackTagCompound.setBoolean("CreativeTab", true);
  }
  public ItemStack onItemRightClick(ItemStack bowl, World world, EntityPlayer player) {

    ChatComponentTranslation chatComponent;

    if (!bowl.hasTagCompound()) {
      bowl.setTagCompound(new NBTTagCompound());
    }
    if (!bowl.getTagCompound().hasKey("amount")) {
      bowl.getTagCompound().setInteger("amount", 0);
    }

    if (bowl.stackTagCompound.getInteger("amount") >= 100 && world.isRemote == false) {
      chatComponent =
          (ChatComponentTranslation)
              new ChatComponentTranslation("This Crucible has been filled.")
                  .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED));
      player.addChatComponentMessage(chatComponent);
    }

    if (bowl.stackTagCompound.getInteger("amount") <= 100) {
      if (player.inventory.hasItem(matryoshikassinners_Items.VillagerSoul)) {
        player.inventory.consumeInventoryItem(matryoshikassinners_Items.VillagerSoul);
        int amount = bowl.stackTagCompound.getInteger("amount");
        bowl.stackTagCompound.setInteger("amount", amount + 6);
        return bowl;
      }
      if (player.inventory.hasItem(matryoshikassinners_Items.AnimalSoul)) {
        player.inventory.consumeInventoryItem(matryoshikassinners_Items.AnimalSoul);
        int amount = bowl.stackTagCompound.getInteger("amount");
        bowl.stackTagCompound.setInteger("amount", amount + 2);
        return bowl;
      }
      if (player.inventory.hasItem(matryoshikassinners_Items.BuffMobSoul)) {
        player.inventory.consumeInventoryItem(matryoshikassinners_Items.BuffMobSoul);
        int amount = bowl.stackTagCompound.getInteger("amount");
        bowl.stackTagCompound.setInteger("amount", amount + 4);
        return bowl;
      }
      if (player.inventory.hasItem(matryoshikassinners_Items.ZombieSoul)) {
        player.inventory.consumeInventoryItem(matryoshikassinners_Items.ZombieSoul);
        int amount = bowl.stackTagCompound.getInteger("amount");
        bowl.stackTagCompound.setInteger("amount", amount + 1);
        return bowl;

      } else {
        if (world.isRemote == false) {
          chatComponent =
              (ChatComponentTranslation)
                  new ChatComponentTranslation(
                          "Currently holds: "
                              + bowl.stackTagCompound.getInteger("amount")
                              + " Soul-fragments")
                      .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED));
          player.addChatComponentMessage(chatComponent);
        }
      }
    }

    return bowl;
  }
Ejemplo n.º 22
0
 public InventoryBackpack(ItemStack stack) {
   invItem = stack;
   if (!invItem.hasTagCompound()) {
     invItem.setTagCompound(new NBTTagCompound());
   }
   readFromNBT(invItem.getTagCompound());
 }
 @Override
 public void addInformation(
     ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
   if (par1ItemStack.getTagCompound() == null) {
     par1ItemStack.setTagCompound(new NBTTagCompound());
   }
   NBTTagCompound tag = par1ItemStack.getTagCompound();
   if (tag.getString("Creator") == "") {
     tag.setString("Creator", par2EntityPlayer.username);
   }
   this.currentCharge = tag.getInteger("CurrentCharge");
   tag.setInteger("MaxStorage", this.maxStorage);
   this.maxStorage = tag.getInteger("MaxStorage");
   tag.setInteger("RechargeRate", this.rechargeRatePerTick);
   this.rechargeRatePerTick = tag.getInteger("RechargeRate");
   dimensionTravel = tag.getInteger("Dimension");
   x = tag.getInteger("posX");
   y = tag.getInteger("posY");
   z = tag.getInteger("posZ");
   if (x != null && y != null && z != null) {
     par3List.add("X: " + x.toString());
     par3List.add("Y: " + y.toString());
     par3List.add("Z: " + z.toString());
     par3List.add("Dimension: " + dimensionTravel);
     par3List.add(this.currentCharge + "/" + this.maxStorage + " MyJ");
     par3List.add("Creator: " + tag.getString("Creator"));
   }
 }
Ejemplo n.º 24
0
  static {
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setString("author", "Guess Who? :3");
    nbt.setString("title", "NotOnlyMoreOres");

    NBTTagList pages = new NBTTagList();
    pages.appendTag(
        new NBTTagString(
            "1",
            "Hey there handsome! ;) How are you doing today? "
                + "I see that you chose to play with this \u00a7nawesome\u00a7r mod that you found, \u00a7oSkorpio's NotOnlyMoreOres Mod\u00a7r! Just wanted to tell you some wise stuff about it! "
                + "Flip to the next page please! :)"));
    pages.appendTag(
        new NBTTagString(
            "2",
            "First of all, if you're just a normal player, I want you to have fun. Understood? Alright. "
                + "Are you a youtuber who's going to review this mod? Alright listen up man. You \u00a7lNEED TO READ THE THREAD FULLY \u00a70alright? ;) Thanks! :3 Flip again! :)"));
    pages.appendTag(
        new NBTTagString(
            "3",
            "And if you have any suggestions, PLEASE visit the thread for the mod and give the author a little help! :) "
                + "Now go, have fun! :D I'll talk to you later! <3"
                + "                               P.S. you seem to like flipping, so why don't you do it one more time? :3"));
    pages.appendTag(
        new NBTTagString(
            "4",
            "\u00a7bT\u00a71R\u00a72O\u00a73L\u00a74O\u00a75L\u00a76O\u00a77L\u00a78O\u00a7aL \u00a70nothing here! GOTCHA! x) \u00a7kSkorpio"));

    nbt.setTag("pages", pages);
    reading = new ItemStack(Item.writtenBook);
    reading.setTagCompound(nbt);
  }
Ejemplo n.º 25
0
 @Override
 public void readSpawnData(ByteArrayDataInput data) {
   returnStack = new ItemStack(data.readShort(), 1, 0);
   rotationYaw = data.readFloat();
   NBTTagCompound compound = new NBTTagCompound();
   NBTTagCompound toolTag = new NBTTagCompound();
   toolTag.setInteger("RenderHandle", data.readInt());
   toolTag.setInteger("RenderHead", data.readInt());
   toolTag.setInteger("RenderAccessory", data.readInt());
   switch (data.readInt()) {
     case 6:
       toolTag.setInteger("Effect6", data.readInt());
     case 5:
       toolTag.setInteger("Effect5", data.readInt());
     case 4:
       toolTag.setInteger("Effect4", data.readInt());
     case 3:
       toolTag.setInteger("Effect3", data.readInt());
     case 2:
       toolTag.setInteger("Effect2", data.readInt());
     case 1:
       toolTag.setInteger("Effect1", data.readInt());
   }
   compound.setCompoundTag("InfiTool", toolTag);
   returnStack.setTagCompound(compound);
 }
Ejemplo n.º 26
0
 @SideOnly(Side.CLIENT)
 public void addInformation(ItemStack stack, EntityPlayer player, List dataList, boolean b) {
   if (stack.stackTagCompound == null) stack.setTagCompound(new NBTTagCompound());
   updateStats(stack);
   dataList.add(
       "+"
           + (int) stack.stackTagCompound.getDouble("damage")
           + " (1 + 10% Energy) Attack Damage");
   dataList.add(
       "+" + (int) stack.stackTagCompound.getDouble("lifeSteal") + "% (5% Energy) LifeSteal");
   dataList.add("");
   dataList.add("�assive: �ain 5 energy on hit.");
   dataList.add("�assive: �eal 6% of your current health");
   dataList.add("�s bonus damage on hit.");
   dataList.add(
       "�ctive: �onsume "
           + stack.stackTagCompound.getInteger("cost")
           + " �nergy to heal a maximum");
   dataList.add(
       "�f " + (int) stack.stackTagCompound.getDouble("energy") / 20 + "�(5% Energy) Heart(s).");
   super.addInformation(stack, player, dataList, b);
   /*dataList.add("");
   dataList.add("�\"A Godly staff only the Pineapple Gods can use. The");
   dataList.add("�Pineapple Gods showed Steve the way to make it");
   dataList.add("�after he found the shrine of Pineapples\"");*/
 }
  public HandlerItemEssentiaCell(final ItemStack storageStack, final ISaveProvider saveProvider) {
    // Ensure we have a NBT tag
    if (!storageStack.hasTagCompound()) {
      storageStack.setTagCompound(new NBTTagCompound());
    }

    // Get the NBT tag
    this.cellData = storageStack.getTagCompound();

    // Get the total types we can store
    this.totalTypes = ((ItemEssentiaCell) ItemEnum.ESSENTIA_CELL.getItem()).maxTypes(storageStack);

    // Get the total bytes we can hold
    this.totalBytes =
        ((ItemEssentiaCell) ItemEnum.ESSENTIA_CELL.getItem()).maxStorage(storageStack);

    // Calculate how many essentia we can hold
    this.totalEssentiaStorage = this.totalBytes * HandlerItemEssentiaCell.ESSENTIA_PER_BYTE;

    // Setup the storage
    this.storedEssentia = new AspectStack[this.totalTypes];

    // Set the save provider
    this.saveProvider = saveProvider;

    // Read the cell data
    this.readCellData();
  }
  @Override
  public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
    TileEntity tile = par1World.getTileEntity(par2, par3, par4);
    OrderExchanger tileentity = null;
    if (tile != null && tile instanceof OrderExchanger) {
      tileentity = (OrderExchanger) tile;
    }

    if (tileentity != null) {

      ItemStack drop = new ItemStack(this, 1, 0);
      NBTTagCompound tag = new NBTTagCompound();
      tag = tileentity.getNBT(tag);
      drop.setTagCompound(tag);
      EntityItem entityitem =
          new EntityItem(par1World, par2 + 0.5D, par3 + 0.5D, par4 + 0.5D, drop);
      float f3 = 0.05F;
      entityitem.motionX = (float) this.rand.nextGaussian() * f3;
      entityitem.motionY = (float) this.rand.nextGaussian() * f3 + 0.2F;
      entityitem.motionZ = (float) this.rand.nextGaussian() * f3;
      par1World.spawnEntityInWorld(entityitem);

      par1World.func_147453_f(par2, par3, par4, par5);
    }
  }
Ejemplo n.º 29
0
 public ItemStack getItemStackWithData(World world, int x, int y, int z) {
   ItemStack stack = new ItemStack(world.getBlock(x, y, z), 1, 0);
   TileEntity tentity = world.getTileEntity(x, y, z);
   if (tentity instanceof TileVendorBlock) {
     TileVendorBlock te = (TileVendorBlock) tentity;
     NBTTagList itemList = new NBTTagList();
     NBTTagCompound tagCompound = new NBTTagCompound();
     for (int i = 0; i < te.getSizeInventory(); i++) {
       ItemStack invStack = te.getStackInSlot(i);
       if (invStack != null) {
         NBTTagCompound tag = new NBTTagCompound();
         tag.setByte("Slot", (byte) i);
         invStack.writeToNBT(tag);
         itemList.appendTag(tag);
       }
     }
     tagCompound.setTag("Inventory", itemList);
     tagCompound.setInteger("CoinSum", te.coinSum);
     tagCompound.setInteger("UserCoinSum", te.userCoinSum);
     tagCompound.setInteger("ItemPrice", te.itemPrice);
     tagCompound.setString("BlockOwner", te.blockOwner);
     tagCompound.setBoolean("Infinite", te.infiniteMode);
     stack.setTagCompound(tagCompound);
     return stack;
   } else return stack;
 }
Ejemplo n.º 30
0
  public ItemWingAuraCascade(ArmorMaterial material, Wing wing) {
    super(material, wing);

    wingList.add(wing);
    for (int i = 1; i < MAX_TIER; i++) {
      wingList.add(
          new IcarusWing(
              wing.name,
              wing.durability + i * wing.durability / MAX_TIER,
              wing.maxHeight + i * wing.maxHeight / MAX_TIER,
              wing.jumpBoost + i * wing.jumpBoost / MAX_TIER,
              wing.glideFactor - i * wing.glideFactor / MAX_TIER,
              wing.rainDrag - i * wing.rainDrag / MAX_TIER,
              wing.waterDrag - i * wing.waterDrag / MAX_TIER,
              wing.fallReductionFactor - i * wing.fallReductionFactor / MAX_TIER));
    }

    for (int i = 0; i < MAX_TIER; i++) {
      IcarusItems.singleWings.addTooltip(
          17 + i,
          StringHelper.LIGHT_BLUE
              + StringHelper.localize("tooltip.icarus.tier")
              + StringHelper.END
              + ": "
              + (i + 1));
      ItemStack stack = new ItemStack(this);
      stack.setTagCompound(new NBTTagCompound());
      stack.stackTagCompound.setInteger(IcarusConstants.NBT_TIER, i);
      angelsteelWings.add(stack);
    }
  }