public static ItemStack getLastCraftingItem(NBTTagCompound cmp, int pos) { if(cmp == null) return ItemStack.EMPTY; NBTTagCompound cmp1 = cmp.getCompoundTag(TAG_ITEM_PREFIX + pos); if(cmp1 == null) return ItemStack.EMPTY; return new ItemStack(cmp1); }
public void readFromNBT( final NBTTagCompound data, final String name ) { final NBTTagCompound c = data.getCompoundTag( name ); if( c != null ) { this.readFromNBT( c ); } }
public void readFromNBT( final NBTTagCompound data, final String name ) { final NBTTagCompound c = data.getCompoundTag( name ); if( c != null ) { this.readFromNBT( c ); } }
public void readFromNBT( final NBTTagCompound data, final String name ) { final NBTTagCompound c = data.getCompoundTag( name ); if( c != null ) { this.readFromNBT( c ); } }
public PacketFluidSlot( final ByteBuf stream ) { this.list = new HashMap<>(); NBTTagCompound tag = ByteBufUtils.readTag( stream ); for( final String key : tag.getKeySet() ) { this.list.put( Integer.parseInt( key ), AEFluidStack.fromNBT( tag.getCompoundTag( key ) ) ); } }
@Override public void readPacketNBT(NBTTagCompound cmp) { super.readPacketNBT(cmp); NBTTagCompound cmp1 = cmp.getCompoundTag(TAG_STACK); stack = new ItemStack(cmp1); }
public static NBTTagCompound getSpawnerTag(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); if(tag != null && tag.hasKey(TAG_SPAWNER)) { return tag.getCompoundTag(TAG_SPAWNER); } return null; }
@Override public void readFromNBT(NBTTagCompound cmp) { super.readFromNBT(cmp); int count = cmp.getInteger(TAG_STACK_COUNT); stacksIn.clear(); for(int i = 0; i < count; i++) { NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_STACK + i); ItemStack stack = new ItemStack(stackcmp); stacksIn.add(stack); } }
/** If nullifyOnFail is true it'll return null if it doesn't find any * compounds, otherwise it'll return a new one. **/ public static NBTTagCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) { return verifyExistance(stack, tag) ? getNBT(stack).getCompoundTag(tag) : nullifyOnFail ? null : new NBTTagCompound(); }
@Override public void readPacketNBT(NBTTagCompound par1nbtTagCompound) { super.readPacketNBT(par1nbtTagCompound); NBTTagCompound cmp = par1nbtTagCompound.getCompoundTag(TAG_REQUEST_TARGET); requestTarget = new ItemStack(cmp); itemCount = par1nbtTagCompound.getInteger(TAG_ITEM_COUNT); }
@Override public void readPacketNBT(NBTTagCompound cmp) { super.readPacketNBT(cmp); subTileName = cmp.getString(TAG_SUBTILE_NAME); NBTTagCompound subCmp = cmp.getCompoundTag(TAG_SUBTILE_CMP); if(subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName)) provideSubTile(subTileName); if(subTile != null) subTile.readFromPacketNBTInternal(subCmp); }
@Override public GameProfile getProfile( final ItemStack is ) { final NBTTagCompound tag = Platform.openNbtData( is ); if( tag.hasKey( "profile" ) ) { return NBTUtil.readGameProfileFromNBT( tag.getCompoundTag( "profile" ) ); } return null; }
@Override public NBTTagCompound getData( final ItemStack is ) { final NBTTagCompound c = Platform.openNbtData( is ); NBTTagCompound o = c.getCompoundTag( "Data" ); if( o == null ) { o = new NBTTagCompound(); } return o.copy(); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.isLocked = data.getBoolean( "isLocked" ); final NBTTagCompound myItem = data.getCompoundTag( "configuredItem" ); this.configuredItem = AEItemStack.fromNBT( myItem ); }
private static List<BlockPos> getCursorList(ItemStack stack) { NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, TAG_CURSOR_LIST, false); List<BlockPos> cursors = new ArrayList<>(); int count = cmp.getInteger(TAG_CURSOR_COUNT); for(int i = 0; i < count; i++) { NBTTagCompound cursorCmp = cmp.getCompoundTag(TAG_CURSOR_PREFIX + i); int x = cursorCmp.getInteger(TAG_X_OFFSET); int y = cursorCmp.getInteger(TAG_Y_OFFSET); int z = cursorCmp.getInteger(TAG_Z_OFFSET); cursors.add(new BlockPos(x, y, z)); } return cursors; }
@Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); if(compound.hasKey("fly_stack")) { stack = new ItemStack(compound.getCompoundTag("fly_stack")); } setFire(compound.getBoolean("flare")); }
@SubscribeEvent(priority = EventPriority.LOWEST) public static void onDrops(LivingDropsEvent event) { EntityLivingBase e = event.getEntityLiving(); if(e.getEntityData().hasKey(TAG_ITEMSTACK_TO_DROP)) { NBTTagCompound cmp = e.getEntityData().getCompoundTag(TAG_ITEMSTACK_TO_DROP); ItemStack stack = new ItemStack(cmp); event.getDrops().clear(); event.getDrops().add(new EntityItem(e.world, e.posX, e.posY, e.posZ, stack)); } } }
public void readFromNBT( final NBTTagCompound extra ) { for( int x = 0; x < this.size; x++ ) { final NBTTagCompound link = extra.getCompoundTag( "links-" + x ); if( link != null && !link.hasNoTags() ) { this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) ); } } }
@Override public void readFromPacketNBT(NBTTagCompound cmp) { super.readFromPacketNBT(cmp); cooldown = cmp.getInteger(TAG_COOLDOWN); digestingMana = cmp.getInteger(TAG_DIGESTING_MANA); lastFood = new ItemStack(cmp.getCompoundTag(TAG_LAST_FOOD)); lastFoodCount = cmp.getInteger(TAG_LAST_FOOD_COUNT); }
private static String getEntityId(ItemStack stack) { NBTTagCompound tag = getSpawnerTag(stack); if(tag != null && tag.hasKey(TAG_SPAWN_DATA)) { tag = tag.getCompoundTag(TAG_SPAWN_DATA); if(tag.hasKey(TAG_ID)) { return EntityList.getTranslationName(new ResourceLocation(tag.getString(TAG_ID))); } } return null; }