Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MilkBucketBlock.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
5 public class MilkBucketBlock : BucketBlock {
6 public static int Index = 110;
7
9
10 public override void Initialize() {
11 Model model = ContentManager.Get<Model>("Models/FullBucket");
12 Matrix boneAbsoluteTransform = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Bucket").ParentBone);
13 Matrix boneAbsoluteTransform2 = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Contents").ParentBone);
14 m_standaloneBlockMesh.AppendModelMeshPart(
15 model.FindMesh("Contents").MeshParts[0],
16 boneAbsoluteTransform2 * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f),
17 false,
18 false,
19 false,
20 false,
22 );
23 m_standaloneBlockMesh.TransformTextureCoordinates(Matrix.CreateTranslation(0.9375f, 0f, 0f));
24 m_standaloneBlockMesh.AppendModelMeshPart(
25 model.FindMesh("Bucket").MeshParts[0],
26 boneAbsoluteTransform * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f),
27 false,
28 false,
29 false,
30 false,
32 );
33 base.Initialize();
34 }
35
36 public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer,
37 int value,
38 Color color,
39 float size,
40 ref Matrix matrix,
41 DrawBlockEnvironmentData environmentData) {
42 BlocksManager.DrawMeshBlock(primitivesRenderer, m_standaloneBlockMesh, color, 2f * size, ref matrix, environmentData);
43 }
44
45 public override int GetDamageDestructionValue(int value) => 245;
46 }
47}
ModelMesh FindMesh(string name, bool throwIfNotFound=true)
ReadOnlyList< ModelMeshPart > MeshParts
static float DegToRad(float degrees)
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)
override int GetDamageDestructionValue(int value)
override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
static Color White
static Matrix CreateTranslation(float x, float y, float z)
static Matrix CreateRotationY(float radians)