@Override public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) { if( from == SettingsFrom.DISMANTLE_ITEM ) { this.internalCurrentPower = compound.getDouble( "internalCurrentPower" ); } }
@Override public void readFromNBT( NBTTagCompound tag ) { super.readFromNBT( tag ); this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 ); this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 ); this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 ); this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 ); }
@Override public double getAECurrentPower( final ItemStack is ) { final NBTTagCompound data = Platform.openNbtData( is ); return data.getDouble( CURRENT_POWER_NBT_KEY ); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.internalCurrentPower = data.getDouble( "internalCurrentPower" ); }
@Override public void onJoin( final IGridStorage storageB ) { this.localStorage.addCurrentAEPower( storageB.dataObject().getDouble( "buffer" ) ); }
private double getInternal( final ItemStack is ) { final NBTTagCompound nbt = Platform.openNbtData( is ); return nbt.getDouble( "internalCurrentPower" ); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) ); }
public static double getDouble(ItemStack stack, String tag, double defaultExpected) { return verifyExistance(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected; }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.cm.readFromNBT( data ); this.setStoredPower( data.getDouble( "storedPower" ) ); }
@SideOnly( Side.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips ) { final NBTTagCompound tag = stack.getTagCompound(); double internalCurrentPower = 0; final double internalMaxPower = this.getAEMaxPower( stack ); if( tag != null ) { internalCurrentPower = tag.getDouble( CURRENT_POWER_NBT_KEY ); } final double percent = internalCurrentPower / internalMaxPower; lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform .gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) ); }
@Override @SideOnly( Side.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips ) { final NBTTagCompound tag = stack.getTagCompound(); double internalCurrentPower = 0; final double internalMaxPower = this.getMaxEnergyCapacity(); if( internalMaxPower > 0 ) { if( tag != null ) { internalCurrentPower = tag.getDouble( "internalCurrentPower" ); } final double percent = internalCurrentPower / internalMaxPower; lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform .gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) ); } }
final int z = this.settings.getInteger( "z" ); this.meteoriteSize = this.settings.getDouble( "real_sizeOfMeteorite" ); this.realCrater = this.settings.getDouble( "realCrater" ); this.squaredMeteoriteSize = this.settings.getDouble( "sizeOfMeteorite" ); this.crater = this.settings.getDouble( "crater" );
@Override public void readPacketNBT(NBTTagCompound cmp) { side = cmp.getInteger(TAG_SIDE); rotating = cmp.getBoolean(TAG_ROTATING); if(world != null && !world.isRemote) rotationTicks = cmp.getInteger(TAG_ROTATION_TICKS); anglePerTick = cmp.getDouble(TAG_ANGLE_PER_TICK); nextRandomRotation = cmp.getInteger(TAG_NEXT_RANDOM_ROTATION); int modeOrdinal = cmp.getInteger(TAG_TORCH_MODE); TorchMode[] modes = TorchMode.values(); torchMode = modes[modeOrdinal % modes.length]; }
@Override public void process( final IMCMessage m ) { final NBTTagCompound msg = m.getNBTValue(); final NBTTagCompound item = (NBTTagCompound) msg.getTag( "item" ); final ItemStack ammo = new ItemStack( item ); final double weight = msg.getDouble( "weight" ); if( ammo.isEmpty() ) { throw new IllegalStateException( "invalid item in message " + m ); } AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight ); } }
public static void spawnPlayer(EntityPlayer player, BlockPos pos, boolean fabricated) { NBTTagCompound data = player.getEntityData(); if(!data.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) data.setTag(EntityPlayer.PERSISTED_NBT_TAG, new NBTTagCompound()); NBTTagCompound persist = data.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); final boolean test = false; if(test || !persist.getBoolean(TAG_HAS_OWN_ISLAND)) { createSkyblock(player.world, pos); if(player instanceof EntityPlayerMP) { EntityPlayerMP pmp = (EntityPlayerMP) player; pmp.setPositionAndUpdate(pos.getX() + 0.5, pos.getY() + 1.6, pos.getZ() + 0.5); pmp.setSpawnChunk(pos, true, player.world.provider.getDimension()); player.inventory.addItemStackToInventory(new ItemStack(ModItems.lexicon)); } if(fabricated) { persist.setBoolean(TAG_HAS_OWN_ISLAND, true); persist.setDouble(TAG_ISLAND_X, player.posX); persist.setDouble(TAG_ISLAND_Y, player.posY); persist.setDouble(TAG_ISLAND_Z, player.posZ); } } else { double posX = persist.getDouble(TAG_ISLAND_X); double posY = persist.getDouble(TAG_ISLAND_Y); double posZ = persist.getDouble(TAG_ISLAND_Z); if(player instanceof EntityPlayerMP) { EntityPlayerMP pmp = (EntityPlayerMP) player; pmp.setPositionAndUpdate(posX, posY, posZ); } } }
public double getKnockbackResistance(ItemStack stack) { NBTHelper.checkNBT(stack); NBTTagCompound tag = stack.getTagCompound(); return tag.getDouble("knockback"); }
public double getSpeedBoost(ItemStack stack) { NBTHelper.checkNBT(stack); NBTTagCompound tag = stack.getTagCompound(); return tag.getDouble("speed"); }