Beispiel #1
0
    @Override
    public void readFromNBT(NBTTagCompound tagCom) {
      TEC.idToUsername.clear();
      NBTTagList idUsernameTag = tagCom.getTagList("idUsernames", 10);
      for (int i = 0; i < idUsernameTag.tagCount(); i++) {
        NBTTagCompound tag = idUsernameTag.getCompoundTagAt(i);
        TEC.idToUsername.put(
            UUID.fromString(tagCom.getString("UUID")), tagCom.getString("playerName"));
      }

      TEC.aspectBuffer.clear();
      NBTTagList bufferTag = tagCom.getTagList("bufferTag", 10);
      for (int i = 0; i < bufferTag.tagCount(); i++) {
        NBTTagCompound idedBuffer = bufferTag.getCompoundTagAt(i);
        UUID playerID = UUID.fromString(idedBuffer.getString("playerID"));
        NBTTagList playersBuffer = idedBuffer.getTagList("buffer", 10);
        for (int j = 0; j < playersBuffer.tagCount(); j++) {
          NBTTagCompound bufferEntry = playersBuffer.getCompoundTagAt(j);

          NBTTagCompound scanTag = bufferEntry.getCompoundTag("scan");
          ScanResult scan =
              new ScanResult(
                  scanTag.getByte("type"),
                  scanTag.getInteger("id"),
                  scanTag.getInteger("meta"),
                  EntityList.createEntityFromNBT(
                      scanTag.getCompoundTag("entityTag"), DimensionManager.getWorld(0)),
                  scanTag.getString("phenomena"));

          TEC.addAspect(
              playerID, scan, bufferEntry.getDouble("chance"), bufferEntry.getDouble("percent"));
        }
      }
    }
 @Override
 public void readFromNBT(NBTTagCompound tag) {
   _pulsesCompleted = tag.getInteger("pulsesCompleted");
   _ticksCompleted = tag.getInteger("ticksCompleted");
   _isActive = tag.getBoolean("isActive");
   _lastClockState = tag.getBoolean("lastClockState");
 }
Beispiel #3
0
 @Override
 public void readFromNBT(NBTTagCompound nbt) {
   super.readFromNBT(nbt);
   dayHarvested = nbt.getInteger("dayHarvested");
   dayFruited = nbt.getInteger("dayFruited");
   hasFruit = nbt.getBoolean("hasFruit");
 }
Beispiel #4
0
  @Override
  public void readFromNBT(NBTTagCompound nbtTagCompound) {

    super.readFromNBT(nbtTagCompound);
    speed = nbtTagCompound.getInteger("Speed");
    speedUpgrades = nbtTagCompound.getInteger("Speedupgrades");
  }
  @Override
  protected void readSyncTag(NBTTagCompound NBT) {
    super.readSyncTag(NBT);

    jam = NBT.getInteger("jam");
    jamColor = NBT.getInteger("jamc");
  }
Beispiel #6
0
  @Override
  public void modify(ItemStack[] input, ItemStack tool) {
    NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
    int increase = matchingAmount(input);
    if (tags.hasKey(key)) {
      int[] keyPair = tags.getIntArray(key);
      if (keyPair[0] == max) {
        keyPair[0] += increase;
        keyPair[1] += max;
        tags.setIntArray(key, keyPair);

        int modifiers = tags.getInteger("Modifiers");
        modifiers -= 1;
        tags.setInteger("Modifiers", modifiers);
      } else {
        keyPair[0] += increase;
        tags.setIntArray(key, keyPair);
      }
      updateModTag(tool, keyPair);
    } else {
      int modifiers = tags.getInteger("Modifiers");
      modifiers -= 1;
      tags.setInteger("Modifiers", modifiers);
      String modName = "\u00a76Blaze (" + increase + "/" + max + ")";
      int tooltipIndex = addToolTip(tool, tooltipName, modName);
      int[] keyPair = new int[] {increase, max, tooltipIndex};
      tags.setIntArray(key, keyPair);
    }

    int fiery = tags.getInteger("Fiery");
    fiery += (increase);
    tags.setInteger("Fiery", fiery);
  }
 @Override
 public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b1) {
   if (stack.hasTagCompound()) {
     NBTTagCompound tagCompound = stack.getTagCompound();
     if (tagCompound.hasKey(ThermalScienceNBTTags.Dim)
         && tagCompound.hasKey(ThermalScienceNBTTags.XCoord)
         && tagCompound.hasKey(ThermalScienceNBTTags.YCoord)
         && tagCompound.hasKey(ThermalScienceNBTTags.ZCoord)) {
       list.add(
           StringHelper.RED + "Dimension: " + tagCompound.getInteger(ThermalScienceNBTTags.Dim));
       list.add(
           StringHelper.PURPLE
               + "X: "
               + tagCompound.getInteger(ThermalScienceNBTTags.XCoord)
               + "; Y: "
               + tagCompound.getInteger(ThermalScienceNBTTags.YCoord)
               + "; Z: "
               + tagCompound.getInteger(ThermalScienceNBTTags.ZCoord));
     } else if (tagCompound.hasKey(ThermalScienceNBTTags.Id)) {
       list.add(
           StringHelper.RED
               + "Controller Id: "
               + tagCompound.getInteger(ThermalScienceNBTTags.Id));
     }
   }
 }
 protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   // super.readFromNBT(nbttagcompound);
   EnumDinoType[] DinoChart = EnumDinoType.values();
   this.BirthTick = nbttagcompound.getInteger("BirthTick");
   this.DinoInside = DinoChart[nbttagcompound.getInteger("DinoType")];
   this.ParentOwner = nbttagcompound.getString("ParentOwner");
 }
  @Override
  public void readFromNBT(NBTTagCompound nbt) {
    super.readFromNBT(nbt);
    storage.readFromNBT(nbt);

    laserSat.readFromNBT(nbt.getCompoundTag("laser"));

    /*NBTTagList tagList = nbt.getTagList("Inventory");
    for (int i = 0; i < tagList.tagCount(); i++) {
    	NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i);
    	byte slot = tag.getByte("Slot");
    	if (slot >= 0 && slot < invBuffer.length) {
    		invBuffer[slot] = ItemStack.loadItemStackFromNBT(tag);
    	}
    }*/
    if (nbt.hasKey("GlassPane")) {
      NBTTagCompound tag = nbt.getCompoundTag("GlassPane");
      glassPanel = ItemStack.loadItemStackFromNBT(tag);
    }

    laserX = nbt.getInteger("laserX");
    laserZ = nbt.getInteger("laserZ");
    mode = MODE.values()[nbt.getByte("mode")];

    if (mode == MODE.SPIRAL) {
      xCenter = nbt.getInteger("CenterX");
      yCenter = nbt.getInteger("CenterY");
      radius = nbt.getInteger("radius");
      numSteps = nbt.getInteger("numSteps");
      prevDir = ForgeDirection.values()[nbt.getInteger("prevDir")];
    }
  }
    public WeightedRandomMinecart(NBTTagCompound p_i1945_2_) {
      super(p_i1945_2_.getInteger("Weight"));
      NBTTagCompound var3 = p_i1945_2_.getCompoundTag("Properties");
      String var4 = p_i1945_2_.getString("Type");

      if (var4.equals("Minecart")) {
        if (var3 != null) {
          switch (var3.getInteger("Type")) {
            case 0:
              var4 = "MinecartRideable";
              break;

            case 1:
              var4 = "MinecartChest";
              break;

            case 2:
              var4 = "MinecartFurnace";
          }
        } else {
          var4 = "MinecartRideable";
        }
      }

      this.field_98222_b = var3;
      this.minecartName = var4;
    }
  @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");
  }
  @Override
  public void modify(ItemStack[] input, ItemStack tool) {
    NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
    tags.setBoolean(key, true);
    addEnchantment(tool, Enchantment.silkTouch, 1);

    int modifiers = tags.getInteger("Modifiers");
    modifiers -= 1;
    tags.setInteger("Modifiers", modifiers);

    int attack = tags.getInteger("Attack");
    attack -= 3;
    if (attack < 0) attack = 0;
    tags.setInteger("Attack", attack);

    int miningSpeed = tags.getInteger("MiningSpeed");
    miningSpeed -= 300;
    if (miningSpeed < 0) miningSpeed = 0;
    tags.setInteger("MiningSpeed", miningSpeed);

    if (tags.hasKey("MiningSpeed2")) {
      int miningSpeed2 = tags.getInteger("MiningSpeed2");
      miningSpeed2 -= 300;
      if (miningSpeed2 < 0) miningSpeed2 = 0;
      tags.setInteger("MiningSpeed2", miningSpeed2);
    }

    addToolTip(tool, color + tooltipName, color + key);
  }
  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;
      }
    }
  }
 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;
   }
 }
  @Override
  public void setupFromNBT(NBTTagCompound tagCompound, int dim, int x, int y, int z) {
    if (tagCompound != null) {
      line = tagCompound.getString("text");
      if (tagCompound.hasKey("color")) {
        color = tagCompound.getInteger("color");
      } else {
        color = 0xffffff;
      }
      if (tagCompound.hasKey("rfcolor")) {
        rfcolor = tagCompound.getInteger("rfcolor");
      } else {
        rfcolor = 0xffffff;
      }
      if (tagCompound.hasKey("rfcolor_neg")) {
        rfcolorNeg = tagCompound.getInteger("rfcolor_neg");
      } else {
        rfcolorNeg = 0xffffff;
      }

      hidebar = tagCompound.getBoolean("hidebar");
      hidetext = tagCompound.getBoolean("hidetext");
      showdiff = tagCompound.getBoolean("showdiff");
      showpct = tagCompound.getBoolean("showpct");

      format = FormatStyle.values()[tagCompound.getInteger("format")];
    }
  }
  @Override
  public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);

    facing = ForgeDirection.getOrientation(tag.getInteger("facing"));
    linkedDir = ForgeDirection.getOrientation(tag.getInteger("linked"));
  }
 @Override
 public void readEntityFromNBT(NBTTagCompound tag) {
   super.readEntityFromNBT(tag);
   if (tag.hasKey("phase") && tag.hasKey("phaseDamage")) {
     float f = this.getMaxHealth() / 5;
     switch (tag.getInteger("phase")) {
       case 0:
         f *= 5;
         break;
       case 1:
         f *= 4;
         break;
       case 2:
         f *= 3;
         break;
       case 3:
         f *= 2;
         break;
       case 4:
       default:
         break;
     }
     this.setHealth(f - tag.getFloat("phaseDamage"));
   }
   if (tag.hasKey("phaseTicks")) this.setPhaseTicks(tag.getInteger("phaseTicks"));
 }
 /**
  * Current implementations of this method in child classes do not use the entry argument beside
  * ev. They just raise the damage on the stack.
  */
 public boolean hitEntity(
     ItemStack par1ItemStack,
     EntityLivingBase par2EntityLivingBase,
     EntityLivingBase par3EntityLivingBase) {
   if (tool == 4 || tool == 5) {
     NBTTagCompound tag = par1ItemStack.getTagCompound();
     this.currentCharge = tag.getInteger("CurrentCharge");
     if (this.currentCharge >= 24) {
       this.currentCharge -= 24;
       tag.setInteger("CurrentCharge", this.currentCharge);
       int extra = this.doModuleHitAdditions(par2EntityLivingBase, par3EntityLivingBase);
       par2EntityLivingBase.attackEntityFrom(
           DamageSource.magic, 20 + extra); // /2 because its steel not the best material
       return false;
     }
     return false;
   } else {
     NBTTagCompound tag = par1ItemStack.getTagCompound();
     this.currentCharge = tag.getInteger("CurrentCharge");
     if (this.currentCharge >= 48) {
       this.currentCharge -= 48;
       tag.setInteger("CurrentCharge", this.currentCharge);
       int extra = this.doModuleHitAdditions(par2EntityLivingBase, par3EntityLivingBase);
       par2EntityLivingBase.attackEntityFrom(
           DamageSource.magic, 12 + extra / 2); // /2 because its steel not the best material
       return false;
     }
     return false;
   }
 }
  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
    World world = player.worldObj;
    int bID = player.worldObj.getBlockId(x, y, z);
    int meta = world.getBlockMetadata(x, y, z);
    Block block = Block.blocksList[bID];
    if (block == null || bID < 1) return false;
    int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
    int shlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getSecondHarvestType());

    if (hlvl <= tags.getInteger("HarvestLevel") && shlvl <= tags.getInteger("HarvestLevel2")) {
      boolean cancelHarvest = false;
      for (ActiveToolMod mod : TConstructRegistry.activeModifiers) {
        if (mod.beforeBlockBreak(this, stack, x, y, z, player)) cancelHarvest = true;
      }

      return cancelHarvest;
    } else {
      if (!player.capabilities.isCreativeMode) onBlockDestroyed(stack, world, bID, x, y, z, player);
      world.setBlockToAir(x, y, z);
      if (!world.isRemote) world.playAuxSFX(2001, x, y, z, bID + (meta << 12));
      return true;
    }
  }
 public static BlockPos getBlockPos(NBTTagCompound tag, String key) {
   final NBTTagCompound newTag = tag.getCompoundTag(key);
   if (newTag == null || newTag.hasNoTags()) {
     return null;
   }
   return new BlockPos(newTag.getInteger("x"), newTag.getInteger("y"), newTag.getInteger("z"));
 }
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound tagCompund) {
    super.readEntityFromNBT(tagCompund);
    this.setEatingHaystack(tagCompund.getBoolean("EatingHaystack"));
    this.func_110242_l(tagCompund.getBoolean("Bred"));
    this.setChested(tagCompund.getBoolean("ChestedHorse"));
    this.setHasReproduced(tagCompund.getBoolean("HasReproduced"));
    this.setHorseType(tagCompund.getInteger("Type"));
    this.setHorseVariant(tagCompund.getInteger("Variant"));
    this.setTemper(tagCompund.getInteger("Temper"));
    this.setHorseTamed(tagCompund.getBoolean("Tame"));

    if (tagCompund.hasKey("OwnerUUID", 8)) {
      this.func_152120_b(tagCompund.getString("OwnerUUID"));
    }

    IAttributeInstance iattributeinstance =
        this.getAttributeMap().getAttributeInstanceByName("Speed");

    if (iattributeinstance != null) {
      this.getEntityAttribute(SharedMonsterAttributes.movementSpeed)
          .setBaseValue(iattributeinstance.getBaseValue() * 0.25D);
    }

    if (this.isChested()) {
      NBTTagList nbttaglist = tagCompund.getTagList("Items", 10);
      this.func_110226_cD();

      for (int i = 0; i < nbttaglist.tagCount(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
        int j = nbttagcompound1.getByte("Slot") & 255;

        if (j >= 2 && j < this.horseChest.getSizeInventory()) {
          this.horseChest.setInventorySlotContents(
              j, ItemStack.loadItemStackFromNBT(nbttagcompound1));
        }
      }
    }

    ItemStack itemstack;

    if (tagCompund.hasKey("ArmorItem", 10)) {
      itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("ArmorItem"));

      if (itemstack != null && func_146085_a(itemstack.getItem())) {
        this.horseChest.setInventorySlotContents(1, itemstack);
      }
    }

    if (tagCompund.hasKey("SaddleItem", 10)) {
      itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("SaddleItem"));

      if (itemstack != null && itemstack.getItem() == Items.saddle) {
        this.horseChest.setInventorySlotContents(0, itemstack);
      }
    } else if (tagCompund.getBoolean("Saddle")) {
      this.horseChest.setInventorySlotContents(0, new ItemStack(Items.saddle));
    }

    this.func_110232_cE();
  }
Beispiel #22
0
  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");
    }
  }
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    this.chestContents = new ItemStack[this.getSizeInventory()];

    if (par1NBTTagCompound.hasKey("chestID")) {
      this.id = par1NBTTagCompound.getInteger("chestID");
    }

    if (par1NBTTagCompound.hasKey("myAccessTick")) {
      this.accessTicks = par1NBTTagCompound.getInteger("myAccessTick");
    }

    if (par1NBTTagCompound.hasKey("CustomName")) {
      this.customName = par1NBTTagCompound.getString("CustomName");
    }

    for (int i = 0; i < nbttaglist.tagCount(); ++i) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
      int j = nbttagcompound1.getByte("Slot") & 255;

      if (j >= 0 && j < this.chestContents.length) {
        this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }
  }
  @Override
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
    if (world.isRemote) return;
    if (stack.hasTagCompound()) {
      TileEntity te = world.getTileEntity(x, y, z);
      if (te instanceof TileVendorBlock) {
        TileVendorBlock tentity = (TileVendorBlock) te;
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null) {
          return;
        }
        NBTTagList tagList = tagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
        for (int i = 0; i < tagList.tagCount(); i++) {
          NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
          byte slot = tag.getByte("Slot");
          if (slot >= 0 && slot < tentity.getSizeInventory()) {
            tentity.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tag));
          }
        }
        tentity.coinSum = tagCompound.getInteger("CoinSum");
        tentity.userCoinSum = tagCompound.getInteger("UserCoinSum");
        tentity.itemPrice = tagCompound.getInteger("ItemPrice");
        tentity.blockOwner = tagCompound.getString("BlockOwner");
        tentity.infiniteMode = tagCompound.getBoolean("Infinite");
      }
      world.markBlockForUpdate(x, y, z);

    } else {
      // item has no owner so we'll set one and get out of here
      ((TileVendorBlock) world.getTileEntity(x, y, z)).blockOwner = entity.getCommandSenderName();
    }
    int meta = stack.getItemDamage();
    world.setBlockMetadataWithNotify(x, y, z, meta, 2);
  }
Beispiel #25
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  protected void readEntityFromNBT(NBTTagCompound tagCompund) {
    if (tagCompund.getBoolean("CustomDisplayTile")) {
      int i = tagCompund.getInteger("DisplayData");

      if (tagCompund.hasKey("DisplayTile", 8)) {
        Block block = Block.getBlockFromName(tagCompund.getString("DisplayTile"));

        if (block == null) {
          this.func_174899_a(Blocks.air.getDefaultState());
        } else {
          this.func_174899_a(block.getStateFromMeta(i));
        }
      } else {
        Block block1 = Block.getBlockById(tagCompund.getInteger("DisplayTile"));

        if (block1 == null) {
          this.func_174899_a(Blocks.air.getDefaultState());
        } else {
          this.func_174899_a(block1.getStateFromMeta(i));
        }
      }

      this.setDisplayTileOffset(tagCompund.getInteger("DisplayOffset"));
    }

    if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0) {
      this.entityName = tagCompund.getString("CustomName");
    }
  }
Beispiel #26
0
 public void readFromNBT(NBTTagCompound compound) {
   this.pos =
       new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z"));
   if (compound.hasKey("ForgeData")) this.customTileData = compound.getCompoundTag("ForgeData");
   if (this.capabilities != null && compound.hasKey("ForgeCaps"))
     this.capabilities.deserializeNBT(compound.getCompoundTag("ForgeCaps"));
 }
  @Override
  public void modify(ItemStack[] input, ItemStack tool) {
    NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
    int[] keyPair;
    if (tags.hasKey(key)) {
      keyPair = tags.getIntArray(key);
      if (keyPair[0] % max == 0) {
        keyPair[0] += increase;
        keyPair[1] += max;
        tags.setIntArray(key, keyPair);

        int modifiers = tags.getInteger("Modifiers");
        modifiers -= 1;
        tags.setInteger("Modifiers", modifiers);
      } else {
        keyPair[0] += increase;
        tags.setIntArray(key, keyPair);
      }
      updateModTag(tool, keyPair);
    } else {
      int modifiers = tags.getInteger("Modifiers");
      modifiers -= 1;
      tags.setInteger("Modifiers", modifiers);
      String modName = TextHelper.AQUA + "Void Mod (" + increase + "/" + max + ")";
      int tooltipIndex = addToolTip(tool, tooltipName, modName);
      keyPair = new int[] {increase, max, tooltipIndex};
      tags.setIntArray(key, keyPair);
    }
  }
 public Connection(NBTTagCompound nbt) {
   if (nbt.hasKey("x")) {
     coord = new ChunkCoordinates(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z"));
   }
   if (nbt.hasKey("vx")) {
     vec = new LittleTileVec(nbt.getByte("vx"), nbt.getByte("vy"), nbt.getByte("vz"));
   }
 }
 @Override
 public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
   NBTTagCompound access = pkt.func_148857_g();
   this.accessTicks = access.getInteger("accessTicks");
   this.setColor(access.getInteger("color"));
   this.clientColor = access.getInteger("color");
   worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
 }
  @Override
  public void readFromNBT(NBTTagCompound nbtTags) {
    super.readFromNBT(nbtTags);

    operatingTicks = nbtTags.getInteger("operatingTicks");
    clientActive = isActive = nbtTags.getBoolean("isActive");
    controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
  }