Skip to content

Commit

Permalink
Fix generator does not generate blocks and mobs is not spawning
Browse files Browse the repository at this point in the history
  • Loading branch information
HirziDevs committed Jun 22, 2024
1 parent 01a70ad commit bc0dbd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function Generator(generatorBlock, gamemode, tool) {
}
}

selectedBlock = blocks.filter(block => block.chance === selectedBlock)[Math.floor(Math.random() * blocks.filter(block => block.chance === selectedBlock).length)]
selectedBlock = blocks.filter(block => block.chance === selectedBlock)[Math.floor(Math.random() * blocks.filter(block => block.chance === selectedBlock).length)].identifier

config.delay = config.delay < 0 ? 0.1 : config.delay;
system.runTimeout(() => {
Expand All @@ -232,7 +232,7 @@ function Generator(generatorBlock, gamemode, tool) {
}
}

selectedMob = mobs.filter(mob => mob.chance === selectedMob)[Math.floor(Math.random() * mobs.filter(mob => mob.chance === selectedMob).length)]
selectedMob = mobs.filter(mob => mob.chance === selectedMob)[Math.floor(Math.random() * mobs.filter(mob => mob.chance === selectedMob).length)].identifier

system.runTimeout(() => {
if (selectedMob !== "nothing") dimension.runCommand(`summon ${selectedMob} ${location.x} ${location.y + 1} ${location.z}`);
Expand Down

0 comments on commit bc0dbd3

Please sign in to comment.