Decompiled source of SnowyCraftingCore v1.0.2

plugins/Snowlance.SnowyCraftingCore.dll

Decompiled 12 minutes ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Dawn;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Snowlance.SnowyCraftingCore.NetcodePatcher;
using SnowyCraftingCore.Unlockables;
using SnowyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Snowlance.SnowyCraftingCore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+fbbcea452c6547c87cae964405f7a929ab138bfa")]
[assembly: AssemblyProduct("SnowyCraftingCore")]
[assembly: AssemblyTitle("Snowlance.SnowyCraftingCore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 SnowyCraftingCore
{
	public class AnalyzableIngredient : ChemistryIngredient, IEquatable<AnalyzableIngredient>
	{
		public Action<AnalyzableIngredient> result;

		public AnalyzableIngredient(Item item, Action<AnalyzableIngredient> result, ChemistryLiquidAppearance? chemistryLiquidAppearance = null, string specialInstructions = "")
		{
			this.result = result;
			base..ctor(item, chemistryLiquidAppearance, specialInstructions);
		}

		public bool Equals(AnalyzableIngredient other)
		{
			return (Object)(object)item == (Object)(object)other.item;
		}

		public override string ToString()
		{
			return ((Object)item).name;
		}
	}
	public class ChemistryFixedOutputReaction : ChemistryRecipe
	{
		public ChemistryFixedOutputReaction(ChemistryIngredient ingredientA, ChemistryIngredient ingredientB, ChemistryIngredient output, float mixTime = -1f)
			: base(ingredientA, ingredientB, (ChemistryIngredient chemistryIngredient, ChemistryIngredient chemistryIngredient2) => output, mixTime)
		{
		}
	}
	public class ChemistryIngredient : IEquatable<ChemistryIngredient>
	{
		public Item item;

		public ChemistryLiquidAppearance chemistryLiquidAppearance;

		public string specialInstructions;

		public ChemistryIngredient(Item item, ChemistryLiquidAppearance? chemistryLiquidAppearance = null, string specialInstructions = "")
		{
			//IL_000f: 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)
			this.item = item;
			this.chemistryLiquidAppearance = chemistryLiquidAppearance ?? new ChemistryLiquidAppearance();
			this.specialInstructions = specialInstructions;
			base..ctor();
		}

		public bool Equals(ChemistryIngredient other)
		{
			return (Object)(object)item == (Object)(object)other.item;
		}

		public override string ToString()
		{
			return ((Object)item).name;
		}
	}
	public class ChemistryLiquidAppearance(Color liquidColor = default(Color), float emissionIntensity = 0f)
	{
		public Color liquidColor = liquidColor;

		public float emissionIntensity = emissionIntensity;

		public override string ToString()
		{
			return $"Color: {((object)Unsafe.As<Color, Color>(ref liquidColor)/*cast due to .constrained prefix*/).ToString()}, EmissionIntensity: {emissionIntensity}";
		}
	}
	public class ChemistryRecipe(ChemistryIngredient ingredientA, ChemistryIngredient ingredientB, Func<ChemistryIngredient, ChemistryIngredient, ChemistryIngredient> reaction, float mixTime = -1f) : IEquatable<ChemistryRecipe>
	{
		public ChemistryIngredient ingredientA = ingredientA;

		public ChemistryIngredient ingredientB = ingredientB;

		public Func<ChemistryIngredient, ChemistryIngredient, ChemistryIngredient> reaction = reaction;

		public float mixTime = mixTime;

		public bool Equals(ChemistryRecipe other)
		{
			return (ingredientA == other.ingredientA && ingredientB == other.ingredientB) || (ingredientA == other.ingredientB && ingredientB == other.ingredientA);
		}

		public override string ToString()
		{
			return ingredientA?.ToString() + " + " + ingredientB?.ToString() + " = ???";
		}
	}
	public static class CraftingAPI
	{
		public static void RegisterIngredient(ChemistryIngredient ingredient)
		{
			if (ChemicalMixerBehavior.RegisteredIngredients.Contains(ingredient))
			{
				Plugin.logger.LogError((object)$"Could not register chemistry ingredient {ingredient}, a similar chemistry ingredient already exists");
			}
			else
			{
				ChemicalMixerBehavior.RegisteredIngredients.Add(ingredient);
			}
		}

		public static void RegisterIngredient(AnalyzableIngredient ingredient)
		{
			if (AnalyzerBehavior.RegisteredIngredients.Contains(ingredient))
			{
				Plugin.logger.LogError((object)$"Could not register analyzable ingredient {ingredient}, a similar analyzable ingredient already exists");
			}
			else
			{
				AnalyzerBehavior.RegisteredIngredients.Add(ingredient);
			}
		}

		public static void RegisterRecipe(ChemistryRecipe recipe)
		{
			if (ChemicalMixerBehavior.RegisteredRecipes.Contains(recipe))
			{
				Plugin.logger.LogError((object)$"Could not register chemistry recipe {recipe}, a similar recipe already exists");
			}
			else
			{
				ChemicalMixerBehavior.RegisteredRecipes.Add(recipe);
			}
		}

		public static void RegisterRecipe(DistilleryRecipe recipe)
		{
			if (AlembicBehavior.RegisteredRecipes.Contains(recipe))
			{
				Plugin.logger.LogError((object)$"Could not register distillery recipe {recipe}, a similar recipe already exists");
			}
			else
			{
				AlembicBehavior.RegisteredRecipes.Add(recipe);
			}
		}

		public static void LogRecipies()
		{
			Plugin.logger.LogDebug((object)"Alembic recipes");
			foreach (DistilleryRecipe registeredRecipe in AlembicBehavior.RegisteredRecipes)
			{
				Plugin.logger.LogDebug((object)registeredRecipe);
			}
			Plugin.logger.LogDebug((object)"ChemistryMixer recipes");
			foreach (ChemistryRecipe registeredRecipe2 in ChemicalMixerBehavior.RegisteredRecipes)
			{
				Plugin.logger.LogDebug((object)registeredRecipe2);
			}
		}
	}
	public class DistilleryFixedOutputReaction : DistilleryRecipe
	{
		public DistilleryFixedOutputReaction(ChemistryIngredient ingredient, ChemistryIngredient? output, float mixTime = -1f)
			: base(ingredient, (ChemistryIngredient chemistryIngredient) => output, mixTime)
		{
		}
	}
	public class DistilleryRecipe(ChemistryIngredient ingredient, Func<ChemistryIngredient, ChemistryIngredient?> reaction, float mixTime = -1f)
	{
		public ChemistryIngredient ingredient = ingredient;

		public Func<ChemistryIngredient, ChemistryIngredient?> reaction = reaction;

		public float mixTime = mixTime;

		public override string ToString()
		{
			return ingredient?.ToString() + " = ???";
		}
	}
	public interface IAnalyzableIngredient : IChemistryIngredient
	{
		Action<AnalyzableIngredient> OnAnalyze();

		bool DespawnItemAfterAnalyzing();
	}
	public interface IChemistryIngredient
	{
		ChemistryIngredient? GetIngredient();

		void OnChemicalOutput(string specialInstructions);
	}
	public interface IChemistryOutputContainer
	{
		bool ReceiveChemistryOutput(ChemistryIngredient ingredient);
	}
	public interface IDistillableIngredient : IChemistryIngredient
	{
		ChemistryIngredient? DistilleryOutput();

		float DistilleryMixTime();

		bool DespawnItemAfterDistilleryInput();
	}
	public interface IMixableIngredient : IChemistryIngredient
	{
		bool DespawnItemAfterInput();
	}
	[BepInPlugin("Snowlance.SnowyCraftingCore", "SnowyCraftingCore", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Snowlance.SnowyCraftingCore");

		public static Plugin Instance { get; private set; }

		public static ManualLogSource logger { get; private set; }

		public static DuskMod Mod { get; private set; }

		public static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;

		public static PlayerControllerB? PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).FirstOrDefault();
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = ((BaseUnityPlugin)Instance).Logger;
			harmony.PatchAll();
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "snowycraftingcore_mainassets"));
			Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.RegisterContentHandlers();
			InitializeNetworkBehaviours();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.SnowyCraftingCore v1.0.2 has loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			ManualLogSource obj = logger;
			if (obj != null)
			{
				obj.LogDebug((object)"Finished initializing network behaviours");
			}
		}
	}
	internal class SnowyCraftingCoreContentHandler : ContentHandler<SnowyCraftingCoreContentHandler>
	{
		public class AnalyzerAssets : AssetBundleLoader<AnalyzerAssets>
		{
			public AnalyzerAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class AlembicAssets : AssetBundleLoader<AlembicAssets>
		{
			public AlembicAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class ChemicalMixerAssets : AssetBundleLoader<ChemicalMixerAssets>
		{
			public ChemicalMixerAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public AnalyzerAssets? Analyzer;

		public AlembicAssets? Alembic;

		public ChemicalMixerAssets? ChemicalMixer;

		public SnowyCraftingCoreContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<AnalyzerAssets>("analyzer", ref Analyzer, false);
			((ContentHandler)this).RegisterContent<AlembicAssets>("alembic", ref Alembic, false);
			((ContentHandler)this).RegisterContent<ChemicalMixerAssets>("chemical_mixer", ref ChemicalMixer, false);
		}
	}
	internal static class SnowyCraftingCoreKeys
	{
		public static readonly NamespacedKey<DawnUnlockableItemInfo> Analyzer = NamespacedKey<DawnUnlockableItemInfo>.From("snowy_crafting_core", "analyzer");

		public static readonly NamespacedKey<DawnUnlockableItemInfo> Alembic = NamespacedKey<DawnUnlockableItemInfo>.From("snowy_crafting_core", "alembic");

		public static readonly NamespacedKey<DawnUnlockableItemInfo> ChemicalMixer = NamespacedKey<DawnUnlockableItemInfo>.From("snowy_crafting_core", "chemical_mixer");
	}
	[HarmonyPatch]
	internal static class TESTING
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
			try
			{
				if (Utils.testing)
				{
				}
			}
			catch
			{
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			try
			{
				if (Utils.testing)
				{
					string text = __instance.chatTextField.text;
					string[] array = text.Split(" ");
					string text2 = array[0];
					string text3 = text2;
					if (text3 == "/recipes")
					{
						CraftingAPI.LogRecipies();
					}
				}
			}
			catch
			{
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.SnowyCraftingCore";

		public const string PLUGIN_NAME = "SnowyCraftingCore";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace SnowyCraftingCore.Unlockables
{
	internal class AlembicBehavior : NetworkBehaviour
	{
		[SerializeField]
		private InteractTrigger inputTrigger = null;

		[SerializeField]
		private Collider inputTriggerCollider = null;

		[SerializeField]
		private Collider outputTriggerCollider = null;

		[SerializeField]
		private MeshRenderer inputRenderer = null;

		[SerializeField]
		private MeshRenderer outputRenderer = null;

		[SerializeField]
		private ParticleSystem inputParticleSystem = null;

		[SerializeField]
		private ParticleSystem outputParticleSystem = null;

		[SerializeField]
		private AudioSource audioSource = null;

		private ChemistryIngredient? inputIngredient;

		private ChemistryIngredient? outputIngredient;

		private DistilleryRecipe? currentlyMixingRecipe;

		private ParticleSystemRenderer inputParticleSystemRenderer = null;

		private bool mixing;

		private ChemistryLiquidAppearance inputDefaultColor = null;

		private const float defaultMixingTime = 10f;

		public static List<DistilleryRecipe> RegisteredRecipes { get; internal set; } = new List<DistilleryRecipe>();

		public void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			inputDefaultColor = new ChemistryLiquidAppearance(((Renderer)inputRenderer).material.color, 2f);
			inputParticleSystemRenderer = ((Component)inputParticleSystem).GetComponent<ParticleSystemRenderer>();
		}

		public void Update()
		{
			inputTriggerCollider.enabled = inputIngredient == null && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
			inputTrigger.interactable = (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && !Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.twoHanded;
			outputTriggerCollider.enabled = outputIngredient != null;
		}

		public void InputTrigger_Interact()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null) && !Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.twoHanded)
			{
				InputIngredientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)Plugin.localPlayer.currentlyHeldObjectServer).NetworkObject));
			}
		}

		public void OutputTrigger_Interact()
		{
			if (inputIngredient != null || outputIngredient != null)
			{
				OutputTrigger_InteractRpc(Plugin.localPlayer.actualClientId);
			}
		}

		private void SetInputFlaskColor(ChemistryLiquidAppearance color)
		{
			//IL_000d: 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_005c: 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)
			((Renderer)inputRenderer).material.color = color.liquidColor;
			((Renderer)inputRenderer).material.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)inputRenderer).material.SetFloat("_EmissionIntensity", color.emissionIntensity);
			((Renderer)inputParticleSystemRenderer).material.color = color.liquidColor;
			((Renderer)inputParticleSystemRenderer).material.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)inputParticleSystemRenderer).material.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		private void SetOutputFlaskColor(ChemistryLiquidAppearance color)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)outputRenderer).enabled = true;
			((Renderer)outputRenderer).sharedMaterial.color = color.liquidColor;
			((Renderer)outputRenderer).sharedMaterial.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)outputRenderer).sharedMaterial.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void InputIngredientRpc(NetworkObjectReference netRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_007a: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2514611931u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2514611931u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			GrabbableObject item = default(GrabbableObject);
			if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) || !((Component)val4).TryGetComponent<GrabbableObject>(ref item))
			{
				return;
			}
			inputIngredient = null;
			currentlyMixingRecipe = null;
			ChemistryIngredient ingredient = null;
			bool flag = true;
			if (item is IChemistryIngredient chemistryIngredient)
			{
				ingredient = chemistryIngredient.GetIngredient();
				if (ingredient != null && chemistryIngredient is IDistillableIngredient distillableIngredient)
				{
					currentlyMixingRecipe = new DistilleryFixedOutputReaction(ingredient, distillableIngredient.DistilleryOutput(), distillableIngredient.DistilleryMixTime());
					flag = distillableIngredient.DespawnItemAfterDistilleryInput();
				}
				Plugin.logger.LogDebug((object)("Got IChemistryIngredient: " + ingredient));
			}
			if (ingredient == null)
			{
				ingredient = ChemicalMixerBehavior.RegisteredIngredients.Where((ChemistryIngredient x) => (Object)(object)x.item == (Object)(object)item.itemProperties).FirstOrDefault();
			}
			if (ingredient == null)
			{
				Plugin.logger.LogDebug((object)("Unable to find registered ingredient for " + ((Object)item).name + ", creating default ingredient"));
				Color liquidColor = Random.ColorHSV();
				ingredient = new ChemistryIngredient(item.itemProperties, new ChemistryLiquidAppearance(liquidColor, 5f));
			}
			inputIngredient = ingredient;
			SetInputFlaskColor(ingredient.chemistryLiquidAppearance);
			if (currentlyMixingRecipe == null)
			{
				currentlyMixingRecipe = RegisteredRecipes.Where((DistilleryRecipe x) => x.ingredient.Equals(ingredient)).FirstOrDefault();
			}
			Plugin.logger.LogDebug((object)((currentlyMixingRecipe != null) ? "Recipe found" : "Recipe not found"));
			if ((Object)(object)Plugin.localPlayer == (Object)(object)item.playerHeldBy && flag)
			{
				Plugin.localPlayer.DespawnHeldObject();
			}
			mixing = true;
			MixIngredients();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void OutputTrigger_InteractRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0080: 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_00b2: 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_017a: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(371832359u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 371832359u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong clientId2 = clientId;
			if (outputIngredient == null || mixing)
			{
				return;
			}
			PlayerControllerB val4 = Plugin.PlayerFromId(clientId2);
			if ((Object)(object)val4 == (Object)null)
			{
				return;
			}
			GrabbableObject outputItem;
			if (((NetworkBehaviour)this).IsServer && (!((Object)(object)val4.currentlyHeldObjectServer != (Object)null) || !(val4.currentlyHeldObjectServer is IChemistryOutputContainer chemistryOutputContainer) || !chemistryOutputContainer.ReceiveChemistryOutput(outputIngredient)))
			{
				outputItem = Utils.SpawnItem(((DawnBaseInfo<DawnItemInfo>)(object)ItemExtensions.GetDawnInfo(outputIngredient.item)).TypedKey, ((Component)val4).transform.position, default(Quaternion), (Transform)null, 0f, false);
				if ((Object)(object)outputItem != (Object)null)
				{
					((MonoBehaviour)this).StartCoroutine(sendSpawnOutputIngredient(outputIngredient.specialInstructions));
				}
			}
			outputParticleSystem.Stop();
			((Renderer)outputRenderer).enabled = false;
			outputIngredient = null;
			IEnumerator sendSpawnOutputIngredient(string specialInstructions)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((NetworkBehaviour)outputItem).NetworkObject != (Object)null && ((NetworkBehaviour)outputItem).NetworkObject.IsSpawned));
				SpawnOutputIngredientRpc(clientId2, NetworkObjectReference.op_Implicit(((NetworkBehaviour)outputItem).NetworkObject), specialInstructions);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SpawnOutputIngredientRpc(ulong clientId, NetworkObjectReference netRef, string specialInstructions)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0081: 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_00a7: 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_010b: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1244149251u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				bool flag = specialInstructions != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(specialInstructions, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1244149251u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			GrabbableObject val5 = default(GrabbableObject);
			if (((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref val5))
			{
				if (val5 is IChemistryIngredient chemistryIngredient)
				{
					chemistryIngredient.OnChemicalOutput(specialInstructions);
				}
				if (Plugin.localPlayer.actualClientId == clientId)
				{
					PlayerControllerBExtensions.GrabGrabbableObject(Plugin.localPlayer, val5);
				}
			}
		}

		private void MixIngredients()
		{
			((MonoBehaviour)this).StartCoroutine(mixIngredients());
			IEnumerator mixIngredients()
			{
				yield return null;
				audioSource.Play();
				float mixTime = ((currentlyMixingRecipe != null && currentlyMixingRecipe.mixTime > 0f) ? currentlyMixingRecipe.mixTime : 10f);
				yield return (object)new WaitForSeconds(mixTime);
				if (currentlyMixingRecipe != null)
				{
					outputIngredient = currentlyMixingRecipe.reaction(inputIngredient);
					if (outputIngredient != null)
					{
						SetOutputFlaskColor(outputIngredient.chemistryLiquidAppearance);
						outputParticleSystem.Play();
					}
				}
				SetInputFlaskColor(inputDefaultColor);
				currentlyMixingRecipe = null;
				inputIngredient = null;
				mixing = false;
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2514611931u, new RpcReceiveHandler(__rpc_handler_2514611931), "InputIngredientRpc");
			((NetworkBehaviour)this).__registerRpc(371832359u, new RpcReceiveHandler(__rpc_handler_371832359), "OutputTrigger_InteractRpc");
			((NetworkBehaviour)this).__registerRpc(1244149251u, new RpcReceiveHandler(__rpc_handler_1244149251), "SpawnOutputIngredientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2514611931(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AlembicBehavior)(object)target).InputIngredientRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_371832359(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AlembicBehavior)(object)target).OutputTrigger_InteractRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1244149251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: 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_005d: 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_0098: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string specialInstructions = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref specialInstructions, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AlembicBehavior)(object)target).SpawnOutputIngredientRpc(clientId, netRef, specialInstructions);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AlembicBehavior";
		}
	}
	internal class AnalyzerBehavior : NetworkBehaviour
	{
		[SerializeField]
		private Animator animator = null;

		[SerializeField]
		private AudioSource audioSource = null;

		[SerializeField]
		private InteractTrigger interactTrigger = null;

		[SerializeField]
		private Collider interactTriggerCollider = null;

		[SerializeField]
		private MeshRenderer testTubeRenderer = null;

		private AnalyzableIngredient? analyzingIngredient;

		private bool inAnimation;

		public static List<AnalyzableIngredient> RegisteredIngredients { get; internal set; } = new List<AnalyzableIngredient>();

		public void Update()
		{
			interactTrigger.interactable = (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
			interactTriggerCollider.enabled = !inAnimation;
		}

		public void OnFinishSpinning()
		{
			inAnimation = false;
			AnalyzableIngredient analyzableIngredient = analyzingIngredient;
			analyzingIngredient = null;
			analyzableIngredient?.result(analyzableIngredient);
			audioSource.Stop();
		}

		public void OnTriggerInteract()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject obj = Plugin.localPlayer.currentlyHeldObjectServer;
			if (!inAnimation && !((Object)(object)obj == (Object)null) && (obj is IAnalyzableIngredient || RegisteredIngredients.Any((AnalyzableIngredient x) => (Object)(object)x.item == (Object)(object)obj.itemProperties)))
			{
				ProcessIngredientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)obj).NetworkObject));
			}
		}

		private void SetTestTubeColor(ChemistryLiquidAppearance color)
		{
			//IL_000d: 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)
			((Renderer)testTubeRenderer).material.color = color.liquidColor;
			((Renderer)testTubeRenderer).material.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)testTubeRenderer).material.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void ProcessIngredientRpc(NetworkObjectReference netRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_007a: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(19884282u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 19884282u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			GrabbableObject item = default(GrabbableObject);
			if (inAnimation || !((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) || !((Component)val4).TryGetComponent<GrabbableObject>(ref item))
			{
				return;
			}
			AnalyzableIngredient analyzableIngredient = null;
			bool flag = true;
			if (item is IAnalyzableIngredient analyzableIngredient2)
			{
				ChemistryIngredient chemistryIngredient = analyzableIngredient2.GetIngredient();
				if (chemistryIngredient == null)
				{
					chemistryIngredient = new ChemistryIngredient(item.itemProperties);
				}
				analyzableIngredient = new AnalyzableIngredient(item.itemProperties, analyzableIngredient2.OnAnalyze(), chemistryIngredient.chemistryLiquidAppearance, chemistryIngredient.specialInstructions);
				flag = analyzableIngredient2.DespawnItemAfterAnalyzing();
			}
			if (analyzableIngredient == null)
			{
				analyzableIngredient = RegisteredIngredients.Where((AnalyzableIngredient x) => (Object)(object)x.item == (Object)(object)item.itemProperties).FirstOrDefault();
			}
			if (analyzableIngredient != null)
			{
				analyzingIngredient = analyzableIngredient;
				SetTestTubeColor(analyzableIngredient.chemistryLiquidAppearance);
				if ((Object)(object)Plugin.localPlayer == (Object)(object)item.playerHeldBy && flag)
				{
					Plugin.localPlayer.DespawnHeldObject();
				}
				inAnimation = true;
				audioSource.Play();
				animator.SetTrigger("spin");
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(19884282u, new RpcReceiveHandler(__rpc_handler_19884282), "ProcessIngredientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_19884282(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AnalyzerBehavior)(object)target).ProcessIngredientRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AnalyzerBehavior";
		}
	}
	internal class ChemicalMixerBehavior : NetworkBehaviour
	{
		[SerializeField]
		private InteractTrigger input1Trigger = null;

		[SerializeField]
		private InteractTrigger input2Trigger = null;

		[SerializeField]
		private InteractTrigger outputTrigger = null;

		[SerializeField]
		private Collider input1TriggerCollider = null;

		[SerializeField]
		private Collider input2TriggerCollider = null;

		[SerializeField]
		private Collider outputTriggerCollider = null;

		[SerializeField]
		private MeshRenderer input1Renderer = null;

		[SerializeField]
		private MeshRenderer input2Renderer = null;

		[SerializeField]
		private MeshRenderer outputRenderer = null;

		[SerializeField]
		private ParticleSystem input1ParticleSystem = null;

		[SerializeField]
		private ParticleSystem input2ParticleSystem = null;

		[SerializeField]
		private ParticleSystem outputParticleSystem = null;

		[SerializeField]
		private AudioSource audioSource = null;

		[SerializeField]
		private Transform explosionPosition = null;

		[SerializeField]
		private Sprite mixIcon = null;

		[SerializeField]
		private Sprite handIcon = null;

		private ChemistryIngredient? input1Ingredient;

		private ChemistryIngredient? input2Ingredient;

		private ChemistryIngredient? outputIngredient;

		private ChemistryRecipe? currentlyMixingRecipe;

		private bool mixing;

		private const float defaultMixingTime = 10f;

		public static List<ChemistryIngredient> RegisteredIngredients { get; internal set; } = new List<ChemistryIngredient>();

		public static List<ChemistryRecipe> RegisteredRecipes { get; internal set; } = new List<ChemistryRecipe>();

		public void Awake()
		{
			input1TriggerCollider = ((Component)input1Trigger).GetComponent<Collider>();
			input2TriggerCollider = ((Component)input2Trigger).GetComponent<Collider>();
			outputTriggerCollider = ((Component)outputTrigger).GetComponent<Collider>();
		}

		public void Update()
		{
			input1TriggerCollider.enabled = input1Ingredient == null && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
			input2TriggerCollider.enabled = input2Ingredient == null && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
			outputTriggerCollider.enabled = (input1Ingredient != null && input2Ingredient != null) || outputIngredient != null;
			if (input1Ingredient != null && input2Ingredient != null && outputIngredient == null)
			{
				outputTrigger.hoverTip = "Mix [E]";
				outputTrigger.hoverIcon = mixIcon;
			}
			else if (outputIngredient != null)
			{
				outputTrigger.hoverTip = "Take Ingredient [E]";
				outputTrigger.hoverIcon = handIcon;
			}
		}

		public void Input1Trigger_Interact()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null) && !Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.twoHanded)
			{
				Plugin.logger.LogDebug((object)"Input1Trigger_Interact");
				InputIngredientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)Plugin.localPlayer.currentlyHeldObjectServer).NetworkObject), 1);
			}
		}

		public void Input2Trigger_Interact()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null) && !Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.twoHanded)
			{
				Plugin.logger.LogDebug((object)"Input2Trigger_Interact");
				InputIngredientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)Plugin.localPlayer.currentlyHeldObjectServer).NetworkObject), 2);
			}
		}

		public void OutputTrigger_Interact()
		{
			if ((input1Ingredient != null && input2Ingredient != null) || outputIngredient != null)
			{
				OutputTrigger_InteractRpc(Plugin.localPlayer.actualClientId);
			}
		}

		private void SetInput1FlaskColor(ChemistryLiquidAppearance color)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)input1Renderer).enabled = true;
			((Renderer)input1Renderer).sharedMaterial.color = color.liquidColor;
			((Renderer)input1Renderer).sharedMaterial.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)input1Renderer).sharedMaterial.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		private void SetInput2FlaskColor(ChemistryLiquidAppearance color)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)input2Renderer).enabled = true;
			((Renderer)input2Renderer).sharedMaterial.color = color.liquidColor;
			((Renderer)input2Renderer).sharedMaterial.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)input2Renderer).sharedMaterial.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		private void SetOutputFlaskColor(ChemistryLiquidAppearance color)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)outputRenderer).enabled = true;
			((Renderer)outputRenderer).sharedMaterial.color = color.liquidColor;
			((Renderer)outputRenderer).sharedMaterial.SetColor("_EmissionColor", color.liquidColor);
			((Renderer)outputRenderer).sharedMaterial.SetFloat("_EmissionIntensity", color.emissionIntensity);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void InputIngredientRpc(NetworkObjectReference netRef, int flaskInputIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00cd: 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_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(278968888u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, flaskInputIndex);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 278968888u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			GrabbableObject item = default(GrabbableObject);
			if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) || !((Component)val4).TryGetComponent<GrabbableObject>(ref item))
			{
				return;
			}
			ChemistryIngredient chemistryIngredient = null;
			bool flag = true;
			if (item is IChemistryIngredient chemistryIngredient2)
			{
				chemistryIngredient = chemistryIngredient2.GetIngredient();
				if (chemistryIngredient2 is IMixableIngredient mixableIngredient)
				{
					flag = mixableIngredient.DespawnItemAfterInput();
				}
			}
			if (chemistryIngredient == null)
			{
				chemistryIngredient = RegisteredIngredients.Where((ChemistryIngredient x) => (Object)(object)x.item == (Object)(object)item.itemProperties).FirstOrDefault();
			}
			if (chemistryIngredient == null)
			{
				Color liquidColor = Random.ColorHSV();
				chemistryIngredient = new ChemistryIngredient(item.itemProperties, new ChemistryLiquidAppearance(liquidColor));
			}
			switch (flaskInputIndex)
			{
			case 1:
				input1Ingredient = chemistryIngredient;
				SetInput1FlaskColor(chemistryIngredient.chemistryLiquidAppearance);
				break;
			case 2:
				input2Ingredient = chemistryIngredient;
				SetInput2FlaskColor(chemistryIngredient.chemistryLiquidAppearance);
				break;
			}
			if ((Object)(object)Plugin.localPlayer == (Object)(object)item.playerHeldBy && flag)
			{
				Plugin.localPlayer.DespawnHeldObject();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void OutputTrigger_InteractRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0080: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2304917220u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2304917220u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong clientId2 = clientId;
			if (((input1Ingredient == null || input2Ingredient == null) && outputIngredient == null) || mixing)
			{
				return;
			}
			GrabbableObject outputItem;
			if (input1Ingredient != null && input2Ingredient != null && outputIngredient == null)
			{
				currentlyMixingRecipe = RegisteredRecipes.Where((ChemistryRecipe x) => (x.ingredientA.Equals(input1Ingredient) && x.ingredientB.Equals(input2Ingredient)) || (x.ingredientA.Equals(input2Ingredient) && x.ingredientB.Equals(input1Ingredient))).FirstOrDefault();
				mixing = true;
				MixIngredients();
			}
			else
			{
				if (outputIngredient == null)
				{
					return;
				}
				PlayerControllerB val4 = Plugin.PlayerFromId(clientId2);
				if ((Object)(object)val4 == (Object)null)
				{
					return;
				}
				if (((NetworkBehaviour)this).IsServer && (!((Object)(object)val4.currentlyHeldObjectServer != (Object)null) || !(val4.currentlyHeldObjectServer is IChemistryOutputContainer chemistryOutputContainer) || !chemistryOutputContainer.ReceiveChemistryOutput(outputIngredient)))
				{
					outputItem = Utils.SpawnItem(((DawnBaseInfo<DawnItemInfo>)(object)ItemExtensions.GetDawnInfo(outputIngredient.item)).TypedKey, ((Component)val4).transform.position, default(Quaternion), (Transform)null, 0f, false);
					if ((Object)(object)outputItem != (Object)null)
					{
						((MonoBehaviour)this).StartCoroutine(sendSpawnOutputIngredient(outputIngredient.specialInstructions));
					}
				}
				outputParticleSystem.Stop();
				((Renderer)outputRenderer).enabled = false;
				outputIngredient = null;
			}
			IEnumerator sendSpawnOutputIngredient(string specialInstructions)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((NetworkBehaviour)outputItem).NetworkObject != (Object)null && ((NetworkBehaviour)outputItem).NetworkObject.IsSpawned));
				SpawnOutputIngredientRpc(clientId2, NetworkObjectReference.op_Implicit(((NetworkBehaviour)outputItem).NetworkObject), specialInstructions);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SpawnOutputIngredientRpc(ulong clientId, NetworkObjectReference netRef, string specialInstructions)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0064: 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_0081: 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_00a7: 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_010b: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2511401182u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				bool flag = specialInstructions != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(specialInstructions, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2511401182u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			GrabbableObject val5 = default(GrabbableObject);
			if (((NetworkObjectReference)(ref netRef)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref val5))
			{
				if (val5 is IChemistryIngredient chemistryIngredient)
				{
					chemistryIngredient.OnChemicalOutput(specialInstructions);
				}
				if (Plugin.localPlayer.actualClientId == clientId)
				{
					PlayerControllerBExtensions.GrabGrabbableObject(Plugin.localPlayer, val5);
				}
			}
		}

		private void MixIngredients()
		{
			((MonoBehaviour)this).StartCoroutine(mixIngredients());
			IEnumerator mixIngredients()
			{
				yield return null;
				input1ParticleSystem.Play();
				input2ParticleSystem.Play();
				audioSource.Play();
				float mixTime = ((currentlyMixingRecipe != null && currentlyMixingRecipe.mixTime > 0f) ? currentlyMixingRecipe.mixTime : 10f);
				yield return (object)new WaitForSeconds(mixTime);
				if (currentlyMixingRecipe != null)
				{
					outputIngredient = currentlyMixingRecipe.reaction(input1Ingredient, input2Ingredient);
					SetOutputFlaskColor(outputIngredient.chemistryLiquidAppearance);
					outputParticleSystem.Play();
				}
				else
				{
					Landmine.SpawnExplosion(explosionPosition.position, true, 0f, 1f, 5, 5f, (GameObject)null, false);
				}
				currentlyMixingRecipe = null;
				input1ParticleSystem.Stop();
				input2ParticleSystem.Stop();
				input1Ingredient = null;
				input2Ingredient = null;
				((Renderer)input1Renderer).enabled = false;
				((Renderer)input2Renderer).enabled = false;
				mixing = false;
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(278968888u, new RpcReceiveHandler(__rpc_handler_278968888), "InputIngredientRpc");
			((NetworkBehaviour)this).__registerRpc(2304917220u, new RpcReceiveHandler(__rpc_handler_2304917220), "OutputTrigger_InteractRpc");
			((NetworkBehaviour)this).__registerRpc(2511401182u, new RpcReceiveHandler(__rpc_handler_2511401182), "SpawnOutputIngredientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_278968888(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				int flaskInputIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref flaskInputIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChemicalMixerBehavior)(object)target).InputIngredientRpc(netRef, flaskInputIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2304917220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChemicalMixerBehavior)(object)target).OutputTrigger_InteractRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2511401182(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: 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_005d: 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_0098: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string specialInstructions = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref specialInstructions, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChemicalMixerBehavior)(object)target).SpawnOutputIngredientRpc(clientId, netRef, specialInstructions);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ChemicalMixerBehavior";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Snowlance.SnowyCraftingCore.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}