[request] adding to fractions to /spawn, or ticks per spawn attempt
jayrock3000 opened this issue ยท 3 comments
I'm looking for a way to mimic the reduced spawn rates certain SMP's use (like on paper servers) for testing in carpet mod. Currently the "/spawn rates" command can increase spawn rates or turn them off, but it can't delay mob spawns to once every two ticks, or three, or six. That's basically what I'm looking for.
I wish I knew enough programming to do this myself, but I'm not even sure how to start. Maybe this can be achieved by casting spawn rates to a float or double so we could type "/spawn rates [type] 0.5" (if possible), or maybe a new command like "/spawn tick [type] [#]" that represents number of ticks inbetween spawn attempts, probably 1 by default.
I would use tick rate, except that hoppers / minecarts / etc. are then also affected.
If someone knows of another simple way to achieve this I'd sure appreciate it :)
Maybe changing the doMobSpawning
gamerule and only enabling it every so often?
To make it tick-wise and not two ticks (since command blocks are based on redstone ticks), maybe put it into a Scarpet app that you can easily control, or datapacks if they support that, which I don't really know about.
Quick Scarpet app I just wrote in the browser (tell me if it doesn't work, didn't check it):
global_enabled = false;
global_delay = 0;
disable() -> (
global_enabled = false;
print('Disabled spawning intervaling');
);
_tick() -> (
run('gamerule doMobSpawning true');
if(!global_enabled,
return();
);
schedule(1, _() -> (
run('gamerule doMobSpawning false');
schedule(global_delay, '_tick');
);
);
interval(amount_int) -> (
global_delay = amount_int;
print('Set spawning interval to ' + amount_int);
if(!global_enabled,
global_enabled = true;
_tick();
);
);
__command() -> (
print('Usage: /command disable or /command interval <amount>');
);
__config() -> {
'scope'->'global',
'legacy_command_type_support' -> true
}