| Fix critical animation particles not displaying (#6876)
| 6 个月前 |
| Fully generated registry accessor classes (#6905)
This is a new take on RegistryTrait.
While this is a major change internally, outwardly it should work exactly the same for the vast majority of plugins.
However, any plugins that were using reflection to mess with Vanilla* (e.g. to override blocks) will break due to internal design changes.
Compared to RegistryTrait, this has various advantages:
- Performance
- simple (non-cloning) registry accessors such as VanillaEffects are over 300% faster
- cloning registry accessors like VanillaItems are 30-40% faster
- registry accessors are now regular functions instead of using __callStatic(), meaning that JIT and Opcache optimizations can improve their performance even further
- Robustness
- while the member values of registries can still be tampered with via reflection, their types are now strictly enforced, which forces plugins to use a class that matches the original type if they want to e.g. hack in a custom class for a block
- plugins cannot add new registry cases via reflection, making it clear that these are not meant to be modified
- Separation of gencode from source code: this makes it clearer to contributors which files are not to be touched
- Doxygen can now understand VanillaBlocks et al and generate proper docs entries, since it didn't understand the @method tags used previously
How it works:
- A class extending RegistrySource is declared
- Members are declared in setup() as before, using register() or registerDelayed() depending on the needs of the code
- build/generate-registry-interface.php src generated
- Generated classes with many functions and initialization logic are placed in the generated/ folder
- When first accessed, the generated class invokes YourRegistrySource->setup() to get the values to assign to its internal members
The main downside to this change is that the generated registry accessor class cannot have custom code added to it. This pattern was never used by PocketMine-MP, but grepPlugins reveals that plugin developers sometimes add custom utility functions to RegistryTrait-using classes, which is not possible with this new system. However, this seems like a small price to pay for the major improvements this system enables. Such functions can always be moved to a separate utility class. This might be revisited in the future if there's a demand for custom functions on the generated output class.
This change also opens the potential for allowing proper overrides of blocks and items, since the gencode is able to enforce class types and ensure type compatibility with code using these functions. I'm not sure if this is something we'll actually allow, but it's a lot less work to safely allow it with this design than with the legacy RegistryTrait. RegistryTrait would have had to do manual type verification, while this design just works like normal code.
There are some minor caveats with this approach, however. Since the accessor functions don't necessarily exist during setup() (as it may be called during codegen), anything that wants to access something via a generated registry interface must use registerDelayed() instead of register(). This is seen in a few places in VanillaItems where items need to reference VanillaBlocks. In this case, the type of the generated registry accessor is based on the return type of the closure given to registerDelayed(), instead of being taken directly from the value. This allows the gencode script to operate without fully initializing the registry, which would cause a circular dependency problem.
TLDR: New registry system, much fast, big improve, many robust, very wow! | 4 个月前 |
| Duct tape for flagged-for-despawn player entities responding to actions
we'll have to fix this properly in the future, but the proper fix requires a significant behavioural change which is way too risky for a patch release. This will do for now.
| 4 个月前 |
| Implement Lingering potion & Area Effect Cloud (#5276)
Co-authored-by: Dylan T. <dktapps@pmmp.io> | 7 个月前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Eliminate weak comparisons in entity package
Weak comparisons were used in cases when we were worried about comparing int and float.
In some cases (particularly involving Vector3) we do need to be wary of this, so floatval() is used to avoid incorrect type comparisons.
In other cases, we were already exclusively comparing float-float, so weak compare wasn't needed anyway.
| 1 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Added NeverSavedWithChunkEntity interface
closes #6809
turns out we can actually use this for players too.
we need this also for fireworks and probably lightning in the future.
| 7 个月前 |
| Updated NBT library to get new ListTag handling features
| 7 个月前 |
| Implement Lingering potion & Area Effect Cloud (#5276)
Co-authored-by: Dylan T. <dktapps@pmmp.io> | 7 个月前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| ExperienceManager: remove superfluous doc comment
| 3 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Allow eating in creative & peaceful
closes #5923
closes #6056
| 1 年前 |
| Avoid unnecessary data loss on invalid items in inventories
we were already doing this in some places but not others. So inconsistent...
while this doesn't fix the root cause of #5128, it should nonetheless fix #5128
as well as not destroying player data on unknown items, which was a frequent
annoyance when switching between branches during PR testing.
| 7 个月前 |
| Allow eating in creative & peaceful
closes #5923
closes #6056
| 1 年前 |
| Use PHP-CS-Fixer to enforce file header presence
| 3 年前 |
| Implemented infinite effects (#6866)
The problem is that we need to ensure an updating ticker for periodic effects to continue
working correctly, but those are typically implemented using the duration ticker.
We don't want to BC break anyone implementing custom effects in PM5, so this is the best
we can do for now.
In this implementation, durations will underflow back to Limits::INT32_MAX when they
would have expired, ensuring a continuous counter. This might cause unexpected behaviour
for consumers of the API, but I don't see another viable solution for PM5.
Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io> | 6 个月前 |
| Eliminate weak comparisons in entity package
Weak comparisons were used in cases when we were worried about comparing int and float.
In some cases (particularly involving Vector3) we do need to be wary of this, so floatval() is used to avoid incorrect type comparisons.
In other cases, we were already exclusively comparing float-float, so weak compare wasn't needed anyway.
| 1 年前 |
| Added NeverSavedWithChunkEntity interface
closes #6809
turns out we can actually use this for players too.
we need this also for fireworks and probably lightning in the future.
| 7 个月前 |
| Skin: Correctly handle errors produced by commented JSON decoder
| 3 年前 |
| Fix entity AABB size mismatch with vanilla (#6841)
| 7 个月前 |
| Fix entity AABB size mismatch with vanilla (#6841)
| 7 个月前 |
| Merge branch 'next-minor' into next-major
| 3 年前 |
| Fix entity AABB size mismatch with vanilla (#6841)
| 7 个月前 |