Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
PumpkinSoupBucketBlock.cs
浏览该文件的文档.
1using System.Globalization;
2using Engine;
4
5namespace Game {
7 public static int Index = 251;
8
10
11 public const string fName = "PumpkinSoupBucketBlock";
12
13 public override void Initialize() {
14 Model model = ContentManager.Get<Model>("Models/FullBucket");
15 Matrix boneAbsoluteTransform = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Bucket").ParentBone);
16 Matrix boneAbsoluteTransform2 = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Contents").ParentBone);
17 m_standaloneBlockMesh.AppendModelMeshPart(
18 model.FindMesh("Contents").MeshParts[0],
19 boneAbsoluteTransform2 * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f),
20 false,
21 false,
22 false,
23 false,
24 new Color(200, 130, 35)
25 );
26 m_standaloneBlockMesh.TransformTextureCoordinates(Matrix.CreateTranslation(0.0625f, 0.4375f, 0f));
27 m_standaloneBlockMesh.AppendModelMeshPart(
28 model.FindMesh("Bucket").MeshParts[0],
29 boneAbsoluteTransform * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f),
30 false,
31 false,
32 false,
33 false,
35 );
36 base.Initialize();
37 }
38
39 public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer,
40 int value,
41 Color color,
42 float size,
43 ref Matrix matrix,
44 DrawBlockEnvironmentData environmentData) {
45 BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color, 2f * size, ref matrix, environmentData);
46 }
47
48 public override int GetDamageDestructionValue(int value) => 252;
49
50 public override IEnumerable<CraftingRecipe> GetProceduralCraftingRecipes() {
51 int isDead = 0;
52 while (isDead <= 1) {
53 int num;
54 for (int rot = 0; rot <= 1; rot = num) {
55 CraftingRecipe craftingRecipe = new() {
56 ResultCount = 1, ResultValue = 251, RequiredHeatLevel = 1f, Description = LanguageControl.Get(fName, "1")
57 };
58 int data = BasePumpkinBlock.SetIsDead(BasePumpkinBlock.SetSize(0, 7), isDead != 0);
59 int value = SetDamage(Terrain.MakeBlockValue(131, 0, data), rot);
60 craftingRecipe.Ingredients[0] = $"pumpkin:{Terrain.ExtractData(value).ToString(CultureInfo.InvariantCulture)}";
61 craftingRecipe.Ingredients[1] = "waterbucket";
62 yield return craftingRecipe;
63 num = rot + 1;
64 }
65 num = isDead + 1;
66 isDead = num;
67 }
68 }
69 }
70}
ModelMesh FindMesh(string name, bool throwIfNotFound=true)
ReadOnlyList< ModelMeshPart > MeshParts
static float DegToRad(float degrees)
static int SetIsDead(int data, bool isDead)
static int SetSize(int data, int size)
virtual int SetDamage(int value, int damage)
static Matrix GetBoneAbsoluteTransform(ModelBone modelBone)
static void DrawMeshBlock(PrimitivesRenderer3D primitivesRenderer, BlockMesh blockMesh, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
static object Get(Type type, string name)
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
override int GetDamageDestructionValue(int value)
override IEnumerable< CraftingRecipe > GetProceduralCraftingRecipes()
override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
static int MakeBlockValue(int contents)
static Color White
static Matrix CreateTranslation(float x, float y, float z)
static Matrix CreateRotationY(float radians)