public static NBTTagCompound toNative(CompoundTag tag) { NBTTagCompound compound = new NBTTagCompound(); for (Entry<String, Tag> child : tag.getValue().entrySet()) { compound.setTag(child.getKey(), toNative(child.getValue())); } return compound; }
/** * Update the given tag compound with position information. * * @param tag the tag * @param position the position * @return a tag compound */ private static NBTTagCompound updateForSet(NBTTagCompound tag, BlockVector3 position) { checkNotNull(tag); checkNotNull(position); tag.setTag("x", new NBTTagInt(position.getBlockX())); tag.setTag("y", new NBTTagInt(position.getBlockY())); tag.setTag("z", new NBTTagInt(position.getBlockZ())); return tag; }
public static void setCompound(ItemStack stack, String tag, NBTTagCompound cmp) { if(!tag.equalsIgnoreCase("ench")) // not override the enchantments getNBT(stack).setTag(tag, cmp); }
public void writeToNBT( final NBTTagCompound data, final String name ) { data.setTag( name, this.serializeNBT() ); }
public static void setList(ItemStack stack, String tag, NBTTagList list) { getNBT(stack).setTag(tag, list); }
public void writeToNBT( final NBTTagCompound data, final String name ) { final NBTTagCompound c = new NBTTagCompound(); this.writeToNBT( c ); data.setTag( name, c ); }
public void writeToNBT( final NBTTagCompound data, final String name ) { final NBTTagCompound c = new NBTTagCompound(); this.writeToNBT( c ); data.setTag( name, c ); }
@Override public void setMemoryCardContents( final ItemStack is, final String settingsName, final NBTTagCompound data ) { final NBTTagCompound c = Platform.openNbtData( is ); c.setString( "Config", settingsName ); c.setTag( "Data", data ); }
@Nonnull @Override public NBTTagCompound writeToNBT(NBTTagCompound cmp) { NBTTagCompound ret = super.writeToNBT(cmp); cmp.setInteger(TAG_STACK_COUNT, stacksIn.size()); int i = 0; for(ItemStack stack : stacksIn) { NBTTagCompound stackcmp = stack.writeToNBT(new NBTTagCompound()); cmp.setTag(TAG_STACK + i, stackcmp); i++; } return ret; }
public void writeToNBT( final NBTTagCompound extra ) { for( int x = 0; x < this.size; x++ ) { final ICraftingLink link = this.getLink( x ); if( link != null ) { final NBTTagCompound ln = new NBTTagCompound(); link.writeToNBT( ln ); extra.setTag( "links-" + x, ln ); } } }
@Override public boolean addNearByMeteorites( final int dim, final int chunkX, final int chunkZ, final NBTTagCompound newData ) { synchronized( SpawnData.class ) { final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ ); // edit. final int size = data.getInteger( "num" ); data.setTag( String.valueOf( size ), newData ); data.setInteger( "num", size + 1 ); this.writeSpawnData( dim, chunkX, chunkZ, data ); return true; } }
@Override public void writePacketNBT(NBTTagCompound cmp) { super.writePacketNBT(cmp); NBTTagCompound cmp1 = new NBTTagCompound(); if(!stack.isEmpty()) cmp1 = stack.writeToNBT(cmp1); cmp.setTag(TAG_STACK, cmp1); }
@Override public void writePacketNBT(NBTTagCompound cmp) { super.writePacketNBT(cmp); cmp.setString(TAG_SUBTILE_NAME, subTileName); NBTTagCompound subCmp = new NBTTagCompound(); cmp.setTag(TAG_SUBTILE_CMP, subCmp); if(subTile != null) subTile.writeToPacketNBTInternal(subCmp); }
@Override public void writeToNBT( final NBTTagCompound data ) { super.writeToNBT( data ); data.setBoolean( "isLocked", this.isLocked ); final NBTTagCompound myItem = new NBTTagCompound(); if( this.configuredItem != null ) { this.configuredItem.writeToNBT( myItem ); } data.setTag( "configuredItem", myItem ); }
@Override public void writePacketNBT(NBTTagCompound par1nbtTagCompound) { super.writePacketNBT(par1nbtTagCompound); NBTTagCompound cmp = new NBTTagCompound(); if(!requestTarget.isEmpty()) cmp = requestTarget.writeToNBT(cmp); par1nbtTagCompound.setTag(TAG_REQUEST_TARGET, cmp); par1nbtTagCompound.setInteger(TAG_ITEM_COUNT, itemCount); }
private static void addCursor(ItemStack stack, BlockPos pos) { NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false); int count = cmp.getInteger(TAG_CURSOR_COUNT); cmp.setTag(TAG_CURSOR_PREFIX + count, cursorToCmp(pos)); cmp.setInteger(TAG_CURSOR_COUNT, count + 1); ItemNBTHelper.setCompound(stack, TAG_CURSOR_LIST, cmp); }
@Override public void writeToNBT( final NBTTagCompound c ) { for( int x = 0; x < this.facades; x++ ) { if( this.storage.getFacade( x ) != null ) { final NBTTagCompound data = new NBTTagCompound(); this.storage.getFacade( x ).getItemStack().writeToNBT( data ); c.setTag( "facade:" + x, data ); } } }
private void setColor( final ItemStack is, final ItemStack newColor ) { final NBTTagCompound data = Platform.openNbtData( is ); if( newColor.isEmpty() ) { data.removeTag( "color" ); } else { final NBTTagCompound color = new NBTTagCompound(); newColor.writeToNBT( color ); data.setTag( "color", color ); } }
@Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); if(!stack.isEmpty()) { compound.setTag("fly_stack", stack.writeToNBT(new NBTTagCompound())); } compound.setBoolean("flare", isFire()); }
@Override public void writeToPacketNBT(NBTTagCompound cmp) { super.writeToPacketNBT(cmp); cmp.setInteger(TAG_COOLDOWN, cooldown); cmp.setInteger(TAG_DIGESTING_MANA, digestingMana); cmp.setTag(TAG_LAST_FOOD, lastFood.writeToNBT(new NBTTagCompound())); cmp.setInteger(TAG_LAST_FOOD_COUNT, lastFoodCount); }