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

Using integer arithmetic in per chunk spawn amount adjustments results in unexpected behaviour #197

Closed
sam-kirby opened this issue Jun 27, 2020 · 0 comments

Comments

@sam-kirby
Copy link

sam-kirby commented Jun 27, 2020

amountAdjuster = world -> infoAmount * InControl.setup.cache.getValidSpawnChunks(world) / 289;

Taking the following example:

{
  "mob": "minecraft:cow",
  "mincount": {
    "amount": 15,
    "perchunk": true
  },
  "result": "deny"
}

This has the unexpected consequence of denying all spawns when less than 289 chunks are loaded. Rather than being per chunk, this is per 289 chunks! This basically means that low population servers and people who reduce their view distance for performance reasons will see no mob spawning.

We intended to use this rule to scale the number of mobs based on either a player's view distance or number of players on a server so that large population servers don't feel empty, whilst preventing lower view distances increasing mob density (as would be the case for per player rules), but the unintended consequence of effectively disabling spawning when using fairly standard view distances renders it unusable.

Floating point arithmetic should probably be used here instead.

It should be noted that the default view distance on a server is 10, requiring 3 players with mostly non-overlapping chunks loaded to raise the number of chunks loaded above the threshold to allow spawning for any rules which have a min count per chunk with result deny.

Ref: DarkPacks/SevTech-Ages#4159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant