Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mob_rooms #157

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion biomes/abstract/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ features:
underwater-flora:
- KELP
- CLINGING_KELP
- SEAGRASS
- SEAGRASS
landforms:
- MOB_ROOMS
22 changes: 22 additions & 0 deletions features/misc/mob_rooms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
id: MOB_ROOMS
type: FEATURE

distributor:
type: PADDED_GRID
width: 20
padding: 75
salt: 8669

locator:
type: AND
locators:
- type: RANDOM
height: &range
min: 0
max: 1
amount: 1

structures:
distribution:
type: CONSTANT
structures: mob_room
83 changes: 83 additions & 0 deletions structures/misc/mob_room/mob_room.tesf
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
num searchRadius = 5;
bool spawnable = true;

for (num x = -searchRadius; x <= searchRadius; x = x + 1) {
for (num y = 0; y <= 100; y = y + 1) {
for (num z = -searchRadius; z <= searchRadius; z = z + 1) {
if (getBlock(x,y,z) == "minecraft:air" &&
getBlock(x,y+1,z) == "minecraft:air" &&
getBlock(x,y-1,z) != "minecraft:air") {

spawnable = true;

if (spawnable == true && getBlock(1,0,0) != "minecraft:air") {
for (num i = 1; i <= 13; i = i + 1) {
if (spawnable == false) break;
for (num j = -6; j <= 6; j = j + 1) {
if (getBlock(i+x,y,j+z) == "minecraft:air") spawnable = false;
if (getBlock(i+x,6+y,j+z) == "minecraft:air") spawnable = false;
}
}

if (spawnable == true) {
structure(7+x,y,z,"mob_room_east_sc","NONE");
structure(7+x,3+y,z,"spawner_state","NONE");
fail;
}
spawnable = true;
}

if (spawnable == true && getBlock(-1,0,0) != "minecraft:air") {
for (num i = 1; i <= 13; i = i + 1) {
if (spawnable == false) break;
for (num j = -6; j <= 6; j = j + 1) {
if (getBlock(-i+x,y,-j+z) == "minecraft:air") spawnable = false;
if (getBlock(-i+x,6+y,-j+z) == "minecraft:air") spawnable = false;
}
}

if (spawnable == true) {
structure(-7+x,y,z,"mob_room_west_sc","NONE");
structure(-7+x,3+y,z,"spawner_state","NONE");
fail;
}
spawnable = true;
}

if (spawnable == true && getBlock(0,0,1) != "minecraft:air") {
for (num i = 1; i <= 13; i = i + 1) {
if (spawnable == false) break;
for (num j = -6; j <= 6; j = j + 1) {
if (getBlock(j+x,y,i+z) == "minecraft:air") spawnable = false;
if (getBlock(j+x,6+y,i+z) == "minecraft:air") spawnable = false;
}
}

if (spawnable == true) {
structure(x,y,7+z,"mob_room_south_sc","NONE");
structure(x,3+y,7+z,"spawner_state","NONE");
fail;
}
spawnable = true;
}

if (spawnable == true && getBlock(0,0,-1) != "minecraft:air") {
for (num i = 1; i <= 13; i = i + 1) {
if (spawnable == false) break;
for (num j = -6; j <= 6; j = j + 1) {
if (getBlock(-j+x,y,-i+z) == "minecraft:air") spawnable = false;
if (getBlock(-j+x,6+y,-i+z) == "minecraft:air") spawnable = false;
}
}

if (spawnable == true) {
structure(x,y,-7+z,"mob_room_north_sc","NONE");
structure(x,3+y,-7+z,"spawner_state","NONE");
fail;
}
spawnable = true;
}
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions structures/misc/mob_room/spawner_state.tesf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
num random = randomInt(3);
if (random == 0) state(0, 0, 0,"type=minecraft:zombie");
if (random == 1) state(0, 0, 0,"type=minecraft:skeleton");
if (random == 2) state(0, 0, 0,"type=minecraft:spider");