public static NBTTagCompound getSpawnerTag(ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); if(tag != null && tag.hasKey(TAG_SPAWNER)) { return tag.getCompoundTag(TAG_SPAWNER); } return null; }
public final void readFromPacketNBTInternal(NBTTagCompound cmp) { if(cmp.hasKey(TAG_TICKS_EXISTED)) ticksExisted = cmp.getInteger(TAG_TICKS_EXISTED); readFromPacketNBT(cmp); }
public static int getEntityOrbitTime(Entity entity) { NBTTagCompound cmp = entity.getEntityData(); if(cmp.hasKey(TAG_ORBIT)) return cmp.getInteger(TAG_ORBIT); else return 0; }
public static boolean verifyExistance(ItemStack stack, String tag) { return !stack.isEmpty() && getNBT(stack).hasKey(tag); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); if( data.hasKey( "dots" ) ) { this.readBuffer( Unpooled.copiedBuffer( data.getByteArray( "dots" ) ) ); } }
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; }
@Override public void readFromPacketNBT(NBTTagCompound cmp) { super.readFromPacketNBT(cmp); if (cmp.hasKey(TAG_LOOT_TABLE)) lootTable = new ResourceLocation(cmp.getString(TAG_LOOT_TABLE)); }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); if( data.hasKey( "paintedColor" ) ) { this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )]; } }
@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 void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); if( data.hasKey( "lastRedstoneState" ) ) { this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )]; } }
@Override public void removePermission( final ItemStack itemStack, final SecurityPermissions permission ) { final NBTTagCompound tag = Platform.openNbtData( itemStack ); if( tag.hasKey( permission.name() ) ) { tag.removeTag( permission.name() ); } }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.config.readFromNBT( data ); this.priority = data.getInteger( "priority" ); if( data.hasKey( "paintedColor" ) ) { this.paintedColor = AEColor.values()[data.getByte( "paintedColor" )]; } }
@Override public void readFromNBT( final NBTTagCompound data ) { super.readFromNBT( data ); this.manager.readFromNBT( data ); this.upgrades.readFromNBT( data, "upgrades" ); if( data.hasKey( "lastRedstoneState" ) ) { this.lastRedstoneState = YesNo.values()[data.getInteger( "lastRedstoneState" )]; } }
@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 CraftingLink( final NBTTagCompound data, final ICraftingCPU cpu ) { this.CraftID = data.getString( "CraftID" ); this.setCanceled( data.getBoolean( "canceled" ) ); this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); if( !data.hasKey( "req" ) || data.getBoolean( "req" ) ) { throw new IllegalStateException( "Invalid Crafting Link for Object" ); } this.cpu = cpu; this.req = null; }
public CraftingLink( final NBTTagCompound data, final ICraftingRequester req ) { this.CraftID = data.getString( "CraftID" ); this.setCanceled( data.getBoolean( "canceled" ) ); this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) ) { throw new IllegalStateException( "Invalid Crafting Link for Object" ); } this.req = req; this.cpu = null; }
public ItemStack getColor( final ItemStack is ) { final NBTTagCompound c = is.getTagCompound(); if( c != null && c.hasKey( "color" ) ) { final NBTTagCompound color = c.getCompoundTag( "color" ); final ItemStack oldColor = new ItemStack( color ); if( !oldColor.isEmpty() ) { return oldColor; } } return this.findNextColor( is, ItemStack.EMPTY, 0 ); }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { if(stack.getTagCompound() != null && stack.getTagCompound().hasKey(TAG_ITEMS)) { NBTTagList oldData = stack.getTagCompound().getTagList(TAG_ITEMS, Constants.NBT.TAG_COMPOUND); IItemHandler newInv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(newInv, null, oldData); stack.getTagCompound().removeTag(TAG_ITEMS); if(stack.getTagCompound().getSize() == 0) stack.setTagCompound(null); } }
@Override public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) { if(stack.getTagCompound() != null && stack.getTagCompound().hasKey(TAG_ITEMS)) { NBTTagList oldData = stack.getTagCompound().getTagList(TAG_ITEMS, Constants.NBT.TAG_COMPOUND); IItemHandler newInv = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.readNBT(newInv, null, oldData); stack.getTagCompound().removeTag(TAG_ITEMS); if(stack.getTagCompound().getSize() == 0) stack.setTagCompound(null); } }