Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MinecraftAdditions v1.0.7
MinecraftEnderman.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; using UnityEngine.Serialization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("GreatColtini")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4305ac441d5d82ba23c918ce9347331e04ee7ae4")] [assembly: AssemblyProduct("MinecraftEnderman")] [assembly: AssemblyTitle("MinecraftEnderman")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class EnemyEnderman : MonoBehaviour { public enum State { Stand, OnScreen, Notice, Attack, Damage, Despawn, Stunned } private PhotonView photonView; private Enemy enemy; public EnemyEndermanAnim anim; public GameObject head; public GameObject hurtCollider; private float hurtColliderTimer; public State currentState; private float stateTimer; private bool stateImpulse; private float tpTimer; public Rigidbody rb; internal PlayerAvatar playerTarget; private bool otherEnemyFetch = true; public List<EnemyEnderman> otherEnemies; private Vector3 teleportPosition; private Vector3 lastTeleportPosition; private float teleportTimer; private bool teleporting; private float teleportRoamTimer; private float noticeLerpTimer = 0f; private float noticeLerpSpeed = 0.4f; private float noticeThreshold = 1f; private void Awake() { enemy = ((Component)this).GetComponent<Enemy>(); photonView = ((Component)this).GetComponent<PhotonView>(); } private void Update() { if (!LevelGenerator.Instance.Generated) { return; } if (!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) { switch (currentState) { case State.Stand: StateStand(); PlayerLookAt(); break; case State.OnScreen: StateOnScreen(); PlayerLookAt(); break; case State.Notice: StateNotice(); PlayerLookAt(); break; case State.Attack: StateAttack(); PlayerLookAt(); break; case State.Damage: StateDamage(); PlayerLookAt(); break; case State.Despawn: StateDespawn(); break; case State.Stunned: StateStunned(); break; } if (enemy.IsStunned()) { enemy.EnemyParent.SpawnedTimerSet(0f); UpdateState(State.Stunned); } } TeleportLogic(); SetFollowTargetToPosition(); LocalEffect(); HurtColliderLogic(); if (currentState != State.OnScreen) { noticeLerpTimer = 0f; } } private void StateStand() { if (stateImpulse) { SetTarget(null); stateTimer = 5f; stateImpulse = false; } if (!Object.op_Implicit((Object)(object)playerTarget)) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!player.isDisabled && enemy.OnScreen.OnScreenPlayer.ContainsKey(player.photonView.ViewID) && enemy.OnScreen.GetOnScreen(player)) { SetTarget(player); UpdateState(State.OnScreen); return; } } } if (!SemiFunc.EnemySpawnIdlePause()) { if (teleportRoamTimer > 0f) { teleportRoamTimer -= Time.deltaTime; } else if (Teleport(_spawn: false)) { SetRoamTimer(); } if (SemiFunc.EnemyForceLeave(enemy)) { Teleport(_spawn: false, _leave: true); } } } private void StateOnScreen() { if (stateImpulse) { tpTimer = Random.Range(0f, 3f); stateTimer = 1f; stateImpulse = false; noticeLerpTimer = 0f; } bool flag = false; bool flag2 = false; if (Object.op_Implicit((Object)(object)playerTarget) && enemy.OnScreen.GetOnScreen(playerTarget)) { stateTimer = 0.2f; flag = true; flag2 = IsPlayerLookingAtMe(); if (flag && !flag2 && tpTimer <= 0f) { if (Random.Range(0f, 1f) < 0.6f) { if (Teleport(_spawn: false)) { tpTimer = 5f; } } else { tpTimer = 2f; } } if (flag2) { noticeLerpTimer += noticeLerpSpeed * Time.deltaTime; if (playerTarget.isLocal) { float num = Mathf.Clamp01(noticeLerpTimer / noticeThreshold); SemiFunc.DoNotLookEffect(((Component)this).gameObject, true, true, true, true, num > 0.5f, num > 0.8f); } } else { noticeLerpTimer -= noticeLerpSpeed * 0.5f * Time.deltaTime; noticeLerpTimer = Mathf.Max(0f, noticeLerpTimer); } } if (tpTimer > 0f) { tpTimer -= Time.deltaTime; } if (flag && noticeLerpTimer >= noticeThreshold) { if (tpTimer <= 0f) { if (Random.Range(0f, 1f) < 0.5f) { if (Teleport(_spawn: false)) { tpTimer = 5f; } } else { tpTimer = 5f; } } UpdateState(State.Notice); } else { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Stand); } } } private void StateNotice() { if (!GameManager.Multiplayer()) { NoticeRPC(); } else { photonView.RPC("NoticeRPC", (RpcTarget)0, Array.Empty<object>()); } UpdateState(State.Attack); } private void StateAttack() { if (stateImpulse) { stateTimer = 1f; if (IsPlayerLookingAtMe()) { stateTimer *= 0.5f; } stateImpulse = false; anim.animator.SetTrigger("Attack"); } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Damage); } } private void StateDamage() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) playerTarget.playerHealth.HurtOther(30, ((Component)playerTarget).transform.position, false, SemiFunc.EnemyGetIndex(enemy)); if (SemiFunc.IsMultiplayer()) { photonView.RPC("ActivateHurtColliderRPC", (RpcTarget)0, new object[1] { ((Component)playerTarget).transform.position }); } else { ActivateHurtColliderRPC(((Component)playerTarget).transform.position); } UpdateState(State.Despawn); } private void StateDespawn() { if (stateImpulse) { stateTimer = 0.4f; stateImpulse = false; } stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { enemy.EnemyParent.SpawnedTimerSet(0f); } } private void StateStunned() { } public void OnSpawn() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (otherEnemyFetch) { otherEnemyFetch = false; foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { EnemyEnderman componentInChildren = ((Component)item).GetComponentInChildren<EnemyEnderman>(true); if (Object.op_Implicit((Object)(object)componentInChildren) && (Object)(object)componentInChildren != (Object)(object)this) { otherEnemies.Add(componentInChildren); } } } if (SemiFunc.EnemySpawnIdlePause()) { lastTeleportPosition = ((Component)this).transform.position; SemiFunc.EnemySpawn(enemy); teleportPosition = ((Component)this).transform.position; teleporting = true; UpdateState(State.Stand); } else if (Teleport(_spawn: true)) { SetRoamTimer(); UpdateState(State.Stand); } else { enemy.EnemyParent.Despawn(); enemy.EnemyParent.DespawnedTimerSet(3f, false); } } public void OnHurt() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) anim.hurtSound.Play(((Component)anim).transform.position, 1f, 1f, 1f, 1f); } private void UpdateState(State _nextState) { stateTimer = 0f; stateImpulse = true; currentState = _nextState; if (GameManager.Multiplayer()) { photonView.RPC("UpdateStateRPC", (RpcTarget)1, new object[1] { _nextState }); } } private bool Teleport(bool _spawn, bool _leave = false) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) if (currentState == State.Stunned) { return false; } List<LevelPoint> list = new List<LevelPoint>(); if (_leave) { list.Add(SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f)); } else { list = SemiFunc.LevelPointGetWithinDistance(((Component)this).transform.position, 3f, 30f); if (list == null) { list = SemiFunc.LevelPointGetWithinDistance(((Component)this).transform.position, 3f, 50f); if (list == null) { list = SemiFunc.LevelPointGetWithinDistance(((Component)this).transform.position, 0f, 999f); } } } if (list == null) { return false; } bool flag = Random.Range(0, 100) < 3; if (Object.op_Implicit((Object)(object)playerTarget)) { flag = Random.Range(0, 100) < 30; } if (flag && !_leave) { list = SemiFunc.LevelPointsGetAllCloseToPlayers(); } if (list == null || list.Count <= 0) { return false; } LevelPoint val = list[Random.Range(0, list.Count)]; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)val).transform.position + Vector3.up * 0.1f, Vector3.up, ref val2, 3.5f, LayerMask.GetMask(new string[1] { "Default" }))) { return false; } foreach (EnemyEnderman otherEnemy in otherEnemies) { if (((Behaviour)otherEnemy).isActiveAndEnabled && Vector3.Distance(otherEnemy.rb.position, ((Component)val).transform.position) <= 2f) { return false; } } if (Vector3.Distance(((Component)val).transform.position, lastTeleportPosition) < 1f) { return false; } if (SemiFunc.EnemyPhysObjectBoundingBoxCheck(((Component)this).transform.position, ((Component)val).transform.position, enemy.Rigidbody.rb)) { return false; } lastTeleportPosition = ((Component)this).transform.position; teleportPosition = ((Component)val).transform.position; teleporting = true; if (!_spawn) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("TeleportEffectRPC", (RpcTarget)0, new object[2] { lastTeleportPosition, true }); } else { TeleportEffectRPC(lastTeleportPosition, intro: true); } } else { enemy.EnemyTeleported(teleportPosition); } return true; } private void TeleportLogic() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || currentState == State.Stunned) { return; } if (teleportTimer <= 0f) { if (teleporting) { enemy.EnemyTeleported(teleportPosition); if (SemiFunc.IsMultiplayer()) { photonView.RPC("TeleportEffectRPC", (RpcTarget)0, new object[2] { teleportPosition, false }); } else { TeleportEffectRPC(teleportPosition, intro: false); } teleporting = false; } } else { teleportTimer -= Time.deltaTime; } } private void PlayerLookAt() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)playerTarget)) { Quaternion val = Quaternion.LookRotation(playerTarget.PlayerVisionTarget.VisionTransform.position - ((Component)enemy.Rigidbody).transform.position); Quaternion val2 = Quaternion.Euler(0f, ((Quaternion)(ref val)).eulerAngles.y, 0f); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, 50f * Time.deltaTime); } } private bool IsPlayerLookingAtMe() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)playerTarget)) { return false; } Vector3 val = head.transform.position - playerTarget.PlayerVisionTarget.VisionTransform.position; ((Vector3)(ref val)).Normalize(); Vector3 forward = playerTarget.PlayerVisionTarget.VisionTransform.forward; float num = Vector3.Dot(val, forward); float num2 = 0.9f; if (num > num2) { RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(playerTarget.PlayerVisionTarget.VisionTransform.position, val, ref val2, Vector3.Distance(playerTarget.PlayerVisionTarget.VisionTransform.position, head.transform.position), LayerMask.GetMask(new string[1] { "Default" })) && (Object)(object)((RaycastHit)(ref val2)).transform != (Object)(object)((Component)this).transform && !((RaycastHit)(ref val2)).transform.IsChildOf(((Component)this).transform)) { return false; } return true; } return false; } private void SetFollowTargetToPosition() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((Component)enemy).transform.position = teleportPosition; } public void SmokeEffect(Vector3 pos) { anim.particleSmokeCalmFill.Play(); } private void Rattle() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) anim.notice.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); anim.rattleImpulse = true; } private void LocalEffect() { if (currentState == State.OnScreen && Object.op_Implicit((Object)(object)playerTarget) && playerTarget.isLocal) { SemiFunc.DoNotLookEffect(((Component)this).gameObject, true, true, true, true, true, false); } } private void SetRoamTimer() { teleportRoamTimer = Random.Range(8f, 22f); } private void HurtColliderLogic() { if (hurtColliderTimer > 0f) { hurtColliderTimer -= Time.deltaTime; if (hurtColliderTimer <= 0f) { hurtCollider.SetActive(false); } } } [PunRPC] private void UpdateStateRPC(State _nextState) { currentState = _nextState; } [PunRPC] private void NoticeRPC() { anim.NoticeSet(); } [PunRPC] public void TeleportEffectRPC(Vector3 position, bool intro) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) SmokeEffect(position); if (intro) { anim.teleportIn.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } else { anim.teleportOut.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } anim.rattleImpulse = true; teleportTimer = 0.1f; } private void SetTarget(PlayerAvatar _player) { if (!((Object)(object)_player == (Object)(object)playerTarget)) { playerTarget = _player; bool flag = true; int num = -1; if (!Object.op_Implicit((Object)(object)playerTarget)) { flag = false; } if (flag) { Rattle(); num = playerTarget.photonView.ViewID; } if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetTargetRPC", (RpcTarget)1, new object[2] { num, flag }); } } } [PunRPC] public void SetTargetRPC(int playerID, bool hasTarget) { if (!hasTarget) { playerTarget = null; return; } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.photonView.ViewID == playerID) { playerTarget = item; break; } } Rattle(); } [PunRPC] public void ActivateHurtColliderRPC(Vector3 _position) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) hurtCollider.transform.position = _position; hurtCollider.transform.rotation = Quaternion.LookRotation(enemy.Vision.VisionTransform.position - _position); hurtCollider.SetActive(true); hurtColliderTimer = 0.25f; } } public class EnemyEndermanAnim : MonoBehaviour { internal Animator animator; public EnemyEnderman controller; public Enemy enemy; public GameObject mesh; public Light backLight; private float[] randomOffsets; internal bool rattleImpulse; public ParticleSystem particleSmoke; public ParticleSystem particleSmokeCalmFill; public ParticleSystem particleImpact; public ParticleSystem particleDirectionalBits; [Space] public Sound teleportIn; public Sound teleportOut; [Space] public Sound notice; [Space] public Sound growLoop; public Sound zoom; public Sound attack; public Sound screamLocal; public Sound screamGlobal; [Space] public Sound hurtSound; public Sound deathSound; private bool despawnImpulse; private bool stunImpulse; private void Awake() { animator = ((Component)this).GetComponent<Animator>(); animator.keepAnimatorStateOnDisable = true; randomOffsets = new float[6]; for (int i = 0; i < randomOffsets.Length; i++) { randomOffsets[i] = Random.Range(0f, MathF.PI * 2f); } } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Invalid comparison between Unknown and I4 if (controller.currentState == EnemyEnderman.State.Damage) { particleSmoke.Play(); attack.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 8f, ((Component)controller.playerTarget).transform.position, 0.3f); GameDirector.instance.CameraImpact.ShakeDistance(10f, 3f, 8f, ((Component)controller.playerTarget).transform.position, 0.1f); } if (rattleImpulse) { if (enemy.Health.healthCurrent > 0) { int num = Random.Range(1, 3); animator.SetTrigger("Rattle" + num); } rattleImpulse = false; } if ((int)enemy.CurrentState == 11 && enemy.Health.healthCurrent > 0) { animator.SetBool("Despawn", true); if (despawnImpulse) { animator.SetTrigger("DespawnTrigger"); despawnImpulse = false; } } else { animator.SetBool("Despawn", false); despawnImpulse = true; } if (enemy.IsStunned() && (int)enemy.CurrentState != 11 && enemy.Health.healthCurrent > 0) { animator.SetBool("Stun", true); if (stunImpulse) { animator.SetTrigger("StunTrigger"); stunImpulse = false; } } else { animator.SetBool("Stun", false); stunImpulse = true; } } public void NoticeSet() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (enemy.Health.healthCurrent < 0) { return; } if (controller.playerTarget.isLocal) { float num = 30f; if (Vector3.Distance(((Component)controller.playerTarget).transform.position, ((Component)enemy).transform.position) > 5f) { num = 20f; } CameraGlitch.Instance.PlayShort(); CameraAim.Instance.AimTargetSet(controller.head.transform.position, 0.75f, 2f, ((Component)controller).gameObject, 90); CameraZoom.Instance.OverrideZoomSet(num, 0.75f, 3f, 1f, ((Component)controller).gameObject, 50); zoom.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } animator.SetTrigger("Scream"); } public void OnDeath() { animator.SetTrigger("Death"); } public void Scream() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) screamLocal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); screamGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } public void DeathEffect() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.5f); GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.1f); particleImpact.Play(); Quaternion rotation = Quaternion.LookRotation(-((Vector3)(ref enemy.Health.hurtDirection)).normalized); ((Component)particleDirectionalBits).transform.rotation = rotation; particleDirectionalBits.Play(); deathSound.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); enemy.EnemyParent.Despawn(); } public void SetDespawn() { enemy.EnemyParent.Despawn(); } public void DespawnSmoke() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) controller.SmokeEffect(controller.rb.position); teleportOut.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } } public class ItemMinecraftTNTExplosion : MonoBehaviour { [CompilerGenerated] private sealed class <ThiefLaunch>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ItemMinecraftTNTExplosion <>4__this; private Rigidbody <component>5__1; private Vector3 <forward>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ThiefLaunch>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <component>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; <component>5__1 = ((Component)<>4__this).GetComponent<Rigidbody>(); <forward>5__2 = ShopManager.instance.extractionPoint.forward; <forward>5__2 += Vector3.up * Random.Range(0.1f, 0.5f); <forward>5__2 += ShopManager.instance.extractionPoint.right * Random.Range(-0.5f, 0.5f); <component>5__1.AddForce(<forward>5__2 * (float)Random.Range(3, 7), (ForceMode)1); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ParticleScriptExplosion particleScriptExplosion; private void Start() { particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); if (SemiFunc.RunIsShop() && SemiFunc.IsMasterClientOrSingleplayer()) { ItemToggle component = ((Component)this).GetComponent<ItemToggle>(); if (ShopManager.instance.isThief) { ((MonoBehaviour)this).StartCoroutine(ThiefLaunch()); component.ToggleItem(true, -1); ((Component)this).GetComponent<ItemGrenade>().isSpawnedGrenade = true; } } } [IteratorStateMachine(typeof(<ThiefLaunch>d__2))] private IEnumerator ThiefLaunch() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ThiefLaunch>d__2(0) { <>4__this = this }; } public void Explosion() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) particleScriptExplosion.Spawn(((Component)this).transform.position, 1.2f, 200, 160, 4f, false, false, 1f); } } public class MinecraftTNT : MonoBehaviour { public Color blinkColor; public UnityEvent onDetonate; public GameObject itemMesh; private Material itemMaterial; private Color originalColor; private ItemToggle itemToggle; private ItemAttributes itemAttributes; internal bool isActive; private float grenadeTimer; public float tickTime = 3f; private PhotonView photonView; private PhysGrabObjectImpactDetector physGrabObjectImpactDetector; public Sound soundSplinter; public Sound soundTick; private float splinterAnimationProgress; public AnimationCurve splinterAnimationCurve; private Transform splinterTransform; private Material grenadeEmissionMaterial; private ItemEquippable itemEquippable; private Vector3 grenadeStartPosition; private Quaternion grenadeStartRotation; private PhysGrabObject physGrabObject; private Vector3 prevPosition; [FormerlySerializedAs("isThiefGrenade")] [HideInInspector] public bool isSpawnedGrenade; public GameObject throwLine; public Rigidbody rb; private float throwLineTimer; private TrailRenderer throwLineTrail; private void Start() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) itemEquippable = ((Component)this).GetComponent<ItemEquippable>(); itemToggle = ((Component)this).GetComponent<ItemToggle>(); itemAttributes = ((Component)this).GetComponent<ItemAttributes>(); photonView = ((Component)this).GetComponent<PhotonView>(); physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); splinterTransform = ((Component)this).transform.Find("Splinter"); GameObject gameObject = ((Component)((Component)this).transform.Find("Mesh")).gameObject; grenadeEmissionMaterial = gameObject.GetComponent<Renderer>().material; grenadeStartPosition = ((Component)this).transform.position; grenadeStartRotation = ((Component)this).transform.rotation; physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); prevPosition = (((Object)(object)rb != (Object)null) ? rb.position : Vector3.zero); throwLineTrail = throwLine.GetComponent<TrailRenderer>(); if ((Object)(object)itemMesh != (Object)null) { Renderer component = itemMesh.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { itemMaterial = component.material; originalColor = itemMaterial.color; } } } private void FixedUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (itemEquippable.isEquipped || itemEquippable.wasEquippedTimer > 0f) { prevPosition = rb.position; return; } _ = prevPosition; if (false) { prevPosition = rb.position; } Vector3 val = (rb.position - prevPosition) / Time.fixedDeltaTime; Vector3 val2 = rb.position - prevPosition; _ = ((Vector3)(ref val2)).normalized; prevPosition = rb.position; if (!physGrabObject.grabbed && ((Vector3)(ref val)).magnitude > 2f) { throwLineTimer = 0.2f; } if (throwLineTimer > 0f) { throwLineTrail.emitting = true; throwLineTimer -= Time.fixedDeltaTime; } else { throwLineTrail.emitting = false; } } private void Update() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) soundTick.PlayLoop(isActive, 2f, 2f, 1f); if (itemEquippable.isEquipped) { if (isActive) { isActive = false; grenadeTimer = 0f; splinterAnimationProgress = 0f; itemToggle.ToggleItem(false, -1); splinterTransform.localEulerAngles = new Vector3(0f, 0f, 0f); if ((Object)(object)itemMaterial != (Object)null) { itemMaterial.color = originalColor; } } return; } if (isActive) { float num = Mathf.PingPong(Time.time * 8f, 1f); Color val = blinkColor * Mathf.LinearToGammaSpace(num); if ((Object)(object)itemMaterial != (Object)null) { float num2 = Mathf.PingPong(Time.time * 8f, 1f); itemMaterial.color = Color.Lerp(originalColor, blinkColor, num2); } } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (itemToggle.toggleState && !isActive) { isActive = true; TickStart(); } if (isActive) { grenadeTimer += Time.deltaTime; if (grenadeTimer >= tickTime) { grenadeTimer = 0f; TickEnd(); } } } private void GrenadeReset() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) isActive = false; grenadeTimer = 0f; throwLine.SetActive(false); splinterAnimationProgress = 0f; itemToggle.ToggleItem(false, -1); splinterTransform.localEulerAngles = new Vector3(0f, 0f, 0f); grenadeEmissionMaterial.SetColor("_EmissionColor", Color.black); if (SemiFunc.IsMasterClientOrSingleplayer()) { Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } private void TickStart() { if (SemiFunc.IsMasterClient()) { photonView.RPC("TickStartRPC", (RpcTarget)0, Array.Empty<object>()); } else { TickStartRPC(); } } private void TickEnd() { if (SemiFunc.IsMasterClient()) { photonView.RPC("TickEndRPC", (RpcTarget)0, Array.Empty<object>()); } else { TickEndRPC(); } } [PunRPC] private void TickStartRPC() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) soundSplinter.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); isActive = true; } [PunRPC] private void TickEndRPC() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (itemEquippable.isEquipped) { return; } onDetonate.Invoke(); if (SemiFunc.IsMasterClientOrSingleplayer()) { if (!SemiFunc.RunIsShop() || isSpawnedGrenade) { if (!isSpawnedGrenade) { StatsManager.instance.ItemRemove(itemAttributes.instanceName); } physGrabObjectImpactDetector.DestroyObject(true); } else { physGrabObject.Teleport(grenadeStartPosition, grenadeStartRotation); } } if (SemiFunc.RunIsShop() && !isSpawnedGrenade) { GrenadeReset(); } } } namespace MinecraftEnderman { [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { MinecraftEnderman.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { MinecraftEnderman.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } [BepInPlugin("GreatColtini.MinecraftEnderman", "MinecraftEnderman", "1.0")] public class MinecraftEnderman : BaseUnityPlugin { internal static MinecraftEnderman Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }