Decompiled source of HearthfirePizzeria v0.1.2

BepInEx/plugins/HearthfirePizzeria/HearthfirePizzeria.dll

Decompiled 13 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("HearthfirePizzeria")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2")]
[assembly: AssemblyProduct("HearthfirePizzeria")]
[assembly: AssemblyTitle("HearthfirePizzeria")]
[assembly: AssemblyVersion("0.1.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
namespace HearthfirePizzeria
{
	internal static class Art
	{
		private static readonly Color Dough = new Color(0.82f, 0.69f, 0.44f);

		private static readonly Color Sauce = new Color(0.55f, 0.18f, 0.065f);

		private static readonly Color Wood = new Color(0.29f, 0.15f, 0.07f);

		private static Texture2D grain;

		internal static GameObject Add(GameObject parent, Material donor, int kind, string key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("attach_cook");
			val.transform.SetParent(parent.transform, false);
			if (key == "Dough")
			{
				Shape(val, donor, (PrimitiveType)0, new Vector3(0f, 0.055f, 0f), new Vector3(0.31f, 0.11f, 0.27f), Dough);
				for (int i = 0; i < 3; i++)
				{
					Shape(val, donor, (PrimitiveType)3, new Vector3((float)(i - 1) * 0.045f, 0.107f, 0f), new Vector3(0.012f, 0.002f, 0.13f), new Color(0.95f, 0.87f, 0.68f));
				}
			}
			else if (key == "Sauce")
			{
				Shape(val, donor, (PrimitiveType)2, new Vector3(0f, 0.035f, 0f), new Vector3(0.27f, 0.035f, 0.27f), Wood);
				Shape(val, donor, (PrimitiveType)2, new Vector3(0f, 0.071f, 0f), new Vector3(0.235f, 0.006f, 0.235f), Sauce);
				Toppings(val, donor, "Garden", 0.1f, 0.083f, 5);
			}
			else if (key.Contains("Topping"))
			{
				Shape(val, donor, (PrimitiveType)3, new Vector3(0f, 0.015f, 0f), new Vector3(0.38f, 0.025f, 0.27f), Wood);
				Toppings(val, donor, key, 0.13f, 0.05f, 12);
			}
			else
			{
				bool flag = kind == 3;
				Shape(val, donor, (PrimitiveType)2, new Vector3(0f, 0.014f, 0f), new Vector3(0.48f, 0.014f, 0.48f), (Color)(flag ? new Color(0.65f, 0.36f, 0.12f) : Dough));
				Shape(val, donor, (PrimitiveType)2, new Vector3(0f, 0.031f, 0f), new Vector3(0.405f, 0.008f, 0.405f), Sauce);
				Crust(val, donor, flag);
				Toppings(val, donor, key, 0.17f, 0.043f, 23);
				if (flag)
				{
					for (int j = 0; j < 7; j++)
					{
						float num = (float)j * 2.4f;
						Shape(val, donor, (PrimitiveType)0, new Vector3(Mathf.Cos(num) * 0.209f, 0.055f, Mathf.Sin(num) * 0.209f), new Vector3(0.018f, 0.006f, 0.013f), new Color(0.22f, 0.11f, 0.045f));
					}
				}
			}
			return val;
		}

		private static Texture2D Grain()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)grain))
			{
				return grain;
			}
			grain = new Texture2D(64, 64, (TextureFormat)4, true);
			Color[] array = (Color[])(object)new Color[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = 0.72f + 0.2f * Mathf.PerlinNoise((float)j * 0.19f, (float)i * 0.19f) + 0.08f * Mathf.PerlinNoise((float)j * 0.8f, (float)i * 0.8f);
					array[i * 64 + j] = new Color(num, num, num, 1f);
				}
			}
			grain.SetPixels(array);
			grain.Apply();
			((Texture)grain).wrapMode = (TextureWrapMode)0;
			return grain;
		}

		private static void Crust(GameObject root, Material donor, bool baked)
		{
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[240];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			int[] array3 = new int[1440];
			for (int i = 0; i < 40; i++)
			{
				for (int j = 0; j < 6; j++)
				{
					float num = (float)i * (float)Math.PI * 2f / 40f;
					float num2 = (float)j * (float)Math.PI * 2f / 6f;
					float num3 = 1f + 0.07f * Mathf.Sin((float)i * 2.13f);
					float num4 = 0.216f + 0.023f * Mathf.Cos(num2) * num3;
					int num5 = i * 6 + j;
					array[num5] = new Vector3(Mathf.Cos(num) * num4, 0.032f + 0.018f * Mathf.Sin(num2) * num3, Mathf.Sin(num) * num4);
					array2[num5] = new Vector2((float)i / 40f * 4f, (float)j / 6f);
					int num6 = num5 * 6;
					int num7 = (i + 1) % 40 * 6;
					array3[num6] = num5;
					array3[num6 + 1] = num7 + (j + 1) % 6;
					array3[num6 + 2] = num7 + j;
					array3[num6 + 3] = num5;
					array3[num6 + 4] = i * 6 + (j + 1) % 6;
					array3[num6 + 5] = num7 + (j + 1) % 6;
				}
			}
			Mesh val = new Mesh
			{
				name = "Handformed pizza crust"
			};
			val.vertices = array;
			val.uv = array2;
			val.triangles = array3;
			val.RecalculateNormals();
			val.RecalculateBounds();
			GameObject val2 = new GameObject("HandformedCrust");
			val2.transform.SetParent(root.transform, false);
			val2.AddComponent<MeshFilter>().sharedMesh = val;
			Material val3 = new Material(donor);
			val3.mainTexture = (Texture)(object)Grain();
			val3.color = (Color)(baked ? new Color(0.57f, 0.34f, 0.15f) : Dough);
			if (val3.HasProperty("_Glossiness"))
			{
				val3.SetFloat("_Glossiness", 0f);
			}
			((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = val3;
		}

		private static void Toppings(GameObject root, Material donor, string key, float radius, float y, int n)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			Color color = default(Color);
			for (int i = 0; i < n; i++)
			{
				float num = (float)i * 2.39996f;
				float num2 = radius * Mathf.Sqrt(((float)i + 0.5f) / (float)n);
				PrimitiveType type;
				if (i % 3 == 0)
				{
					((Color)(ref color))..ctor(0.79f, 0.72f, 0.53f);
					type = (PrimitiveType)0;
				}
				else if (i % 3 == 1)
				{
					color = (key.Contains("Garden") ? new Color(0.61f, 0.3f, 0.09f) : (key.Contains("Wolf") ? new Color(0.43f, 0.24f, 0.14f) : new Color(0.54f, 0.22f, 0.12f)));
					type = (PrimitiveType)3;
				}
				else
				{
					((Color)(ref color))..ctor(0.3f, 0.36f, 0.13f);
					type = (PrimitiveType)3;
				}
				Shape(root, donor, type, new Vector3(Mathf.Cos(num) * num2, y, Mathf.Sin(num) * num2), new Vector3(0.04f, 0.018f, 0.025f), color).transform.localRotation = Quaternion.Euler(0f, (float)(i * 53), 0f);
			}
		}

		private unsafe static GameObject Shape(GameObject root, Material donor, PrimitiveType type, Vector3 pos, Vector3 scale, Color color)
		{
			//IL_0000: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = "Hearthfire_" + ((object)(*(PrimitiveType*)(&type))/*cast due to .constrained prefix*/).ToString();
			obj.transform.SetParent(root.transform, false);
			obj.transform.localPosition = pos;
			obj.transform.localScale = scale;
			Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>());
			Material val = new Material(donor);
			val.mainTexture = (Texture)(object)Grain();
			val.color = color;
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0f);
			}
			obj.GetComponent<Renderer>().sharedMaterial = val;
			return obj;
		}

		internal static Sprite Icon(string key, int kind)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[16384];
			bool flag = key.Contains("Topping");
			bool flag2 = key == "Dough";
			bool flag3 = key == "Sauce";
			for (int i = 0; i < 128; i++)
			{
				Color val2;
				for (int j = 0; j < 128; array[i * 128 + j] = val2, j++)
				{
					float num = ((float)j - 63.5f) / 52f;
					float num2 = ((float)i - 63.5f) / 43f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					val2 = Color.clear;
					bool num4;
					if (!flag)
					{
						num4 = num3 < 1f;
					}
					else
					{
						if (!(Mathf.Abs(num) < 1f))
						{
							continue;
						}
						num4 = Mathf.Abs(num2) < 0.8f;
					}
					if (!num4)
					{
						continue;
					}
					val2 = (Color)(flag ? Wood : (flag2 ? Dough : (flag3 ? Wood : ((kind == 3) ? new Color(0.68f, 0.38f, 0.13f) : Dough))));
					if (!flag2 && !flag && num3 < 0.84f)
					{
						val2 = Sauce;
					}
					if (!flag2 && (!flag3 || num3 < 0.7f))
					{
						for (int k = 0; k < (flag3 ? 5 : 17); k++)
						{
							float num5 = (float)k * 2.39996f;
							float num6 = 0.7f * Mathf.Sqrt(((float)k + 0.5f) / 17f);
							float num7 = num - Mathf.Cos(num5) * num6;
							float num8 = num2 - Mathf.Sin(num5) * num6;
							if (num7 * num7 + num8 * num8 < 0.009f)
							{
								val2 = ((k % 3 == 0) ? new Color(0.87f, 0.8f, 0.61f) : ((k % 3 != 1) ? new Color(0.43f, 0.57f, 0.16f) : (key.Contains("Garden") ? new Color(0.9f, 0.42f, 0.1f) : (key.Contains("Wolf") ? new Color(0.43f, 0.24f, 0.14f) : new Color(0.6f, 0.26f, 0.14f)))));
							}
						}
					}
					float num9 = 0.86f + 0.14f * (1f - num2) * 0.5f;
					((Color)(ref val2))..ctor(val2.r * num9, val2.g * num9, val2.b * num9, 1f);
				}
			}
			val.SetPixels(array);
			val.Apply();
			((Object)val).name = key + "_icon";
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 128f);
		}

		private static bool Visible(Transform t, Transform root)
		{
			while (Object.op_Implicit((Object)(object)t) && (Object)(object)t != (Object)(object)root)
			{
				if (!((Component)t).gameObject.activeSelf)
				{
					return false;
				}
				t = t.parent;
			}
			return true;
		}

		internal static void RefitKiln(GameObject oven, GameObject kiln)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("HearthfireKilnShell");
			val.transform.SetParent(oven.transform, false);
			val.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
			LODGroup[] componentsInChildren = kiln.GetComponentsInChildren<LODGroup>(true);
			HashSet<Renderer> excluded = new HashSet<Renderer>(componentsInChildren.SelectMany((LODGroup l) => l.GetLODs().Skip(1)).SelectMany((LOD l) => l.renderers));
			MeshFilter[] array = (from f in kiln.GetComponentsInChildren<MeshFilter>(true)
				where Visible(((Component)f).transform, kiln.transform) && Object.op_Implicit((Object)(object)((Component)f).GetComponent<MeshRenderer>()) && ((Renderer)((Component)f).GetComponent<MeshRenderer>()).enabled && !excluded.Contains((Renderer)(object)((Component)f).GetComponent<MeshRenderer>()) && Object.op_Implicit((Object)(object)f.sharedMesh) && ((Object)f).name == "default"
				select f).ToArray();
			Bounds val2 = default(Bounds);
			bool flag = true;
			Dictionary<MeshFilter, Mesh> dictionary = array.ToDictionary((MeshFilter f) => f, (MeshFilter f) => MeshRead.Copy(f.sharedMesh));
			MeshFilter[] array2 = array;
			foreach (MeshFilter val3 in array2)
			{
				if (!Object.op_Implicit((Object)(object)val3.sharedMesh) || !Object.op_Implicit((Object)(object)((Component)val3).GetComponent<MeshRenderer>()))
				{
					continue;
				}
				Vector3[] vertices = dictionary[val3].vertices;
				foreach (Vector3 val4 in vertices)
				{
					Vector3 val5 = kiln.transform.InverseTransformPoint(((Component)val3).transform.TransformPoint(val4));
					if (flag)
					{
						((Bounds)(ref val2))..ctor(val5, Vector3.zero);
						flag = false;
					}
					else
					{
						((Bounds)(ref val2)).Encapsulate(val5);
					}
				}
			}
			if (flag)
			{
				throw new InvalidOperationException("Kiln has no readable static mesh");
			}
			if (((Bounds)(ref val2)).size.x < 0.001f || ((Bounds)(ref val2)).size.y < 0.001f || ((Bounds)(ref val2)).size.z < 0.001f)
			{
				throw new InvalidOperationException("Degenerate kiln mesh bounds");
			}
			array2 = array;
			foreach (MeshFilter val6 in array2)
			{
				MeshRenderer component = ((Component)val6).GetComponent<MeshRenderer>();
				if (!Object.op_Implicit((Object)(object)val6.sharedMesh) || !Object.op_Implicit((Object)(object)component))
				{
					continue;
				}
				Mesh val7 = dictionary[val6];
				Vector3[] vertices2 = val7.vertices;
				for (int num3 = 0; num3 < vertices2.Length; num3++)
				{
					Vector3 val8 = kiln.transform.InverseTransformPoint(((Component)val6).transform.TransformPoint(vertices2[num3]));
					val8 -= ((Bounds)(ref val2)).center;
					vertices2[num3] = new Vector3(val8.x / ((Bounds)(ref val2)).size.x * 2.8f, (val8.y / ((Bounds)(ref val2)).size.y + 0.5f) * 2f + 0.65f, val8.z / ((Bounds)(ref val2)).size.z * 2.7f);
				}
				val7.vertices = vertices2;
				for (int num4 = 0; num4 < val7.subMeshCount; num4++)
				{
					int[] triangles = val7.GetTriangles(num4);
					List<int> list = new List<int>();
					for (int num5 = 0; num5 < triangles.Length; num5 += 3)
					{
						_ = (vertices2[triangles[num5]] + vertices2[triangles[num5 + 1]] + vertices2[triangles[num5 + 2]]) / 3f;
						list.Add(triangles[num5]);
						list.Add(triangles[num5 + 1]);
						list.Add(triangles[num5 + 2]);
					}
					val7.SetTriangles(list, num4);
				}
				val7.RecalculateBounds();
				val7.RecalculateNormals();
				val7.RecalculateTangents();
				GameObject val9 = new GameObject("KilnStoneShell");
				val9.transform.SetParent(val.transform, false);
				val9.AddComponent<MeshFilter>().sharedMesh = val7;
				((Renderer)val9.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)component).sharedMaterials;
				val9.layer = ((Component)oven.GetComponentsInChildren<Collider>(true).First()).gameObject.layer;
				val9.AddComponent<MeshCollider>().sharedMesh = val7;
			}
			Material sharedMaterial = ((Renderer)((Component)array[0]).GetComponent<MeshRenderer>()).sharedMaterial;
			GameObject val10 = Shape(val.gameObject, sharedMaterial, (PrimitiveType)3, new Vector3(0f, 0.325f, 0f), new Vector3(2.8f, 0.65f, 2.7f), new Color(0.44f, 0.43f, 0.4f));
			((Object)val10).name = "Raised baking hearth";
			val10.GetComponent<Renderer>().enabled = false;
			for (int num6 = -1; num6 <= 1; num6++)
			{
				for (int num7 = -1; num7 <= 1; num7++)
				{
					for (int num8 = 0; num8 < 2; num8++)
					{
						float num9 = 0.32f + 0.025f * (float)((num6 - num7 + num8 + 6) % 3);
						Shape(val.gameObject, sharedMaterial, (PrimitiveType)3, new Vector3((float)num6 * 0.933f, 0.1625f + (float)num8 * 0.325f, (float)num7 * 0.9f), new Vector3(0.923f, 0.315f, 0.89f), new Color(num9, num9 * 0.98f, num9 * 0.91f));
					}
				}
			}
			val10.AddComponent<BoxCollider>().size = Vector3.one;
			val10.layer = ((Component)oven.GetComponentsInChildren<Collider>(true).First()).gameObject.layer;
			MeshRenderer[] componentsInChildren2 = oven.GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val11 in componentsInChildren2)
			{
				if (!((Component)val11).transform.IsChildOf(val.transform))
				{
					((Renderer)val11).enabled = false;
				}
			}
		}
	}
	public sealed class Cost
	{
		public readonly string Id;

		public readonly int Amount;

		public Cost(string id, int amount)
		{
			Id = id;
			Amount = amount;
		}
	}
	public sealed class Component
	{
		public string Id;

		public string Name;

		public string Description;

		public string Station;

		public int Yield;

		public int Level;

		public int Kind;

		public Cost[] Costs;
	}
	public sealed class Pizza
	{
		public string Id;

		public string Name;

		public string Topping;

		public float Health;

		public float Stamina;
	}
	public static class Menu
	{
		public static readonly Component[] Components = new Component[5]
		{
			new Component
			{
				Id = "Dough",
				Name = "Pizza dough",
				Description = "Barley dough ready for sauce and prepared toppings.",
				Station = "piece_preptable",
				Level = 1,
				Yield = 2,
				Kind = 0,
				Costs = new Cost[2]
				{
					new Cost("BarleyFlour", 4),
					new Cost("Honey", 1)
				}
			},
			new Component
			{
				Id = "Sauce",
				Name = "Hearthfire sauce",
				Description = "A savory carrot, mushroom and onion sauce. No new tomato crop required.",
				Station = "piece_cauldron",
				Level = 4,
				Yield = 2,
				Kind = 1,
				Costs = new Cost[3]
				{
					new Cost("Carrot", 2),
					new Cost("Mushroom", 2),
					new Cost("Onion", 1)
				}
			},
			new Component
			{
				Id = "GardenTopping",
				Name = "Prepared garden toppings",
				Description = "Sliced mushrooms, onions and carrots for pizza.",
				Station = "piece_preptable",
				Level = 1,
				Yield = 2,
				Kind = 1,
				Costs = new Cost[3]
				{
					new Cost("Mushroom", 4),
					new Cost("Onion", 2),
					new Cost("Carrot", 2)
				}
			},
			new Component
			{
				Id = "LoxTopping",
				Name = "Prepared lox toppings",
				Description = "Roasted lox with sliced mushrooms and onions.",
				Station = "piece_preptable",
				Level = 1,
				Yield = 2,
				Kind = 1,
				Costs = new Cost[3]
				{
					new Cost("CookedLoxMeat", 2),
					new Cost("Mushroom", 2),
					new Cost("Onion", 2)
				}
			},
			new Component
			{
				Id = "WolfTopping",
				Name = "Prepared wolf toppings",
				Description = "Cooked wolf with sliced mushrooms and onions.",
				Station = "piece_preptable",
				Level = 1,
				Yield = 2,
				Kind = 1,
				Costs = new Cost[3]
				{
					new Cost("CookedWolfMeat", 2),
					new Cost("Mushroom", 2),
					new Cost("Onion", 2)
				}
			}
		};

		public static readonly Pizza[] Pizzas = new Pizza[3]
		{
			new Pizza
			{
				Id = "GardenPizza",
				Name = "Garden hearth pizza",
				Topping = "GardenTopping",
				Health = 30f,
				Stamina = 80f
			},
			new Pizza
			{
				Id = "LoxPizza",
				Name = "Lox feast pizza",
				Topping = "LoxTopping",
				Health = 80f,
				Stamina = 30f
			},
			new Pizza
			{
				Id = "WolfPizza",
				Name = "Wolf hunter pizza",
				Topping = "WolfTopping",
				Health = 55f,
				Stamina = 55f
			}
		};
	}
	internal static class MeshRead
	{
		internal static Mesh Copy(Mesh source)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0037: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			if (source.isReadable)
			{
				return Object.Instantiate<Mesh>(source);
			}
			Mesh val = new Mesh
			{
				name = ((Object)source).name + "_HearthfireCopy",
				indexFormat = source.indexFormat
			};
			Dictionary<int, byte[]> dictionary = new Dictionary<int, byte[]>();
			VertexAttributeDescriptor[] vertexAttributes = source.GetVertexAttributes();
			for (int i = 0; i < vertexAttributes.Length; i++)
			{
				VertexAttributeDescriptor val2 = vertexAttributes[i];
				if (!dictionary.ContainsKey(((VertexAttributeDescriptor)(ref val2)).stream))
				{
					GraphicsBuffer vertexBuffer = source.GetVertexBuffer(((VertexAttributeDescriptor)(ref val2)).stream);
					try
					{
						uint[] array = new uint[(vertexBuffer.count * vertexBuffer.stride + 3) / 4];
						vertexBuffer.GetData((Array)array);
						byte[] array2 = new byte[array.Length * 4];
						Buffer.BlockCopy(array, 0, array2, 0, array2.Length);
						dictionary.Add(((VertexAttributeDescriptor)(ref val2)).stream, array2);
					}
					finally
					{
						((IDisposable)vertexBuffer)?.Dispose();
					}
				}
			}
			Vector3[] array3 = (Vector3[])(object)new Vector3[source.vertexCount];
			Vector2[] array4 = (Vector2[])(object)new Vector2[source.vertexCount];
			for (int j = 0; j < array3.Length; j++)
			{
				array3[j] = Read(source, dictionary, (VertexAttribute)0, j);
				if (source.HasVertexAttribute((VertexAttribute)4))
				{
					Vector3 val3 = Read(source, dictionary, (VertexAttribute)4, j);
					array4[j] = new Vector2(val3.x, val3.y);
				}
			}
			val.vertices = array3;
			val.uv = array4;
			GraphicsBuffer indexBuffer = source.GetIndexBuffer();
			byte[] array5;
			try
			{
				array5 = new byte[indexBuffer.count * indexBuffer.stride];
				indexBuffer.GetData((Array)array5);
			}
			finally
			{
				((IDisposable)indexBuffer)?.Dispose();
			}
			val.subMeshCount = source.subMeshCount;
			for (int k = 0; k < source.subMeshCount; k++)
			{
				SubMeshDescriptor subMesh = source.GetSubMesh(k);
				if ((int)((SubMeshDescriptor)(ref subMesh)).topology != 0)
				{
					throw new InvalidOperationException("Non-triangle kiln mesh");
				}
				int num = (((int)source.indexFormat == 0) ? 2 : 4);
				int[] array6 = new int[((SubMeshDescriptor)(ref subMesh)).indexCount];
				for (int l = 0; l < array6.Length; l++)
				{
					int startIndex = (((SubMeshDescriptor)(ref subMesh)).indexStart + l) * num;
					array6[l] = (int)((num == 2) ? BitConverter.ToUInt16(array5, startIndex) : BitConverter.ToUInt32(array5, startIndex)) + ((SubMeshDescriptor)(ref subMesh)).baseVertex;
				}
				val.SetTriangles(array6, k);
			}
			val.RecalculateBounds();
			val.RecalculateNormals();
			val.RecalculateTangents();
			return val;
		}

		private unsafe static Vector3 Read(Mesh mesh, Dictionary<int, byte[]> streams, VertexAttribute attr, int i)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			//IL_0033: 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)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			int vertexAttributeStream = mesh.GetVertexAttributeStream(attr);
			int num = mesh.GetVertexAttributeOffset(attr) + i * mesh.GetVertexBufferStride(vertexAttributeStream);
			int vertexAttributeDimension = mesh.GetVertexAttributeDimension(attr);
			VertexAttributeFormat vertexAttributeFormat = mesh.GetVertexAttributeFormat(attr);
			byte[] value = streams[vertexAttributeStream];
			Vector3 zero = Vector3.zero;
			for (int j = 0; j < Math.Min(vertexAttributeDimension, 3); j++)
			{
				float num2;
				if ((int)vertexAttributeFormat == 0)
				{
					num2 = BitConverter.ToSingle(value, num + j * 4);
				}
				else
				{
					if ((int)vertexAttributeFormat != 1)
					{
						throw new InvalidOperationException("Unsupported kiln vertex format " + ((object)(*(VertexAttributeFormat*)(&vertexAttributeFormat))/*cast due to .constrained prefix*/).ToString());
					}
					num2 = Half(BitConverter.ToUInt16(value, num + j * 2));
				}
				((Vector3)(ref zero))[j] = num2;
			}
			return zero;
		}

		private static float Half(ushort h)
		{
			int num = (((h & 0x8000) == 0) ? 1 : (-1));
			int num2 = (h >> 10) & 0x1F;
			int num3 = h & 0x3FF;
			switch (num2)
			{
			case 0:
				return (float)num * (float)Math.Pow(2.0, -14.0) * ((float)num3 / 1024f);
			case 31:
				if (num3 != 0)
				{
					return float.NaN;
				}
				return (float)num * float.PositiveInfinity;
			default:
				return (float)num * (float)Math.Pow(2.0, num2 - 15) * (1f + (float)num3 / 1024f);
			}
		}
	}
	internal static class OvenArt
	{
		private static Material clay;

		private static Material stone;

		private static Material soot;

		private static Material iron;

		private static Material bark;

		private static Material endgrain;

		private static Material ivory;

		private static Material[] stoneVariants;

		private static int collisionLayer;

		private static int stoneIndex;

		internal static void Build(GameObject oven, GameObject kiln)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0625: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_082b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0830: Unknown result type (might be due to invalid IL or missing references)
			//IL_0949: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0990: Unknown result type (might be due to invalid IL or missing references)
			//IL_0863: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
			//IL_07aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad3: Expected O, but got Unknown
			//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b52: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1f: Expected O, but got Unknown
			//IL_0c43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e97: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = PrefabManager.Instance.GetPrefab("CarrotSeeds");
			if (!Object.op_Implicit((Object)(object)prefab))
			{
				throw new InvalidOperationException("Missing static item material donor CarrotSeeds");
			}
			Material val = prefab.GetComponentsInChildren<MeshRenderer>(true).SelectMany((MeshRenderer r) => ((Renderer)r).sharedMaterials).First((Material m) => Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader));
			Debug.Log((object)("Hearthfire oven static material donor=" + ((Object)val).name + " shader=" + ((Object)val.shader).name));
			clay = Surface(val, "Hearthfire fired clay", new Color(0.3f, 0.105f, 0.05f), 0);
			stone = Surface(val, "Weathered hearth stone", new Color(0.265f, 0.255f, 0.225f), 1);
			soot = Surface(val, "Soot-dark firebrick", new Color(0.045f, 0.028f, 0.017f), 5);
			iron = Surface(val, "Forged iron", new Color(0.1f, 0.095f, 0.085f), 2);
			bark = Surface(val, "Split log bark", new Color(0.23f, 0.13f, 0.065f), 3);
			endgrain = Surface(val, "Split wood endgrain", new Color(0.4f, 0.245f, 0.115f), 4);
			ivory = Surface(val, "Chalk knotwork", new Color(0.77f, 0.66f, 0.45f), 2);
			stoneIndex = 0;
			stoneVariants = (Material[])(object)new Material[3]
			{
				stone,
				new Material(stone)
				{
					name = "Warm hearth stone",
					color = new Color(1.08f, 1f, 0.9f)
				},
				new Material(stone)
				{
					name = "Cool hearth stone",
					color = new Color(0.91f, 0.97f, 1.05f)
				}
			};
			collisionLayer = ((Component)oven.GetComponentsInChildren<Collider>(true).First()).gameObject.layer;
			GameObject val2 = new GameObject("HearthfireKilnShell");
			val2.transform.SetParent(oven.transform, false);
			Dome(val2, inner: false);
			Dome(val2, inner: true);
			int[] array = new int[2] { -1, 1 };
			foreach (int num2 in array)
			{
				Box(val2, "Inset side mortar", new Vector3(0f, 0.32f, (float)num2 * 1.105f), new Vector3(2.54f, 0.6f, 0.32f), soot, collider: false);
			}
			Box(val2, "Inset back mortar", new Vector3(-1.13f, 0.32f, 0f), new Vector3(0.25f, 0.6f, 1.88f), soot, collider: false);
			Box(val2, "Hearth mortar bedding", new Vector3(0f, 0.665f, 0f), new Vector3(2.68f, 0.1f, 2.62f), soot, collider: false);
			Vector3 pos = default(Vector3);
			for (int num3 = -1; num3 <= 1; num3 += 2)
			{
				for (int num4 = 0; num4 < 2; num4++)
				{
					for (int num5 = 0; num5 < 4; num5++)
					{
						((Vector3)(ref pos))..ctor(-0.96f + (float)num5 * 0.64f, 0.165f + (float)num4 * 0.31f, (float)num3 * 1.105f);
						Box(val2, "Hearth side masonry", pos, new Vector3(0.625f, 0.295f, 0.39f), stone, collider: true, Quaternion.Euler(0f, (float)((num5 % 2 == 0) ? 1 : (-1)), 0f));
					}
				}
			}
			for (int num6 = 0; num6 < 2; num6++)
			{
				for (int num7 = -1; num7 <= 1; num7++)
				{
					Box(val2, "Hearth back masonry", new Vector3(-1.13f, 0.165f + (float)num6 * 0.31f, (float)num7 * 0.63f), new Vector3(0.32f, 0.295f, 0.62f), stone, collider: true);
				}
			}
			for (int num8 = -2; num8 <= 2; num8++)
			{
				Box(val2, "Hearth paving slab", new Vector3(0f, 0.69f, (float)num8 * 0.53f), new Vector3(2.72f, 0.17f, 0.52f), stone, collider: true);
			}
			Box(val2, "Inset baking stone", new Vector3(0.21f, 0.785f, 0f), new Vector3(1.98f, 0.04f, 1.68f), soot, collider: true);
			for (int num9 = 0; num9 < 13; num9++)
			{
				float a = (float)num9 * (float)Math.PI / 13f + 0.012f;
				float b = (float)(num9 + 1) * (float)Math.PI / 13f - 0.012f;
				ArcWedge(val2, "Arch stone " + num9, a, b, 0.8f, 1.025f, 0.87f, 0.62f, 1.33f, stone, collide: true);
				ArcWedge(val2, "Iron arch strap " + num9, (float)num9 * (float)Math.PI / 13f, (float)(num9 + 1) * (float)Math.PI / 13f, 0.965f, 1.06f, 0.87f, 1.337f, 1.362f, iron, collide: false);
			}
			array = new int[2] { -1, 1 };
			foreach (int num10 in array)
			{
				Box(val2, "Arch foot", new Vector3(1f, 0.84f, (float)num10 * 0.914f), new Vector3(0.68f, 0.28f, 0.24f), stone, collider: true);
				Ring(val2, new Vector3(1.39f, 1.055f, (float)num10 * 0.99f), 0.115f, 0.022f, iron, 16, Quaternion.Euler(0f, 90f, 0f));
				Box(val2, "Ring hanger", new Vector3(1.385f, 1.2f, (float)num10 * 0.99f), new Vector3(0.04f, 0.16f, 0.055f), iron, collider: false);
			}
			Vector3 pos2 = default(Vector3);
			for (int num11 = 0; num11 < 7; num11++)
			{
				float num12 = ((float)num11 + 0.5f) * (float)Math.PI / 7f;
				((Vector3)(ref pos2))..ctor(1.38f, 0.87f + Mathf.Sin(num12) * 1.012f, Mathf.Cos(num12) * 1.012f);
				Rivet(val2, pos2);
			}
			Knot(val2, new Vector3(1.4f, 1.92f, 0f), 0.12f);
			for (int num13 = 0; num13 < 2; num13++)
			{
				for (int num14 = 0; num14 < ((num13 == 0) ? 5 : 4); num14++)
				{
					float num15 = ((float)num14 - ((num13 == 0) ? 2f : 1.5f)) * 0.3f;
					Log(val2, new Vector3(0.02f, 0.17f + (float)num13 * 0.26f, num15), 1.82f - 0.09f * (float)((num14 + num13) % 3), 0.14f - 0.012f * (float)(num14 % 2), num14 + num13 * 4);
				}
			}
			for (int num16 = 0; num16 < 4; num16++)
			{
				float num17 = 2.085f + (float)num16 * 0.16f;
				Quaternion val3 = Quaternion.Euler(0f, (float)(num16 % 2 * 90), 0f);
				array = new int[2] { -1, 1 };
				foreach (int num18 in array)
				{
					Box(val2, "Chimney long brick", new Vector3(-0.34f, num17, 0.34f) + val3 * new Vector3(0f, 0f, (float)num18 * 0.16f), new Vector3(0.44f, 0.15f, 0.12f), stone, collider: true, val3);
					Box(val2, "Chimney short brick", new Vector3(-0.34f, num17, 0.34f) + val3 * new Vector3((float)num18 * 0.16f, 0f, 0f), new Vector3(0.12f, 0.15f, 0.19f), stone, collider: true, val3);
				}
			}
			Frustum(val2, "Chimney iron hood", new Vector3(-0.34f, 2.64f, 0.34f), 0.37f, 0.24f, 0.16f, iron);
			Box(val2, "Chimney cap ridge", new Vector3(-0.34f, 2.735f, 0.34f), new Vector3(0.5f, 0.055f, 0.07f), iron, collider: false);
			array = new int[2] { -1, 1 };
			foreach (int num19 in array)
			{
				Box(val2, "Hood horn", new Vector3(-0.34f, 2.72f, 0.34f + (float)num19 * 0.35f), new Vector3(0.07f, 0.09f, 0.24f), iron, collider: false, Quaternion.Euler((float)(num19 * 28), 0f, 0f));
			}
			array = new int[2] { -1, 1 };
			foreach (int num20 in array)
			{
				Box(val2, "Hearth iron strap", new Vector3(1.372f, 0.37f, (float)num20 * 1.09f), new Vector3(0.035f, 0.43f, 0.085f), iron, collider: false);
				Knot(val2, new Vector3(1.398f, 0.43f, (float)num20 * 1.09f), 0.075f);
			}
			GameObject val4 = new GameObject("Wooden pizza peel");
			val4.transform.SetParent(val2.transform, false);
			val4.transform.localPosition = new Vector3(1.61f, 0.04f, -1.2f);
			val4.transform.localRotation = Quaternion.Euler(14f, 0f, 10f);
			EllipseBoard(val4);
			Box(val4, "Peel handle", new Vector3(0f, 0.97f, 0f), new Vector3(0.065f, 1.36f, 0.055f), bark, collider: false);
			for (int num21 = 0; num21 < 3; num21++)
			{
				Box(val4, "Peel handle wrap", new Vector3(0f, 0.84f + (float)num21 * 0.035f, 0f), new Vector3(0.079f, 0.02f, 0.066f), iron, collider: false);
			}
			array = new int[2] { -1, 1 };
			foreach (int side in array)
			{
				ChalkBand(val2, side, 0);
				ChalkBand(val2, side, 1);
			}
			CoalBed(val2, hot: false);
			CombineVisuals(val2);
			GameObject val5 = new GameObject("HearthfireActiveEmbers");
			val5.transform.SetParent(val2.transform, false);
			CoalBed(val5, hot: true);
			CombineVisuals(val5);
			GameObject val6 = new GameObject("Active warm hearth light");
			val6.transform.SetParent(val5.transform, false);
			val6.transform.localPosition = new Vector3(0.24f, 1.12f, 0.35f);
			Light obj = val6.AddComponent<Light>();
			obj.type = (LightType)2;
			obj.color = new Color(1f, 0.46f, 0.16f);
			obj.range = 3.25f;
			obj.intensity = 1.65f;
			obj.shadows = (LightShadows)0;
			val5.SetActive(false);
			MeshRenderer[] componentsInChildren = oven.GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val7 in componentsInChildren)
			{
				if (((Component)val7).transform.IsChildOf(val2.transform))
				{
					continue;
				}
				bool flag = false;
				Transform val8 = ((Component)val7).transform;
				while (Object.op_Implicit((Object)(object)val8) && (Object)(object)val8 != (Object)(object)oven.transform)
				{
					if (((Object)val8).name == "Working")
					{
						flag = true;
						break;
					}
					val8 = val8.parent;
				}
				if (!flag)
				{
					((Renderer)val7).enabled = false;
				}
			}
			Transform val9 = oven.transform.Find("Working");
			if (Object.op_Implicit((Object)(object)val9))
			{
				val9.localScale *= 0.55f;
				MeshRenderer val10 = ((IEnumerable<MeshRenderer>)((Component)val9).GetComponentsInChildren<MeshRenderer>(true)).FirstOrDefault((Func<MeshRenderer, bool>)((MeshRenderer r) => ((Object)r).name == "logs_glowing"));
				? val11;
				if (!Object.op_Implicit((Object)(object)val10))
				{
					val11 = new Vector3(0.473f, 0.2585f, -0.011f);
				}
				else
				{
					Transform transform = oven.transform;
					Bounds bounds = ((Renderer)val10).bounds;
					val11 = transform.InverseTransformPoint(((Bounds)(ref bounds)).center);
				}
				Vector3 val12 = (Vector3)val11;
				val9.position += oven.transform.TransformVector(new Vector3(-0.4f, 0.84f, 0.6f) - val12);
				Light[] componentsInChildren2 = ((Component)val9).GetComponentsInChildren<Light>(true);
				for (int num = 0; num < componentsInChildren2.Length; num++)
				{
					((Behaviour)componentsInChildren2[num]).enabled = false;
				}
				ParticleSystem[] componentsInChildren3 = ((Component)val9).GetComponentsInChildren<ParticleSystem>(true);
				foreach (ParticleSystem val13 in componentsInChildren3)
				{
					if (((Object)val13).name.IndexOf("smoke", StringComparison.OrdinalIgnoreCase) >= 0)
					{
						((Component)val13).transform.position = oven.transform.TransformPoint(new Vector3(-0.34f, 2.8f, 0.34f));
					}
				}
			}
			OvenFireVisuals.Attach(oven, val5);
		}

		private static Vector3 ClayPoint(float y, float z)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			float num = (y - 0.79f) / 1.38f;
			return new Vector3(1.25f * Mathf.Sqrt(Mathf.Max(0.001f, 1f - num * num - z * z / 1.5625f)) + 0.012f, y, z);
		}

		private static void ChalkBand(GameObject root, int side, int phase)
		{
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[66];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			int[] array3 = new int[192];
			for (int i = 0; i <= 32; i++)
			{
				float num = (float)i / 32f;
				float z = (float)side * (0.18f + 0.5f * num);
				float num2 = 1.88f - 0.17f * num + (float)((phase == 0) ? 1 : (-1)) * 0.055f * Mathf.Sin(num * (float)Math.PI * 2f);
				array[i * 2] = ClayPoint(num2 - 0.007f, z);
				array[i * 2 + 1] = ClayPoint(num2 + 0.007f, z);
				array2[i * 2] = new Vector2(num, 0f);
				array2[i * 2 + 1] = new Vector2(num, 1f);
				if (i < 32)
				{
					int num3 = i * 2;
					int num4 = i * 6;
					array3[num4] = num3;
					array3[num4 + 1] = num3 + 2;
					array3[num4 + 2] = num3 + 1;
					array3[num4 + 3] = num3 + 1;
					array3[num4 + 4] = num3 + 2;
					array3[num4 + 5] = num3 + 3;
				}
			}
			if (side > 0)
			{
				for (int j = 0; j < array3.Length; j += 3)
				{
					int num5 = array3[j + 1];
					array3[j + 1] = array3[j + 2];
					array3[j + 2] = num5;
				}
			}
			Mesh val = new Mesh
			{
				name = "Chalk shoulder interlace",
				vertices = array,
				uv = array2,
				triangles = array3
			};
			val.RecalculateNormals();
			val.RecalculateBounds();
			Part(root, val, ivory, collide: false);
		}

		private static void CoalBed(GameObject root, bool hot)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0039: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			Material val = soot;
			if (hot)
			{
				val = new Material(soot)
				{
					name = "Active side embers",
					color = new Color(0.48f, 0.1f, 0.025f)
				};
				if (val.HasProperty("_EmissionColor"))
				{
					val.SetColor("_EmissionColor", new Color(1.8f, 0.25f, 0.025f));
					val.EnableKeyword("_EMISSION");
				}
			}
			Vector3 pos = default(Vector3);
			for (int i = 0; i < 19; i++)
			{
				float num = (float)i * 2.39996f;
				float num2 = 0.045f + 0.011f * (float)i;
				((Vector3)(ref pos))..ctor(-0.4f + Mathf.Cos(num) * num2, 0.825f + (float)(i % 3) * 0.009f, 0.6f + Mathf.Sin(num) * num2 * 0.72f);
				float num3 = 0.075f + 0.009f * (float)(i % 4);
				if (hot)
				{
					pos.y += 0.027f;
					num3 *= 0.48f;
				}
				Box(root, hot ? "Operating ember" : "Cold coal", pos, new Vector3(num3, num3 * 0.45f, num3 * 0.8f), val, collider: false, Quaternion.Euler((float)(i * 17), (float)(i * 43), (float)(i * 13)));
			}
		}

		private static void CombineVisuals(GameObject root)
		{
			//IL_00a5: 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_00c7: Expected O, but got Unknown
			foreach (IGrouping<Material, MeshRenderer> item in from r in (from r in root.GetComponentsInChildren<MeshRenderer>(true)
					where ((Renderer)r).enabled && Object.op_Implicit((Object)(object)((Component)r).GetComponent<MeshFilter>()) && Object.op_Implicit((Object)(object)((Renderer)r).sharedMaterial)
					select r).ToArray()
				group r by ((Renderer)r).sharedMaterial)
			{
				CombineInstance[] array = item.Select(delegate(MeshRenderer r)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					CombineInstance result = default(CombineInstance);
					((CombineInstance)(ref result)).mesh = ((Component)r).GetComponent<MeshFilter>().sharedMesh;
					((CombineInstance)(ref result)).transform = root.transform.worldToLocalMatrix * ((Component)r).transform.localToWorldMatrix;
					return result;
				}).ToArray();
				Mesh val = new Mesh
				{
					name = "Combined " + ((Object)item.Key).name
				};
				val.CombineMeshes(array, true, true);
				val.RecalculateBounds();
				val.RecalculateTangents();
				foreach (MeshRenderer item2 in item)
				{
					((Renderer)item2).enabled = false;
				}
				Part(root, val, item.Key, collide: false);
			}
		}

		private static Material Surface(Material donor, string name, Color color, int type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(donor)
			{
				name = name,
				color = Color.white
			};
			val.shaderKeywords = val.shaderKeywords.Where((string k) => k.IndexOf("SNOW", StringComparison.OrdinalIgnoreCase) < 0 && k.IndexOf("WIND", StringComparison.OrdinalIgnoreCase) < 0 && k.IndexOf("BILLBOARD", StringComparison.OrdinalIgnoreCase) < 0).ToArray();
			Texture2D val2 = new Texture2D(128, 128, (TextureFormat)4, true)
			{
				name = name + " mottled texture"
			};
			Color[] array = (Color[])(object)new Color[16384];
			for (int num = 0; num < 128; num++)
			{
				for (int num2 = 0; num2 < 128; num2++)
				{
					float num3 = Mathf.PerlinNoise((float)num2 * 0.085f + (float)(type * 7), (float)num * 0.085f);
					float num4 = Mathf.PerlinNoise((float)num2 * 0.51f, (float)num * 0.51f + (float)(type * 13));
					float num5 = 0.69f + 0.36f * num3 + 0.13f * num4;
					if (type == 3)
					{
						num5 *= 0.72f + 0.28f * Mathf.PerlinNoise((float)num2 * 0.6f, (float)num * 0.025f);
					}
					if (type == 4)
					{
						float num6 = num2 - 57;
						float num7 = (float)(num - 69) * 1.12f;
						float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7);
						num5 = 0.86f + 0.1f * num3 + 0.04f * num4 + 0.025f * Mathf.Sin(num8 * 0.29f + 1.5f * num3);
						if (Mathf.Abs(Mathf.Atan2(num7, num6) - 0.72f) < 0.014f && num8 > 21f)
						{
							num5 *= 0.56f;
						}
					}
					if (type == 0)
					{
						num5 = 0.86f + 0.1f * Mathf.PerlinNoise((float)num2 * 0.32f, (float)num * 0.32f) + 0.04f * num4;
					}
					if (type == 1)
					{
						num5 = 0.78f + 0.23f * num3 + 0.08f * num4;
						if (Mathf.PerlinNoise((float)num2 * 0.37f, (float)num * 0.37f) < 0.27f)
						{
							num5 *= 0.72f;
						}
					}
					if (type == 5)
					{
						num5 = 0.82f + 0.1f * num3;
					}
					array[num * 128 + num2] = new Color(color.r * num5, color.g * num5, color.b * num5, 1f);
				}
			}
			val2.SetPixels(array);
			val2.Apply();
			((Texture)val2).wrapMode = (TextureWrapMode)0;
			val.mainTexture = (Texture)(object)val2;
			if (val.HasProperty("_BumpMap"))
			{
				val.SetTexture("_BumpMap", (Texture)null);
			}
			if (val.HasProperty("_Metallic"))
			{
				val.SetFloat("_Metallic", (type == 2) ? 0.45f : 0f);
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", (type == 2) ? 0.2f : 0.04f);
			}
			return val;
		}

		private static void Dome(GameObject root, bool inner)
		{
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			List<Vector3> list = new List<Vector3>();
			List<Vector2> list2 = new List<Vector2>();
			List<int> list3 = new List<int>();
			float num = (inner ? 1.175f : 1.25f);
			float num2 = (inner ? 1.29f : 1.38f);
			for (int i = 0; i <= 24; i++)
			{
				float num3 = (float)i * (float)Math.PI * 0.5f / 24f;
				for (int j = 0; j <= 64; j++)
				{
					float num4 = (float)j * (float)Math.PI * 2f / 64f;
					float num5 = (inner ? 1f : (1f + 0.008f * Mathf.Sin(num4 * 7f + (float)i * 0.71f)));
					list.Add(new Vector3(Mathf.Cos(num4) * Mathf.Cos(num3) * num * num5, 0.79f + Mathf.Sin(num3) * num2, Mathf.Sin(num4) * Mathf.Cos(num3) * num * num5));
					list2.Add(new Vector2((float)j / 64f * 2f, (float)i / 24f));
				}
			}
			for (int k = 0; k < 24; k++)
			{
				for (int l = 0; l < 64; l++)
				{
					int num6 = k * 65 + l;
					int num7 = num6 + 1;
					int num8 = num6 + 64 + 1;
					int c = num8 + 1;
					AddDomeTriangle(list, list3, num6, num8, num7, inner);
					AddDomeTriangle(list, list3, num7, num8, c, inner);
				}
			}
			Mesh val = new Mesh
			{
				name = (inner ? "Dark hollow oven interior" : "Fired-clay oven dome")
			};
			val.SetVertices(list);
			val.SetUVs(0, list2);
			val.SetTriangles(list3, 0);
			val.RecalculateNormals();
			val.RecalculateBounds();
			Part(root, val, inner ? soot : clay, !inner);
		}

		private static void AddDomeTriangle(List<Vector3> v, List<int> t, int a, int b, int c, bool inner)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			Vector3 val = (v[a] + v[b] + v[c]) / 3f;
			float num = val.z / 0.82f;
			float num2 = 0.87f + 0.82f * Mathf.Sqrt(Mathf.Max(0f, 1f - num * num));
			if (!(val.x > 0f) || !(Mathf.Abs(num) < 1f) || !(val.y < num2))
			{
				if (inner)
				{
					t.Add(a);
					t.Add(c);
					t.Add(b);
				}
				else
				{
					t.Add(a);
					t.Add(b);
					t.Add(c);
				}
			}
		}

		private static Material StoneTone()
		{
			return stoneVariants[stoneIndex++ % stoneVariants.Length];
		}

		private static Vector3[] CubeCorners(Vector3 size)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0062: 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_0074: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = size * 0.5f;
			return (Vector3[])(object)new Vector3[8]
			{
				new Vector3(0f - val.x, 0f - val.y, 0f - val.z),
				new Vector3(0f - val.x, 0f - val.y, val.z),
				new Vector3(0f - val.x, val.y, val.z),
				new Vector3(0f - val.x, val.y, 0f - val.z),
				new Vector3(val.x, 0f - val.y, 0f - val.z),
				new Vector3(val.x, 0f - val.y, val.z),
				new Vector3(val.x, val.y, val.z),
				new Vector3(val.x, val.y, 0f - val.z)
			};
		}

		private static Mesh ChippedMesh(string name, Vector3[] corners, float bevel)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Expected O, but got Unknown
			int[,] array = new int[6, 4]
			{
				{ 0, 3, 2, 1 },
				{ 4, 5, 6, 7 },
				{ 0, 1, 5, 4 },
				{ 3, 7, 6, 2 },
				{ 0, 4, 7, 3 },
				{ 1, 2, 6, 5 }
			};
			Vector3 center = corners.Aggregate(Vector3.zero, (Vector3 sum, Vector3 p) => sum + p) / 8f;
			Vector3[,] array2 = new Vector3[6, 4];
			List<Vector3>[] array3 = new List<Vector3>[8];
			for (int num = 0; num < 8; num++)
			{
				array3[num] = new List<Vector3>();
			}
			Dictionary<string, List<Vector3[]>> dictionary = new Dictionary<string, List<Vector3[]>>();
			List<Vector3> verts = new List<Vector3>();
			List<Vector2> uvs = new List<Vector2>();
			List<int> triangles = new List<int>();
			Action<Vector3[]> action = delegate(Vector3[] polygon)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: 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_0050: 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)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: 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_0066: 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_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: 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_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val5 = Vector3.Cross(polygon[1] - polygon[0], polygon[2] - polygon[0]);
				Vector3 val6 = polygon.Aggregate(Vector3.zero, (Vector3 sum, Vector3 p) => sum + p) / (float)polygon.Length;
				if (Vector3.Dot(val5, val6 - center) < 0f)
				{
					Array.Reverse(polygon);
				}
				int count = verts.Count;
				Vector3 val7 = polygon[1] - polygon[0];
				Vector3 normalized = ((Vector3)(ref val7)).normalized;
				val7 = Vector3.Cross(polygon[1] - polygon[0], polygon[2] - polygon[0]);
				Vector3 val8 = Vector3.Cross(((Vector3)(ref val7)).normalized, normalized);
				foreach (Vector3 val9 in polygon)
				{
					verts.Add(val9);
					Vector3 val10 = val9 - polygon[0];
					uvs.Add(new Vector2(Vector3.Dot(val10, normalized) * 3f, Vector3.Dot(val10, val8) * 3f));
				}
				for (int num11 = 1; num11 < polygon.Length - 1; num11++)
				{
					triangles.Add(count);
					triangles.Add(count + num11);
					triangles.Add(count + num11 + 1);
				}
			};
			for (int num2 = 0; num2 < 6; num2++)
			{
				for (int num3 = 0; num3 < 4; num3++)
				{
					int num4 = array[num2, num3];
					Vector3 val = corners[num4];
					Vector3 val2 = corners[array[num2, (num3 + 3) % 4]] - val;
					Vector3 val3 = corners[array[num2, (num3 + 1) % 4]] - val;
					float num5 = bevel * (0.72f + 0.27f * (1f + Mathf.Sin((float)num4 * 3.71f + (float)num2 * 0.91f)) * 0.5f);
					array2[num2, num3] = val + ((Vector3)(ref val2)).normalized * Mathf.Min(num5, ((Vector3)(ref val2)).magnitude * 0.17f) + ((Vector3)(ref val3)).normalized * Mathf.Min(num5 * 1.12f, ((Vector3)(ref val3)).magnitude * 0.17f);
					array3[num4].Add(array2[num2, num3]);
				}
				action((Vector3[])(object)new Vector3[4]
				{
					array2[num2, 0],
					array2[num2, 1],
					array2[num2, 2],
					array2[num2, 3]
				});
				for (int num6 = 0; num6 < 4; num6++)
				{
					int num7 = array[num2, num6];
					int num8 = array[num2, (num6 + 1) % 4];
					string key = Math.Min(num7, num8) + ":" + Math.Max(num7, num8);
					if (!dictionary.ContainsKey(key))
					{
						dictionary[key] = new List<Vector3[]>();
					}
					dictionary[key].Add((Vector3[])(object)((num7 < num8) ? new Vector3[2]
					{
						array2[num2, num6],
						array2[num2, (num6 + 1) % 4]
					} : new Vector3[2]
					{
						array2[num2, (num6 + 1) % 4],
						array2[num2, num6]
					}));
				}
			}
			foreach (List<Vector3[]> value in dictionary.Values)
			{
				if (value.Count == 2)
				{
					action((Vector3[])(object)new Vector3[4]
					{
						value[0][0],
						value[0][1],
						value[1][1],
						value[1][0]
					});
				}
			}
			List<Vector3>[] array4 = array3;
			foreach (List<Vector3> list in array4)
			{
				if (list.Count == 3)
				{
					action(list.ToArray());
				}
			}
			Mesh val4 = new Mesh
			{
				name = name + " chipped stone"
			};
			val4.SetVertices(verts);
			val4.SetUVs(0, uvs);
			val4.SetTriangles(triangles, 0);
			val4.RecalculateNormals();
			val4.RecalculateBounds();
			return val4;
		}

		private static GameObject Box(GameObject root, string name, Vector3 pos, Vector3 size, Material material, bool collider, Quaternion? rot = null)
		{
			//IL_0026: 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_00b3: 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_0067: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val).name = name;
			val.transform.SetParent(root.transform, false);
			val.transform.localPosition = pos;
			if (rot.HasValue)
			{
				val.transform.localRotation = rot.Value;
			}
			if ((Object)(object)material == (Object)(object)stone)
			{
				val.GetComponent<MeshFilter>().sharedMesh = ChippedMesh(name, CubeCorners(size), Mathf.Min(0.035f, Mathf.Min(size.x, Mathf.Min(size.y, size.z)) * 0.17f));
				val.GetComponent<BoxCollider>().size = size;
				material = StoneTone();
			}
			else
			{
				val.transform.localScale = size;
			}
			((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = material;
			val.layer = collisionLayer;
			if (!collider)
			{
				Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>());
			}
			return val;
		}

		private static GameObject Part(GameObject root, Mesh mesh, Material material, bool collide)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject(((Object)mesh).name);
			val.transform.SetParent(root.transform, false);
			val.layer = collisionLayer;
			val.AddComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material;
			if (collide)
			{
				val.AddComponent<MeshCollider>().sharedMesh = mesh;
			}
			return val;
		}

		private static void ArcWedge(GameObject root, string name, float a, float b, float inner, float outer, float y, float back, float front, Material mat, bool collide)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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)
			//IL_00ab: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] corners = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(back, y + Mathf.Sin(a) * inner, Mathf.Cos(a) * inner),
				new Vector3(back, y + Mathf.Sin(b) * inner, Mathf.Cos(b) * inner),
				new Vector3(back, y + Mathf.Sin(b) * outer, Mathf.Cos(b) * outer),
				new Vector3(back, y + Mathf.Sin(a) * outer, Mathf.Cos(a) * outer),
				new Vector3(front, y + Mathf.Sin(a) * inner, Mathf.Cos(a) * inner),
				new Vector3(front, y + Mathf.Sin(b) * inner, Mathf.Cos(b) * inner),
				new Vector3(front, y + Mathf.Sin(b) * outer, Mathf.Cos(b) * outer),
				new Vector3(front, y + Mathf.Sin(a) * outer, Mathf.Cos(a) * outer)
			};
			PolyBox(root, name, corners, mat, collide);
		}

		private static void PolyBox(GameObject root, string name, Vector3[] corners, Material mat, bool collide)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_0125: Expected O, but got Unknown
			//IL_0073: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mat == (Object)(object)stone)
			{
				Part(root, ChippedMesh(name, corners, 0.019f), StoneTone(), collide);
				return;
			}
			int[,] array = new int[6, 4]
			{
				{ 0, 3, 2, 1 },
				{ 4, 5, 6, 7 },
				{ 0, 1, 5, 4 },
				{ 3, 7, 6, 2 },
				{ 0, 4, 7, 3 },
				{ 1, 2, 6, 5 }
			};
			Vector3[] array2 = (Vector3[])(object)new Vector3[24];
			Vector2[] array3 = (Vector2[])(object)new Vector2[24];
			int[] array4 = new int[36];
			for (int i = 0; i < 6; i++)
			{
				for (int j = 0; j < 4; j++)
				{
					array2[i * 4 + j] = corners[array[i, j]];
					array3[i * 4 + j] = new Vector2((float)((j == 1 || j == 2) ? 1 : 0), (float)((j >= 2) ? 1 : 0));
				}
				int num = i * 6;
				int num2 = (array4[num] = i * 4);
				array4[num + 1] = num2 + 1;
				array4[num + 2] = num2 + 2;
				array4[num + 3] = num2;
				array4[num + 4] = num2 + 2;
				array4[num + 5] = num2 + 3;
			}
			Mesh val = new Mesh
			{
				name = name,
				vertices = array2,
				uv = array3,
				triangles = array4
			};
			val.RecalculateNormals();
			val.RecalculateBounds();
			Part(root, val, mat, collide);
		}

		private static void Ring(GameObject root, Vector3 pos, float r, float tube, Material material, int count, Quaternion rotation)
		{
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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)
			Vector3[] array = (Vector3[])(object)new Vector3[count * 6];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			int[] array3 = new int[count * 6 * 6];
			for (int i = 0; i < count; i++)
			{
				for (int j = 0; j < 6; j++)
				{
					int num = i * 6 + j;
					float num2 = (float)i * (float)Math.PI * 2f / (float)count;
					float num3 = (float)j * (float)Math.PI / 3f;
					float num4 = r + tube * Mathf.Cos(num3);
					array[num] = pos + rotation * new Vector3(Mathf.Cos(num2) * num4, Mathf.Sin(num2) * num4, tube * Mathf.Sin(num3));
					array2[num] = new Vector2((float)i / (float)count, (float)j / 6f);
					int num5 = num * 6;
					int num6 = (i + 1) % count * 6;
					array3[num5] = num;
					array3[num5 + 1] = num6 + j;
					array3[num5 + 2] = num6 + (j + 1) % 6;
					array3[num5 + 3] = num;
					array3[num5 + 4] = num6 + (j + 1) % 6;
					array3[num5 + 5] = i * 6 + (j + 1) % 6;
				}
			}
			Mesh val = new Mesh
			{
				name = "Forged hanging ring",
				vertices = array,
				uv = array2,
				triangles = array3
			};
			val.RecalculateNormals();
			val.RecalculateBounds();
			Part(root, val, material, collide: false);
		}

		private static void Rivet(GameObject root, Vector3 pos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Box(root, "Hammered rivet", pos, new Vector3(0.045f, 0.055f, 0.055f), iron, collider: false, Quaternion.Euler(45f, 0f, 0f));
		}

		private static void Knot(GameObject root, Vector3 pos, float s)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0057: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			for (int i = -1; i <= 1; i += 2)
			{
				Box(root, "Forged knot", pos + new Vector3(0f, (float)i * s * 0.45f, 0f), new Vector3(0.028f, s * 1.65f, 0.027f), iron, collider: false, Quaternion.Euler((float)(i * 45), 0f, 0f));
				Box(root, "Forged knot", pos + new Vector3(0.01f, 0f, (float)i * s * 0.45f), new Vector3(0.028f, s * 1.65f, 0.027f), iron, collider: false, Quaternion.Euler((float)(-i * 45), 0f, 0f));
			}
		}

		private static void Log(GameObject root, Vector3 pos, float length, float radius, int seed)
		{
			//IL_0065: 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_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Expected O, but got Unknown
			Vector3[] array = (Vector3[])(object)new Vector3[14];
			for (int i = 0; i < 7; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 7f;
				float num2 = radius * (1f + 0.11f * Mathf.Sin((float)seed + (float)i * 3.1f));
				float num3 = Mathf.Min(Mathf.Sin(num) * num2, num2 * 0.58f);
				array[i] = pos + new Vector3((0f - length) * 0.5f, num3, Mathf.Cos(num) * num2);
				array[i + 7] = pos + new Vector3(length * 0.5f, num3, Mathf.Cos(num) * num2);
			}
			List<int> list = new List<int>();
			for (int j = 0; j < 7; j++)
			{
				int num4 = (j + 1) % 7;
				list.AddRange(new int[6]
				{
					j,
					num4 + 7,
					num4,
					j,
					j + 7,
					num4 + 7
				});
			}
			Vector2[] uv = ((IEnumerable<Vector3>)array).Select((Func<Vector3, Vector2>)((Vector3 p) => new Vector2(p.x * 2f, p.y * 4f))).ToArray();
			Mesh val = new Mesh
			{
				name = "Split firewood bark",
				vertices = array,
				uv = uv,
				triangles = list.ToArray()
			};
			val.RecalculateNormals();
			val.RecalculateBounds();
			Part(root, val, bark, collide: false);
			for (int num5 = 0; num5 < 2; num5++)
			{
				Vector3[] array2 = (Vector3[])(object)new Vector3[8];
				Vector2[] array3 = (Vector2[])(object)new Vector2[8];
				array2[0] = pos + new Vector3((float)((num5 != 0) ? 1 : (-1)) * (length * 0.5f + 0.001f), 0f, 0f);
				array3[0] = new Vector2(0.5f, 0.5f);
				int[] array4 = new int[21];
				for (int num6 = 0; num6 < 7; num6++)
				{
					array2[num6 + 1] = array[num6 + num5 * 7];
					array3[num6 + 1] = new Vector2(0.5f + (array2[num6 + 1].z - pos.z) / (radius * 2f), 0.5f + (array2[num6 + 1].y - pos.y) / (radius * 2f));
					array4[num6 * 3] = 0;
					array4[num6 * 3 + 1] = ((num5 == 0) ? (num6 + 1) : ((num6 + 1) % 7 + 1));
					array4[num6 * 3 + 2] = ((num5 == 0) ? ((num6 + 1) % 7 + 1) : (num6 + 1));
				}
				Mesh val2 = new Mesh
				{
					name = "Split log end",
					vertices = array2,
					uv = array3,
					triangles = array4
				};
				val2.RecalculateNormals();
				Part(root, val2, endgrain, collide: false);
			}
		}

		private static void Frustum(GameObject root, string name, Vector3 pos, float bottom, float top, float height, Material m)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[8];
			for (int i = 0; i < 4; i++)
			{
				float num = ((i >= 2) ? 1 : (-1));
				float num2 = ((i != 0 && i != 3) ? 1 : (-1));
				array[i] = pos + new Vector3(num * bottom, 0f, num2 * bottom);
				array[i + 4] = pos + new Vector3(num * top, height, num2 * top);
			}
			PolyBox(root, name, array, m, collide: false);
		}

		private static void EllipseBoard(GameObject root)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			Vector3[] array = (Vector3[])(object)new Vector3[32];
			for (int i = 0; i < 16; i++)
			{
				float num = (float)i * (float)Math.PI * 2f / 16f;
				array[i] = new Vector3(Mathf.Cos(num) * 0.21f, 0.25f + Mathf.Sin(num) * 0.28f, -0.035f);
				array[i + 1