this has already been seen to cause duplication bugs when thorns is used. Anything else that modifies inventory during applyPostDamageEffects() when the mob is possibly dead will also cause duplication issues.
This allows controlling how arrows are picked up:
- by anything
- by only creative players
- by nothing
This adds new API methods to Arrow:
- getPickupMode()
- setPickupMode()
This adds new public constants to Arrow:
- PICKUP_NONE
- PICKUP_ANY
- PICKUP_CREATIVE
PhpStorm can't see these or understand how they are being called, which is very annoying for bug hunting. Additionally, we already have the CodeOptimizer for this.
* Implemented InventoryEventProcessor, fixes#1986
Event processors can now be registered and unregistered at will. Entity inventory/armor change events are now handled by event processors instead of the inventories themselves, which allows enabling/disabling the calling of these events at will.
This now avoids stupid things happening when initializing inventory contents, since the callers for those events are now registered _after_ the contents are initialized.
Once upon a time, these userland functions were faster than calling builtins, but not anymore. According to my test the Math functions are twice slower in PHP 7.2 with typehints and 50% slower without typehints.
Inlining is slightly faster than using builtins, but the difference is very small - not worth making the code look any more ugly than it does already.
Totem usage can be detected using the MODIFIER_TOTEM constant of EntityDamageEvent.
This does not currently support using the totem in the offhand because offhand is not implemented yet.
The general purpose of this is to split up base damage from modifiers.
- Added methods getBaseDamage(), setBaseDamage(), getOriginalBaseDamage(), getModifiers(), getOriginalModifiers()
- setDamage() renamed to setModifier() and type is now mandatory
- getDamage() renamed to getModifier() and type is now mandatory
- getOriginalDamage() renamed to getOriginalModifier() and type is now mandatory
- Removed MODIFIER_BASE constant
- Constructors now accept: float baseDamage, float[] modifiers instead of just float[] modifiers
ArrayOutOfBoundsException is not thrown by SPL anymore since the exception handler throwing it was removed by @shoghicp. Regardless, it seems cleaner to to check it properly.
this happens when a player respawns before their death animation ends. I don't know why, but their bounding box height suddenly becomes zero. This solves the bug by simply resending the height and width properties to viewers on respawn.
Closes#2135.