8 public static int Index = 203;
26 if (item.Name.LocalName ==
"ClothingData") {
27 XAttribute index = item.Attribute(
"Index");
31 int.TryParse(index.Value, out
int ClothIndex);
34 string className = item.Attribute(
"Class")?.Value ?? typeof(
ClothingData).FullName;
35 if (!
string.IsNullOrEmpty(className)) {
38#pragma warning disable IL2072
39 clothingData = (
ClothingData)Activator.CreateInstance(type, item);
40#pragma warning restore IL2072
41 if (clothingData ==
null) {
42 throw new Exception(
"ClothingData is not assignable to Game.ClothingData.");
45 catch (Exception ex) {
46 Log.
Error($
"ClothingData from class {className} create failed! {ex}");
49 if (clothingData ==
null) {
55 foreach (XElement xElement1
in item.Elements()) {
62 XElement xElement =
null;
73 foreach (
ModelMesh mesh
in playerModel.Meshes) {
76 Color color = Color.White * 0.8f;
77 color.A =
byte.MaxValue;
106 foreach (
ModelMesh mesh2
in outerClothingModel.Meshes) {
109 Color color2 = Color.White * 0.8f;
110 color2.A =
byte.MaxValue;
137 if (clothingData ==
null) {
142 if (clothingColor != 0) {
150 return clothingData ==
null ? string.Empty : clothingData.
Description;
155 return base.GetCategory(value);
166 num1 = (num1 & -3841) | ((damage & 0xF) << 8);
170 public override bool CanWear(
int value) =>
true;
181 int colorsCount = !clothingData.CanBeDyed ? 1 : 16;
183 while (color < colorsCount) {
192 if (heatLevel < 1f) {
195 List<string> list = ingredients.Where(i => !
string.IsNullOrEmpty(i)).ToList();
196 if (list.Count == 2) {
200 foreach (
string item
in list) {
227 if (num4 != clothingColor) {
235 RequiredHeatLevel = 1f,
236 Description = $
"{LanguageControl.Get("BlocksManager", "Dyed
")} {SubsystemPalette.GetName(terrain, color, null)}",
237 Ingredients = (
string[])ingredients.Clone()
254 if (clothingColor2 != 0) {
262 RequiredHeatLevel = 1f,
264 Ingredients = (
string[])ingredients.Clone()
276 clothingIndex &= 0x3FF;
277 return (data & -196864) | (clothingIndex & 0xFF) | ((clothingIndex & 0x300) << 8);
282 public static int SetClothingColor(
int data,
int color) => (data & -61441) | ((color & 0xF) << 12);
295 if (clothingData ==
null) {
ReadOnlyList< ModelBone > Bones
ModelBone FindBone(string name, bool throwIfNotFound=true)
void CopyAbsoluteBoneTransformsTo(Matrix[] absoluteTransforms)
ReadOnlyList< ModelMeshPart > MeshParts
static void Error(object message)
static int Max(int x1, int x2)
static Type FindType(string typeName, bool skipSystemAssemblies, bool throwIfNotFound)
virtual int SetDamage(int value, int damage)
virtual int GetDamage(int value)
static int DamageItem(int value, int damageCount, Entity owner=null)
static void DrawMeshBlock(PrimitivesRenderer3D primitivesRenderer, BlockMesh blockMesh, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
static Model GetOuterClothingModel(PlayerClass playerClass)
static Model GetPlayerModel(PlayerClass playerClass)
override ClothingData GetClothingData(int value)
static int SetClothingColor(int data, int color)
override IEnumerable< int > GetCreativeValues()
virtual void LoadClothingData(XElement item)
override int GetDamage(int value)
static int SetClothingIndex(int data, int clothingIndex)
override bool CanWear(int value)
override int GetDisplayOrder(int value)
override string GetDescription(int value)
static Matrix[] m_slotTransforms
override string GetCategory(int value)
override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value)
override void Initialize()
override int SetDamage(int value, int damage)
static int GetClothingIndex(int data)
override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
Dictionary< int, ClothingData > m_clothingData
static int GetClothingColor(int data)
override CraftingRecipe GetAdHocCraftingRecipe(SubsystemTerrain terrain, string[] ingredients, float heatLevel, float playerLevel)
static object Get(Type type, string name)
static void DecodeIngredient(string ingredient, out string craftingId, out int? data)
static int GetColor(int data)
static int CombineColors(int color1, int color2)
string GetName(int index)
Color GetFabricColor(int index)
static int ReplaceData(int value, int data)
static int MakeBlockValue(int contents)
static int ExtractData(int value)
static void ModListAllDo(Action< ModEntity > entity)
static Matrix CreateTranslation(float x, float y, float z)
static Matrix CreateRotationY(float radians)
static Matrix CreateScale(float scale)