Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
GrassBlock.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
5 public class GrassBlock : CubeBlock {
6 public static int Index = 8;
7
8 public override int GetFaceTextureSlot(int face, int value) {
9 switch (face) {
10 case 4: return 0;
11 case 5: return 2;
12 default:
13 if (Terrain.ExtractData(value) == 0) {
14 return 3;
15 }
16 return 68;
17 }
18 }
19
20 public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer,
21 int value,
22 Color color,
23 float size,
24 ref Matrix matrix,
25 DrawBlockEnvironmentData environmentData) {
26 Color topColor = color * BlockColorsMap.Grass.Lookup(environmentData.Temperature, environmentData.Humidity);
28 primitivesRenderer,
29 value,
30 new Vector3(size),
31 ref matrix,
32 color,
33 topColor,
34 environmentData
35 );
36 }
37
38 public override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z) {
39 Color topColor = BlockColorsMap.Grass.Lookup(generator.Terrain, x, y, z);
40 Color topColor2 = BlockColorsMap.Grass.Lookup(generator.Terrain, x + 1, y, z);
41 Color topColor3 = BlockColorsMap.Grass.Lookup(generator.Terrain, x + 1, y, z + 1);
42 Color topColor4 = BlockColorsMap.Grass.Lookup(generator.Terrain, x, y, z + 1);
43 generator.GenerateCubeVertices(
44 this,
45 value,
46 x,
47 y,
48 z,
49 1f,
50 1f,
51 1f,
52 1f,
54 topColor,
55 topColor2,
56 topColor3,
57 topColor4,
58 -1,
59 geometry.OpaqueSubsetsByFace
60 );
61 }
62
64 Vector3 position,
65 int value,
66 float strength) => new(subsystemTerrain, position, strength, DestructionDebrisScale, Color.White, 2);
67
68 public override bool IsSuitableForPlants(int value, int plantValue) => true;
69 }
70}
Engine.Vector3 Vector3
static BlockColorsMap Grass
Color Lookup(int temperature, int humidity)
virtual void GenerateCubeVertices(Block block, int value, int x, int y, int z, Color color, TerrainGeometrySubset[] subsetsByFace)
float DestructionDebrisScale
static void DrawCubeBlock(PrimitivesRenderer3D primitivesRenderer, int value, Vector3 size, ref Matrix matrix, Color color, Color topColor, DrawBlockEnvironmentData environmentData)
override BlockDebrisParticleSystem CreateDebrisParticleSystem(SubsystemTerrain subsystemTerrain, Vector3 position, int value, float strength)
override bool IsSuitableForPlants(int value, int plantValue)
override void GenerateTerrainVertices(BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
override int GetFaceTextureSlot(int face, int value)
TerrainGeometrySubset[] OpaqueSubsetsByFace
static int ExtractData(int value)
static Color White