Skip to content

Commit

Permalink
Merge pull request #157 from DeathShadez/2.0
Browse files Browse the repository at this point in the history
Add mob_rooms
  • Loading branch information
justaureus committed Apr 1, 2024
2 parents 3a47255 + 31a3efc commit f774873
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 1 deletion.
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");

0 comments on commit f774873

Please sign in to comment.