Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Commit 8d5fd24

Browse files
committed
Flowers
1 parent ca56145 commit 8d5fd24

File tree

2 files changed

+86
-4
lines changed

2 files changed

+86
-4
lines changed

VoxelData.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,5 +410,32 @@ public static class Rail
410410
{1, 3, 0, 2}, // Bottom Face
411411
};
412412
}
413+
public static class Cobweb
414+
{
415+
public static readonly Vector3[] verts = new Vector3[8] {
416+
new Vector3(0.0f, 0.0f, 0.0f), // 0
417+
new Vector3(1.0f, 0.0f, 0.0f), // 1
418+
new Vector3(1.0f, 1.0f, 0.0f), // 2
419+
new Vector3(0.0f, 1.0f, 0.0f), // 3
420+
new Vector3(0.0f, 0.0f, 1.0f), // 4
421+
new Vector3(1.0f, 0.0f, 1.0f), // 5
422+
new Vector3(1.0f, 1.0f, 1.0f), // 6
423+
new Vector3(0.0f, 1.0f, 1.0f) // 7
424+
};
425+
public static readonly int[,] tris = new int[,] {
426+
{0, 3, 5, 6},
427+
{5, 6, 0, 3},
428+
{1, 2, 4, 7},
429+
{4, 7, 1, 2},
430+
};
431+
/*public static readonly int[,] voxelTris = new int[6, 4] {
432+
{0, 3, 1, 2}, // Back Face
433+
{5, 6, 4, 7}, // Front Face
434+
{3, 7, 2, 6}, // Top Face
435+
{1, 5, 0, 4}, // Bottom Face
436+
{4, 7, 0, 3}, // Left Face
437+
{1, 2, 5, 6} // Right Face
438+
};*/
439+
}
413440
}
414441
}

World.cs

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ public static class World
6868
{ "golden_rail", new []{ "powered_rail" } },
6969
{ "redstone_lamp", new []{ "redstone_lamp_off" } },
7070
{ "lit_redstone_lamp", new []{ "redstone_lamp_on" } },
71-
{ "powered_repeater", new []{ "repeater_on", /*"redstone_torch_on"*/ } },
72-
{ "unpowered_repeater", new []{ "repeater_off", /*"redstone_torch_off"*/ } },
71+
{ "powered_repeater", new []{ "repeater_on", "redstone_torch_on" } },
72+
{ "unpowered_repeater", new []{ "repeater_off", "redstone_torch_off" } },
73+
{ "powered_comparator", new []{ "comparator_on", } },
74+
{ "unpowered_comparator", new []{ "comparator_off", } },
7375
{ "dark_oak_fence_gate", new []{ "planks_big_oak" } },
7476
{ "wheat", new []{ "wheat_stage_7" } },
7577
{ "carrots", new []{ "carrots_stage_3" } },
@@ -102,9 +104,10 @@ public static class World
102104
{ "smooth_stone", new []{ "stone_slab_top" } }, // maybe not idk
103105
// terracotta
104106
{ "white_glazed_terracotta", new []{ "glazed_terracotta_white" } },
107+
{ "red_glazed_terracotta", new []{ "glazed_terracotta_red" } },
108+
{ "black_glazed_terracotta", new []{ "glazed_terracotta_black" } },
105109
// flowers
106110
{ "yellow_flower", new []{ "flower_dandelion" } },
107-
{ "red_flower", new []{ "flower_rose" } },
108111
{ "buttercup", new []{ "flower_buttercup" } },
109112
// fence
110113
{ "fence", new []{ "planks" } },
@@ -482,6 +485,37 @@ public static class World
482485
}
483486
}
484487
},
488+
{ "red_flower", (int data) =>
489+
{
490+
int type = data & 0b_1111;
491+
switch (type) {
492+
case 0:
493+
return new [] { "flower_rose" };
494+
case 1:
495+
return new [] { "flower_blue_orchid" };
496+
case 2:
497+
return new [] { "flower_allium" };
498+
case 3:
499+
return new [] { "flower_houstonia" };
500+
case 4:
501+
return new [] { "flower_tulip_red" };
502+
case 5:
503+
return new [] { "flower_tulip_orange" };
504+
case 6:
505+
return new [] { "flower_tulip_white" };
506+
case 7:
507+
return new [] { "flower_tulip_pink" };
508+
case 8:
509+
return new [] { "flower_oxeye_daisy" };
510+
case 9:
511+
return new [] { "flower_cornflower" };
512+
case 10:
513+
return new [] { "flower_lily_of_the_valley" };
514+
default:
515+
return new [] { "flower_rose" };
516+
}
517+
}
518+
},
485519
{ "glass", (int data) =>
486520
{
487521
int type = data & 0b_1111;
@@ -1023,6 +1057,7 @@ public static class World
10231057
{ "cactus", 21 },
10241058
{ "water", 22 },
10251059
{ "rail", 25 },
1060+
{ "web", 27 },
10261061
};
10271062

10281063
public static readonly bool[] RendererIsFullBlockLookUp = new bool[]
@@ -1054,6 +1089,7 @@ public static class World
10541089
false,
10551090
false, // rail
10561091
false, // rail other
1092+
false,
10571093
};
10581094

10591095
public delegate void RenderBlock(Vector3 pos, Vector3i cp/*chunk pos, pre multiplied*/, int[] tex, int data, ref List<Vertex> vertices, ref List<uint> triangles);
@@ -1601,7 +1637,7 @@ public static class World
16011637
}
16021638

16031639
uint tex = (uint)texA[0];
1604-
uint torchTex = tex;//(uint)texA[1];
1640+
uint torchTex = (uint)texA[1];
16051641
for (int p = 0; p < 6; p++) {
16061642
uint firstVertIndex = (uint)verts.Count;
16071643
if (p == 2 || p == 3) { // top/bottom
@@ -2012,6 +2048,25 @@ public static class World
20122048
blockRenderers[25](pos, cp, texA, data, ref vertices, ref triangles);
20132049
}
20142050
},
2051+
{ 27, (Vector3 pos, Vector3i cp, int[] texA, int data, ref List<Vertex> vertices, ref List<uint> triangles) => // cobweb
2052+
{
2053+
uint tex = (uint)texA[0];
2054+
Vector3 offset = -Vector3.One / 2f;
2055+
for (int p = 0; p < 4; p++) {
2056+
uint firstVertIndex = (uint)vertices.Count;
2057+
vertices.Add(new Vertex(pos + VoxelData.voxelVerts[VoxelData.Cobweb.tris[p, 0]] + offset, VoxelData.voxelUvs[0], tex));
2058+
vertices.Add(new Vertex(pos + VoxelData.voxelVerts[VoxelData.Cobweb.tris[p, 1]] + offset, VoxelData.voxelUvs[1], tex));
2059+
vertices.Add(new Vertex(pos + VoxelData.voxelVerts[VoxelData.Cobweb.tris[p, 2]] + offset, VoxelData.voxelUvs[2], tex));
2060+
vertices.Add(new Vertex(pos + VoxelData.voxelVerts[VoxelData.Cobweb.tris[p, 3]] + offset, VoxelData.voxelUvs[3], tex));
2061+
triangles.Add(firstVertIndex);
2062+
triangles.Add(firstVertIndex + 1);
2063+
triangles.Add(firstVertIndex + 2);
2064+
triangles.Add(firstVertIndex + 2);
2065+
triangles.Add(firstVertIndex + 1);
2066+
triangles.Add(firstVertIndex + 3);
2067+
}
2068+
}
2069+
},
20152070
};
20162071

20172072
public static BuildPlate plate;

0 commit comments

Comments
 (0)