public static short getShort(ItemStack stack, String tag, short defaultExpected) { return verifyExistance(stack, tag) ? getNBT(stack).getShort(tag) : defaultExpected; }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.setOutput( data.getBoolean( "output" ) ); this.freq = data.getShort( "freq" ); }
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" ) ); } }
final short freq = nbtData.getShort( TAG_P2P_FREQUENCY ); final String freqTooltip = Platform.p2p().toHexString( freq ); currentToolTip.add( I18n.translateToLocalFormatted( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
protected AbstractCellInventory( final IStorageCell<T> cellType, final ItemStack o, final ISaveProvider container ) { this.i = o; this.cellType = cellType; this.itemsPerByte = this.cellType.getChannel().getUnitsPerByte(); this.maxItemTypes = this.cellType.getTotalTypes( this.i ); if( this.maxItemTypes > MAX_ITEM_TYPES ) { this.maxItemTypes = MAX_ITEM_TYPES; } if( this.maxItemTypes < 1 ) { this.maxItemTypes = 1; } this.container = container; this.tagCompound = Platform.openNbtData( o ); this.storedItems = this.tagCompound.getShort( ITEM_TYPE_TAG ); this.storedItemCount = this.tagCompound.getInteger( ITEM_COUNT_TAG ); this.cellItems = null; }
@Override @SideOnly( Side.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips ) { lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) ); final NBTTagCompound data = this.getData( stack ); if( data.hasKey( "tooltip" ) ) { lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) ); } if( data.hasKey( "freq" ) ) { final short freq = data.getShort( "freq" ); final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString( freq ); lines.add( I18n.translateToLocalFormatted( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) ); } }
public void onWanded(EntityPlayer player, ItemStack wand) { if(stage != State.IDLE || itemToEnchant.isEmpty() || !itemToEnchant.isItemEnchantable()) return; List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.getX() - 2, pos.getY(), pos.getZ() - 2, pos.getX() + 3, pos.getY() + 1, pos.getZ() + 3)); int count = items.size(); if(count > 0 && !world.isRemote) { for(EntityItem entity : items) { ItemStack item = entity.getItem(); if(item.getItem() == Items.ENCHANTED_BOOK) { NBTTagList enchants = ItemEnchantedBook.getEnchantments(item); if(enchants.tagCount() > 0) { NBTTagCompound enchant = enchants.getCompoundTagAt(0); short id = enchant.getShort("id"); if(isEnchantmentValid(Enchantment.getEnchantmentByID(id))) { advanceStage(); return; } } } } } }
@Override protected void readTypeSettings(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound dataRoot) { setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]); setExtractionRedstoneMode(RedstoneControlMode.fromOrdinal(dataRoot.getShort("extractionRedstoneMode")), dir); }
@Override protected void readTypeSettings(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound dataRoot) { setConnectionMode(dir, ConnectionMode.values()[dataRoot.getShort("connectionMode")]); setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]); setExtractionRedstoneMode(RedstoneControlMode.fromOrdinal(dataRoot.getShort("extractionRedstoneMode")), dir); }
@Override protected void readTypeSettings(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound dataRoot) { forceConnectionMode(dir, ConnectionMode.values()[dataRoot.getShort("connectionMode")]); setInputSignalColor(dir, DyeColor.values()[dataRoot.getShort("inputSignalColor")]); setOutputSignalColor(dir, DyeColor.values()[dataRoot.getShort("outputSignalColor")]); setOutputStrength(dir, dataRoot.getBoolean("signalStrong")); }
final short freq = data.getShort( "freq" );
@Override protected void readTypeSettings(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound dataRoot) { setConnectionMode(dir, ConnectionMode.values()[dataRoot.getShort("connectionMode")]); setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]); setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir); setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]); setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]); setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed")); setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin")); setOutputPriority(dir, dataRoot.getInteger("outputPriority")); }
protected void readSettingsFromNBT(NBTTagCompound nbtRoot) { mode = CmpMode.values()[nbtRoot.getByte("mode") & 255]; level = nbtRoot.getShort("level"); sticky = nbtRoot.getBoolean("sticky"); }
@Override protected void readTypeSettings(@Nonnull EnumFacing dir, @Nonnull NBTTagCompound dataRoot) { super.readTypeSettings(dir, dataRoot); setConnectionMode(dir, ConnectionMode.values()[dataRoot.getShort("connectionMode")]); setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]); setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir); setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]); setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]); setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed")); setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin")); setOutputPriority(dir, dataRoot.getInteger("outputPriority")); }
@Override public NBTTagCompound fixTagCompound(NBTTagCompound compound) { if ( !compound.getString("id").equals("logisticspipes:solid_block") && !compound.getString("id").equals("logisticspipes:tile.logisticssolidblock") ) return compound; int meta = compound.getShort("Damage"); compound.removeTag("Damage"); compound.setString("id", BlockDummy.updateItemMap.get(meta).getRegistryName().toString()); return compound; } }
@Override public @Nonnull NBTTagCompound fixTagCompound(@Nonnull NBTTagCompound compound) { String nameOld = MachineObject.block_tank.getRegistryName().toString(); String nameNew = MachineObject.block_tank.getRegistryName().toString(); if (nameOld.equals(compound.getString("id")) && compound.getShort("Damage") > 0) { compound.setString("id", nameNew); compound.setShort("Damage", (short) 0); } return compound; } }
public static Channel readFromNBT(NBTTagCompound root) { String name = root.getString("name"); UserIdent user = UserIdent.readfromNbt(root, "user"); ChannelType type = NullHelper.notnullJ(ChannelType.values()[root.getShort("type")], "Enum.values()"); return name.isEmpty() ? null : new Channel(name, user, type); }
@Override public void readFromNBT(NBTTagCompound nbttagcompound) { super.readFromNBT(nbttagcompound); IAllele stored = AlleleManager.alleleRegistry.getAllele(nbttagcompound.getString("UID")); if (stored instanceof IAlleleFruit) { allele = (IAlleleFruit) stored; } else { allele = defaultAllele; } maturity = nbttagcompound.getShort("MT"); yield = nbttagcompound.getFloat("SP"); }
final short storedFrequency = data.getShort( "freq" );