コード例 #1
0
  @Override
  public HashMap getExtendedDetails(World world) {

    HashMap retMap = getBasicDetails(world);

    TileEntity crucible = world.getBlockTileEntity(xCoord, yCoord, zCoord);

    NBTTagCompound compound = this.getTagCompound(crucible);
    retMap.put("Heat", compound.getShort("Heat"));
    retMap.put("Liquid", compound.getBoolean("Liquid"));
    retMap.put("LiquidQty", compound.getShort("liquidQty"));
    int[] tb = compound.getIntArray("Tags");
    EnumTag tag;
    int a = 1;
    HashMap tagMap;
    HashMap tags = new HashMap();
    for (int i = 0; i < tb.length; i++) {
      try {
        if (tb[i] > 0) {
          tagMap = new HashMap();
          tag = EnumTag.get(i);
          tagMap.put("Name", tag.name);
          tagMap.put("Aggro", tag.aggro);
          tagMap.put("Amount", tb[i]);
          tags.put(a, tagMap);
          a++;
        }
      } catch (Exception e) {
      }
    }
    retMap.put("Aspects", tags);

    return retMap;
  }
コード例 #2
0
 public void readData(NBTTagCompound nbt, SyncType type) {
   super.readData(nbt, type);
   if (type == SyncType.SAVE || type == SyncType.SYNC) {
     this.cookTime = nbt.getShort("cookTime");
     this.active = nbt.getShort("active");
   }
 }
コード例 #3
0
 /** (abstract) Protected helper method to read subclass entity data from NBT. */
 public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
   xTile = par1NBTTagCompound.getShort("xTile");
   yTile = par1NBTTagCompound.getShort("yTile");
   zTile = par1NBTTagCompound.getShort("zTile");
   inTile = par1NBTTagCompound.getByte("inTile") & 0xff;
   throwableShake = par1NBTTagCompound.getByte("shake") & 0xff;
   inGround = par1NBTTagCompound.getByte("inGround") == 1;
 }
コード例 #4
0
 public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
   this.xTile = par1NBTTagCompound.getShort("xTile");
   this.yTile = par1NBTTagCompound.getShort("yTile");
   this.zTile = par1NBTTagCompound.getShort("zTile");
   this.inTile = par1NBTTagCompound.getByte("inTile") & 255;
   this.inData = par1NBTTagCompound.getByte("inData") & 255;
   this.inGround = par1NBTTagCompound.getByte("inGround") == 1;
 }
コード例 #5
0
  @Override
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);

    this.interval = par1NBTTagCompound.getShort("Interval");
    this.round = par1NBTTagCompound.getShort("Round");
    this.click = par1NBTTagCompound.getShort("Click");
    this.chargeAmount = par1NBTTagCompound.getShort("ChargeAmount");
  }
コード例 #6
0
ファイル: EntityItem.java プロジェクト: JelkeNelisse/Mod
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.health = par1NBTTagCompound.getShort("Health") & 255;
    this.age = par1NBTTagCompound.getShort("Age");
    NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item");
    this.func_92013_a(ItemStack.loadItemStackFromNBT(var2));

    if (this.func_92014_d() == null) {
      this.setDead();
    }
  }
コード例 #7
0
ファイル: EntityBKnife.java プロジェクト: Gusanito/Mods
 public void readEntityFromNBT(NBTTagCompound var1) {
   this.xTile = var1.getShort("xTile");
   this.yTile = var1.getShort("yTile");
   this.zTile = var1.getShort("zTile");
   this.inTile = var1.getByte("inTile") & 255;
   this.inData = var1.getByte("inData") & 255;
   this.arrowShake = var1.getByte("shake") & 255;
   this.inGround = var1.getByte("inGround") == 1;
   this.doesArrowBelongToPlayer = var1.getBoolean("player");
 }
コード例 #8
0
  private void findBestEquipment() {

    int bestScore = -1;
    ItemStack bestWeapon = null;
    int bestLocation = 0;
    ItemStack currentCheck;
    int currentScore;
    for (int i = 0; i < this.inventory.mainInventory.length; i++) {
      currentCheck = this.inventory.mainInventory[i];
      if (currentCheck == null) continue;
      Multimap map = currentCheck.getAttributeModifiers();
      Collection Attributes =
          (Collection) map.get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());

      if (Attributes.size() == 0) currentScore = 0;
      else currentScore = (int) ((AttributeModifier) Attributes.toArray()[0]).getAmount();
      NBTTagList enchList = currentCheck.getEnchantmentTagList();
      if (enchList == null) currentScore += 0;
      else {
        for (int j = 0; j < enchList.tagCount(); j++) {
          NBTTagCompound comp = (NBTTagCompound) enchList.getCompoundTagAt(j);
          int enchId = comp.getShort("id");
          int enchLvl = comp.getShort("lvl");
          switch (enchId) {
            case 16:
              currentScore += (1 * enchLvl);
              break;
            case 19:
              currentScore += (1 * enchLvl);
              break;
            case 20:
              currentScore += (2 * enchLvl);
              break;
            default:
              currentScore += 1;
          }
        }
      }
      UnDeath.logging.info(
          String.format("Item %s got score %d", currentCheck.toString(), currentScore));
      if (currentScore > bestScore) {
        bestWeapon = currentCheck;
        bestLocation = i;
        bestScore = currentScore;
      }
    }
    if (bestScore == -1) {
      UnDeath.logging.info("No weapons found");
      this.inventory.currentItem = -1;
      return;
    }
    UnDeath.logging.info(
        String.format("Best Weapon is %s with score %d", bestWeapon.toString(), bestScore));
    this.inventory.currentItem = bestLocation;
  }
コード例 #9
0
  public void readEntityFromNBT(NBTTagCompound tags) {
    // super.readEntityFromNBT(tags);

    this.returnStack = ItemStack.loadItemStackFromNBT(tags.getCompoundTag("Throwable"));
    xTile = tags.getShort("xTile");
    yTile = tags.getShort("yTile");
    zTile = tags.getShort("zTile");
    inTile = tags.getByte("inTile") & 0xff;
    arrowShake = tags.getByte("shake") & 0xff;
    onGround = tags.getByte("onGround") == 1;
  }
コード例 #10
0
 @Override
 protected void readEntityFromNBT(NBTTagCompound var1) {
   this.xTile = var1.getShort("xTile");
   this.yTile = var1.getShort("yTile");
   this.zTile = var1.getShort("zTile");
   this.inTile = var1.getByte("inTile") & 255;
   this.inData = var1.getByte("inData") & 255;
   this.arrowShake = var1.getByte("shake") & 255;
   this.inGround = var1.getBoolean("inGround");
   this.beenInGround = var1.getBoolean("beenInGrond");
   this.pickupMode = var1.getByte("pickup");
 }
コード例 #11
0
 @Override
 public void handlePacketData(NBTTagCompound tag) {
   if (tag.hasKey("EntityId")) {
     this.mobID = tag.getString("EntityId");
     this.minSpawnDelay = tag.getShort("MinSpawnDelay");
     this.maxSpawnDelay = tag.getShort("MaxSpawnDelay");
     this.spawnCount = tag.getShort("SpawnCount");
     this.maxNearbyEntities = tag.getShort("MaxNearbyEntities");
     this.activatingRangeFromPlayer = tag.getShort("RequiredPlayerRange");
     this.spawnRange = tag.getShort("SpawnRange");
   }
 }
コード例 #12
0
  /** Read the stack fields from a NBT object. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.field_151002_e = Item.getItemById(par1NBTTagCompound.getShort("id"));
    this.stackSize = par1NBTTagCompound.getByte("Count");
    this.itemDamage = par1NBTTagCompound.getShort("Damage");

    if (this.itemDamage < 0) {
      this.itemDamage = 0;
    }

    if (par1NBTTagCompound.hasKey("tag", 10)) {
      this.stackTagCompound = par1NBTTagCompound.getCompoundTag("tag");
    }
  }
コード例 #13
0
 public static List<int[]> getEnchantments(ItemStack itemstack) {
   ArrayList<int[]> arraylist = new ArrayList<int[]>();
   if (itemstack != null) {
     NBTTagList nbttaglist = itemstack.getEnchantmentTagList();
     if (nbttaglist != null) {
       for (int i = 0; i < nbttaglist.tagCount(); i++) {
         NBTTagCompound tag = nbttaglist.getCompoundTagAt(i);
         arraylist.add(new int[] {tag.getShort("id"), tag.getShort("lvl")});
       }
     }
   }
   return arraylist;
 }
コード例 #14
0
 /** Reads a tile entity from NBT. */
 public void readFromNBT(NBTTagCompound nbttagcompound) {
   super.readFromNBT(nbttagcompound);
   NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
   electrolysisItemStacks = new ItemStack[getSizeInventory()];
   for (int i = 0; i < nbttaglist.tagCount(); i++) {
     NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
     byte byte0 = nbttagcompound1.getByte("Slot");
     if (byte0 >= 0 && byte0 < electrolysisItemStacks.length) {
       electrolysisItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
     }
   }
   electrolysisCookTime = nbttagcompound.getShort("CookTime");
   currentAmount = nbttagcompound.getShort("CurrentAmount");
 }
コード例 #15
0
  /*
   * (abstract) Protected helper method to read subclass entity data from NBT.
   */
  @Override
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.xTile = par1NBTTagCompound.getShort("xTile");
    this.yTile = par1NBTTagCompound.getShort("yTile");
    this.zTile = par1NBTTagCompound.getShort("zTile");
    this.inTile = Block.getBlockById(par1NBTTagCompound.getByte("inTile") & 255);
    this.inData = par1NBTTagCompound.getByte("inData") & 255;
    this.inGround = par1NBTTagCompound.getByte("inGround") == 1;
    this.active = par1NBTTagCompound.getByte("active") == 1;

    if (par1NBTTagCompound.hasKey("damage")) {
      this.damage = par1NBTTagCompound.getDouble("damage");
    }
  }
コード例 #16
0
  public ItemStack getCraftingResult() {
    this.cost = 0;
    ItemStack output = this.tool.getStack().copy();

    NBTTagList toolList = getEnchantmentTagList(output);
    NBTTagList bookList = getEnchantmentTagList(this.enchantedBook.copy());

    boolean changed = false;

    for (int iBook = 0; iBook < bookList.tagCount(); iBook++) {
      boolean found = false;
      NBTTagCompound bookEnchant = bookList.getCompoundTagAt(iBook);

      // Check the tool for allowed enchants
      if (!this.tool
          .getItem()
          .getAllowedEnchantments()
          .contains(Enchantment.enchantmentsList[bookEnchant.getShort("id")].type)) continue;

      // Check if the enchant already exists
      for (int iTool = 0; iTool < toolList.tagCount(); iTool++) {
        NBTTagCompound toolEnchant = toolList.getCompoundTagAt(iTool);
        if (toolEnchant.getShort("id") == bookEnchant.getShort("id")) {
          found = true;
          if (toolEnchant.getShort("lvl") < bookEnchant.getShort("lvl")) {
            changed = true;
            toolEnchant.setShort("lvl", bookEnchant.getShort("lvl"));
          }
          continue;
        }
      }

      // It doesn't exist yet, just add it
      if (!found) {
        boolean allowed = true;
        for (int iTool = 0; iTool < toolList.tagCount(); iTool++) {
          int toolEnchant = toolList.getCompoundTagAt(iTool).getShort("id");
          if (!Enchantment.enchantmentsList[toolEnchant].canApplyTogether(
              Enchantment.enchantmentsList[bookEnchant.getShort("id")])) {
            allowed = false;
          }
        }

        if (allowed) {
          changed = true;
          toolList.appendTag(bookEnchant);
          int lvl = bookEnchant.getShort("lvl") + 1;
          int cost = lvl * lvl * 2 / (this.tool.getHeadMaterial().arcaneLevel + 1);
          this.cost += cost;
        }
      }
    }

    if ((output.getEnchantmentTagList() == null || output.getEnchantmentTagList().tagCount() == 0)
        && toolList.tagCount() > 0) {
      output.getTagCompound().setTag("ench", toolList);
    }

    return changed ? output : null;
  }
コード例 #17
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound tagCompund) {
    this.xTile = tagCompund.getShort("xTile");
    this.yTile = tagCompund.getShort("yTile");
    this.zTile = tagCompund.getShort("zTile");

    if (tagCompund.hasKey("inTile", 8)) {
      this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
    } else {
      this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
    }

    this.shake = tagCompund.getByte("shake") & 255;
    this.inGround = tagCompund.getByte("inGround") == 1;
  }
コード例 #18
0
  /**
   * @param openingPlayer
   * @param synch
   */
  public ContainerSpawnerPlacer(EntityPlayer openingPlayer, int x, int y, int z) {
    super(openingPlayer, null);

    ItemStack builderItem = player.inventory.getCurrentItem();
    if (builderItem.hasTagCompound() && builderItem.getTagCompound().hasKey("spawnData")) {
      NBTTagCompound tag = builderItem.getTagCompound().getCompoundTag("spawnData");
      this.mobID = tag.getString("EntityId");
      this.minSpawnDelay = tag.getShort("MinSpawnDelay");
      this.maxSpawnDelay = tag.getShort("MaxSpawnDelay");
      this.spawnCount = tag.getShort("SpawnCount");
      this.maxNearbyEntities = tag.getShort("MaxNearbyEntities");
      this.activatingRangeFromPlayer = tag.getShort("RequiredPlayerRange");
      this.spawnRange = tag.getShort("SpawnRange");
    }
  }
コード例 #19
0
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    try {
      this.IC_Outputpacketamount = nbttagcompound.getShort("ICOutputpacketamount");
    } catch (Exception e) {
      this.IC_Outputpacketamount = nbttagcompound.getInteger("ICOutputpacketamount");
    }
    this.IC_Output = nbttagcompound.getInteger("ICOutput");
    this.IC_Outputpacketsize = nbttagcompound.getInteger("ICOutputpacketsize");
    this.UE_Output = nbttagcompound.getInteger("UEOutput");
    this.UE_Outputvoltage = nbttagcompound.getInteger("UEOutputvoltage");
    this.UE_Outputamp = nbttagcompound.getInteger("UEOutputamp");

    NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
    this.inventory = new ItemStack[getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);

      byte byte0 = nbttagcompound1.getByte("Slot");
      if ((byte0 >= 0) && (byte0 < this.inventory.length)) {
        this.inventory[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }
  }
コード例 #20
0
  // This is where you load the data that you saved in writeToNBT
  @Override
  public void readFromNBT(NBTTagCompound nbtTagCompound) {
    super.readFromNBT(
        nbtTagCompound); // The super call is required to save and load the tiles location
    final byte NBT_TYPE_COMPOUND = 10; // See NBTBase.createNewByType() for a listing
    NBTTagList dataForAllSlots = nbtTagCompound.getTagList("Items", NBT_TYPE_COMPOUND);

    Arrays.fill(itemStacks, null); // set all slots to empty
    for (int i = 0; i < dataForAllSlots.tagCount(); ++i) {
      NBTTagCompound dataForOneSlot = dataForAllSlots.getCompoundTagAt(i);
      byte slotNumber = dataForOneSlot.getByte("Slot");
      if (slotNumber >= 0 && slotNumber < this.itemStacks.length) {
        this.itemStacks[slotNumber] = ItemStack.loadItemStackFromNBT(dataForOneSlot);
      }
    }

    // Load everything else.  Trim the arrays (or pad with 0) to make sure they have the correct
    // number of elements
    cookTime = nbtTagCompound.getShort("CookTime");
    burnTimeRemaining =
        Arrays.copyOf(nbtTagCompound.getIntArray("burnTimeRemaining"), FUEL_SLOTS_COUNT);
    burnTimeInitialValue =
        Arrays.copyOf(nbtTagCompound.getIntArray("burnTimeInitial"), FUEL_SLOTS_COUNT);
    cachedNumberOfBurningSlots = -1;
  }
コード例 #21
0
  @Override
  public void readFromNBT(NBTTagCompound tagCompound) {
    super.readFromNBT(tagCompound);

    facing = ForgeDirection.getOrientation(tagCompound.getInteger("direction"));

    isValidMultiblock = tagCompound.getBoolean("isValidMultiblock");

    NBTTagList itemsTag = (NBTTagList) tagCompound.getTag("Items");
    furnaceItems = new ItemStack[getSizeInventory()];

    for (int i = 0; i < itemsTag.tagCount(); i++) {
      NBTTagCompound slotTag = (NBTTagCompound) itemsTag.getCompoundTagAt(i);
      byte slot = slotTag.getByte("Slot");

      if (slot >= 0 && slot < furnaceItems.length)
        furnaceItems[slot] = ItemStack.loadItemStackFromNBT(slotTag);
    }

    furnaceBurnTime = tagCompound.getShort("BurnTime");
    furnaceCookTime = tagCompound.getShort("CookTime");
    currentItemBurnTime = TileEntityFurnace.getItemBurnTime(furnaceItems[1]);
    cooking = tagCompound.getBoolean("active");
    type = tagCompound.getInteger("type");
    if (type == 1) partBlocks = stonebrick;
    hole = hole.readFromNBT(tagCompound, "hole");
  }
コード例 #22
0
  public void readFromNBT(NBTTagCompound nbt) {
    parseData(nbt.getShort("flags"), nbt.getByte("outputs"));

    dX = nbt.getFloat("x");
    dY = nbt.getFloat("y");
    dZ = nbt.getFloat("z");
  }
コード例 #23
0
  // NBT
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);

    if (par1NBTTagCompound.hasKey("CookingItem")) {
      this.getItemstack(
          ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("CookingItem")));
    }

    this.cookingTime = par1NBTTagCompound.getShort("CookingTime");

    this.finishedCooking = par1NBTTagCompound.getBoolean("FinishedCooking");

    this.readyTime = par1NBTTagCompound.getShort("ReadyTime");

    this.tooLate = par1NBTTagCompound.getBoolean("TooLate");
  }
コード例 #24
0
  public static boolean hasUpgrade(
      Class<? extends TurretUpgrades> tUpg, Map<Integer, ItemStack> upgMap) {
    if (upgMap == null || tUpg == null) return false;

    TurretUpgrades chkUpg = upgradeListCLT.get(tUpg);

    if (!upgMap.containsKey(chkUpg.getUpgradeID())
        || (upgMap.containsKey(chkUpg.getUpgradeID()) && upgMap.get(chkUpg.getUpgradeID()) == null))
      return false;

    if (upgMap.containsKey(chkUpg.getUpgradeID()) && upgMap.get(chkUpg.getUpgradeID()) != null) {
      ItemStack is = upgMap.get(chkUpg.getUpgradeID());
      if (CUS.areStacksEqualWithWCV(chkUpg.getItem(), is)) {
        if (is.isItemEnchanted() && chkUpg.getEnchantment() != null) {
          NBTTagList ench = is.getEnchantmentTagList();
          for (int j = 0; j < ench.tagCount(); ++j) {
            NBTTagCompound var4 = (NBTTagCompound) ench.tagAt(j);
            if (var4.getShort("id") == chkUpg.getEnchantment().effectId) {
              return true;
            }
          }
        } else if (chkUpg.getEnchantment() == null) {
          return true;
        }
      }
    }

    return false;
  }
コード例 #25
0
ファイル: PartWireNormal.java プロジェクト: blay09/CharsetMC
 @Override
 public void readFromNBT(NBTTagCompound nbt) {
   super.readFromNBT(nbt);
   if (nbt.hasKey("s")) {
     signalLevel = nbt.getShort("s");
   }
 }
コード例 #26
0
  @Override
  public void readFromNBT(NBTTagCompound tagCompound) {
    super.readFromNBT(tagCompound);

    // ItemStacks
    NBTTagList tagList = tagCompound.getTagList("Items", 10);
    ovenStacks = new ItemStack[getSizeInventory()];

    for (int i = 0; i < tagList.tagCount(); ++i) {
      NBTTagCompound itemTag = tagList.getCompoundTagAt(i);
      byte slot = itemTag.getByte("Slot");

      if (slot >= 0 && slot < ovenStacks.length) {
        ovenStacks[slot] = ItemStack.loadItemStackFromNBT(itemTag);
      }
    }

    // Burn Time & Cook Time
    ovenBurnTime = tagCompound.getShort("BurnTime");
    ovenCookTime = tagCompound.getShort("CookTime");
    currentItemBurnLength = getItemBurnTime(ovenStacks[1]);

    if (tagCompound.hasKey("CustomName")) {
      ovenName = tagCompound.getString("CustomName");
    }
  }
コード例 #27
0
ファイル: TECrucible.java プロジェクト: jack42/TFCraft
  public void readFromItemNBT(NBTTagCompound nbt) {
    temperature = nbt.getInteger("temp");

    NBTTagList nbttaglist = nbt.getTagList("Metals");

    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
      int id = nbttagcompound1.getInteger("ID");
      float amount = nbttagcompound1.getShort("Amount");
      // Added so that hopefully old worlds that stored metal as shorts wont break
      float amountF = amount + nbttagcompound1.getFloat("AmountF");
      Metal m = MetalRegistry.instance.getMetalFromItem(Item.itemsList[id]);
      addMetal(MetalRegistry.instance.getMetalFromItem(Item.itemsList[id]), amount);
    }

    nbttaglist = nbt.getTagList("Items");
    storage = new ItemStack[getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
      byte byte0 = nbttagcompound1.getByte("Slot");
      if (byte0 >= 0 && byte0 < storage.length) {
        storage[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }

    if (currentAlloy != null) {
      currentAlloy.outputAmount = nbt.getInteger("outputAmount");
    }
  }
コード例 #28
0
ファイル: NbtDataUtil.java プロジェクト: Kiskae/SpongeCommon
  public static List<ItemEnchantment> getItemEnchantments(ItemStack itemStack) {
    if (!itemStack.isItemEnchanted()) {
      return Collections.EMPTY_LIST;
    }
    final List<ItemEnchantment> enchantments = Lists.newArrayList();
    final NBTTagList list = itemStack.getEnchantmentTagList();
    for (int i = 0; i < list.tagCount(); i++) {
      final NBTTagCompound compound = list.getCompoundTagAt(i);
      final short enchantmentId = compound.getShort(NbtDataUtil.ITEM_ENCHANTMENT_ID);
      final short level = compound.getShort(NbtDataUtil.ITEM_ENCHANTMENT_LEVEL);

      final Enchantment enchantment =
          (Enchantment) net.minecraft.enchantment.Enchantment.getEnchantmentById(enchantmentId);
      enchantments.add(new ItemEnchantment(enchantment, level));
    }
    return enchantments;
  }
コード例 #29
0
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound var1) {
    super.readFromNBT(var1);
    NBTTagList var2 = var1.getTagList("Items");
    this.enchanterItemStacks = new ItemStack[this.getSizeInventory()];

    for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
      NBTTagCompound var4 = (NBTTagCompound) var2.tagAt(var3);
      byte var5 = var4.getByte("Slot");

      if (var5 >= 0 && var5 < this.enchanterItemStacks.length) {
        this.enchanterItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }

    this.enchantProgress = var1.getShort("BurnTime");
    this.enchantTimeForItem = var1.getShort("CookTime");
  }
コード例 #30
0
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.entityName = par1NBTTagCompound.getString("EntityId");
    this.spawnDelay = par1NBTTagCompound.getShort("Delay");
    powered = par1NBTTagCompound.getBoolean("Powered");
    spawnSpeed = par1NBTTagCompound.getShort("Speed");
    requiresPlayer = par1NBTTagCompound.getBoolean("RequiresPlayer");
    ignoreSpawnRequirements = par1NBTTagCompound.getBoolean("IgnoreSpawnRequirements");
    skeletonType = par1NBTTagCompound.getInteger("SkeletonType");

    this.minSpawnDelay = par1NBTTagCompound.getShort("MinSpawnDelay");
    this.maxSpawnDelay = par1NBTTagCompound.getShort("MaxSpawnDelay");
    this.spawnCount = par1NBTTagCompound.getShort("SpawnCount");

    if (par1NBTTagCompound.hasKey("MaxNearbyEntities", 99)) {
      this.maxNearbyEntities = par1NBTTagCompound.getShort("MaxNearbyEntities");
      this.activatingRangeFromPlayer = par1NBTTagCompound.getShort("RequiredPlayerRange");
    }

    if (par1NBTTagCompound.hasKey("SpawnRange", 99)) {
      this.spawnRange = par1NBTTagCompound.getShort("SpawnRange");
    }

    if (this.getSpawnerWorld() != null && this.getSpawnerWorld().isRemote) {
      this.renderedEntity = null;
    }
  }