@Override public void writeToNBT( NBTTagCompound tag ) { super.writeToNBT( tag ); tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 ); tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 ); tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 ); tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 ); }
private void setInternal( final ItemStack is, final double amt ) { final NBTTagCompound nbt = Platform.openNbtData( is ); nbt.setDouble( "internalCurrentPower", amt ); } }
@Override public NBTTagCompound writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); data.setDouble( "internalCurrentPower", this.internalCurrentPower ); return data; }
@Override public NBTTagCompound downloadSettings( final SettingsFrom from ) { if( from == SettingsFrom.DISMANTLE_ITEM ) { final NBTTagCompound tag = new NBTTagCompound(); tag.setDouble( "internalCurrentPower", this.internalCurrentPower ); tag.setDouble( "internalMaxPower", this.getInternalMaxPower() ); // used for tool tip. return tag; } return null; }
public static void setDouble(ItemStack stack, String tag, double d) { getNBT(stack).setDouble(tag, d); }
@Override public double extractAEPower( final ItemStack is, final double amount, Actionable mode ) { final double currentStorage = this.getAECurrentPower( is ); final double fulfillable = Math.min( amount, currentStorage ); if( mode == Actionable.MODULATE ) { final NBTTagCompound data = Platform.openNbtData( is ); data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable ); } return fulfillable; }
@Override public void onSplit( final IGridStorage storageB ) { final double newBuffer = this.localStorage.getAECurrentPower() / 2; this.localStorage.removeCurrentAEPower( newBuffer ); storageB.dataObject().setDouble( "buffer", newBuffer ); }
@Override public NBTTagCompound writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() ); return data; }
@Override public void populateGridStorage( final IGridStorage storage ) { storage.dataObject().setDouble( "buffer", this.localStorage.getAECurrentPower() ); }
@Override public double injectAEPower( final ItemStack is, final double amount, Actionable mode ) { final double maxStorage = this.getAEMaxPower( is ); final double currentStorage = this.getAECurrentPower( is ); final double required = maxStorage - currentStorage; final double overflow = amount - required; if( mode == Actionable.MODULATE ) { final NBTTagCompound data = Platform.openNbtData( is ); final double toAdd = Math.min( amount, required ); data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd ); } return Math.max( 0, overflow ); }
@Override public NBTTagCompound writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); this.cm.writeToNBT( data ); data.setDouble( "storedPower", this.getStoredPower() ); return data; }
@Override protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks ) { super.getCheckedSubItems( creativeTab, itemStacks ); final ItemStack charged = new ItemStack( this, 1 ); final NBTTagCompound tag = Platform.openNbtData( charged ); tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) ); tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) ); itemStacks.add( charged ); }
@Override @SideOnly( Side.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks ) { super.getSubBlocks( tabs, itemStacks ); final ItemStack charged = new ItemStack( this, 1 ); final NBTTagCompound tag = Platform.openNbtData( charged ); tag.setDouble( "internalCurrentPower", this.getMaxPower() ); tag.setDouble( "internalMaxPower", this.getMaxPower() ); itemStacks.add( charged ); }
@Override public void writePacketNBT(NBTTagCompound cmp) { cmp.setInteger(TAG_SIDE, side); cmp.setBoolean(TAG_ROTATING, rotating); cmp.setInteger(TAG_ROTATION_TICKS, rotationTicks); cmp.setDouble(TAG_ANGLE_PER_TICK, anglePerTick); cmp.setInteger(TAG_TORCH_MODE, torchMode.ordinal()); cmp.setInteger(TAG_NEXT_RANDOM_ROTATION, nextRandomRotation); }
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); } } }
this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) ); this.settings.setDouble( "real_sizeOfMeteorite", this.meteoriteSize ); this.settings.setDouble( "realCrater", this.realCrater ); this.settings.setDouble( "sizeOfMeteorite", this.squaredMeteoriteSize ); this.settings.setDouble( "crater", this.crater );
@Override public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) { super.writeEntityToNBT(par1nbtTagCompound); par1nbtTagCompound.setInteger(TAG_TICKS_EXISTED, getTicksExisted()); par1nbtTagCompound.setInteger(TAG_COLOR, getColor()); par1nbtTagCompound.setInteger(TAG_MANA, getMana()); par1nbtTagCompound.setInteger(TAG_STARTING_MANA, getStartingMana()); par1nbtTagCompound.setInteger(TAG_MIN_MANA_LOSS, getMinManaLoss()); par1nbtTagCompound.setFloat(TAG_TICK_MANA_LOSS, getManaLossPerTick()); par1nbtTagCompound.setFloat(TAG_GRAVITY, getGravity()); ItemStack stack = getSourceLens(); NBTTagCompound lensCmp = new NBTTagCompound(); if(!stack.isEmpty()) lensCmp = stack.writeToNBT(lensCmp); par1nbtTagCompound.setTag(TAG_LENS_STACK, lensCmp); BlockPos coords = getBurstSourceBlockPos(); par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.getX()); par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.getY()); par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.getZ()); par1nbtTagCompound.setDouble(TAG_LAST_MOTION_X, motionX); par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Y, motionY); par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Z, motionZ); UUID identity = getShooterUUID(); boolean hasShooter = identity != null; par1nbtTagCompound.setBoolean(TAG_HAS_SHOOTER, hasShooter); if(hasShooter) { par1nbtTagCompound.setLong(TAG_SHOOTER_UUID_MOST, identity.getMostSignificantBits()); par1nbtTagCompound.setLong(TAG_SHOOTER_UUID_LEAST, identity.getLeastSignificantBits()); } }
public void setAttackSpeedBoost(ItemStack stack, double attackSpeed) { NBTHelper.checkNBT(stack); NBTTagCompound tag = stack.getTagCompound(); tag.setDouble("attackSpeed", attackSpeed); }