@Override public void handleDataPacket(NBTTagCompound nbt) { if (!worldObj.isRemote) { if (nbt.hasKey("fluidID")) { if (nbt.getByte("fluidID") == -1) fluid = null; } else if (nbt.hasKey("mode")) { mode = nbt.getByte("mode"); } else if (nbt.hasKey("seal")) { sealed = nbt.getBoolean("seal"); if (!sealed) { unsealtime = (int) TFC_Time.getTotalHours(); sealtime = 0; } else { sealtime = (int) TFC_Time.getTotalHours(); unsealtime = 0; } } if (nbt.hasKey("tab")) { int tab = nbt.getByte("tab"); if (tab == 0) worldObj .getPlayerEntityByName(nbt.getString("player")) .openGui(TerraFirmaCraft.instance, 35, worldObj, xCoord, yCoord, zCoord); else if (tab == 1) worldObj .getPlayerEntityByName(nbt.getString("player")) .openGui(TerraFirmaCraft.instance, 36, worldObj, xCoord, yCoord, zCoord); } } }
@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)); } } }
/** 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 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 writeSpawnData(ByteArrayDataOutput data) { NBTTagCompound tags = returnStack.getTagCompound().getCompoundTag("InfiTool"); data.writeShort(returnStack.itemID); data.writeFloat(rotationYaw); data.writeInt(tags.getInteger("RenderHandle")); data.writeInt(tags.getInteger("RenderHead")); data.writeInt(tags.getInteger("RenderAccessory")); int effects = 0; if (tags.hasKey("Effect1")) effects++; if (tags.hasKey("Effect2")) effects++; if (tags.hasKey("Effect3")) effects++; if (tags.hasKey("Effect4")) effects++; if (tags.hasKey("Effect5")) effects++; if (tags.hasKey("Effect6")) effects++; data.writeInt(effects); switch (effects) { case 6: data.writeInt(tags.getInteger("Effect6")); case 5: data.writeInt(tags.getInteger("Effect5")); case 4: data.writeInt(tags.getInteger("Effect4")); case 3: data.writeInt(tags.getInteger("Effect3")); case 2: data.writeInt(tags.getInteger("Effect2")); case 1: data.writeInt(tags.getInteger("Effect1")); } }
private void func_143027_a(World world) { if (this.itemData == null) { this.itemData = world.loadItemData(MapGenStructureData.class, this.getStructureName()); if (this.itemData == null) { this.itemData = new MapGenStructureData(this.getStructureName()); world.setItemData(this.getStructureName(), this.itemData); } else { NBTTagCompound var2 = this.itemData.getTag(); for (String var4 : var2.getKeySet()) { NBTBase var5 = var2.getTag(var4); if (var5.getType() == 10) { NBTTagCompound var6 = (NBTTagCompound) var5; if (var6.hasKey("ChunkX") && var6.hasKey("ChunkZ")) { int x = var6.getInteger("ChunkX"); int z = var6.getInteger("ChunkZ"); StructureStart var9 = MapGenStructureIO.func_143035_a(var6); if (var9 != null) { this.structureMap.put(ChunkPos.toLong(x, z), var9); } } } } } } }
@Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); inventory = new ArrayList<ItemStack>(); if (tag.hasKey("inventory")) { NBTTagList list = tag.getTagList("inventory", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < list.tagCount(); i++) { inventory.add(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i))); } } incenses = new ArrayList<ItemStack>(); if (tag.hasKey("incenses")) { NBTTagList list = tag.getTagList("incenses", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < list.tagCount(); i++) { incenses.add(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i))); } } if (tag.hasKey("ritualName")) { ritualName = tag.getString("ritualName"); ritual = RitualManager.getRitualFromName(ritualName); System.out.println("Ritual name: " + ritualName); } if (tag.hasKey("progress")) { progress = tag.getInteger("progress"); } }
/** * @param stack to extract the info from * @return */ public static ItemStructureSettings getSettingsFor(ItemStack stack) { ItemStructureSettings settings = new ItemStructureSettings(); NBTTagCompound tag; if (stack.hasTagCompound() && stack.getTagCompound().hasKey("structData")) { tag = stack.getTagCompound().getCompoundTag("structData"); } else { tag = new NBTTagCompound(); } for (int i = 0; i < 4; i++) { settings.setKeys[i] = false; } if (tag.hasKey("pos1")) { settings.pos1.read(tag.getCompoundTag("pos1")); settings.setKeys[0] = true; } if (tag.hasKey("pos2")) { settings.pos2.read(tag.getCompoundTag("pos2")); settings.setKeys[1] = true; } if (tag.hasKey("buildKey")) { settings.key.read(tag.getCompoundTag("buildKey")); settings.setKeys[2] = true; settings.buildFace = tag.getCompoundTag("buildKey").getInteger("face"); } if (tag.hasKey("name")) { settings.name = tag.getString("name"); settings.setKeys[3] = true; } return settings; }
float calculateStrength(NBTTagCompound tags, Block block, int meta) { float mineSpeed = tags.getInteger("MiningSpeed"); int heads = 1; if (tags.hasKey("MiningSpeed2")) { mineSpeed += tags.getInteger("MiningSpeed2"); heads++; } if (tags.hasKey("MiningSpeedHandle")) { mineSpeed += tags.getInteger("MiningSpeedHandle"); heads++; } if (tags.hasKey("MiningSpeedExtra")) { mineSpeed += tags.getInteger("MiningSpeedExtra"); heads++; } float trueSpeed = mineSpeed / (heads * 100f); int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType()); int durability = tags.getInteger("Damage"); float stonebound = tags.getFloat("Shoddy"); float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound; trueSpeed += bonusLog; if (hlvl <= tags.getInteger("HarvestLevel")) return trueSpeed; return 0.1f; }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); inv.readFromNBT(nbttagcompound); if (nbttagcompound.hasKey("box")) { box.initialize(nbttagcompound.getCompoundTag("box")); } if (nbttagcompound.hasKey("path")) { path = new LinkedList<BlockIndex>(); NBTTagList list = nbttagcompound.getTagList("path", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < list.tagCount(); ++i) { path.add(new BlockIndex(list.getCompoundTagAt(i))); } } done = nbttagcompound.getBoolean("done"); fluidTank.readFromNBT(nbttagcompound); // The rest of load has to be done upon initialize. initNBT = (NBTTagCompound) nbttagcompound.getCompoundTag("bptBuilder").copy(); }
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 readFromNBT(NBTTagCompound nbtTags) { super.readFromNBT(nbtTags); finishedCalc = nbtTags.getBoolean("finishedCalc"); if (nbtTags.hasKey("fluidTank")) { fluidTank.readFromNBT(nbtTags.getCompoundTag("fluidTank")); } if (nbtTags.hasKey("activeNodes")) { NBTTagList tagList = nbtTags.getTagList("activeNodes", NBT.TAG_COMPOUND); for (int i = 0; i < tagList.tagCount(); i++) { activeNodes.add(Coord4D.read((NBTTagCompound) tagList.getCompoundTagAt(i))); } } if (nbtTags.hasKey("usedNodes")) { NBTTagList tagList = nbtTags.getTagList("usedNodes", NBT.TAG_COMPOUND); for (int i = 0; i < tagList.tagCount(); i++) { usedNodes.add(Coord4D.read((NBTTagCompound) tagList.getCompoundTagAt(i))); } } }
@Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); if (this instanceof IStructurePart && compound.hasKey(CoreReferences.NBT.STRUCTURE)) { int dim; if (getWorld() == null) dim = compound.getInteger(CoreReferences.NBT.StructureData.DIMENSION); else dim = getWorld().provider.getDimension(); ((IStructurePart) this) .setStructure( StructureRegistry.getInstance() .getStructure( dim, Coordinate3D.fromNBT(compound.getCompoundTag(CoreReferences.NBT.STRUCTURE)))); } if (getState().requiresNBTStorage()) this.getState().readFromNBTTagCompound(compound.getTag(CoreReferences.NBT.STATE)); if (this instanceof IItemStorage) this.readInventoryFromCompound(compound.getTag(CoreReferences.NBT.INVENTORY)); if (this instanceof IFluidContainingEntity) this.readFluidsFromCompound(compound.getTag(CoreReferences.NBT.FLUIDS)); if (compound.hasKey(CoreReferences.NBT.NAME)) { this.name = compound.getString(CoreReferences.NBT.NAME); } }
/** (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"); } }
@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")); }
/** (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(); }
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; } }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); if (!nbttagcompound.hasKey("altarData")) return; NBTTagCompound altarCompound = nbttagcompound.getCompoundTag("altarData"); NBTTagList allAddedItems = altarCompound.getTagList("allAddedItems", Constants.NBT.TAG_COMPOUND); NBTTagList currentAddedItems = altarCompound.getTagList("currentAddedItems", Constants.NBT.TAG_COMPOUND); this.isCrafting = altarCompound.getBoolean("isCrafting"); this.currentKey = altarCompound.getInteger("currentKey"); this.currentSpellName = altarCompound.getString("currentSpellName"); if (altarCompound.hasKey("phylactery")) { NBTTagCompound phylactery = altarCompound.getCompoundTag("phylactery"); if (phylactery != null) this.addedPhylactery = ItemStack.loadItemStackFromNBT(phylactery); } if (altarCompound.hasKey("catalyst")) { NBTTagCompound catalyst = altarCompound.getCompoundTag("catalyst"); if (catalyst != null) this.addedBindingCatalyst = ItemStack.loadItemStackFromNBT(catalyst); } this.allAddedItems.clear(); for (int i = 0; i < allAddedItems.tagCount(); ++i) { NBTTagCompound addedItem = (NBTTagCompound) allAddedItems.getCompoundTagAt(i); if (addedItem == null) continue; ItemStack stack = ItemStack.loadItemStackFromNBT(addedItem); if (stack == null) continue; this.allAddedItems.add(stack); } this.currentAddedItems.clear(); for (int i = 0; i < currentAddedItems.tagCount(); ++i) { NBTTagCompound addedItem = (NBTTagCompound) currentAddedItems.getCompoundTagAt(i); if (addedItem == null) continue; ItemStack stack = ItemStack.loadItemStackFromNBT(addedItem); if (stack == null) continue; this.currentAddedItems.add(stack); } this.spellDef.clear(); for (ArrayList<KeyValuePair<ISpellPart, byte[]>> groups : shapeGroups) groups.clear(); NBTTagCompound currentSpellDef = altarCompound.getCompoundTag("spellDef"); this.spellDef.addAll(NBTToISpellPartList(currentSpellDef)); NBTTagList currentShapeGroups = altarCompound.getTagList("shapeGroups", Constants.NBT.TAG_COMPOUND); for (int i = 0; i < currentShapeGroups.tagCount(); ++i) { NBTTagCompound compound = (NBTTagCompound) currentShapeGroups.getCompoundTagAt(i); shapeGroups.get(i).addAll(NBTToISpellPartList(compound)); } }
@Override public void readCustomNBT(NBTTagCompound cmp) { super.readCustomNBT(cmp); if (cmp.hasKey(TAG_UUID_LEAST) && cmp.hasKey(TAG_UUID_MOST)) { golemConnected = new UUID(cmp.getLong(TAG_UUID_MOST), cmp.getLong(TAG_UUID_LEAST)); // verifyGolem(); } }
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")); } }
public void readItemNBT(NBTTagCompound tag) { if (tag.hasKey("e")) { enabledSides = tag.getByte("e"); } if (tag.hasKey("i")) { invertedSides = tag.getByte("i"); } }
@Override public void readFromNBT(NBTTagCompound data) { super.readFromNBT(data); if (data.hasKey("StorageSlots")) inv.readFromNBT(data, "StorageSlots"); if (data.hasKey("items")) craftingSlots.readFromNBT(data); else craftingSlots.readFromNBT(data, "craftingSlots"); }
@Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); if (tag.hasKey("texture")) this.setTextureID(tag.getByte("texture")); if (tag.hasKey("cryseType")) this.setCryseType(tag.getByte("cryseType")); if (tag.hasKey("spinTicks")) this.setSpinTicks(tag.getInteger("spinTicks")); if (tag.hasKey("attackTime")) this.setAttackTime(tag.getInteger("attackTime")); if (tag.hasKey("flutterTicks")) this.setFlutterTicks(tag.getInteger("flutterTicks")); }
public static void teleportPlayerOutOfMachineDimension(EntityPlayerMP player) { NBTTagCompound playerNBT = player.getEntityData(); // Grab the CompactMachines entry from the player NBT data NBTTagCompound cmNBT = null; if (playerNBT.hasKey(Reference.MOD_ID)) { cmNBT = playerNBT.getCompoundTag(Reference.MOD_ID); } int targetDimension = 0; double targetX; double targetY; double targetZ; if (cmNBT != null && cmNBT.hasKey("oldPosX")) { // First try to grab the original position by looking at the CompactMachines NBT Tag targetDimension = cmNBT.getInteger("oldDimension"); targetX = cmNBT.getDouble("oldPosX"); targetY = cmNBT.getDouble("oldPosY"); targetZ = cmNBT.getDouble("oldPosZ"); } else if (playerNBT.hasKey("oldDimension") && playerNBT.getInteger("oldDimension") != ConfigurationHandler.dimensionId) { // Backwards compatibility - but these values are also being set by RandomThings // A problem exists in two cases: // a) A player entered the SpiritDimension from the CM dimension, RandomThings would set the // oldDimension to the CM dimension // b) A player entered the CM dimension from the SpectreDimension, CM did previously set the // oldDimension to the SpectreDimension // In both cases the player gets trapped in a loop between the two dimensions and has no way // of getting back to the overworld // We want to allow backwards compatibility with our old settings so players in a CM during an // update to a version containing this commit // would still be trapped in the two dimensions. We can break this cycle by not allowing to // get back to another CM using the // old system. // That's because CM never writes its own dimension into the oldDimension tag, only // RandomThings would do that. targetDimension = playerNBT.getInteger("oldDimension"); targetX = playerNBT.getDouble("oldPosX"); targetY = playerNBT.getDouble("oldPosY"); targetZ = playerNBT.getDouble("oldPosZ"); } else { ChunkCoordinates cc = MinecraftServer.getServer().worldServerForDimension(0).provider.getRandomizedSpawnPoint(); targetX = cc.posX; targetY = cc.posY; targetZ = cc.posZ; } MinecraftServer.getServer() .getConfigurationManager() .transferPlayerToDimension( player, targetDimension, new TeleporterCM(MinecraftServer.getServer().worldServerForDimension(targetDimension))); player.setPositionAndUpdate(targetX, targetY, targetZ); }
@Override protected void readEntityFromNBT(NBTTagCompound var1) { super.readEntityFromNBT(var1); if (var1.hasKey("mirrorRoll")) { dataWatcher.updateObject(IS_MIRROR_ROTE, var1.getBoolean("mirrorRoll") ? (byte) 1 : (byte) 0); } if (var1.hasKey("wheelSize")) { dataWatcher.updateObject(SIZE, var1.getByte("wheelSize")); } }
@Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); this.fuseTicks = nbt.getShort("Fuse"); if (nbt.hasKey("ex")) { ex = ExplosiveRegistry.get(nbt.getString("ex")); ex_size = Math.max(nbt.getDouble("size"), 1.0); if (nbt.hasKey("ex_data")) ex_data = nbt.getCompoundTag("ex_data"); } }
@Override public void readCommonNBT(NBTTagCompound nbt) { super.readCommonNBT(nbt); if (nbt.hasKey("isRedstonePowerd")) isRedstonePowered = nbt.getBoolean("isRedstonePowerd"); if (nbt.hasKey("burning")) burning = nbt.getInteger("burning"); if (nbt.hasKey("burningItem")) { NBTTagCompound tag = (NBTTagCompound) nbt.getTag("burningItem"); burningItem = ItemStack.loadItemStackFromNBT(tag); } }
/// Reads this entity from NBT. @Override public void readEntityFromNBT(NBTTagCompound tag) { super.readEntityFromNBT(tag); NBTTagCompound saveTag = SpecialMobData.getSaveLocation(tag); if (saveTag.hasKey("Babies")) { this.babies = saveTag.getByte("Babies"); } else if (tag.hasKey("Babies")) { this.babies = tag.getByte("Babies"); } }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { this.owner = nbttagcompound.getString("owner").replace(".", ""); this.spaceStationName = nbttagcompound.getString("spaceStationName"); if (nbttagcompound.hasKey("dataCompound")) { this.dataCompound = nbttagcompound.getCompoundTag("dataCompound"); } else { this.dataCompound = new NBTTagCompound(); } if (nbttagcompound.hasKey("homePlanet")) { this.homePlanet = nbttagcompound.getInteger("homePlanet"); } else { GCLog.info( "Home planet data not found in space station save file for \"" + this.spaceStationName + "\". Using default overworld."); this.homePlanet = 0; // Overworld dimension ID } if (nbttagcompound.hasKey("dimensionIdStatic")) { this.dimensionIdStatic = nbttagcompound.getInteger("dimensionIdStatic"); } else { GCLog.info( "Static dimension ID not found in space station save file for \"" + this.spaceStationName + "\". Using default overworld."); this.dimensionIdStatic = ConfigManagerCore.idDimensionOverworldOrbitStatic; } if (nbttagcompound.hasKey("dimensionIdDynamic")) { this.dimensionIdDynamic = nbttagcompound.getInteger("dimensionIdDynamic"); } else { GCLog.info( "Dynamic dimension ID not found in space station save file for \"" + this.spaceStationName + "\". Using default overworld."); this.dimensionIdDynamic = ConfigManagerCore.idDimensionOverworldOrbit; } this.allowAllPlayers = nbttagcompound.getBoolean("allowedAll"); final NBTTagList var2 = nbttagcompound.getTagList("allowedPlayers", 10); this.allowedPlayers.clear(); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { final NBTTagCompound var4 = var2.getCompoundTagAt(var3); final String var5 = var4.getString("allowedPlayer"); if (!this.allowedPlayers.contains(var5)) { this.allowedPlayers.add(var5); } } }
public static NBTTagCompound filterSpongeCustomData(NBTTagCompound rootCompound) { if (rootCompound.hasKey(FORGE_DATA_TAG, TAG_COMPOUND)) { final NBTTagCompound forgeCompound = rootCompound.getCompoundTag(FORGE_DATA_TAG); if (forgeCompound.hasKey(SPONGE_DATA, TAG_COMPOUND)) { cleanseInnerCompound(forgeCompound, SPONGE_DATA); } } else if (rootCompound.hasKey(SPONGE_DATA, TAG_COMPOUND)) { cleanseInnerCompound(rootCompound, SPONGE_DATA); } return rootCompound; }