Decompiled source of PotteryBarn v1.19.0

PotteryBarn.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using ComfyLib;
using HarmonyLib;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PotteryBarn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PotteryBarn")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cda4d928-01d6-4d77-af0d-9caff7369336")]
[assembly: AssemblyFileVersion("1.19.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.19.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PotteryBarn
{
	public static class BuilderShop
	{
		public static readonly PotteryPieceList HammerPieces = new PotteryPieceList().AddPiece("Ashlands_Fortress_Floor", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 4)).AddPiece("Ashlands_Fortress_Gate", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 10).Add("Grausten", 10)).AddPiece("Ashlands_Fortress_Gate_Door", "blackforge", new PieceResourceList().Add("Pot_Shard_Red", 10).Add("FlametalNew", 5))
			.AddPiece("Ashlands_Fortress_Wall_Spikes", "blackforge", new PieceResourceList().Add("Pot_Shard_Red", 10).Add("Blackwood", 6).Add("FlametalNew", 6))
			.AddPiece("Ashlands_Wall_2x2", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_cornerR", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_cornerR_top", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_edge", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_edge_top", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_edge2", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_edge2_top", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("Ashlands_Wall_2x2_top", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Grausten", 6))
			.AddPiece("blackmarble_altar_crystal_broken", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("Crystal", 8))
			.AddPiece("blackmarble_post01", "piece_stonecutter", new PieceResourceList().Add("Pot_Shard_Red", 10).Add("BlackMarble", 7))
			.AddPiece("CharredBanner1", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Blackwood", 4).Add("JuteRed", 2))
			.AddPiece("CharredBanner2", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Blackwood", 3).Add("JuteRed", 1))
			.AddPiece("CharredBanner3", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("Blackwood", 2).Add("JuteRed", 1))
			.AddPiece("dvergrprops_barrel", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 25).Add("Copper", 5)
				.Add("Resin", 10))
			.AddPiece("dvergrprops_bed", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 8).Add("Copper", 1)
				.Add("WolfPelt", 2)
				.Add("LoxPelt", 1))
			.AddPiece("dvergrprops_chair", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("YggdrasilWood", 4).Add("Copper", 1))
			.AddPiece("dvergrprops_crate", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("YggdrasilWood", 6))
			.AddPiece("dvergrprops_crate_long", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 10).Add("Copper", 1))
			.AddPiece("dvergrprops_shelf", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 15).Add("Copper", 4))
			.AddPiece("dvergrprops_stool", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 1).Add("YggdrasilWood", 2).Add("Copper", 1))
			.AddPiece("dvergrprops_table", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 10).Add("Copper", 2))
			.AddPiece("dvergrtown_slidingdoor", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 10).Add("BlackMarble", 10))
			.AddPiece("MountainKit_brazier", "forge", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("Coal", 4).Add("Bronze", 2))
			.AddPiece("MountainKit_brazier_blue", "forge", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("Coal", 4).Add("Bronze", 2))
			.AddPiece("MountainKit_brazier_purple", "forge", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("Coal", 4).Add("Bronze", 2))
			.AddPiece("MountainKit_wood_gate", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("Wood", 10).Add("Bronze", 2))
			.AddPiece("TreasureChest_dvergrtower", "piece_workbench", new PieceResourceList().Add("Pot_Shard_Red", 5).Add("YggdrasilWood", 7).Add("Copper", 2));
	}
	public static class CreatorShop
	{
		public static readonly PotteryPieceList CultivatorPieces = new PotteryPieceList().AddPiece("GlowingMushroom", PieceConstants.Workstation.None, new List<PieceResource>(2)
		{
			("MushroomBlue", 1),
			("MushroomYellow", 3)
		}).AddPiece("marker01", PieceConstants.Workstation.None, new List<PieceResource>(2)
		{
			("MushroomBlue", 1),
			("Stone", 5)
		});

		public static readonly PotteryPieceList HammerPieces = new PotteryPieceList().AddPiece("asksvin_carrion", "piece_workbench", new List<PieceResource>(4)
		{
			("MushroomBlue", 5),
			("AsksvinCarrionNeck", 1),
			("AsksvinCarrionRibcage", 1),
			("AsksvinCarrionSkull", 1)
		}).AddPiece("asksvin_carrion2", "piece_workbench", new List<PieceResource>(4)
		{
			("MushroomBlue", 5),
			("AsksvinCarrionNeck", 1),
			("AsksvinCarrionRibcage", 1),
			("AsksvinCarrionSkull", 1)
		}).AddPiece("Charred_altar_bellfragment", "piece_stonecutter", new List<PieceResource>(4)
		{
			("MushroomBlue", 3),
			("BellFragment", 3),
			("Grausten", 5),
			("Crystal", 5)
		})
			.AddPiece("CreepProp_egg_hanging01", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 3),
				("RoyalJelly", 20),
				("TrophySeeker", 1)
			})
			.AddPiece("CreepProp_entrance1", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 2),
				("RoyalJelly", 30)
			})
			.AddPiece("CreepProp_hanging01", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 2),
				("RoyalJelly", 20)
			})
			.AddPiece("CreepProp_wall01", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 2),
				("RoyalJelly", 20)
			})
			.AddPiece("dverger_demister", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 8),
				("Wisp", 20)
			})
			.AddPiece("dverger_demister_large", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 30),
				("Wisp", 50)
			})
			.AddPiece("dvergrprops_hooknchain", "blackforge", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Iron", 2),
				("Chain", 3)
			})
			.AddPiece("dvergrtown_creep_door", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 3),
				("RoyalJelly", 50)
			})
			.AddPiece("dvergrtown_wood_crane", "blackforge", new List<PieceResource>(4)
			{
				("MushroomBlue", 5),
				("YggdrasilWood", 20),
				("Copper", 4),
				("BronzeNails", 20)
			})
			.AddPiece("dvergrtown_wood_support", "blackforge", new List<PieceResource>(2)
			{
				("MushroomBlue", 3),
				("YggdrasilWood", 20)
			})
			.AddPiece("fader_bellholder", "blackforge", new List<PieceResource>(2)
			{
				("MushroomBlue", 3),
				("FlametalNew", 10)
			})
			.AddPiece("goblin_banner", "piece_workbench", new List<PieceResource>(5)
			{
				("MushroomBlue", 1),
				("FineWood", 2),
				("LeatherScraps", 6),
				("Bloodbag", 2),
				("BoneFragments", 2)
			})
			.AddPiece("goblin_fence", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 4),
				("BoneFragments", 8)
			})
			.AddPiece("goblin_pole", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("BoneFragments", 4)
			})
			.AddPiece("goblin_pole_small", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 1),
				("BoneFragments", 2)
			})
			.AddPiece("goblin_roof_45d", "piece_workbench", new List<PieceResource>(4)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("DeerHide", 2),
				("BoneFragments", 8)
			})
			.AddPiece("goblin_roof_45d_corner", "piece_workbench", new List<PieceResource>(4)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("DeerHide", 2),
				("BoneFragments", 8)
			})
			.AddPiece("goblin_roof_cap", "piece_workbench", new List<PieceResource>(4)
			{
				("MushroomBlue", 4),
				("Wood", 10),
				("DeerHide", 6),
				("BoneFragments", 12)
			})
			.AddPiece("goblin_stairs", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("BoneFragments", 4)
			})
			.AddPiece("goblin_stepladder", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("BoneFragments", 4)
			})
			.AddPiece("goblin_woodwall_1m", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 2),
				("BoneFragments", 4)
			})
			.AddPiece("goblin_woodwall_2m", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 4),
				("BoneFragments", 8)
			})
			.AddPiece("goblin_woodwall_2m_ribs", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Wood", 4),
				("BoneFragments", 8)
			})
			.AddPiece("goblinking_totemholder", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 1),
				("BoneFragments", 4)
			})
			.AddPiece("GraveStone_CharredTwitcherNest", "piece_stonecutter", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Grausten", 5),
				("CharcoalResin", 1)
			})
			.AddPiece("GraveStone_Elite_CharredTwitcherNest", "piece_stonecutter", new List<PieceResource>(3)
			{
				("MushroomBlue", 1),
				("Grausten", 5),
				("CharcoalResin", 1)
			})
			.AddPiece("Skull1", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 1),
				("BoneFragments", 10)
			})
			.AddPiece("Skull2", "piece_workbench", new List<PieceResource>(2)
			{
				("MushroomBlue", 10),
				("BoneFragments", 50)
			})
			.AddPiece("StatueCorgi", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 5),
				("Stone", 20)
			})
			.AddPiece("StatueDeer", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 5),
				("Stone", 20)
			})
			.AddPiece("StatueEvil", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 5),
				("Stone", 20)
			})
			.AddPiece("StatueHare", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 5),
				("Stone", 20)
			})
			.AddPiece("StatueSeed", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 5),
				("Stone", 20)
			})
			.AddPiece("stonechest", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 10),
				("Stone", 20)
			})
			.AddPiece("trader_wagon_destructable", "piece_workbench", new List<PieceResource>(4)
			{
				("MushroomBlue", 10),
				("YggdrasilWood", 50),
				("BronzeNails", 80),
				("Tar", 10)
			})
			.AddPiece("TreasureChest_dvergr_loose_stone", "piece_stonecutter", new List<PieceResource>(2)
			{
				("MushroomBlue", 10),
				("BlackMarble", 20)
			})
			.AddPiece("TreasureChest_dvergrtown", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 10),
				("YggdrasilWood", 10),
				("Copper", 2)
			})
			.AddPiece("volture_strawpile", "piece_workbench", new List<PieceResource>(3)
			{
				("MushroomBlue", 2),
				("Wood", 10),
				("CharredBone", 10)
			});
	}
	public static class PieceConstants
	{
		public static class Item
		{
			public const string AsksvinCarrionNeck = "AsksvinCarrionNeck";

			public const string AsksvinCarrionRibcage = "AsksvinCarrionRibcage";

			public const string AsksvinCarrionSkull = "AsksvinCarrionSkull";

			public const string BellFragment = "BellFragment";

			public const string BlackMarble = "BlackMarble";

			public const string Blackwood = "Blackwood";

			public const string Bloodbag = "Bloodbag";

			public const string BoneFragments = "BoneFragments";

			public const string Bronze = "Bronze";

			public const string BronzeNails = "BronzeNails";

			public const string Chain = "Chain";

			public const string CharcoalResin = "CharcoalResin";

			public const string CharredBone = "CharredBone";

			public const string Coal = "Coal";

			public const string Copper = "Copper";

			public const string Crystal = "Crystal";

			public const string DeerHide = "DeerHide";

			public const string ElderBark = "ElderBark";

			public const string FineWood = "FineWood";

			public const string FlametalNew = "FlametalNew";

			public const string Grausten = "Grausten";

			public const string GreydwarfEye = "GreydwarfEye";

			public const string Iron = "Iron";

			public const string JuteBlue = "JuteBlue";

			public const string JuteRed = "JuteRed";

			public const string Lantern = "Lantern";

			public const string LeatherScraps = "LeatherScraps";

			public const string LoxPelt = "LoxPelt";

			public const string MushroomBlue = "MushroomBlue";

			public const string MushroomYellow = "MushroomYellow";

			public const string PotShardRed = "Pot_Shard_Red";

			public const string Resin = "Resin";

			public const string RoyalJelly = "RoyalJelly";

			public const string Stone = "Stone";

			public const string SurtlingCore = "SurtlingCore";

			public const string Tar = "Tar";

			public const string TrophySeeker = "TrophySeeker";

			public const string Wisp = "Wisp";

			public const string WolfClaw = "WolfClaw";

			public const string WolfPelt = "WolfPelt";

			public const string Wood = "Wood";

			public const string YggdrasilWood = "YggdrasilWood";
		}

		public static class Workstation
		{
			public static readonly string None = string.Empty;

			public const string BlackForge = "blackforge";

			public const string Forge = "forge";

			public const string Stonecutter = "piece_stonecutter";

			public const string Workbench = "piece_workbench";
		}
	}
	public static class VanillaShop
	{
		public static readonly PotteryPieceList CultivatorPieces = new PotteryPieceList().AddPiece("vines", PieceConstants.Workstation.None, new List<PieceResource>(1) { ("Wood", 2) });

		public static readonly PotteryPieceList BuildingPieces = new PotteryPieceList().AddPiece("Ashlands_floor_large", "piece_stonecutter", new List<PieceResource>(1) { ("Grausten", 32) }).AddPiece("Ashlands_StairsBroad", "piece_stonecutter", new List<PieceResource>(1) { ("Grausten", 24) }).AddPiece("ashwood_arch_top", "piece_workbench", new List<PieceResource>(1) { ("Blackwood", 2) })
			.AddPiece("blackmarble_2x2_enforced", "blackforge", new List<PieceResource>(2)
			{
				("BlackMarble", 8),
				("Copper", 4)
			})
			.AddPiece("blackmarble_base_2", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 10) })
			.AddPiece("blackmarble_column_3", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 24) })
			.AddPiece("blackmarble_floor_large", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 80) })
			.AddPiece("blackmarble_head_big01", "blackforge", new List<PieceResource>(1) { ("BlackMarble", 8) })
			.AddPiece("blackmarble_head_big02", "blackforge", new List<PieceResource>(1) { ("BlackMarble", 8) })
			.AddPiece("blackmarble_head01", "blackforge", new List<PieceResource>(1) { ("Copper", 4) })
			.AddPiece("blackmarble_head02", "blackforge", new List<PieceResource>(1) { ("Copper", 4) })
			.AddPiece("blackmarble_out_2", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 8) })
			.AddPiece("blackmarble_slope_1x2", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 3) })
			.AddPiece("blackmarble_tile_floor_1x1", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 2) })
			.AddPiece("blackmarble_tile_floor_2x2", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 4) })
			.AddPiece("blackmarble_tile_wall_2x4", "piece_stonecutter", new List<PieceResource>(1) { ("BlackMarble", 8) })
			.AddPiece("dvergrprops_banner", "piece_workbench", new List<PieceResource>(2)
			{
				("YggdrasilWood", 2),
				("JuteBlue", 4)
			})
			.AddPiece("dvergrprops_curtain", "piece_workbench", new List<PieceResource>(2)
			{
				("YggdrasilWood", 2),
				("JuteBlue", 4)
			})
			.AddPiece("dvergrprops_lantern_standing", "blackforge", new List<PieceResource>(1) { ("Lantern", 1) })
			.AddPiece("dvergrprops_wood_beam", "piece_workbench", new List<PieceResource>(1) { ("YggdrasilWood", 12) })
			.AddPiece("dvergrprops_wood_floor", "piece_workbench", new List<PieceResource>(1) { ("YggdrasilWood", 2) })
			.AddPiece("dvergrprops_wood_pole", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 8),
				("Copper", 4)
			})
			.AddPiece("dvergrprops_wood_stair", "piece_workbench", new List<PieceResource>(1) { ("YggdrasilWood", 2) })
			.AddPiece("dvergrprops_wood_wall", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 32),
				("Copper", 16)
			})
			.AddPiece("dvergrtown_stair_corner_wood_left", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 6),
				("Copper", 3)
			})
			.AddPiece("metalbar_1x2", "piece_stonecutter", new List<PieceResource>(1) { ("Copper", 8) })
			.AddPiece("piece_dvergr_pole", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 2),
				("Copper", 1)
			})
			.AddPiece("piece_dvergr_pole", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 2),
				("Copper", 1)
			})
			.AddPiece("piece_dvergr_wood_door", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 12),
				("Copper", 12)
			})
			.AddPiece("piece_dvergr_wood_wall", "blackforge", new List<PieceResource>(2)
			{
				("YggdrasilWood", 10),
				("Copper", 5)
			})
			.AddPiece("root07", PieceConstants.Workstation.None, new List<PieceResource>(1) { ("ElderBark", 2) })
			.AddPiece("root08", PieceConstants.Workstation.None, new List<PieceResource>(1) { ("ElderBark", 2) })
			.AddPiece("root11", PieceConstants.Workstation.None, new List<PieceResource>(1) { ("ElderBark", 2) })
			.AddPiece("root12", PieceConstants.Workstation.None, new List<PieceResource>(1) { ("ElderBark", 2) });

		public static readonly PotteryPieceList MiscPieces = new PotteryPieceList().AddPiece("portal", "piece_stonecutter", new List<PieceResource>(3)
		{
			("Stone", 30),
			("SurtlingCore", 2),
			("GreydwarfEye", 10)
		}).AddPiece("CastleKit_brazier", "forge", new List<PieceResource>(3)
		{
			("Bronze", 5),
			("Coal", 2),
			("WolfClaw", 3)
		});
	}
	public static class PotteryManager
	{
		public static readonly Regex PrefabNameRegex = new Regex("([a-z])([A-Z])");

		public static readonly string HammerPieceTable = "_HammerPieceTable";

		public static readonly string CultivatorPieceTable = "_CultivatorPieceTable";

		public static PieceCategory BuildingCategory;

		public static PieceCategory MiscCategory;

		public static PieceCategory CreatorShopCategory;

		public static PieceCategory BuilderShopCategory;

		public static readonly Quaternion PrefabIconRenderRotation = Quaternion.Euler(0f, -37.5f, 0f);

		public static readonly Dictionary<string, Piece> VanillaPieces = new Dictionary<string, Piece>();

		public static readonly Dictionary<string, Piece> ShopPieces = new Dictionary<string, Piece>();

		public static readonly Dictionary<string, Requirement[]> VanillaPieceResources = new Dictionary<string, Requirement[]>();

		public static readonly Dictionary<string, CraftingStation> CraftingStationCache = new Dictionary<string, CraftingStation>();

		public static readonly DropTable EmptyDropTable = new DropTable();

		public static int IsPlacedByPotteryBarnHashCode = StringExtensionMethods.GetStableHashCode("IsPlacedByPotteryBarn");

		public static bool IsPlacingPiece { get; set; } = false;


		public static PieceTable GetHammerPieceTable()
		{
			return PieceManager.Instance.GetPieceTable(HammerPieceTable);
		}

		public static PieceTable GetCultivatorPieceTable()
		{
			return PieceManager.Instance.GetPieceTable(CultivatorPieceTable);
		}

		public static void AddPieces()
		{
			PieceManager.OnPiecesRegistered -= AddPieces;
			SetupCategories(PieceManager.Instance);
			AddHammerPieces(GetHammerPieceTable());
			AddCultivatorPieces(GetCultivatorPieceTable());
		}

		public static void SetupCategories(PieceManager pieceManager)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			BuildingCategory = (PieceCategory)2;
			MiscCategory = (PieceCategory)0;
			CreatorShopCategory = pieceManager.AddPieceCategory("CreatorShop");
			BuilderShopCategory = pieceManager.AddPieceCategory("BuilderShop");
		}

		public static void AddHammerPieces(PieceTable hammerPieceTable)
		{
			//IL_00f5: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			hammerPieceTable.AddPiece(GetExistingPiece("turf_roof").SetName("turf_roof"));
			hammerPieceTable.AddPiece(GetExistingPiece("turf_roof_top").SetName("turf_roof_top"));
			hammerPieceTable.AddPiece(GetExistingPiece("turf_roof_wall").SetName("turf_roof_wall"));
			hammerPieceTable.AddPiece(GetExistingPiece("ArmorStand_Female").SetName("ArmorStand_Female").SetComfort(0));
			hammerPieceTable.AddPiece(GetExistingPiece("ArmorStand_Male").SetName("ArmorStand_Male"));
			Piece existingPiece = GetExistingPiece("stone_floor");
			int? amount = 12;
			bool? recover = true;
			hammerPieceTable.AddPiece(existingPiece.ModifyResource("Stone", amount, null, recover));
			Piece existingPiece2 = GetExistingPiece("wood_ledge");
			int? amount2 = 1;
			recover = true;
			hammerPieceTable.AddPiece(existingPiece2.ModifyResource("Wood", amount2, null, recover));
			AddPotteryPieces(hammerPieceTable, BuildingCategory, VanillaShop.BuildingPieces, VanillaPieces);
			AddPotteryPieces(hammerPieceTable, MiscCategory, VanillaShop.MiscPieces, VanillaPieces);
			AddPotteryPieces(hammerPieceTable, CreatorShopCategory, CreatorShop.HammerPieces, ShopPieces);
			AddPotteryPieces(hammerPieceTable, BuilderShopCategory, BuilderShop.HammerPieces, ShopPieces);
		}

		public static void AddCultivatorPieces(PieceTable cultivatorPieceTable)
		{
			//IL_0001: 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)
			AddPotteryPieces(cultivatorPieceTable, MiscCategory, VanillaShop.CultivatorPieces, VanillaPieces);
			AddPotteryPieces(cultivatorPieceTable, CreatorShopCategory, CreatorShop.CultivatorPieces, ShopPieces);
		}

		public static void AddPotteryPieces(PieceTable pieceTable, PieceCategory pieceCategory, PotteryPieceList potteryPieces, Dictionary<string, Piece> pieceByNameCache)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			foreach (PotteryPiece potteryPiece in potteryPieces)
			{
				Piece orAddPiece = GetOrAddPiece(potteryPiece.PiecePrefab);
				orAddPiece.SetCategory(pieceCategory).SetResources(CreatePieceRequirements(potteryPiece.PieceResources)).SetCraftingStation(GetCraftingStation(potteryPiece.CraftingStation))
					.SetCanBeRemoved(canBeRemoved: true);
				pieceTable.AddPiece(orAddPiece);
				pieceByNameCache.Add(potteryPiece.PiecePrefab, orAddPiece);
			}
		}

		public static Piece GetExistingPiece(string prefabName)
		{
			return PrefabManager.Instance.GetPrefab(prefabName).GetComponent<Piece>();
		}

		public static Piece GetOrAddPiece(string prefabName)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName);
			Piece val = default(Piece);
			if (prefab.TryGetComponent<Piece>(ref val))
			{
				if (!VanillaPieceResources.ContainsKey(((Object)val).name))
				{
					VanillaPieceResources.Add(((Object)val).name, val.m_resources);
				}
			}
			else
			{
				val = prefab.AddComponent<Piece>();
				val.m_name = FormatPrefabName(((Object)prefab).name);
				SetPlacementRestrictions(val);
			}
			val.m_description = ((Object)prefab).name;
			if (!Object.op_Implicit((Object)(object)val.m_icon))
			{
				val.m_icon = LoadOrRenderIcon(prefab, PrefabIconRenderRotation);
			}
			return val;
		}

		public static Requirement[] CreatePieceRequirements(ICollection<PieceResource> pieceResources)
		{
			return pieceResources.Select(CreatePieceRequirement).ToArray();
		}

		public static Requirement CreatePieceRequirement(PieceResource pieceResource)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			return new Requirement
			{
				m_resItem = PrefabManager.Instance.GetPrefab(pieceResource.Name).GetComponent<ItemDrop>(),
				m_amount = pieceResource.Amount
			};
		}

		public static CraftingStation GetCraftingStation(string prefabName)
		{
			if (string.IsNullOrEmpty(prefabName))
			{
				return null;
			}
			if (!CraftingStationCache.TryGetValue(prefabName, out var value))
			{
				value = PrefabManager.Instance.GetPrefab(prefabName).GetComponent<CraftingStation>();
				CraftingStationCache.Add(prefabName, value);
			}
			return value;
		}

		public static Piece SetPlacementRestrictions(Piece piece)
		{
			piece.m_repairPiece = false;
			piece.m_groundOnly = false;
			piece.m_groundPiece = false;
			piece.m_cultivatedGroundOnly = false;
			piece.m_waterPiece = false;
			piece.m_noInWater = false;
			piece.m_notOnWood = false;
			piece.m_notOnTiltingSurface = false;
			piece.m_inCeilingOnly = false;
			piece.m_notOnFloor = false;
			piece.m_onlyInTeleportArea = false;
			piece.m_allowedInDungeons = false;
			piece.m_clipEverything = true;
			return piece;
		}

		public static string FormatPrefabName(string prefabName)
		{
			return PrefabNameRegex.Replace(prefabName, "$1 $2").TrimStart(new char[1] { ' ' }).Replace('_', ' ')
				.Replace("  ", " ");
		}

		public static Requirement[] CreateRequirements(Dictionary<string, int> data)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			Requirement[] array = (Requirement[])(object)new Requirement[data.Count];
			for (int i = 0; i < data.Count; i++)
			{
				KeyValuePair<string, int> keyValuePair = data.ElementAt(i);
				Requirement val = new Requirement
				{
					m_resItem = Cache.GetPrefab<GameObject>(keyValuePair.Key).GetComponent<ItemDrop>(),
					m_amount = keyValuePair.Value
				};
				array[i] = val;
			}
			return array;
		}

		public static bool IsShopPiece(Piece piece)
		{
			return ShopPieces.ContainsKey(piece.m_description);
		}

		public static bool IsVanillaPiece(Piece piece)
		{
			return VanillaPieces.ContainsKey(piece.m_description);
		}

		public static Sprite LoadOrRenderIcon(GameObject prefab, Quaternion renderRotation)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			RenderRequest val = new RenderRequest(prefab)
			{
				Rotation = renderRotation
			};
			return RenderManager.Instance.Render(val);
		}

		public static void SetupPiece(Piece piece)
		{
			bool flag = IsShopPiece(piece);
			bool flag2 = IsVanillaPiece(piece);
			if (!flag && !flag2)
			{
				return;
			}
			if (flag)
			{
				piece.m_canBeRemoved = piece.IsCreator();
			}
			if (flag2)
			{
				piece.m_canBeRemoved = true;
			}
			if (IsPlacingPiece)
			{
				piece.SetIsPlacedByPotteryBarn(isPlacedByPotteryBarn: true);
			}
			else if (!piece.IsPlacedByPotteryBarn())
			{
				if (VanillaPieceResources.TryGetValue(((Object)piece).name, out var value))
				{
					piece.m_resources = value;
				}
				else
				{
					piece.m_resources = Array.Empty<Requirement>();
				}
				return;
			}
			DropOnDestroyed val = default(DropOnDestroyed);
			if (((Component)piece).TryGetComponent<DropOnDestroyed>(ref val))
			{
				val.m_dropWhenDestroyed = EmptyDropTable;
			}
			Destructible val2 = default(Destructible);
			if (((Component)piece).TryGetComponent<Destructible>(ref val2) && Object.op_Implicit((Object)(object)val2.m_spawnWhenDestroyed))
			{
				CustomFieldUtils.SetDestructibleFields(val2, "vfx_SawDust");
			}
		}

		public static void PlacePieceDoAttackPreDelegate(GameObject clonedObject)
		{
			Piece piece = default(Piece);
			if (clonedObject.TryGetComponent<Piece>(ref piece))
			{
				SetupPiece(piece);
			}
			Container val = default(Container);
			if (clonedObject.TryGetComponent<Container>(ref val))
			{
				val.GetInventory().RemoveAll();
			}
		}

		public static void SetIsPlacedByPotteryBarn(this Piece piece, bool isPlacedByPotteryBarn)
		{
			if (Object.op_Implicit((Object)(object)piece.m_nview) && piece.m_nview.IsValid())
			{
				piece.m_nview.m_zdo.Set(IsPlacedByPotteryBarnHashCode, true);
			}
		}

		public static bool IsPlacedByPotteryBarn(this Piece piece)
		{
			if (Object.op_Implicit((Object)(object)piece.m_nview) && piece.m_nview.IsValid())
			{
				return piece.m_nview.m_zdo.GetBool(IsPlacedByPotteryBarnHashCode, false);
			}
			return false;
		}
	}
	public static class PieceRequirementExtensions
	{
		public static Requirement SetAmount(this Requirement requirement, int amount)
		{
			requirement.m_amount = amount;
			return requirement;
		}

		public static Requirement SetRecover(this Requirement requirement, bool recover)
		{
			requirement.m_recover = recover;
			return requirement;
		}
	}
	public static class PieceTableExtensions
	{
		public static PieceTable AddPiece(this PieceTable pieceTable, Piece piece)
		{
			if (!pieceTable.m_pieces.Contains(((Component)piece).gameObject))
			{
				pieceTable.m_pieces.Add(((Component)piece).gameObject);
			}
			return pieceTable;
		}
	}
	public sealed class PotteryPieceList : IEnumerable<PotteryPiece>, IEnumerable
	{
		public readonly Dictionary<string, PotteryPiece> Pieces = new Dictionary<string, PotteryPiece>();

		public PotteryPieceList AddPiece(string piecePrefab, string craftingStation, ICollection<PieceResource> pieceResources)
		{
			Pieces[piecePrefab] = new PotteryPiece(piecePrefab, craftingStation, pieceResources);
			return this;
		}

		public bool Contains(string prefabName)
		{
			return Pieces.ContainsKey(prefabName);
		}

		public IEnumerator<PotteryPiece> GetEnumerator()
		{
			return Pieces.Values.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public sealed record PotteryPiece(string PiecePrefab, string CraftingStation, ICollection<PieceResource> PieceResources);
	public sealed class PieceResourceList : List<PieceResource>
	{
		public PieceResourceList Add(string resourceName, int resourceAmount)
		{
			Add(new PieceResource(resourceName, resourceAmount));
			return this;
		}
	}
	public sealed record PieceResource(string Name, int Amount)
	{
		public static implicit operator PieceResource((string, int) tuple)
		{
			return new PieceResource(tuple.Item1, tuple.Item2);
		}
	}
	public static class CustomFieldUtils
	{
		public static readonly int HasFieldsHashCode = StringExtensionMethods.GetStableHashCode("HasFields");

		public static readonly int HasFieldsDestructibleHashCode = StringExtensionMethods.GetStableHashCode("HasFieldsDestructible");

		public static readonly int DestructibleSpawnWhenDestroyedHashCode = StringExtensionMethods.GetStableHashCode("Destructible.m_spawnWhenDestroyed");

		public static void SetDestructibleFields(Destructible destructible, string spawnWhenDestroyed)
		{
			ZDO zdo = destructible.m_nview.m_zdo;
			zdo.Set(HasFieldsHashCode, true);
			zdo.Set(HasFieldsDestructibleHashCode, true);
			zdo.Set(DestructibleSpawnWhenDestroyedHashCode, spawnWhenDestroyed);
			destructible.m_nview.LoadFields();
		}
	}
	public static class PlacementGhostUtils
	{
		public static bool HasActiveComponents(GameObject gameObject)
		{
			MonsterAI val = default(MonsterAI);
			AnimalAI val2 = default(AnimalAI);
			Tameable val3 = default(Tameable);
			Ragdoll val4 = default(Ragdoll);
			Humanoid val5 = default(Humanoid);
			if (!gameObject.TryGetComponent<MonsterAI>(ref val) && !gameObject.TryGetComponent<AnimalAI>(ref val2) && !gameObject.TryGetComponent<Tameable>(ref val3) && !gameObject.TryGetComponent<Ragdoll>(ref val4))
			{
				return gameObject.TryGetComponent<Humanoid>(ref val5);
			}
			return true;
		}

		public static void DestroyActiveComponents(GameObject gameObject)
		{
			MonsterAI val = default(MonsterAI);
			if (gameObject.TryGetComponent<MonsterAI>(ref val))
			{
				Object.DestroyImmediate((Object)(object)val);
			}
			AnimalAI val2 = default(AnimalAI);
			if (gameObject.TryGetComponent<AnimalAI>(ref val2))
			{
				Object.DestroyImmediate((Object)(object)val2);
			}
			Tameable val3 = default(Tameable);
			if (gameObject.TryGetComponent<Tameable>(ref val3))
			{
				Object.DestroyImmediate((Object)(object)val3);
			}
			Ragdoll val4 = default(Ragdoll);
			if (gameObject.TryGetComponent<Ragdoll>(ref val4))
			{
				Object.DestroyImmediate((Object)(object)val4);
			}
			Humanoid val5 = default(Humanoid);
			if (gameObject.TryGetComponent<Humanoid>(ref val5))
			{
				val5.m_defaultItems = Array.Empty<GameObject>();
				val5.m_randomWeapon = Array.Empty<GameObject>();
				val5.m_randomArmor = Array.Empty<GameObject>();
				val5.m_randomShield = Array.Empty<GameObject>();
				val5.m_randomSets = Array.Empty<ItemSet>();
			}
		}
	}
	[HarmonyPatch(typeof(EffectList))]
	internal static class EffectListPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("Create")]
		private static IEnumerable<CodeInstruction> CreateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldloc_2, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EffectData), "m_enabled"), (string)null)
			}).ThrowIfInvalid("Could not patch EffectList.Create()! (m_enabled)")
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldloc_2, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(EffectListPatch), "CheckEffectDataDelegate", (Type[])null, (Type[])null))
				})
				.InstructionEnumeration();
		}

		private static void CheckEffectDataDelegate(EffectData effectData)
		{
			if (PluginConfig.IsModEnabled.Value && effectData.m_enabled && !Object.op_Implicit((Object)(object)effectData.m_prefab))
			{
				effectData.m_enabled = false;
			}
		}
	}
	[HarmonyPatch(typeof(Piece))]
	internal static class PiecePatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void AwakePostfix(Piece __instance)
		{
			if (!PotteryManager.IsPlacingPiece)
			{
				PotteryManager.SetupPiece(__instance);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DropResources")]
		private static void DropResourcesPrefix(Piece __instance)
		{
			Container val = default(Container);
			if (((Component)__instance).TryGetComponent<Container>(ref val))
			{
				val.DropAllItems();
			}
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal static class PlayerPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("SetupPlacementGhost")]
		private static IEnumerable<CodeInstruction> SetupPlacementGhostTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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_0065: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)ReflectionUtils.GetGenericMethod(typeof(Object), "Instantiate", 1, new Type[1] { typeof(Type) }).MakeGenericMethod(typeof(GameObject)), (string)null),
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(Player), "m_placementGhost"), (string)null)
			}).ThrowIfInvalid("Could not patch Player.SetupPlacementGhost()! (m_placementGhost)")
				.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PlayerPatch), "SetupPlacementGhostInstantiateDelegate", (Type[])null, (Type[])null)))
				.InstructionEnumeration();
		}

		private static GameObject SetupPlacementGhostInstantiateDelegate(GameObject selectedPrefab)
		{
			bool flag = false;
			if (PluginConfig.IsModEnabled.Value && PlacementGhostUtils.HasActiveComponents(selectedPrefab))
			{
				flag = selectedPrefab.activeSelf;
				selectedPrefab.SetActive(false);
			}
			GameObject val = Object.Instantiate<GameObject>(selectedPrefab);
			if (PluginConfig.IsModEnabled.Value && flag)
			{
				selectedPrefab.SetActive(true);
				PlacementGhostUtils.DestroyActiveComponents(val);
				val.SetActive(true);
			}
			return val;
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetupPlacementGhost")]
		private static void SetupPlacementGhostPrefix()
		{
			PotteryManager.IsPlacingPiece = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetupPlacementGhost")]
		private static void SetupPlacementGhostPostfix()
		{
			PotteryManager.IsPlacingPiece = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("CheckCanRemovePiece")]
		private static void CheckCanRemovePostfix(Piece piece, ref bool __result)
		{
			if (__result)
			{
				if (PotteryManager.IsShopPiece(piece))
				{
					__result = piece.IsCreator();
				}
				else if (PotteryManager.IsVanillaPiece(piece))
				{
					__result = piece.IsPlacedByPlayer();
				}
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch("PlacePiece")]
		private static IEnumerable<CodeInstruction> PlacePieceTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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_003b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			List<Label> labels;
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(WearNTear), "OnPlaced", (Type[])null, (Type[])null), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldarg_S, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null)
			}).Advance(1)
				.ExtractLabels(out labels)
				.Insert((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldloc_0, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PotteryManager), "PlacePieceDoAttackPreDelegate", (Type[])null, (Type[])null))
				})
				.AddLabels((IEnumerable<Label>)labels)
				.InstructionEnumeration();
		}

		[HarmonyPrefix]
		[HarmonyPatch("PlacePiece")]
		private static void PlacePiecePrefix()
		{
			PotteryManager.IsPlacingPiece = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("PlacePiece")]
		private static void PlacePiecePostfix()
		{
			PotteryManager.IsPlacingPiece = false;
		}
	}
	public static class PluginConfig
	{
		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod (restart required).");
		}
	}
	public static class PieceExtensions
	{
		public static Piece SetCanBeRemoved(this Piece piece, bool canBeRemoved)
		{
			piece.m_canBeRemoved = canBeRemoved;
			return piece;
		}

		public static Piece SetCategory(this Piece piece, PieceCategory pieceCategory)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			piece.m_category = pieceCategory;
			return piece;
		}

		public static Piece SetComfort(this Piece piece, int comfort)
		{
			piece.m_comfort = comfort;
			return piece;
		}

		public static Piece SetCraftingStation(this Piece piece, CraftingStation craftingStation)
		{
			piece.m_craftingStation = craftingStation;
			return piece;
		}

		public static Piece SetGroundOnly(this Piece piece, bool groundOnly)
		{
			piece.m_groundOnly = groundOnly;
			return piece;
		}

		public static Piece SetName(this Piece piece, string name)
		{
			piece.m_name = name;
			return piece;
		}

		public static Piece SetResources(this Piece piece, params Requirement[] requirements)
		{
			piece.m_resources = requirements;
			return piece;
		}

		public static Piece SetTargetNonPlayerBuilt(this Piece piece, bool canTarget)
		{
			piece.m_targetNonPlayerBuilt = canTarget;
			return piece;
		}

		public static Piece ModifyResource(this Piece piece, string resourceName, int? amount = null, int? amountPerLevel = null, bool? recover = null)
		{
			if (!amount.HasValue && !amountPerLevel.HasValue && !recover.HasValue)
			{
				throw new InvalidOperationException("At least one of the optional parameters must be specified!");
			}
			Requirement resource = piece.GetResource(resourceName);
			if (amount.HasValue)
			{
				resource.m_amount = amount.Value;
			}
			if (amountPerLevel.HasValue)
			{
				resource.m_amountPerLevel = amountPerLevel.Value;
			}
			if (recover.HasValue)
			{
				resource.m_recover = recover.Value;
			}
			return piece;
		}

		public static Requirement GetResource(this Piece piece, string resourceName)
		{
			Requirement[] resources = piece.m_resources;
			foreach (Requirement val in resources)
			{
				if (((Object)val.m_resItem).name == resourceName)
				{
					return val;
				}
			}
			throw new InvalidOperationException("No matching resource '" + resourceName + "' for Piece " + piece.m_name + ".");
		}
	}
	[BepInPlugin("redseiko.valheim.potterybarn", "PotteryBarn", "1.19.0")]
	[BepInDependency("com.jotunn.jotunn", "2.21.3")]
	public sealed class PotteryBarn : BaseUnityPlugin
	{
		public const string PluginGuid = "redseiko.valheim.potterybarn";

		public const string PluginName = "PotteryBarn";

		public const string PluginVersion = "1.19.0";

		private void Awake()
		{
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			PieceManager.OnPiecesRegistered += PotteryManager.AddPieces;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.potterybarn");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[EditorBrowsable(EditorBrowsableState.Never)]
	public static class IsExternalInit
	{
	}
}
namespace ComfyLib
{
	public static class CodeMatcherExtensions
	{
		public static CodeMatcher ExtractLabels(this CodeMatcher matcher, out List<Label> labels)
		{
			labels = new List<Label>(matcher.Labels);
			matcher.Labels.Clear();
			return matcher;
		}
	}
	public static class ConfigFileExtensions
	{
		internal sealed class ConfigurationManagerAttributes
		{
			public Action<ConfigEntryBase> CustomDrawer;

			public bool? Browsable;

			public bool? HideDefaultButton;

			public bool? HideSettingName;

			public bool? IsAdvanced;

			public int? Order;

			public bool? ReadOnly;
		}

		private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();

		private static int GetSettingOrder(string section)
		{
			if (!_sectionToSettingOrder.TryGetValue(section, out var value))
			{
				value = 0;
			}
			_sectionToSettingOrder[section] = value - 1;
			return value;
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = null,
					HideDefaultButton = hideDefaultButton,
					HideSettingName = hideSettingName,
					IsAdvanced = isAdvanced,
					Order = GetSettingOrder(section),
					ReadOnly = readOnly
				}
			}));
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = customDrawer,
					HideDefaultButton = hideDefaultButton,
					HideSettingName = hideSettingName,
					IsAdvanced = isAdvanced,
					Order = GetSettingOrder(section),
					ReadOnly = readOnly
				}
			}));
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
		{
			configEntry.SettingChanged += delegate
			{
				settingChangedHandler();
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}

		public static string[] GetStringValues(this ConfigEntry<string> configEntry)
		{
			return configEntry.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
		}
	}
	public static class ChatExtensions
	{
		public static void AddMessage(this Chat chat, object obj)
		{
			if (Object.op_Implicit((Object)(object)chat))
			{
				((Terminal)chat).AddString($"{obj}");
				chat.m_hideTimer = 0f;
			}
		}
	}
	public static class ObjectExtensions
	{
		public static T FirstByNameOrThrow<T>(this T[] unityObjects, string name) where T : Object
		{
			foreach (T val in unityObjects)
			{
				if (((Object)val).name == name)
				{
					return val;
				}
			}
			throw new InvalidOperationException($"Could not find Unity object of type {typeof(T)} with name: {name}");
		}

		public static T Ref<T>(this T unityObject) where T : Object
		{
			if (!Object.op_Implicit((Object)(object)unityObject))
			{
				return default(T);
			}
			return unityObject;
		}
	}
	public static class ReflectionUtils
	{
		public const BindingFlags AllBindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty;

		public static MethodInfo GetGenericMethod(Type type, string name, int genericParameterCount, Type[] types)
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.IsGenericMethod && methodInfo.ContainsGenericParameters && methodInfo.Name == name && HasMatchingParameterTypes(genericParameterCount, types, methodInfo.GetParameters()))
				{
					return methodInfo;
				}
			}
			return null;
		}

		private static bool HasMatchingParameterTypes(int genericParameterCount, Type[] types, ParameterInfo[] parameters)
		{
			if (parameters.Length < genericParameterCount || parameters.Length != types.Length)
			{
				return false;
			}
			int num = 0;
			for (int i = 0; i < parameters.Length; i++)
			{
				if (parameters[i].ParameterType.IsGenericParameter)
				{
					num++;
				}
				else if (types[i] != parameters[i].ParameterType)
				{
					return false;
				}
			}
			if (num != genericParameterCount)
			{
				return false;
			}
			return true;
		}
	}
}