Add option to control mob cap implementation#880
Open
Alexandra-Myers wants to merge 35 commits intosmartcmd:mainfrom
Open
Add option to control mob cap implementation#880Alexandra-Myers wants to merge 35 commits intosmartcmd:mainfrom
Alexandra-Myers wants to merge 35 commits intosmartcmd:mainfrom
Conversation
Author
|
does anyone have any suggested software for dealing with swf files? |
Author
Author
Author
I know what they are, however I don't know how to use them. |
Author
|
Okay, PR ready. |
Author
|
@codeHusky I believe now it should be ready to merge. |
Author
|
If you'd like, I can revert the changes I made to the constants (making them no longer const), as at this point they are mostly unnecessary (though I kept them for future expansion). |
This reverts commit 09a3359.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This is more or less an expansion of #789, preserving LCE functionality by default whilst letting the user remove the mob cap.
This PR introduces per-chunk caps based on Java Edition 1.8.8, as well as 4J's comments on what they changed from Java.
Changes
Previous Behavior
Previously, the limits for certain mob groups in their count was unchangeable, and the limits were enforced level wide rather than per chunk.
Root Cause
This was not erroneous but was rather a design decision to allow for better performance on the devices it ran on.
New Behavior
By default, it uses the same logic as existed before this version, however there is now an option to turn off mob caps, when true it is as follows:
Does NOT remove the mob cap for spawning, rather, breeding, spawn eggs, and construction are all unlimited, and spawning works exactly like in Java, with the base size per chunk for the mob category (leftover in original LCE code, though I edited it to keep the max count the same when one player is on) being scaled by the amount of loaded chunks and then scaled back down by a magic number (it is literally called MAGIC_NUMBER in official mappings for the modern game), which is then used as the mob cap for that category, effectively acting as the mob caps used in LCE, except more dynamic.
Fix Implementation
Stores
eGameHostOption_WorldMobCaponto game host options using the bitmask 0x40000000.Added
no-mob-capto server.properties to control it on the dedicated server.Added a checkbox to
UIScene_LaunchMoreOptionsMenufor modifying the mob cap setting.Inside of
Level::canCreateMore, added a check for ifeGameHostOption_NoMobCapis enabled, returning true early if so.Removed
MobCategory::getMaxInstancesPerLevel, its usage has been replaced withMobCategory::getMaxInstancesPerChunk.m_maxinMobCategorywas turned into a pointer as a reference for the now non-constant caps. (later can become user controlled with a better config system, ideally)Removed the
m_maxPerLevelfield fromMobCategory, instead usingm_max.Inside of
MobSpawner::tick, references tomobCategory->getMaxInstancesPerLevel()were moved to their own variable and replaced withmobCategory->getMaxInstancesPerChunk(), as now ifeGameHostOption_NoMobCapis enabled, the max instances will be updated to instead use Java's math, as so:AI Use Disclosure
No AI was used in the making of this Pull Request.
Related Issues