// Token: 0x06002EEE RID: 12014 RVA: 0x000C7B2C File Offset: 0x000C5D2C
        public override void OnEnter()
        {
            base.OnEnter();
            WormBodyPositions2 component = base.GetComponent <WormBodyPositions2>();

            if (component)
            {
                component.yDamperConstant = 0f;
                component.ySpringConstant = 0f;
                component.maxTurnSpeed    = 0f;
                component.meatballCount   = 0;
                Util.PlaySound(DeathState.deathSoundString, component.bones[0].gameObject);
            }
            Transform modelTransform = base.GetModelTransform();

            if (modelTransform)
            {
                PrintController printController = modelTransform.gameObject.AddComponent <PrintController>();
                printController.printTime            = DeathState.duration;
                printController.enabled              = true;
                printController.startingPrintHeight  = 99999f;
                printController.maxPrintHeight       = 99999f;
                printController.startingPrintBias    = 1f;
                printController.maxPrintBias         = 3.5f;
                printController.animateFlowmapPower  = true;
                printController.startingFlowmapPower = 1.14f;
                printController.maxFlowmapPower      = 30f;
                printController.disableWhenFinished  = false;
                printController.printCurve           = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
                ParticleSystem[] componentsInChildren = modelTransform.GetComponentsInChildren <ParticleSystem>();
                for (int i = 0; i < componentsInChildren.Length; i++)
                {
                    componentsInChildren[i].Stop();
                }
                ChildLocator component2 = modelTransform.GetComponent <ChildLocator>();
                if (component2)
                {
                    Transform transform = component2.FindChild("PP");
                    if (transform)
                    {
                        PostProcessDuration component3 = transform.GetComponent <PostProcessDuration>();
                        if (component3)
                        {
                            component3.enabled     = true;
                            component3.maxDuration = DeathState.duration;
                        }
                    }
                }
                if (NetworkServer.active)
                {
                    EffectManager.SimpleMuzzleFlash(DeathState.initialDeathExplosionEffect, base.gameObject, "HeadCenter", true);
                }
            }
        }
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_CrystalWorld";
            SetItemTierWhenAvailable(ItemTier.Tier3);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Damage,
                ItemTag.Utility,
                ItemTag.AIBlacklist,
                ItemTag.CannotCopy
            };
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Crystal World/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Crystal World/Icon.png");
            itemDef.pickupModelPrefab.AddComponent <CrystalWorldContainer>();
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.17426F, 0.07766F, -0.05266F), new Vector3(16.68701F, 66.665F, 36.228F), new Vector3(0.042F, 0.042F, 0.042F));
                AddDisplayRule("HuntressBody", "Muzzle", new Vector3(-0.1516F, -0.0345F, -0.09869F), new Vector3(355.162F, 32.177F, 180.96F), new Vector3(0.042F, 0.042F, 0.042F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(0.19815F, 0.04837F, 0.02337F), new Vector3(350.191F, 244.703F, 340.178F), new Vector3(0.037F, 0.037F, 0.037F));
                AddDisplayRule("ToolbotBody", "Chest", new Vector3(3.83001F, 1.891F, 0.03063F), new Vector3(29.795F, 9.384F, 2.716F), new Vector3(0.489F, 0.489F, 0.489F));
                AddDisplayRule("EngiBody", "Chest", new Vector3(-0.20791F, 0.30973F, 0.18735F), new Vector3(4.991F, 46.464F, 181.437F), new Vector3(0.065F, 0.065F, 0.065F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(0F, 0.56045F, 0F), new Vector3(33.04002F, 48.09F, 359.072F), new Vector3(0.168F, 0.168F, 0.168F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0F, 0.78124F, 0.82794F), new Vector3(22.677F, 152.024F, 24.393F), new Vector3(0.134F, 0.163F, 0.131F));
                AddDisplayRule("MageBody", "Chest", new Vector3(0.06498F, 0.25775F, 0.30228F), new Vector3(0.366F, 347.899F, 165.881F), new Vector3(0.0827F, 0.0827F, 0.0827F));
                AddDisplayRule("MercBody", "HandR", new Vector3(0.00372F, 0.11846F, 0.0863F), new Vector3(0F, 0F, 0F), new Vector3(0.07229F, 0.07229F, 0.07217F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.45015F, 0.77395F, -0.18053F), new Vector3(0F, 0F, 0F), new Vector3(0.29135F, 0.29135F, 0.29135F));
                AddDisplayRule("LoaderBody", "MechUpperArmL", new Vector3(0.07707F, 0.07703F, -0.00595F), new Vector3(7.628F, 218.893F, 342.184F), new Vector3(0.10413F, 0.10413F, 0.10413F));
                AddDisplayRule("CrocoBody", "SpineChest2", new Vector3(-1.42325F, 2.10075F, 1.05927F), new Vector3(337.83F, 226.76F, 273.311F), new Vector3(0.411F, 0.411F, 0.411F));
                AddDisplayRule("CaptainBody", "MuzzleGun", new Vector3(-0.0034F, 0.03444F, -0.31976F), new Vector3(0F, 0F, 0F), new Vector3(0.04057F, 0.03674F, 0.04057F));
                AddDisplayRule("BrotherBody", "UpperArmL", new Vector3(0.02255F, -0.01451F, -0.00259F), new Vector3(303.36F, 82.77999F, 101.5723F), new Vector3(0.05297F, 0.08504F, 0.08504F));
                AddDisplayRule("ScavBody", "UpperArmL", new Vector3(0.32551F, 0.61566F, 1.17648F), new Vector3(0F, 0F, 0F), new Vector3(2.65712F, 2.73031F, 2.65712F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Chest", new Vector3(0.1151F, 0.32048F, -0.33018F), new Vector3(10.681F, 0.007F, 0.071F), new Vector3(0.07588F, 0.07588F, 0.07588F));
                }
                AddDisplayRule("RailgunnerBody", "Backpack", new Vector3(0.09864F, 0.17726F, -0.08467F), new Vector3(0F, 0F, 0F), new Vector3(0.09998F, 0.09998F, 0.09998F));
                AddDisplayRule("VoidSurvivorBody", "Chest", new Vector3(0.36683F, 0.1762F, 0.00002F), new Vector3(0F, 0F, 0F), new Vector3(0.16615F, 0.16615F, 0.16615F));
            };
            ballPrefab = PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, "MysticsItems_CrystalWorldBall", false);

            // DefaultDisplayRule("Head", new Vector3(0f, 0.5f, 0f), new Vector3(0f, -90f, 180f), new Vector3(0.2f, 0.2f, 0.2f));

            /*
             * How the world projection works:
             * When a model (aka a World Container) is spawned in, a random Crystal World is also created at very distant coords
             * Each Crystal World has a Camera that renders the World to a RenderTexture, with a custom skybox
             * Each active camera has a Projector child that draws the RenderTexture as billboards where the Containers are right now, and outputs it into the final Projection RenderTexture
             * Active cameras also have a Container Prerender component that sets every active container's inner display texture to the texture with projections
             */

            // Register all worlds using the same code block
            string[] worldsToLoad =
            {
                "Crystallize",
                "In Circles"
            };
            foreach (string worldName in worldsToLoad)
            {
                GameObject world        = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Crystal World/Worlds/" + worldName + ".prefab");
                GameObject cameraObject = world.transform.Find("CameraPivot").Find("Camera").gameObject;
                cameraObject.AddComponent <CrystalWorldCamera>();
                RenderTexture renderTexture = null;
                if (!Main.isDedicatedServer)
                {
                    renderTexture = new RenderTexture(1028, 1028, 0, RenderTextureFormat.ARGB32)
                    {
                        name = "Crystal World \"" + worldName + "\""
                    }
                }
                ;
                cameraObject.GetComponent <Camera>().targetTexture = renderTexture;
                foreach (Transform worldObjectTransform in world.transform)
                {
                    GameObject worldObject = worldObjectTransform.gameObject;
                    Renderer   renderer    = worldObject.GetComponent <MeshRenderer>();
                    if (renderer)
                    {
                        Material material = renderer.material;
                        if (material.shader.name == "Standard")
                        {
                            HopooShaderToMaterial.Standard.Apply(material);
                            HopooShaderToMaterial.Standard.DisableEverything(material);
                        }
                    }
                }
                // Run specific per-world code
                switch (worldName)
                {
                case "Crystallize":
                    ParticleSystemRenderer snowRenderer = world.transform.Find("Snow").gameObject.GetComponent <ParticleSystemRenderer>();
                    Material snowMaterial = new Material(HopooShaderToMaterial.Standard.shader);
                    snowRenderer.material = snowMaterial;
                    HopooShaderToMaterial.Standard.Emission(snowMaterial, 2f, Color.white);
                    break;
                }
                worlds.Add(new WorldInfo
                {
                    prefab            = world,
                    shownInContainers = new List <GameObject>(),
                    renderTexture     = renderTexture
                });
            }

            On.RoR2.SceneCamera.Awake += (orig, self) =>
            {
                orig(self);
                GameObject projector = new GameObject
                {
                    name = "Crystal World Projector"
                };
                projector.transform.SetParent(self.transform);
                projector.transform.localPosition = Vector3.zero;
                projector.transform.localRotation = Quaternion.identity;
                CrystalWorldProjector          component          = projector.AddComponent <CrystalWorldProjector>();
                CrystalWorldContainerPrerender prerenderComponent = self.gameObject.AddComponent <CrystalWorldContainerPrerender>();
                prerenderComponent.renderTexture = component.projectionRenderTexture;
            };

            pulsePrefab = Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Crystal World/Explosion.prefab");
            EffectComponent effectComponent = pulsePrefab.AddComponent <EffectComponent>();

            effectComponent.applyScale      = true;
            effectComponent.disregardZScale = false;
            effectComponent.soundName       = "Play_item_proc_iceRingSpear";
            VFXAttributes vfxAttributes = pulsePrefab.AddComponent <VFXAttributes>();

            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
            pulsePrefab.AddComponent <DestroyOnTimer>().duration = 1f;

            GameObject     ppHolder = pulsePrefab.transform.Find("PP").gameObject;
            SphereCollider ppSphere = ppHolder.AddComponent <SphereCollider>();

            ppSphere.radius    = 60f;
            ppSphere.isTrigger = true;
            ppHolder.layer     = LayerIndex.postProcess.intVal;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.blendDistance = 30f;
            pp.isGlobal      = false;
            pp.weight        = 0.2f;
            pp.priority      = 10;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppCrystalWorldExplosion";
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();
            Color        c            = Color.white;
            float        intensity    = 3f;

            c.r *= intensity; c.g *= intensity; c.b *= intensity;
            colorGrading.colorFilter.value         = c;
            colorGrading.colorFilter.overrideState = true;
            colorGrading.saturation.value          = -100f;
            colorGrading.saturation.overrideState  = true;
            colorGrading.contrast.value            = -100f;
            colorGrading.contrast.overrideState    = true;
            pp.sharedProfile = ppProfile;

            PostProcessDuration postProcessDuration = ppHolder.AddComponent <PostProcessDuration>();

            postProcessDuration.ppVolume      = pp;
            postProcessDuration.ppWeightCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 0.35f),
                    new Keyframe(1f, 0f)
                }
            };
            postProcessDuration.maxDuration = 1f;

            MysticsItemsContent.Resources.effectPrefabs.Add(pulsePrefab);

            On.RoR2.HoldoutZoneController.Awake += (orig, self) =>
            {
                orig(self);
                MysticsItemsCrystalWorldTeleporterEffect component = self.GetComponent <MysticsItemsCrystalWorldTeleporterEffect>();
                if (!component)
                {
                    component = self.gameObject.AddComponent <MysticsItemsCrystalWorldTeleporterEffect>();
                    switch (MysticsRisky2Utils.Utils.TrimCloneFromString(self.gameObject.name))
                    {
                    case "Teleporter1":
                        component.displayModel = true;
                        component.offset       = new Vector3(0f, 3f, 0f);
                        break;

                    case "LunarTeleporter Variant":
                        component.displayModel = true;
                        component.offset       = new Vector3(0f, 3f, 0f);
                        break;
                    }
                }
            };
        }
        public override void OnLoad()
        {
            base.OnLoad();
            itemDef.name = "MysticsItems_RiftLens";
            SetItemTierWhenAvailable(ItemTier.Lunar);
            itemDef.tags = new ItemTag[]
            {
                ItemTag.Utility,
                ItemTag.AIBlacklist,
                ItemTag.CannotCopy,
                ItemTag.OnStageBeginEffect
            };
            MysticsItemsContent.Resources.unlockableDefs.Add(GetUnlockableDef());
            itemDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Items/Rift Lens/Model.prefab"));
            itemDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Items/Rift Lens/Icon.png");
            ModelPanelParameters modelPanelParams = itemDef.pickupModelPrefab.GetComponentInChildren <ModelPanelParameters>();

            modelPanelParams.minDistance = 2;
            modelPanelParams.maxDistance = 6;
            itemDisplayPrefab            = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(itemDef.pickupModelPrefab, itemDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS += () =>
            {
                AddDisplayRule("CommandoBody", "Head", new Vector3(0.1f, 0.25f, 0.15f), new Vector3(20f, 210f, 0f), new Vector3(0.06f, 0.06f, 0.06f));
                AddDisplayRule("HuntressBody", "Head", new Vector3(-0.0009F, 0.2635F, 0.1117F), new Vector3(0F, 180F, 0F), new Vector3(0.03F, 0.03F, 0.03F));
                AddDisplayRule("Bandit2Body", "Head", new Vector3(0F, 0.057F, 0.135F), new Vector3(0F, 180F, 180F), new Vector3(0.028F, 0.028F, 0.028F));
                AddDisplayRule("ToolbotBody", "Head", new Vector3(0.409F, 3.049F, -1.067F), new Vector3(60F, 0F, 180F), new Vector3(0.3F, 0.3F, 0.3F));
                AddDisplayRule("EngiBody", "HeadCenter", new Vector3(0.098F, 0.019F, 0.127F), new Vector3(1.506F, 213.327F, 354.045F), new Vector3(0.029F, 0.029F, 0.029F));
                AddDisplayRule("EngiTurretBody", "Head", new Vector3(0.005F, 0.525F, 2.043F), new Vector3(0F, 180F, 0F), new Vector3(0.108F, 0.083F, 0.083F));
                AddDisplayRule("EngiWalkerTurretBody", "Head", new Vector3(0.006F, 0.774F, 0.853F), new Vector3(0F, 177.859F, 0F), new Vector3(0.306F, 0.306F, 0.306F));
                AddDisplayRule("MageBody", "Head", new Vector3(0.048F, 0.06F, 0.117F), new Vector3(13.941F, 189.822F, 2.364F), new Vector3(0.026F, 0.026F, 0.026F));
                AddDisplayRule("MercBody", "Head", new Vector3(0.05F, 0.156F, 0.151F), new Vector3(10.716F, 202.078F, 355.897F), new Vector3(0.053F, 0.053F, 0.053F));
                AddDisplayRule("TreebotBody", "HeadCenter", new Vector3(-0.005F, 0.058F, -0.002F), new Vector3(85.226F, 270F, 270F), new Vector3(0.098F, 0.098F, 0.098F));
                AddDisplayRule("LoaderBody", "Head", new Vector3(0.051F, 0.125F, 0.134F), new Vector3(10.267F, 205.465F, 354.736F), new Vector3(0.047F, 0.04F, 0.048F));
                AddDisplayRule("CrocoBody", "Head", new Vector3(-1.531F, 1.934F, 0.459F), new Vector3(14.526F, 104.513F, 346.531F), new Vector3(0.236F, 0.236F, 0.236F));
                AddDisplayRule("CaptainBody", "HandR", new Vector3(-0.085F, 0.108F, 0.013F), new Vector3(69.075F, 70.114F, 350.542F), new Vector3(0.026F, 0.03F, 0.042F));
                AddDisplayRule("BrotherBody", "Head", BrotherInfection.blue, new Vector3(0.003F, -0.01F, 0.061F), new Vector3(349.888F, 70.121F, 339.729F), new Vector3(0.133F, 0.133F, 0.133F));
                AddDisplayRule("ScavBody", "Head", new Vector3(5.068F, 4.15F, -0.55F), new Vector3(46.576F, 301.45F, 310.155F), new Vector3(1.363F, 1.363F, 1.363F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "GunBarrel", new Vector3(0.00002F, 0.07266F, -0.32569F), new Vector3(0F, 180F, 0F), new Vector3(0.02325F, 0.02325F, 0.02325F));
                }
                AddDisplayRule("RailgunnerBody", "GunScope", new Vector3(-0.07466F, -0.14553F, 0.31781F), new Vector3(0F, 180F, 0F), new Vector3(0.02909F, 0.02909F, 0.02909F));
                AddDisplayRule("VoidSurvivorBody", "Head", new Vector3(0.00001F, 0.17385F, 0.09392F), new Vector3(58.31651F, 180F, 180F), new Vector3(0.03831F, 0.03831F, 0.03831F));
            };

            MysticsItemsRiftChest component = riftChest.AddComponent <MysticsItemsRiftChest>();

            SfxLocator sfxLocator = riftChest.AddComponent <SfxLocator>();

            sfxLocator.openSound = "Play_env_riftchest_open";

            riftChest.AddComponent <GenericDisplayNameProvider>().displayToken = "MYSTICSITEMS_RIFTCHEST_NAME";

            PurchaseInteraction purchaseInteraction = riftChest.AddComponent <PurchaseInteraction>();

            purchaseInteraction.displayNameToken = "MYSTICSITEMS_RIFTCHEST_NAME";
            purchaseInteraction.contextToken     = "MYSTICSITEMS_RIFTCHEST_CONTEXT";

            ChestBehavior chestBehavior = riftChest.AddComponent <ChestBehavior>();

            chestBehavior.dropTable = Addressables.LoadAssetAsync <PickupDropTable>("RoR2/Base/Chest1/dtChest1.asset").WaitForCompletion();

            riftChest.transform.Find("InteractionCollider").gameObject.AddComponent <EntityLocator>().entity = riftChest;

            riftChest.transform.Find("RiftOrigin/Sprite").gameObject.AddComponent <Billboard>();

            ObjectScaleCurve objectScaleCurve = riftChest.transform.Find("RiftOrigin").gameObject.AddComponent <ObjectScaleCurve>();

            objectScaleCurve.useOverallCurveOnly = true;
            objectScaleCurve.overallCurve        = new AnimationCurve()
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f),
                    new Keyframe(1f, 0f)
                }
            };
            objectScaleCurve.timeMax = 0.5f;
            objectScaleCurve.enabled = false;

            //post processing
            GameObject ppHolder = Object.Instantiate(PrefabAPI.InstantiateClone(new GameObject("RiftLensPostProcessing"), "RiftLensPostProcessing", false), riftChest.transform);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal      = false;
            pp.weight        = 1f;
            pp.priority      = 50;
            pp.blendDistance = 10f;
            SphereCollider sphereCollider = ppHolder.AddComponent <SphereCollider>();

            sphereCollider.radius    = 5f;
            sphereCollider.isTrigger = true;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppRiftLens";
            LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>();

            lensDistortion.SetAllOverridesTo(true);
            lensDistortion.intensity.value = -30f;
            lensDistortion.scale.value     = 1f;
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();

            colorGrading.colorFilter.value         = new Color32(178, 242, 255, 255);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            PostProcessDuration ppDuration = pp.gameObject.AddComponent <PostProcessDuration>();

            ppDuration.ppVolume      = pp;
            ppDuration.ppWeightCurve = new AnimationCurve
            {
                keys = new Keyframe[]
                {
                    new Keyframe(0f, 1f, 0f, Mathf.Tan(-45f * Mathf.Deg2Rad)),
                    new Keyframe(1f, 0f, Mathf.Tan(135f * Mathf.Deg2Rad), 0f)
                },
                preWrapMode  = WrapMode.Clamp,
                postWrapMode = WrapMode.Clamp
            };
            ppDuration.maxDuration  = 1;
            ppDuration.destroyOnEnd = true;
            ppDuration.enabled      = false;
            component.ppDuration    = ppDuration;

            riftChestSpawnCard      = ScriptableObject.CreateInstance <InteractableSpawnCard>();
            riftChestSpawnCard.name = "iscMysticsItems_UnstableRift";
            riftChestSpawnCard.directorCreditCost = 0;
            riftChestSpawnCard.forbiddenFlags     = NodeFlags.NoChestSpawn;
            riftChestSpawnCard.hullSize           = HullClassification.Human;
            riftChestSpawnCard.nodeGraphType      = MapNodeGroup.GraphType.Ground;
            riftChestSpawnCard.occupyPosition     = true;
            riftChestSpawnCard.orientToFloor      = false;
            riftChestSpawnCard.sendOverNetwork    = true;
            riftChestSpawnCard.prefab             = riftChest;

            GenericGameEvents.OnPopulateScene += (rng) =>
            {
                int riftsToSpawn = 0;
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    if (characterMaster.teamIndex == TeamIndex.Player)
                    {
                        int thisItemCount = characterMaster.inventory.GetItemCount(itemDef);
                        if (thisItemCount > 0)
                        {
                            characterMaster.inventory.RemoveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, characterMaster.inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff));
                            characterMaster.inventory.GiveItem(MysticsItemsContent.Items.MysticsItems_RiftLensDebuff, baseRifts + riftsPerStack * (thisItemCount - 1));
                            riftsToSpawn += baseRifts.Value + riftsPerStack.Value * (thisItemCount - 1);
                        }
                    }
                }
                if (riftsToSpawn > 0)
                {
                    for (int i = 0; i < riftsToSpawn; i++)
                    {
                        GameObject riftChest = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(riftChestSpawnCard, new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, rng));
                    }
                }
                MysticsItemsRiftLensBehaviour.CalculateCountdownForAll();
            };

            On.RoR2.CharacterBody.OnInventoryChanged += (orig, self) =>
            {
                orig(self);
                self.AddItemBehavior <MysticsItemsRiftLensBehaviour>(self.inventory.GetItemCount(itemDef));
            };

            ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources;

            hudPanelPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load <GameObject>("Prefabs/UI/HudModules/HudCountdownPanel"), "RiftLensHUDPanel");
            hudPanelPrefab.transform.Find("Juice/Container/CountdownTitleLabel").GetComponent <LanguageTextMeshController>().token = "OBJECTIVE_MYSTICSITEMS_RIFTLENS_FLAVOUR";
            var col = new Color32(0, 157, 255, 255);

            hudPanelPrefab.transform.Find("Juice/Container/Border").GetComponent <Image>().color = col;
            hudPanelPrefab.transform.Find("Juice/Container/CountdownLabel").GetComponent <HGTextMeshProUGUI>().color = col;

            PositionIndicator positionIndicator = riftPositionIndicator.AddComponent <PositionIndicator>();

            positionIndicator.insideViewObject              = riftPositionIndicator.transform.Find("InsideFrame").gameObject;
            positionIndicator.outsideViewObject             = riftPositionIndicator.transform.Find("OutsideFrame").gameObject;
            positionIndicator.alwaysVisibleObject           = riftPositionIndicator.transform.Find("Sprite").gameObject;
            positionIndicator.shouldRotateOutsideViewObject = true;
            positionIndicator.outsideViewRotationOffset     = 90f;

            GenericGameEvents.OnPlayerCharacterDeath += GenericGameEvents_OnPlayerCharacterDeath;
        }