@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.spin = data.getByte( "spin" ); }
public static byte getByte(ItemStack stack, String tag, byte defaultExpected) { return verifyExistance(stack, tag) ? getNBT(stack).getByte(tag) : defaultExpected; }
public PatternIngredient( NBTTagCompound tag ) { this.stack = new ItemStack( tag ); if( this.stack.isEmpty() ) { this.id = tag.getString( "id" ); this.count = tag.getByte( "Count" ); this.damage = Math.max( 0, tag.getShort( "Damage" ) ); } }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); if( data.hasKey( "paintedColor" ) ) { this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )]; } }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound compound) { this.xTile = compound.getInteger("xTile"); this.yTile = compound.getInteger("yTile"); this.zTile = compound.getInteger("zTile"); if (compound.hasKey("inTile", 8)) { this.inTile = Block.getBlockFromName(compound.getString("inTile")); } else { this.inTile = Block.getBlockById(compound.getByte("inTile") & 255); } this.throwableShake = compound.getByte("shake") & 255; this.inGround = compound.getByte("inGround") == 1; this.thrower = null; this.throwerName = compound.getString("ownerName"); if (this.throwerName != null && this.throwerName.isEmpty()) { this.throwerName = null; } this.thrower = this.getThrower(); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.config.readFromNBT( data ); this.priority = data.getInteger( "priority" ); if( data.hasKey( "paintedColor" ) ) { this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )]; } }
@Override public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) { if( part instanceof PartDenseCableSmart || part instanceof PartCableSmart ) { final int usedChannels; final int maxChannels = ( part instanceof PartDenseCableSmart ) ? 32 : 8; if( part.getGridNode().isActive() ) { final NBTTagCompound tmp = new NBTTagCompound(); part.writeToNBT( tmp ); usedChannels = tmp.getByte( "usedChannels" ); } else { usedChannels = 0; } final String formattedChannelString = String.format( TheOneProbeText.CHANNELS.getLocal(), usedChannels, maxChannels ); probeInfo.text( formattedChannelString ); } }
/** * Determines the source of the channel. * <p/> * If the client received information of the channels on the server, they are used, else if the cache contains a * previous stored value, this will be used. Default value is 0. * * @param part part to be looked at * @param tag tag maybe containing the channel information * @param cache cache with previous knowledge * * @return used channels on the cable */ private byte getUsedChannels( final IPart part, final NBTTagCompound tag, final Object2ByteMap<IPart> cache ) { final byte usedChannels; if( tag.hasKey( ID_USED_CHANNELS ) ) { usedChannels = tag.getByte( ID_USED_CHANNELS ); this.cache.put( part, usedChannels ); } else if( this.cache.containsKey( part ) ) { usedChannels = this.cache.get( part ); } else { usedChannels = -1; } return usedChannels; }
final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS );
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.cm.readFromNBT( data ); if( data.hasKey( "paintedColor" ) ) { this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )]; } this.securityKey = data.getLong( "securityKey" ); this.getConfigSlot().readFromNBT( data, "config" ); final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" ); for( final Object key : storedItems.getKeySet() ) { final NBTBase obj = storedItems.getTag( (String) key ); if( obj instanceof NBTTagCompound ) { this.inventory.getStoredItems().add( AEItemStack.fromItemStack( new ItemStack( (NBTTagCompound) obj ) ) ); } } }
@Override public byte getMode(@Nonnull ItemStack stack) { return ItemHelper.getOrCreateCompound(stack).getByte("Target"); }
@Override public byte getMode(@Nonnull ItemStack stack) { return ItemHelper.getOrCreateCompound(stack).getByte(TAG_MODE); }
@Override public void readFromNBT(NBTTagCompound data) { NBTList<NBTTagCompound> tagList = NBTUtilForestry.getNBTList(data, "tanks", NBTUtilForestry.EnumNBTType.COMPOUND); for (NBTTagCompound tag : tagList) { int slot = tag.getByte("tank"); if (slot >= 0 && slot < tanks.size()) { StandardTank tank = tanks.get(slot); tank.readFromNBT(tag); updateTankLevels(tank, false); } } }
@Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); byte value = nbt.getByte("front"); front = LRDU.fromInt((value >> 0) & 0x3); }
protected void readSettingsFromNBT(NBTTagCompound nbtRoot) { mode = CmpMode.values()[nbtRoot.getByte("mode") & 255]; level = nbtRoot.getShort("level"); sticky = nbtRoot.getBoolean("sticky"); }
@Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); byte value = nbt.getByte("front"); front = LRDU.fromInt((value >> 0) & 0x3); switchState = nbt.getBoolean("switchState"); }
private byte getFlight(ItemStack stack) { if(!stack.hasTagCompound()) return 0; return stack.getTagCompound().getCompoundTag("Fireworks").getByte("Flight"); }
@Override public void readEntityFromNBT(@Nonnull NBTTagCompound root) { super.readEntityFromNBT(root); if (root.hasKey("scale")) { setScale(root.getFloat("scale")); } if (root.hasKey("growthMode")) { setGrowthMode(root.getByte("growthMode")); } }
@Override public void readEntityFromNBT(NBTTagCompound compound) { if(compound.hasKey(TAG_ITEMDROPCHANCE, 99)) { itemDropChance = compound.getFloat(TAG_ITEMDROPCHANCE); } super.readEntityFromNBT(compound); this.updateFacingWithBoundingBox(EnumFacing.getFront(compound.getByte(TAG_REALFACINGDIRECTION))); }
public static void readFromNBT(NBTTagCompound nbt, String str, IInventory inventory) { NBTTagList var2 = nbt.getTagList(str, 10); for (int var3 = 0; var3 < var2.tagCount(); ++var3) { NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); int var5 = var4.getByte("Slot") & 255; if (var5 >= 0 && var5 < inventory.getSizeInventory()) { inventory.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4)); } } }