Package baubles.common.container

Examples of baubles.common.container.InventoryBaubles


  }

  @Override
  public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    if(!par2World.isRemote) {
      InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
      for(int i = 0; i < baubles.getSizeInventory(); i++)
        if(baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
          baubles.setInventorySlotContents(i, par1ItemStack.copy());
          if(!par3EntityPlayer.capabilities.isCreativeMode){
            par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
          }
          onEquipped(par1ItemStack, par3EntityPlayer);
          break;
View Full Code Here


    playerBaubles.remove(player.getCommandSenderName());
  }

  public static InventoryBaubles getPlayerBaubles(EntityPlayer player) {
    if (!playerBaubles.containsKey(player.getCommandSenderName())) {
      InventoryBaubles inventory = new InventoryBaubles(player);
      playerBaubles.put(player.getCommandSenderName(), inventory);
    }
    return playerBaubles.get(player.getCommandSenderName());
  }
View Full Code Here

            }
          }
        }

        if (data != null) {
          InventoryBaubles inventory = new InventoryBaubles(player);
          inventory.readNBT(data);
          playerBaubles.put(player.getCommandSenderName(), inventory);
          if (save)
            savePlayerBaubles(player, file1, file2);
        }
      } catch (Exception exception1) {
View Full Code Here

          }
        }

        try {
          if (file1 != null) {
            InventoryBaubles inventory = getPlayerBaubles(player);
            NBTTagCompound data = new NBTTagCompound();
            inventory.saveNBT(data);

            FileOutputStream fileoutputstream = new FileOutputStream(
                file1);
            CompressedStreamTools.writeCompressed(data,
                fileoutputstream);
View Full Code Here

    // player events
    if (event.entity instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) event.entity;

      InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
      for (int a = 0; a < baubles.getSizeInventory(); a++) {
        if (baubles.getStackInSlot(a) != null
            && baubles.getStackInSlot(a).getItem() instanceof IBauble) {
          ((IBauble) baubles.getStackInSlot(a).getItem()).onWornTick(
              baubles.getStackInSlot(a), player);
        }
      }

    }
View Full Code Here

  private static ResourceLocation textureHalo = new ResourceLocation(LibResources.MISC_HALO);

  @SubscribeEvent
  public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
    InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.entityPlayer);
    if(inv.getStackInSlot(0) != null && inv.getStackInSlot(0).getItem() instanceof ItemFlightTiara) {
      int meta = inv.getStackInSlot(0).getItemDamage();
      if(meta > 0 && meta <= ItemFlightTiara.wingIcons.length) {
        IIcon icon = ItemFlightTiara.wingIcons[meta - 1];
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);

        boolean flying = event.entityPlayer.capabilities.isFlying;
View Full Code Here

            positionsBuilder.append(horse.getEntityId()).append(";");

        } else if(e instanceof EntityPlayer) {
          EntityPlayer player_ = (EntityPlayer) e;
          InventoryPlayer inv = player_.inventory;
          InventoryBaubles binv = PlayerHandler.getPlayerBaubles(player_);
          if(scanInventory(inv, pstack) || scanInventory(binv, pstack))
            positionsBuilder.append(player_.getEntityId()).append(";");

        } else if(e instanceof EntityVillager) {
          EntityVillager villager = (EntityVillager) e;
View Full Code Here

    return getCooldown(stack) <= 0 ? itemIcon : iconOff;
  }

  @SubscribeEvent
  public void onTossItem(ItemTossEvent event) {
    InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.player);
    for(int i = 0; i < inv.getSizeInventory(); i++) {
      ItemStack stack = inv.getStackInSlot(i);
      if(stack != null && stack.getItem() == this) {
        setCooldown(stack, 100);
        if(event.player instanceof EntityPlayerMP)
          PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(event.player, i), (EntityPlayerMP) event.player);
      }
View Full Code Here

    setUnlocalizedName(name);
  }

  @Override
  public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
    for(int i = 0; i < baubles.getSizeInventory(); i++) {
      if(baubles.isItemValidForSlot(i, par1ItemStack)) {
        ItemStack stackInSlot = baubles.getStackInSlot(i);
        if(stackInSlot == null || ((IBauble) stackInSlot.getItem()).canUnequip(stackInSlot, par3EntityPlayer)) {
          if(!par2World.isRemote) {
            baubles.setInventorySlotContents(i, par1ItemStack.copy());
            if(!par3EntityPlayer.capabilities.isCreativeMode)
              par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
          }

          onEquipped(par1ItemStack, par3EntityPlayer);
View Full Code Here

      float chance = getChance(stack);
      for (ItemStack element : player.inventory.armorInventory)
        chance += getChance(element);

      InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
      for(int i = 0; i < baubles.getSizeInventory(); i++)
        chance += getChance(baubles.getStackInSlot(i));

      if(Math.random() < chance) {
        EntityPixie pixie = new EntityPixie(player.worldObj);
        pixie.setPosition(player.posX, player.posY + 2, player.posZ);
View Full Code Here

TOP

Related Classes of baubles.common.container.InventoryBaubles

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.