First iteration of script, finally no errors but it also doesn't work.

This commit is contained in:
2025-05-20 15:43:35 -05:00
parent a32e2004a7
commit 0723e1f299
3 changed files with 21 additions and 11 deletions

View File

@ -1,16 +1,29 @@
// priority: 0
// Visit the wiki for more info - https://kubejs.com/
/*EntityEvents.spawned(event => {
const dimrule = [
['man:managgresive','the_deep_void:deep_void'],
['man:manfromthefog','the_deep_void:deep_void'],
['man:manfromthefogback','the_deep_void:deep_void'],
['man:mftfhang','the_deep_void:deep_void']
];
EntityEvents.spawned(event => {
const { entity } = event;
// Only apply restrictions to natural spawns
if (entity.spawnReason !== 'natural') return;
switch (entity.type) {
case "entity.man.
let type = entity.type;
if (!dimrule.includes(entity.type)) {return;};
const t = findRowWithValue(dimrule, entity.type);
let d = dimrule[t][1];
if(entity.level.name != d) {event.cancel();};
});
function findRowWithValue(matrix, value) {
for (let i = 0; i < matrix.length; i++) {
if (matrix[i].includes(value)) {
return i; // Return the row index if the value is found
};
};
return -1; // Return -1 if the value is not found in any row
};
/*
@silytonta
Is there a way for me to make mobs spawn in a dimension/biome that they usually dont?

Binary file not shown.