Package net.mcft.copy.betterstorage.misc

Examples of net.mcft.copy.betterstorage.misc.PropertiesBackpack


  }
 
  public void unequip(EntityLivingBase carrier, boolean despawn) {
    if (worldObj.isRemote) return;
    // Move items from the player backpack data to this tile entity.
    PropertiesBackpack backpackData = ItemBackpack.getBackpackData(carrier);
    if (backpackData.contents != null) {
      System.arraycopy(backpackData.contents, 0, contents, 0, Math.min(contents.length, backpackData.contents.length));
      backpackData.contents = null;
    }
    if (despawn) despawnTime = 0;
View Full Code Here


   
    EntityLivingBase entity = event.entityLiving;
    EntityPlayer player = ((entity instanceof EntityPlayer) ? (EntityPlayer)entity : null);
    ItemStack backpack = ItemBackpack.getBackpack(entity);
   
    PropertiesBackpack backpackData;
    if (backpack == null) {
     
      backpackData = EntityUtils.getProperties(entity, PropertiesBackpack.class);
      if (backpackData == null) return;
     
View Full Code Here

    if (entity.worldObj.isRemote) return;

    EntityPlayer player = ((entity instanceof EntityPlayer) ? (EntityPlayer)entity : null);
    ItemStack backpack = ItemBackpack.getBackpack(entity);
    if (backpack == null) return;
    PropertiesBackpack backpackData = ItemBackpack.getBackpackData(entity);
    if (backpackData.contents == null) return;
   
    boolean keepInventory = entity.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory");
    if ((player != null) && keepInventory) {
     
View Full Code Here

    if (!entityData.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) return;
    NBTTagCompound persistent = entityData.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
   
    if (!persistent.hasKey("Backpack")) return;
    NBTTagCompound compound = persistent.getCompoundTag("Backpack");
    PropertiesBackpack backpackData = ItemBackpack.getBackpackData(event.player);
   
    int size = compound.getInteger("count");
    ItemStack[] contents = new ItemStack[size];
    NbtUtils.readItems(contents, compound.getTagList("Items", NBT.TAG_COMPOUND));
    backpackData.contents = contents;
View Full Code Here

  public int getBackpackRows() { return BetterStorage.globalConfig.getInteger(GlobalConfig.backpackRows); }
 
  protected int getDefaultColor() { return 0xA06540; }
 
  protected IInventory getBackpackItemsInternal(EntityLivingBase carrier, EntityPlayer player) {
    PropertiesBackpack backpackData = getBackpackData(carrier);
    int size = (getBackpackColumns() * getBackpackRows());
    if (backpackData.contents == null)
      backpackData.contents = new ItemStack[size];
    // In case the backpack size got changed in
    // the configuration file, update it here.
View Full Code Here

  public void damageArmor(EntityLivingBase entity, ItemStack stack,
                          DamageSource source, int damage, int slot) {
    if (!takesDamage(stack, source)) return;
    stack.damageItem(damage, entity);
    if (stack.stackSize > 0) return;
    PropertiesBackpack backpackData = ItemBackpack.getBackpackData(entity);
    if (backpackData.contents != null)
      for (ItemStack s : backpackData.contents)
        WorldUtils.dropStackFromEntity(entity, s, 2.0F);
    entity.renderBrokenItemStack(stack);
  }
View Full Code Here

    return getBackpackData(entity).backpack;
  }
  public static void setBackpack(EntityLivingBase entity, ItemStack backpack, ItemStack[] contents) {
    boolean setChestplate = (BetterStorage.globalConfig.getBoolean(GlobalConfig.backpackChestplate) ||
                             !(entity instanceof EntityPlayer) || hasChestplateBackpackEquipped(entity));
    PropertiesBackpack backpackData = getBackpackData(entity);
    if (!setChestplate) backpackData.backpack = backpack;
    else entity.setCurrentItemOrArmor(EquipmentSlot.CHEST, backpack);
    backpackData.contents = contents;
    ItemBackpack.updateHasItems(entity, backpackData);
  }
View Full Code Here

 
  public static void initBackpackData(EntityLivingBase entity) {
    EntityUtils.createProperties(entity, PropertiesBackpack.class);
  }
  public static PropertiesBackpack getBackpackData(EntityLivingBase entity) {
    PropertiesBackpack backpackData = EntityUtils.getOrCreateProperties(entity, PropertiesBackpack.class);
    if (!backpackData.initialized) {
      updateHasItems(entity, backpackData);
      backpackData.initialized = true;
    }
    return backpackData;
View Full Code Here

 
  @Override
  public void setLivingAnimations(EntityLivingBase entity, float par2, float par3, float partialTicks) {
    float angle = 0;
    if (entity != null) {
      PropertiesBackpack backpack = ItemBackpack.getBackpackData(entity);
      angle = backpack.prevLidAngle + (backpack.lidAngle - backpack.prevLidAngle) * partialTicks;
      angle = 1.0F - angle;
      angle = 1.0F - angle * angle;
    }
    if (baseModel.top != null)
View Full Code Here

TOP

Related Classes of net.mcft.copy.betterstorage.misc.PropertiesBackpack

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.