@Override public boolean isValid(ItemStack disk) { return disk.hasTagCompound() && disk.getTagCompound().hasUniqueId(NBT_ID); }
@Override public boolean isValid(ItemStack disk) { return disk.hasTagCompound() && disk.getTagCompound().hasUniqueId(NBT_ID); }
private boolean isValid(ItemStack disk) { return disk.hasTagCompound() && disk.getTagCompound().hasUniqueId(NetworkNodeStorage.NBT_ID); }
private boolean isValid(ItemStack disk) { return disk.hasTagCompound() && disk.getTagCompound().hasUniqueId(NetworkNodeFluidStorage.NBT_ID); }
public static Optional<UUID> getTabSelected(ItemStack stack) { if (stack.hasTagCompound() && stack.getTagCompound().hasUniqueId(NBT_TAB_SELECTED)) { return Optional.of(stack.getTagCompound().getUniqueId(NBT_TAB_SELECTED)); } return Optional.absent(); }
@Override public void read(NBTTagCompound tag) { super.read(tag); if (tag.hasKey(NBT_TAB_PAGE)) { tabPage = tag.getInteger(NBT_TAB_PAGE); } if (tag.hasUniqueId(NBT_TAB_SELECTED)) { tabSelected = Optional.of(tag.getUniqueId(NBT_TAB_SELECTED)); } }
@Override public void read(NBTTagCompound tag) { super.read(tag); if (tag.hasUniqueId(NBT_ID)) { storageId = tag.getUniqueId(NBT_ID); loadStorage(); } OneSixMigrationHelper.migrateItemStorageBlock(this, tag); }
@Override public void read(NBTTagCompound tag) { super.read(tag); if (tag.hasUniqueId(NBT_ID)) { storageId = tag.getUniqueId(NBT_ID); loadStorage(); } OneSixMigrationHelper.migrateFluidStorageBlock(this, tag); }
@Override public void readFromNBT(NBTTagCompound compound) { channelToWireless.clear(); NBTTagList tagList = compound.getTagList("channels", Constants.NBT.TAG_COMPOUND); for (int i = 0 ; i < tagList.tagCount() ; i++) { NBTTagCompound tc = tagList.getCompoundTagAt(i); WirelessChannelInfo channelInfo = new WirelessChannelInfo(); readRouters(tc.getTagList("routers", Constants.NBT.TAG_COMPOUND), channelInfo); UUID owner = null; if (tc.hasUniqueId("owner")) { owner = tc.getUniqueId("owner"); } String name = tc.getString("name"); IChannelType type = XNet.xNetApi.findType(tc.getString("type")); channelToWireless.put(new WirelessChannelKey(name, type, owner), channelInfo); } }
@Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { if (!world.isRemote) { NetworkNodeStorage storage = ((TileStorage) world.getTileEntity(pos)).getNode(); if (stack.hasTagCompound() && stack.getTagCompound().hasUniqueId(NetworkNodeStorage.NBT_ID)) { storage.setStorageId(stack.getTagCompound().getUniqueId(NetworkNodeStorage.NBT_ID)); } storage.loadStorage(); } // Call this after loading the storage, so the network discovery can use the loaded storage. super.onBlockPlacedBy(world, pos, state, player, stack); }
@Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { if (!world.isRemote) { NetworkNodeFluidStorage storage = ((TileFluidStorage) world.getTileEntity(pos)).getNode(); if (stack.hasTagCompound() && stack.getTagCompound().hasUniqueId(NetworkNodeFluidStorage.NBT_ID)) { storage.setStorageId(stack.getTagCompound().getUniqueId(NetworkNodeFluidStorage.NBT_ID)); } storage.loadStorage(); } // Call this after loading the storage, so the network discovery can use the loaded storage. super.onBlockPlacedBy(world, pos, state, player, stack); }
public void read(NBTTagCompound tag) { if (tag.hasUniqueId(NBT_OWNER)) { owner = tag.getUniqueId(NBT_OWNER); } if (tag.hasKey(NBT_DIRECTION)) { direction = EnumFacing.byIndex(tag.getInteger(NBT_DIRECTION)); } if (tag.hasKey(NBT_VERSION)) { version = tag.getString(NBT_VERSION); } readConfiguration(tag); // We do this after readConfiguration so the 1.6 migration calls see that version is null. OneSixMigrationHelper.removalHook(); if (version == null) { version = RS.VERSION; } }
@Override public void deserialize(NBTTagCompound tag) { owner = tag.hasUniqueId("owner") ? tag.getUniqueId("owner") : null; if (owner != null) cachedNetwork = NetworkHelper.getSoulNetwork(owner); currentRitual = BloodMagic.RITUAL_MANAGER.getRitual(tag.getString(Constants.NBT.CURRENT_RITUAL)); if (currentRitual != null) { NBTTagCompound ritualTag = tag.getCompoundTag(Constants.NBT.CURRENT_RITUAL_TAG); if (!ritualTag.hasNoTags()) { currentRitual.readFromNBT(ritualTag); } } active = tag.getBoolean(Constants.NBT.IS_RUNNING); activeTime = tag.getInteger(Constants.NBT.RUNTIME); direction = EnumFacing.VALUES[tag.getInteger(Constants.NBT.DIRECTION)]; redstoned = tag.getBoolean(Constants.NBT.IS_REDSTONED); for (EnumDemonWillType type : EnumDemonWillType.values()) { if (tag.getBoolean("EnumWill" + type)) { currentActiveWillConfig.add(type); } } }
if (compound.hasUniqueId(TAG_UUID))
@SubscribeEvent(priority = EventPriority.LOWEST) public static void livingDropsEvent(LivingDropsEvent event) { EntityLivingBase mob = event.getEntityLiving(); if (mob.getEntityData().hasUniqueId(HIT_BY_DIRECT)) { UUID uuid = mob.getEntityData().getUniqueId(HIT_BY_DIRECT); if (uuid != null) { EntityPlayer player = mob.world.getPlayerEntityByUUID(uuid); if (player != null) { ItemStack stack = player.getHeldItemMainhand(); if (INSTANCE.hasAnyUpgradeVariant(stack) && EnergyUpgradeManager.getEnergyStored(stack) > 0) { EnergyUpgradeManager.extractEnergy(stack, doDirect(event, player) * DarkSteelConfig.directEnergyCost.get(), false); } } } } }
@Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); if (tagCompound.hasKey("burntime")) { this.burnTime = tagCompound.getInteger("burntime"); this.cookTime = tagCompound.getInteger("cooktime"); this.totalBurnTime = tagCompound.getInteger("cooktime_total"); } if (tagCompound.hasUniqueId("owner")) { ownerID = tagCompound.getUniqueId("owner"); } if (tagCompound.hasKey("ownername")) { username = tagCompound.getString("ownername"); } if (tagCompound.hasKey("bypass_recipecheck")) { ItemStack liquid = getStackInSlot(SLOT_LIQUID); ItemStack ingredient = getStackInSlot(SLOT_INGREDIENT); if (!liquid.isEmpty()) { checkedRecipe = AlchemicalCauldronCraftingManager.getInstance().findRecipe(liquid, ingredient); } } }
@Override public void read(NBTTagCompound tag) { super.read(tag); // Fix cascading crafter invalidates while reading patterns this.reading = true; StackUtils.readItems(patternsInventory, 0, tag); if (API.instance().getOneSixMigrationHelper().migratePatternInventory(patternsInventory)) { markDirty(); } this.invalidate(); this.reading = false; StackUtils.readItems(upgrades, 1, tag); if (tag.hasKey(NBT_DISPLAY_NAME)) { displayName = tag.getString(NBT_DISPLAY_NAME); } if (tag.hasUniqueId(NBT_UUID)) { uuid = tag.getUniqueId(NBT_UUID); } if (tag.hasKey(NBT_MODE)) { mode = CrafterMode.getById(tag.getInteger(NBT_MODE)); } if (tag.hasKey(NBT_LOCKED)) { locked = tag.getBoolean(NBT_LOCKED); } if (tag.hasKey(NBT_WAS_POWERED)) { wasPowered = tag.getBoolean(NBT_WAS_POWERED); } }