Skip to content

Commit f0848d7

Browse files
committed
Better Bee spawning
1 parent 51b3aed commit f0848d7

3 files changed

Lines changed: 32 additions & 16 deletions

File tree

structures/misc/bee-nest/bee_nest.tesf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
num dir = randomInt(4);
1+
num randomDir = randomInt(4);
22
num x = 0;
33
num z = 0;
44
str face = "west";
5-
num bees = 2 + randomInt(2);
5+
num randomBees = 2 + randomInt(2);
66

7-
if (dir == 0) {
7+
if (randomDir == 0) {
88
face = "west";
99
x = -1;
1010
z = 0;
11-
} else if (dir == 1) {
11+
} else if (randomDir == 1) {
1212
face = "north";
1313
x = 0;
1414
z = -1;
15-
} else if (dir == 2) {
15+
} else if (randomDir == 2) {
1616
face = "east";
1717
x = 1;
1818
z = 0;
19-
} else if (dir == 3) {
19+
} else if (randomDir == 3) {
2020
face = "south";
2121
x = 0;
2222
z = 1;
2323
}
2424

25+
num randomBeesMinusOne = randomBees - 1;
2526
str bee_data = "{bees:[";
26-
for (num i = 0; i < bees; i = i + 1) {
27+
for (num i = 0; i < randomBees; i = i + 1) {
2728
str bee = "{entity_data:{id:\"minecraft:bee\"},min_ticks_in_hive:" + (i * 150) + ",ticks_in_hive:0}";
2829
bee_data = bee_data + bee;
29-
if (i < bees - 1) {
30+
if (i < randomBeesMinusOne) {
3031
bee_data = bee_data + ",";
3132
}
3233
}

structures/misc/bee-nest/bee_nest_block.tesf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
str direction = "west";
22
num randomDir = randomInt(4);
33
num randomHon = randomInt(6);
4+
num randomBees = randomInt(101);
5+
6+
if (randomBees >= 85) {
7+
randomBees = 3;
8+
} else {
9+
randomBees = 0;
10+
}
411

512
if (randomDir == 0) {
613
direction = "west";
@@ -12,4 +19,19 @@ if (randomDir == 0) {
1219
direction = "north";
1320
}
1421

15-
block(0, 0, 0,"minecraft:bee_nest[facing="+ direction +",honey_level="+ randomHon +"]", true);
22+
str bee_data = "";
23+
24+
if (randomBees > 0) {
25+
num randomBeesMinusOne = randomBees - 1;
26+
bee_data = "{bees:[";
27+
for (num i = 0; i < randomBees; i = i + 1) {
28+
str bee = "{entity_data:{id:\"minecraft:bee\"},min_ticks_in_hive:" + (i * 150) + ",ticks_in_hive:0}";
29+
bee_data = bee_data + bee;
30+
if (i < randomBeesMinusOne) {
31+
bee_data = bee_data + ",";
32+
}
33+
}
34+
bee_data = bee_data + "]}";
35+
}
36+
37+
block(0, 0, 0, "minecraft:bee_nest[facing="+ direction +",honey_level="+ randomHon +"]" + bee_data, true);

structures/misc/bee-nest/large_bee_nest.tesf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ for (num x = -radius-warp; x < radius+warp; x = x + 1) {
3838
}
3939
}
4040

41-
entity(0, yTranslate + 10, 0, "minecraft:bee");
42-
entity(0, yTranslate + 10, 0, "minecraft:bee");
43-
entity(0, yTranslate + 10, 0, "minecraft:bee");
44-
entity(0, yTranslate + 10, 0, "minecraft:bee");
45-
entity(0, yTranslate + 10, 0, "minecraft:bee");
46-
47-
4841
structure(3-randomInt(7), 15, 3-randomInt(7), "honey_comb", "NONE");
4942
structure(3-randomInt(7), 15, 3-randomInt(7), "honey_comb", "NONE");
5043
structure(3-randomInt(7), 15, 3-randomInt(7), "honey_comb", "NONE");

0 commit comments

Comments
 (0)