You are viewing a potentially older version of this package. View all versions.
4902-Minecraft_Scraps-1.2.0 icon

Minecraft Scraps

Adds 15 client sided Minecraft scraps, percentage based retexture of magnifying glass

By 4902
Date uploaded 2 months ago
Version 1.2.0
Download link 4902-Minecraft_Scraps-1.2.0.zip
Downloads 13299
Dependency string 4902-Minecraft_Scraps-1.2.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

Randomly replaces a certain percentage of Magnifying glass items with a random Minecraft block/item/mob, with different item names, sound effects, and boxcollider scales

Percentage to replace magnifying glass is 80%, percentage for item types is from a weighted random selection, both are changeable by config

List of item types

Diamond Block
Spider
Zombie
Villager
Creeper
Pumpkin
Anvil
Steve
TNT
Diamond
Diamond Sword
Diamond Pickaxe
Apple
Torch
Chest

Item types are synced between players if config values are the same

cs in zip. assetbundle from https://thunderstore.io/c/lethal-company/p/rainbow137/MinecraftScraps/

CHANGELOG

1.2.0
-fixed error with getting lobbyid
-replaced system.random with custom random
-added section text to config

1.1.0
-added chest
-added source code to the changelog
-updated readme/description

1.0.0
Source code

1.1.0

using UInt32 = System.UInt32; using UInt64 = System.UInt64; using System.IO; using System.Reflection; using BepInEx; using BepInEx.Logging; using BepInEx.Configuration; using HarmonyLib; using GameNetcodeStuff; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.InputSystem; using Unity.Netcode; namespace mcs { [BepInPlugin("4902.Minecraft_Scraps", "Minecraft_Scraps", "1.0.0")] public class yon : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("4902.Minecraft_Scraps"); public static ManualLogSource mls; public static ConfigEntry<int> base_percentage; //80 public static ConfigEntry<int> cfg_diamond_block; //. . . 20 public static ConfigEntry<int> cfg_spider; //35 public static ConfigEntry<int> cfg_zombie; //35 public static ConfigEntry<int> cfg_villager; //. 30 public static ConfigEntry<int> cfg_creeper; //35 public static ConfigEntry<int> cfg_pumpkin; //35 public static ConfigEntry<int> cfg_anvil; //. . . 20 public static ConfigEntry<int> cfg_steve; //. . . . 01 public static ConfigEntry<int> cfg_tnt; //. . 25 public static ConfigEntry<int> cfg_diamond; //. 30 public static ConfigEntry<int> cfg_diamond_sword; //. . 25 public static ConfigEntry<int> cfg_diamond_pickaxe; //. . 25 public static ConfigEntry<int> cfg_apple; //35 public static ConfigEntry<int> cfg_torch; //35 public static ConfigEntry<int> cfg_chest; //35 private void Awake() { base_percentage = Config.Bind("#", "base_percent", 80, "percentage that a minecraft scrap will replace magnifying glass\ninput = percentage, 50 is 50% etc"); cfg_diamond_block = Config.Bind("Items", "diamond_block", 20, "item types with higher numbers relative to other item types will be more frequent\n(if there are (10 red, 20 green, 30 blue) blocks, and if one block was selected randomly, the color with more blocks would be more likely to be selected, and a color with no blocks couldn't be selected)\n(color is the item type, number of blocks is the config number)"); cfg_spider = Config.Bind("Items", "spider", 35, ""); cfg_zombie = Config.Bind("Items", "zombie", 35, ""); cfg_villager = Config.Bind("Items", "villager", 30, ""); cfg_creeper = Config.Bind("Items", "creeper", 35, ""); cfg_pumpkin = Config.Bind("Items", "pumpkin", 35, ""); cfg_anvil = Config.Bind("Items", "anvil", 20, ""); cfg_steve = Config.Bind("Items", "steve", 1, ""); cfg_tnt = Config.Bind("Items", "tnt", 25, ""); cfg_diamond = Config.Bind("Items", "diamond", 30, ""); cfg_diamond_sword = Config.Bind("Items", "diamond_sword", 25, ""); cfg_diamond_pickaxe = Config.Bind("Items", "diamond_pickaxe", 25, ""); cfg_apple = Config.Bind("Items", "apple", 35, ""); cfg_torch = Config.Bind("Items", "torch", 35, ""); cfg_chest = Config.Bind("Items", "chest", 35, ""); mls = BepInEx.Logging.Logger.CreateLogSource("Minecraft Scraps"); mls.LogInfo("1.12.2"); harmony.PatchAll(typeof(go)); harmony.PatchAll(typeof(pcb)); harmony.PatchAll(typeof(hm)); harmony.PatchAll(typeof(sor)); harmony.PatchAll(typeof(gnm)); } } [HarmonyPatch(typeof(GrabbableObject))] internal class go { public static int items = 1 + 15; //1/21 public static string[] item = new string[items]; public static Mesh[] fish = new Mesh[items]; public static Material[][] cats = new Material[items][]; public static AudioClip[] take = new AudioClip[items]; public static AudioClip[] give = new AudioClip[items]; private static bool[] dots = new bool[items]; private static int[] weights = new int[items]; public static Transform chest; [HarmonyPatch("Start")] private static void Postfix(GrabbableObject __instance, ref MeshRenderer ___mainObjectRenderer) { if (((Object)__instance.itemProperties).name == "MagnifyingGlass") { MeshFilter component = ___mainObjectRenderer.GetComponent<MeshFilter>(); if (item[0] == null) { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "4902-minecraft_scraps").Replace("\\", "/"); yon.mls.LogMessage("Searching this filepath:" + text); AssetBundle asset = AssetBundle.LoadFromFileAsync(text).assetBundle; //glass item[0] = __instance.itemProperties.itemName; fish[0] = component.mesh; cats[0] = ___mainObjectRenderer.materials; take[0] = __instance.itemProperties.grabSFX; give[0] = __instance.itemProperties.dropSFX; //diamond_block item[1] = "Diamond block"; fish[1] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("minecraft diamond block.fbx"))); cats[1] = new Material[] {asset.LoadAsset<Material>("diamond-minecraft-2.mat")}; take[1] = asset.LoadAsset<AudioClip>("block place1.ogg"); give[1] = asset.LoadAsset<AudioClip>("block place2.ogg"); //spider item[2] = "Spider"; fish[2] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("Spider.fbx"))); cats[2] = new Material[] {asset.LoadAsset<Material>("spider.mat")}; take[2] = asset.LoadAsset<AudioClip>("spider1.ogg"); give[2] = asset.LoadAsset<AudioClip>("spider2.ogg"); //zombie item[3] = "Zombie"; fish[3] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("Zombie.fbx"))); cats[3] = new Material[] {asset.LoadAsset<Material>("zombie.mat")}; take[3] = asset.LoadAsset<AudioClip>("zombie1.ogg"); give[3] = asset.LoadAsset<AudioClip>("zombie2.ogg"); //villager item[4] = "Villager"; fish[4] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("Villager.fbx"))); cats[4] = new Material[] {asset.LoadAsset<Material>("villager_farmer.mat")}; take[4] = asset.LoadAsset<AudioClip>("villager1.ogg"); give[4] = asset.LoadAsset<AudioClip>("villager2.ogg"); //creeper item[5] = "Creeper"; fish[5] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("Creeper.fbx"))); cats[5] = new Material[] {asset.LoadAsset<Material>("creeper.mat")}; take[5] = asset.LoadAsset<AudioClip>("creeper.ogg"); give[5] = take[5]; //pumpkin item[6] = "Pumpkin"; fish[6] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("pumpkin.obj").GetComponentInChildren<MeshFilter>().mesh)); cats[6] = new Material[] {asset.LoadAsset<Material>("pumpkin.mat")}; take[6] = take[1]; give[6] = give[1]; //anvil item[7] = "Anvil"; fish[7] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("mineways2skfb.obj").GetComponentInChildren<MeshFilter>().mesh)); cats[7] = new Material[] {asset.LoadAsset<Material>("mineways2skfb-rgba.mat")}; take[7] = asset.LoadAsset<AudioClip>("anvil1.ogg"); give[7] = asset.LoadAsset<AudioClip>("anvil2.ogg"); //steve item[8] = "Steve"; fish[8] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<Mesh>("steve.fbx"))); cats[8] = new Material[] {asset.LoadAsset<Material>("steve.mat")}; take[8] = take[0]; give[8] = give[0]; //tnt item[9] = "TNT"; fish[9] = Object.Instantiate<Mesh>(asset.LoadAsset<Mesh>("mesh_id27_0_0.asset")); cats[9] = new Material[] {asset.LoadAsset<Material>("60_0.mat")}; take[9] = asset.LoadAsset<AudioClip>("tnt1.ogg"); give[9] = asset.LoadAsset<AudioClip>("tnt2.ogg"); //diamond item[10] = "Diamond"; fish[10] = Object.Instantiate<Mesh>(asset.LoadAsset<Mesh>("cube_0_0_0.asset")); cats[10] = new Material[] {asset.LoadAsset<Material>("material_0.mat")}; take[10] = take[1]; give[10] = give[1]; //diamond_sword item[11] = "Diamond sword"; fish[11] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("diamondsword.obj").GetComponentInChildren<MeshFilter>().mesh)); cats[11] = new Material[] {asset.LoadAsset<Material>("diffuse1.mat")}; take[11] = take[1]; give[11] = give[1]; //diamond_pickaxe item[12] = "Diamond pickaxe"; fish[12] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("diamond-pickaxe.obj").GetComponentInChildren<MeshFilter>().mesh)); cats[12] = new Material[] {asset.LoadAsset<Material>("diffuse2.mat")}; take[12] = take[1]; give[12] = give[1]; //apple item[13] = "Apple"; fish[13] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("apple.blend").GetComponentInChildren<MeshFilter>().mesh)); cats[13] = new Material[] {asset.LoadAsset<Material>("apple.mat")}; take[13] = asset.LoadAsset<AudioClip>("eat1.ogg"); give[13] = take[13]; //torch item[14] = "Torch"; fish[14] = Object.Instantiate<Mesh>(fish1.fish2(asset.LoadAsset<GameObject>("torch.obj").GetComponentInChildren<MeshFilter>().mesh)); cats[14] = new Material[] {asset.LoadAsset<Material>("torch_diffuse.mat")}; take[14] = take[1]; give[14] = give[1]; //chest item[15] = "Chest"; chest = asset.LoadAsset<GameObject>("chest.fbx").transform; fish[15] = Object.Instantiate<Mesh>(fish1.fish2(chest.GetComponentsInChildren<Transform>()[1].GetComponent<SkinnedMeshRenderer>().sharedMesh)); cats[15] = new Material[] {asset.LoadAsset<Material>("diffuse.mat")}; take[15] = asset.LoadAsset<AudioClip>("chest1.ogg"); give[15] = asset.LoadAsset<AudioClip>("chest2.ogg"); //percentage weights weights[0] = 0; //total weights[1] = yon.cfg_diamond_block.Value; weights[2] = yon.cfg_spider.Value; weights[3] = yon.cfg_zombie.Value; weights[4] = yon.cfg_villager.Value; weights[5] = yon.cfg_creeper.Value; weights[6] = yon.cfg_pumpkin.Value; weights[7] = yon.cfg_anvil.Value; weights[8] = yon.cfg_steve.Value; weights[9] = yon.cfg_tnt.Value; weights[10] = yon.cfg_diamond.Value; weights[11] = yon.cfg_diamond_sword.Value; weights[12] = yon.cfg_diamond_pickaxe.Value; weights[13] = yon.cfg_apple.Value; weights[14] = yon.cfg_torch.Value; weights[15] = yon.cfg_chest.Value; for (int n = 1; n < weights.Length; n = n + 1) { if (weights[n] < 0) weights[n] = 0; weights[0] = weights[0] + weights[n]; } } if (item[0] != null) { Shion cr = (GameNetworkManager.Instance.disableSteam == false && sor.lobbyid != 0 && __instance.GetComponent<NetworkObject>() != null ? new Shion((int)((sor.lobbyid + __instance.GetComponent<NetworkObject>().NetworkObjectId) % 1000000000)) : new Shion()); //System.Random sr = (GameNetworkManager.Instance.disableSteam == false ? new System.Random((int)((GameNetworkManager.Instance.currentLobby.Value.Id + __instance.GetComponent<NetworkObject>().NetworkObjectId) % 1000000000)) : new System.Random()); if (cr.next32mm(0, 100) < yon.base_percentage.Value) { //blocks int random_number = cr.next32mm(1, weights[0] + 1); int index = 0, added = 0; for (index = 1; index < weights.Length; index = index + 1) { added = added + weights[index]; if (added >= random_number) { break; } } if (index == 1) { //diamond_block component.mesh = fish[1]; if (dots[1] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { //x=up-/down+, y=left-/right+, z=foward+/backward-, horizontal glass furthest vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 90f; float vx = vertices[n].x; float vz = vertices[n].z; float nx = normals[n].x; float nz = normals[n].z; vertices[n].x = -vz; vertices[n].z = vx; normals[n].x = -nz; normals[n].z = nx; vertices[n].x = vertices[n].x - 0.5f; //u vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[1] = mesh; dots[1] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.5f, 0f, 0f); //(0, 0, 0.97) box.size = new Vector3(1.9f, 1.9f, 1.9f); //(0.44, 1.97, 3.79) ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.5f, 0f, 0f); //(0, 0, 1.07) __instance.itemProperties.itemName = item[1]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[1]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[1]; ___mainObjectRenderer.materials = cats[1]; __instance.itemProperties.grabSFX = take[1]; __instance.itemProperties.dropSFX = give[1]; } else if (index == 2) { //spider component.mesh = fish[2]; if (dots[2] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3f; float vx = vertices[n].x; //90cc float vz = vertices[n].z; float nx = normals[n].x; float nz = normals[n].z; vertices[n].x = -vz; vertices[n].z = vx; normals[n].x = -nz; normals[n].z = nx; float vyy = vertices[n].y; //270cw float vzz = vertices[n].z; float nyy = normals[n].y; float nzz = normals[n].z; vertices[n].y = vzz; vertices[n].z = -vyy; normals[n].y = nzz; normals[n].z = -nyy; vertices[n].y = vertices[n].y - 0.24f; //l vertices[n].x = vertices[n].x + 0.1f; //d vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[2] = mesh; dots[2] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(0.05f, 0f, 0f); box.size = new Vector3(0.65f, 1.9f, 1.9f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(0.05f, 0f, 0f); __instance.itemProperties.itemName = item[2]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[2]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[2]; ___mainObjectRenderer.materials = cats[2]; __instance.itemProperties.grabSFX = take[2]; __instance.itemProperties.dropSFX = give[2]; } else if (index == 3) { //zombie component.mesh = fish[3]; if (dots[3] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3f; float vx = vertices[n].x; float vy = vertices[n].y; float nx = normals[n].x; float ny = normals[n].y; vertices[n].x = vy; vertices[n].y = -vx; normals[n].x = ny; normals[n].y = -nx; vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[3] = mesh; dots[3] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(0.05f, 0f, 0f); box.size = new Vector3(0.65f, 1.2f, 2.4f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(0.05f, 0f, 0f); __instance.itemProperties.itemName = item[3]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[3]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[3]; ___mainObjectRenderer.materials = cats[3]; __instance.itemProperties.grabSFX = take[3]; __instance.itemProperties.dropSFX = give[3]; } else if (index == 4) { //villager component.mesh = fish[4]; if (dots[4] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3f; float vx = vertices[n].x; float vy = vertices[n].y; float nx = vertices[n].x; float ny = vertices[n].y; vertices[n].x = vy; vertices[n].y = -vx; normals[n].x = ny; normals[n].y = -nx; vertices[n].z = vertices[n].z + 0.4f; //f vertices[n].y = vertices[n].y + 0.05f; //r vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[4] = mesh; dots[4] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(0.05f, 0f, 0.1f); box.size = new Vector3(0.65f, 1.2f, 2.6f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(0.05f, 0f, 0f); __instance.itemProperties.itemName = item[4]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[4]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[4]; ___mainObjectRenderer.materials = cats[4]; __instance.itemProperties.grabSFX = take[4]; __instance.itemProperties.dropSFX = give[4]; } else if (index == 5) { //creeper component.mesh = fish[5]; if (dots[5] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3f; float vx = vertices[n].x; float vy = vertices[n].y; float nx = normals[n].x; float ny = normals[n].y; vertices[n].x = vy; vertices[n].y = -vx; normals[n].x = ny; normals[n].y = -nx; vertices[n].z = vertices[n].z + 0.25f; //f vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[5] = mesh; dots[5] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(0.05f, 0f, 0.25f); box.size = new Vector3(0.65f, 0.6f, 1.9f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(0.05f, 0f, 0.25f); __instance.itemProperties.itemName = item[5]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[5]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[5]; ___mainObjectRenderer.materials = cats[5]; __instance.itemProperties.grabSFX = take[5]; __instance.itemProperties.dropSFX = give[5]; } else if (index == 6) { //pumpkin component.mesh = fish[6]; if (dots[6] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 1.11f; float vx = vertices[n].x; float vz = vertices[n].z; float nx = normals[n].x; float nz = normals[n].z; vertices[n].x = -vz; vertices[n].z = vx; normals[n].x = -nz; normals[n].z = nx; float vxx = vertices[n].x; float vyy = vertices[n].y; float nxx = normals[n].x; float nyy = normals[n].y; vertices[n].x = -vyy; vertices[n].y = vxx; normals[n].x = -nyy; normals[n].y = nxx; float vyyy = vertices[n].y; float vzzz = vertices[n].z; float nyyy = normals[n].y; float nzzz = normals[n].z; vertices[n].y = vzzz; vertices[n].z = -vyyy; normals[n].y = nzzz; normals[n].z = -nyyy; vertices[n].y = vertices[n].y - 0.8f; //l vertices[n].x = vertices[n].x - 0.5f; //u vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[6] = mesh; dots[6] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.5f, 0f, 0f); box.size = new Vector3(1.9f, 1.9f, 1.9f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.5f, 0f, 0f); __instance.itemProperties.itemName = item[6]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[6]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[6]; ___mainObjectRenderer.materials = cats[6]; __instance.itemProperties.grabSFX = take[6]; __instance.itemProperties.dropSFX = give[6]; } else if (index == 7) { //anvil component.mesh = fish[7]; if (dots[7] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3.5f; float vx = vertices[n].x; float vz = vertices[n].z; float nx = normals[n].x; float nz = normals[n].z; vertices[n].x = -vz; vertices[n].z = vx; normals[n].x = -nz; normals[n].z = nx; float vxx = vertices[n].x; float vyy = vertices[n].y; float nxx = normals[n].x; float nyy = normals[n].y; vertices[n].x = -vyy; vertices[n].y = vxx; normals[n].x = -nyy; normals[n].y = nxx; float vyyy = vertices[n].y; float vzzz = vertices[n].z; float nyyy = normals[n].y; float nzzz = normals[n].z; vertices[n].y = vzzz; vertices[n].z = -vyyy; normals[n].y = nzzz; normals[n].z = -nyyy; vertices[n].y = vertices[n].y - 0.25f; //l vertices[n].x = vertices[n].x - 0.25f; //u vertices[n].z = vertices[n].z - 0.25f; //b vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[7] = mesh; dots[7] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.5f, 0f, 0f); box.size = new Vector3(1.9f, 1.9f, 1.425f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.5f, 0f, 0f); __instance.itemProperties.itemName = item[7]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[7]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[7]; ___mainObjectRenderer.materials = cats[7]; __instance.itemProperties.grabSFX = take[7]; __instance.itemProperties.dropSFX = give[7]; } else if (index == 8) { //steve component.mesh = fish[8]; if (dots[8] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 3f; float vx = vertices[n].x; float vy = vertices[n].y; float nx = normals[n].x; float ny = normals[n].y; vertices[n].x = vy; vertices[n].y = -vx; normals[n].x = ny; normals[n].y = -nx; vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[8] = mesh; dots[8] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(0.05f, 0f, 0f); box.size = new Vector3(0.65f, 1.2f, 2.4f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(0.05f, 0f, 0f); __instance.itemProperties.itemName = item[8]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[8]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[8]; ___mainObjectRenderer.materials = cats[8]; __instance.itemProperties.grabSFX = take[8]; __instance.itemProperties.dropSFX = give[8]; } else if (index == 9) { //tnt component.mesh = fish[9]; if (dots[9] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = (vertices[n] * 0.005f) * 1.044f; float vx = vertices[n].x; float vy = vertices[n].y; float nx = normals[n].x; float ny = normals[n].y; vertices[n].x = -vy; vertices[n].y = vx; normals[n].x = -ny; normals[n].y = nx; vertices[n].x = vertices[n].x - 0.5f; //u vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[9] = mesh; dots[9] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.5f, 0f, 0f); box.size = new Vector3(1.9f, 1.9f, 1.9f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.5f, 0f, 0f); __instance.itemProperties.itemName = item[9]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[9]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[9]; ___mainObjectRenderer.materials = cats[9]; __instance.itemProperties.grabSFX = take[9]; __instance.itemProperties.dropSFX = give[9]; } else if (index == 10) { //diamond component.mesh = fish[10]; if (dots[10] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; int[] triangles = mesh.triangles; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 0.75f; float vy = vertices[n].y; float vz = vertices[n].z; float ny = normals[n].y; float nz = normals[n].z; vertices[n].y = -vy; vertices[n].z = -vz; normals[n].y = -ny; normals[n].z = -nz; float vxx = vertices[n].x; float vyy = vertices[n].y; float nxx = normals[n].x; float nyy = normals[n].y; vertices[n].x = -vxx; vertices[n].y = -vyy; normals[n].x = -nxx; normals[n].y = -nyy; vertices[n].x = vertices[n].x * 0.08f; vertices[n].x = vertices[n].x - 0.1f; //u vertices[n].z = vertices[n].z + 0.3f; //f vertices[n].y = vertices[n].y + 0.1f; //r vertices[n] = vertices[n] + center; } for (int n = 0; n < triangles.Length; n = n + 3) { if (vertices[triangles[n]].x > -0.1f && vertices[triangles[n + 1]].x > -0.1f && vertices[triangles[n + 2]].x > -0.1f) { int temp = triangles[n]; triangles[n] = triangles[n + 2]; triangles[n + 2] = temp; } } mesh.vertices = vertices; mesh.normals = normals; mesh.triangles = triangles; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[10] = mesh; dots[10] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.1f, 0f, 0.3f); box.size = new Vector3(0.1f, 1.4f, 1.5f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.1f, 0f, 0.3f); __instance.itemProperties.itemName = item[10]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[10]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[10]; ___mainObjectRenderer.materials = cats[10]; __instance.itemProperties.grabSFX = take[10]; __instance.itemProperties.dropSFX = give[10]; } else if (index == 11) { //diamond_sword component.mesh = fish[11]; if (dots[11] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 0.06f; float vy = vertices[n].y; float vz = vertices[n].z; float ny = normals[n].y; float nz = normals[n].z; vertices[n].y = -vy; vertices[n].z = -vz; normals[n].y = -ny; normals[n].z = -nz; float vxx = vertices[n].x; float vyy = vertices[n].y; float nxx = normals[n].x; float nyy = normals[n].y; vertices[n].x = vyy; vertices[n].y = -vxx; normals[n].x = nyy; normals[n].y = -nxx; float vyyy = vertices[n].y; float vzzz = vertices[n].z; float nyyy = normals[n].y; float nzzz = normals[n].z; vertices[n].y = (float)(vyyy * System.Math.Cos(5.497787) - vzzz * System.Math.Sin(5.497787)); vertices[n].z = (float)(vyyy * System.Math.Sin(5.497787) + vzzz * System.Math.Cos(5.497787)); normals[n].y = (float)(nyyy * System.Math.Cos(5.497787) - nzzz * System.Math.Sin(5.497787)); normals[n].z = (float)(nyyy * System.Math.Sin(5.497787) + nzzz * System.Math.Cos(5.497787)); vertices[n].x = vertices[n].x - 0.1f; //u vertices[n].z = vertices[n].z + 1f; //f vertices[n].y = vertices[n].y + 0.01f; //r vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[11] = mesh; dots[11] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.1f, 0f, 1f); box.size = new Vector3(0.1f, 1.3f, 2.7f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.1f, 0f, 1f); __instance.itemProperties.itemName = item[11]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[11]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[11]; ___mainObjectRenderer.materials = cats[11]; __instance.itemProperties.grabSFX = take[11]; __instance.itemProperties.dropSFX = give[11]; } else if (index == 12) { //diamond_pickaxe component.mesh = fish[12]; if (dots[12] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 0.06f; float vy = vertices[n].y; float vz = vertices[n].z; float ny = normals[n].y; float nz = normals[n].z; vertices[n].y = -vy; vertices[n].z = -vz; normals[n].y = -ny; normals[n].z = -nz; float vxx = vertices[n].x; float vyy = vertices[n].y; float nxx = normals[n].x; float nyy = normals[n].y; vertices[n].x = vyy; vertices[n].y = -vxx; normals[n].x = nyy; normals[n].y = -nxx; float vyyy = vertices[n].y; float vzzz = vertices[n].z; float nyyy = normals[n].y; float nzzz = normals[n].z; vertices[n].y = (float)(vyyy * System.Math.Cos(0.7853982) - vzzz * System.Math.Sin(0.7853982)); vertices[n].z = (float)(vyyy * System.Math.Sin(0.7853982) + vzzz * System.Math.Cos(0.7853982)); normals[n].y = (float)(nyyy * System.Math.Cos(0.7853982) - nzzz * System.Math.Sin(0.7853982)); normals[n].z = (float)(nyyy * System.Math.Sin(0.7853982) + nzzz * System.Math.Cos(0.7853982)); vertices[n].x = vertices[n].x - 0.1f; //u vertices[n].z = vertices[n].z + 0.8f; //f vertices[n].y = vertices[n].y + 0.01f; //r vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[12] = mesh; dots[12] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.1f, 0f, 0.7f); box.size = new Vector3(0.1f, 1.5f, 2f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.1f, 0f, 0.7f); __instance.itemProperties.itemName = item[12]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[12]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[12]; ___mainObjectRenderer.materials = cats[12]; __instance.itemProperties.grabSFX = take[12]; __instance.itemProperties.dropSFX = give[12]; } else if (index == 13) { //apple component.mesh = fish[13]; if (dots[13] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; //Vector3[] normals = mesh.normals; int[] triangles = mesh.triangles; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 0.93f; vertices[n].x = vertices[n].x * 0.08f; vertices[n].x = vertices[n].x - 0.1f; //u vertices[n].z = vertices[n].z + 0.5f; //f vertices[n].y = vertices[n].y + 0.2f; //r vertices[n] = vertices[n] + center; } for (int n = 0; n < triangles.Length; n = n + 3) { if (vertices[triangles[n]].x > -0.1f && vertices[triangles[n + 1]].x > -0.1f && vertices[triangles[n + 2]].x > -0.1f) { int temp = triangles[n]; triangles[n] = triangles[n + 2]; triangles[n + 2] = temp; } } mesh.vertices = vertices; //mesh.normals = normals; mesh.triangles = triangles; mesh.RecalculateBounds(); //mesh.RecalculateNormals(); fish[13] = mesh; dots[13] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.1f, -0.05f, 0.4f); box.size = new Vector3(0.1f, 1.4f, 1.65f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.1f, -0.05f, 0.4f); __instance.itemProperties.itemName = item[13]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[13]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[13]; ___mainObjectRenderer.materials = cats[13]; __instance.itemProperties.grabSFX = take[13]; __instance.itemProperties.dropSFX = give[13]; } else if (index == 14) { //torch component.mesh = fish[14]; if (dots[14] == false) { Mesh mesh = component.mesh; Vector3[] vertices = mesh.vertices; Vector3[] normals = mesh.normals; Bounds bounds = mesh.bounds; Vector3 center = bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 1f; float vy = vertices[n].y; float vz = vertices[n].z; float ny = normals[n].y; float nz = normals[n].z; vertices[n].y = -vz; vertices[n].z = vy; normals[n].y = -nz; normals[n].z = ny; vertices[n].x = vertices[n].x - 0.1f; //u vertices[n].z = vertices[n].z + 0.3f; //f vertices[n] = vertices[n] + center; } mesh.vertices = vertices; mesh.normals = normals; mesh.RecalculateBounds(); mesh.RecalculateNormals(); fish[14] = mesh; dots[14] = true; } BoxCollider box = ___mainObjectRenderer.GetComponent<BoxCollider>(); box.center = new Vector3(-0.1f, 0f, 0.3f); box.size = new Vector3(0.25f, 0.25f, 1.25f); ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.1f, 0f, 0.3f); __instance.itemProperties.itemName = item[14]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[14]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[14]; ___mainObjectRenderer.materials = cats[14]; __instance.itemProperties.grabSFX = take[14]; __instance.itemProperties.dropSFX = give[14]; } else if (index == 15) { //chest if (dots[15] == false) { Vector3[] vertices = fish[15].vertices; Vector3[] normals = fish[15].normals; Vector3 center = fish[15].bounds.center; for (int n = 0; n < vertices.Length; n = n + 1) { vertices[n] = vertices[n] - center; vertices[n] = vertices[n] * 87.5f; float vy = vertices[n].y; float vz = vertices[n].z; float ny = normals[n].y; float nz = normals[n].z; vertices[n].y = -vy; vertices[n].z = -vz; normals[n].y = -ny; normals[n].z = -nz; float vxx = vertices[n].x; float vzz = vertices[n].z; float nxx = normals[n].x; float nzz = normals[n].z; vertices[n].x = vzz; vertices[n].z = -vxx; normals[n].x = nzz; normals[n].z = -nxx; vertices[n].x = vertices[n].x - 0.4f; //u vertices[n] = vertices[n] + center; } fish[15].vertices = vertices; fish[15].normals = normals; fish[15].RecalculateBounds(); fish[15].RecalculateNormals(); dots[15] = true; } Object.Instantiate<Transform>(chest).SetParent(__instance.transform); Transform tr1 = __instance.GetComponentsInChildren<Transform>()[4]; Transform tr2 = __instance.GetComponentsInChildren<Transform>()[2]; tr1.localPosition = new Vector3(0.4f, 0f, 0f); tr1.localRotation = new Quaternion(0.7071068f, 0f, -0.7071068f, 0f); tr1.localScale = new Vector3(90f, 90f, 90f); tr2.localPosition = new Vector3(0f, 0f, 0f); tr2.localRotation = new Quaternion(0f, 0f, 0f, 1f); tr2.localScale = new Vector3(1f, 1f, 1f); __instance.GetComponentsInChildren<Transform>()[3].GetComponent<SkinnedMeshRenderer>().materials = cats[15]; __instance.GetComponent<MeshFilter>().mesh = null; BoxCollider box = __instance.GetComponent<BoxCollider>(); box.center = new Vector3(-0.4f, -0.01f, -0.01f); box.size = new Vector3(1.6f, 1.6f, 1.6f); __instance.GetComponentInChildren<ScanNodeProperties>().transform.localPosition = new Vector3(-0.4f, -0.01f, -0.01f); __instance.itemProperties.itemName = item[15]; __instance.GetComponentInChildren<ScanNodeProperties>().headerText = item[15]; __instance.itemProperties.grabSFX = take[15]; __instance.itemProperties.dropSFX = give[15]; } else { yon.mls.LogInfo("?"); } } else { //glass component.mesh = fish[0]; __instance.itemProperties.itemName = item[0]; ___mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText = item[0]; __instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[0]; ___mainObjectRenderer.materials = cats[0]; __instance.itemProperties.grabSFX = take[0]; __instance.itemProperties.dropSFX = give[0]; } } } } [HarmonyPatch("PlayDropSFX")] private static void Prefix(ref GrabbableObject __instance) { if (item[0] != null && __instance != null && __instance.mainObjectRenderer != null && __instance.mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>() != null && ((Object)__instance.itemProperties).name == "MagnifyingGlass") { for (int n = 0; n < item.Length; n = n + 1) { if (__instance.mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText == item[n]) { __instance.itemProperties.dropSFX = give[n]; break; } } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class pcb { [HarmonyPatch("BeginGrabObject")] private static void Postfix(ref GrabbableObject ___currentlyGrabbingObject) { if (go.item[0] != null && ___currentlyGrabbingObject != null && ___currentlyGrabbingObject.mainObjectRenderer != null && ___currentlyGrabbingObject.mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>() != null && ((Object)___currentlyGrabbingObject.itemProperties).name == "MagnifyingGlass") { for (int n = 0; n < go.item.Length; n = n + 1) { if (___currentlyGrabbingObject.mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText == go.item[n]) { ___currentlyGrabbingObject.itemProperties.grabSFX = go.take[n]; ___currentlyGrabbingObject.itemProperties.itemName = ___currentlyGrabbingObject.mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText; break; } } } } [HarmonyPatch("ScrollMouse_performed")] private static void Prefix(ref InputAction.CallbackContext context, ref int ___currentItemSlot, ref GrabbableObject[] ___ItemSlots) { if (go.item[0] != null) { bool foward = false; if (context.ReadValue<float>() > 0f) foward = true; int next = ___currentItemSlot - 1; if (foward == true) next = (___currentItemSlot + 1) % ___ItemSlots.Length; else if (___currentItemSlot == 0) next = ___ItemSlots.Length - 1; if (next >= 0 && next < ___ItemSlots.Length && ___ItemSlots[next] != null && ___ItemSlots[next].mainObjectRenderer != null && ___ItemSlots[next].mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>() != null && ((Object)___ItemSlots[next].itemProperties).name == "MagnifyingGlass") { for (int n = 0; n < go.item.Length; n = n + 1) { if (___ItemSlots[next].mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText == go.item[n]) { ___ItemSlots[next].itemProperties.grabSFX = go.take[n]; ___ItemSlots[next].itemProperties.itemName = ___ItemSlots[next].mainObjectRenderer.GetComponentInChildren<ScanNodeProperties>().headerText; break; } } } } } } [HarmonyPatch(typeof(HUDManager))] internal class hm { [HarmonyPatch("DisplayNewScrapFound"), HarmonyPrefix] private static void Prefix1(ref System.Collections.Generic.List<GrabbableObject> ___itemsToBeDisplayed) { if (go.item[0] != null && ___itemsToBeDisplayed[0] != null && ((Object)___itemsToBeDisplayed[0].itemProperties).name == "MagnifyingGlass" && ___itemsToBeDisplayed[0].GetComponentInChildren<ScanNodeProperties>() != null) { ___itemsToBeDisplayed[0].itemProperties.itemName = ___itemsToBeDisplayed[0].itemProperties.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = ___itemsToBeDisplayed[0].GetComponentInChildren<ScanNodeProperties>().headerText; } } [HarmonyPatch("displayScrapTimer"), HarmonyPrefix] private static void Prefix2(ref GameObject displayingObject) { if (go.item[0] != null && displayingObject.name == "MagnifyingGlass(Clone)" && displayingObject.GetComponentInChildren<ScanNodeProperties>() != null) { for (int n = 0; n < go.item.Length; n = n + 1) { if (displayingObject.GetComponentInChildren<ScanNodeProperties>().headerText == go.item[n]) { displayingObject.GetComponent<MeshFilter>().mesh = go.fish[n]; break; } } } } } [HarmonyPatch(typeof(StartOfRound))] internal class sor { public static uint lobbyid = 0; [HarmonyPatch("Start")] private static void Postfix() { if (GameNetworkManager.Instance.disableSteam == false) { if (GameNetworkManager.Instance.currentLobby.HasValue == true) { lobbyid = (uint)GameNetworkManager.Instance.currentLobby.Value.Id; yon.mls.LogInfo(lobbyid); } else { yon.mls.LogError("current lobby id is null"); } } } } [HarmonyPatch(typeof(GameNetworkManager))] internal class gnm { [HarmonyPatch("Disconnect")] private static void Postfix() { sor.lobbyid = 0; } } internal class fish1 { public static Mesh fish2(Mesh nonReadableMesh) { Mesh meshCopy = new Mesh(); meshCopy.indexFormat = nonReadableMesh.indexFormat; // Handle vertices GraphicsBuffer verticesBuffer = nonReadableMesh.GetVertexBuffer(0); int totalSize = verticesBuffer.stride * verticesBuffer.count; byte[] data = new byte[totalSize]; verticesBuffer.GetData(data); meshCopy.SetVertexBufferParams(nonReadableMesh.vertexCount, nonReadableMesh.GetVertexAttributes()); meshCopy.SetVertexBufferData(data, 0, 0, totalSize); verticesBuffer.Release(); // Handle triangles meshCopy.subMeshCount = nonReadableMesh.subMeshCount; GraphicsBuffer indexesBuffer = nonReadableMesh.GetIndexBuffer(); int tot = indexesBuffer.stride * indexesBuffer.count; byte[] indexesData = new byte[tot]; indexesBuffer.GetData(indexesData); meshCopy.SetIndexBufferParams(indexesBuffer.count, nonReadableMesh.indexFormat); meshCopy.SetIndexBufferData(indexesData, 0, 0, tot); indexesBuffer.Release(); // Restore submesh structure uint currentIndexOffset = 0; for (int i = 0; i < meshCopy.subMeshCount; i++) { uint subMeshIndexCount = nonReadableMesh.GetIndexCount(i); meshCopy.SetSubMesh(i, new SubMeshDescriptor((int)currentIndexOffset, (int)subMeshIndexCount)); currentIndexOffset += subMeshIndexCount; } // Recalculate normals and bounds meshCopy.RecalculateNormals(); meshCopy.RecalculateBounds(); return meshCopy; } } public class Shion { private UInt64[] state; public Shion() { System.Security.Cryptography.RandomNumberGenerator rand = System.Security.Cryptography.RandomNumberGenerator.Create(); byte[] randBytes = new byte[8]; rand.GetBytes(randBytes, 0, 8); UInt64 seed = System.BitConverter.ToUInt64(randBytes, 0); xorshift256_init(seed); } public Shion(int seed) { xorshift256_init((ulong)seed); } //next public int next32mm(int min, int max) { uint value = next32(); double scale = ((double)(max - min)) / UInt32.MaxValue; return (int)(min + (value * scale)); } public byte[] next8() { UInt64 nextInt64 = xoshiro256ss(); return System.BitConverter.GetBytes(nextInt64); } public UInt32 next32() { byte[] randBytes = next8(); return System.BitConverter.ToUInt32(randBytes, 0); } public UInt64 next64() { return xoshiro256ss(); } public double next01() { UInt64 nextInt64 = xoshiro256ss(); //0 inclusive, 1 exclusive return (double)nextInt64 / (double)(UInt64.MaxValue); } //misc private UInt64 splitmix64(UInt64 partialstate) { partialstate = partialstate + 0x9E3779B97f4A7C15; partialstate = (partialstate ^ (partialstate >> 30)) * 0xBF58476D1CE4E5B9; partialstate = (partialstate ^ (partialstate >> 27)) * 0x94D049BB133111EB; return partialstate ^ (partialstate >> 31); } private void xorshift256_init(UInt64 seed) { UInt64[] result = new UInt64[4]; result[0] = splitmix64(seed); result[1] = splitmix64(result[0]); result[2] = splitmix64(result[1]); result[3] = splitmix64(result[2]); state = result; } private UInt64 rotl64(UInt64 x, int k) { return (x << k) | (x >> (64 - k)); } private UInt64 xoshiro256ss() { UInt64 result = rotl64(state[1] * 5, 7) * 9; UInt64 t = state[1] << 17; state[2] ^= state[0]; state[3] ^= state[1]; state[1] ^= state[2]; state[0] ^= state[3]; state[2] ^= t; state[3] = rotl64(state[3], 45); return result; } } }