Dylan K. Taylor
4f8f334436
Replaced usages of Math::floorFloat() with (int) floor() and Math::ceilFloat() with (int) ceil()
...
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.
2018-05-28 18:54:35 +01:00
Dylan K. Taylor
74c0863905
Living: fixed preventing effect expiry using events, closes #2208
2018-05-28 17:14:18 +01:00
Dylan K. Taylor
c18ba38b74
Entity: avoid astonishing behaviour with motion vector modifications
2018-05-26 10:40:04 +01:00
Dylan K. Taylor
02b53785be
Entity: added some new ID constants
2018-05-24 12:39:44 +01:00
Dylan K. Taylor
9dd0ee7f05
Entity: replaced motion and lastMotion fields with vectors
2018-05-24 12:11:41 +01:00
Dylan K. Taylor
595f1f58da
Living: added knockback resistance attribute checks
2018-05-24 11:49:18 +01:00
Dylan K. Taylor
fbf760bafe
Enchantment: implemented Vanishing
2018-05-23 17:23:56 +01:00
Dylan K. Taylor
acf29711c2
Implemented Totems, close #2198
...
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.
2018-05-23 10:06:35 +01:00
Dylan K. Taylor
faa88a55e4
EntityDamageEvent: break API
...
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
2018-05-22 19:05:25 +01:00
Dylan K. Taylor
adb9390b53
Entity: Rename isInsideOfWater() to isUnderwater()
2018-05-19 18:10:43 +01:00
Dylan K. Taylor
6111ce7df1
Human: don't hardcode max food
2018-05-19 16:48:21 +01:00
Dylan K. Taylor
1f73c08762
Human: fix possible bug with food ticking
...
it updates it but doesn't take note of the updated value, which could cause the code below to be erroneously triggered.
2018-05-19 16:47:04 +01:00
Dylan K. Taylor
2900167ffa
Human: removed redundant isSprinting() check from doFoodTick()
...
this is checked in setSprinting() anyway.
2018-05-19 16:33:13 +01:00
Dylan K. Taylor
11cc9f19ad
Human: replace hardcoded difficulty values with constants in doFoodTick()
2018-05-19 16:32:30 +01:00
Dylan K. Taylor
807af2e6fb
Human: change doFoodTick() visibility to protected
2018-05-19 16:30:41 +01:00
Dylan K. Taylor
0bb5e88b5c
Hinting up Entity API to PHP 7.2 standards
2018-05-19 10:46:47 +01:00
Dylan K. Taylor
389990e0a8
Entity: remove useless functions
...
these may be TODOs but I have no idea why or where they need to be implemented, so until they do they are useless clutter.
2018-05-18 20:09:55 +01:00
Dylan K. Taylor
d8dc89e7c8
EnderChestInventory: Removed unnecessary owner parameter
2018-05-18 16:46:48 +01:00
Dylan K. Taylor
c285295037
Merge branch 'release/alpha12'
2018-05-17 18:40:24 +01:00
Dylan K. Taylor
5c66c615bf
Living: fix possible crash in getTargetBlock()
...
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.
2018-05-09 17:11:37 +01:00
Dylan K. Taylor
dd1dfefd83
ItemEntity: remove unnecessary damage types restrictions
...
Invalid damage types are all restricted by other means anyway. This fixes items not getting killed by fire (close #2143 ) and cacti.
2018-05-04 22:57:28 +01:00
Dylan K. Taylor
8b225fc4ef
New entity metadata flags and properties
2018-05-02 12:03:29 +01:00
Dylan K. Taylor
646455f6e8
fixed painting particles, removed DestroyParticle
...
it didn't last long because they changed how this works... yuk
2018-04-09 16:26:15 +01:00
Dylan K. Taylor
05a1e61e5b
Painting: polyfill height and width
2018-04-09 16:20:46 +01:00
SleepSpace9
47faf5a994
Human: Add support for 128x128 skins in isValidSkin() ( #2140 )
2018-04-07 09:00:08 +01:00
Dylan K. Taylor
c06c1c7ce0
Human: Added a hack for nametags
...
Apparently NAMETAG metadata is useless in AddPlayerPacket now, so it has to be sent separately.
2018-04-05 11:56:44 +01:00
Dylan K. Taylor
a889a0e517
Workaround for player hitbox bug on respawn
...
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 .
2018-04-04 20:11:16 +01:00
Dylan K. Taylor
9ed0d9d36f
added some data properties
2018-04-04 19:40:12 +01:00
Dylan K. Taylor
5b7b2dd0e2
Merge changes from ALPHA11 for 1.2.13
2018-04-04 11:31:39 +01:00
Frago9876543210
42d04a4418
Allow use of 128x128 skins for last beta build ( #2123 )
2018-04-04 11:03:51 +01:00
Dylan K. Taylor
526f05631e
fix metadata properties for new beta
...
there are more things than this, but I don't have time to figure them all out.
2018-04-04 11:03:05 +01:00
Dylan K. Taylor
5ce55bd3b0
duct tape for block ID remapping
2018-04-04 11:00:39 +01:00
Dylan K. Taylor
1fc388d6de
DataPropertyManager: fix an unnecessary FQN
2018-04-02 12:34:05 +01:00
Dylan K. Taylor
d4d57aa9ea
Merge branch 'feature/xp-event'
2018-03-30 12:46:53 +01:00
Dylan K. Taylor
4b03dbebba
Entity: use temporalVector in checkBlockCollision() instead of creating a new Vector3
2018-03-30 12:21:37 +01:00
Dylan K. Taylor
1d5978df98
Fixed falling blocks getting moved by currents, closes #2080
2018-03-30 12:20:59 +01:00
Dylan K. Taylor
c20b16a0fe
Living: fixed damage resistance negating >100% of damage, closes #2052
2018-03-30 11:31:43 +01:00
Dylan K. Taylor
c0c684b12e
Removed the need for paintings to check for destruction on schedule
...
Since we have a mechanism for triggering things on entities anyway, make use of it to do more than just forcing movement updates.
2018-03-25 13:15:10 +01:00
Dylan K. Taylor
924334a776
Painting: fixed performance bug, close #2117
2018-03-25 13:06:02 +01:00
Dylan K. Taylor
eb9f60f41c
Entity: some minor cleanup to constructor
2018-03-24 11:52:23 +00:00
Dylan K. Taylor
1648fff916
Replaced Position->getLevel() null checks with isValid()
2018-03-20 11:10:36 +00:00
Dylan K. Taylor
73e09392b6
Timings: Clean up some terrible code, move namespaces
2018-03-19 19:05:51 +00:00
Dylan K. Taylor
ac5a91b67e
Cleaned up bool comparison mess
2018-03-19 14:10:55 +00:00
Dylan K. Taylor
fa644edef3
Entity: removed redundant return values for move()
2018-03-14 13:39:23 +00:00
Dylan K. Taylor
ddc9dca8b4
Player: fixed being able to eat cake in creative
...
closes #2070
2018-03-13 18:32:08 +00:00
Dylan K. Taylor
cd35bd6872
git diff-tree --check $(git hash-object -t tree /dev/null) HEAD
2018-03-11 10:31:25 +00:00
Dylan K. Taylor
d09a43cfef
Added PlayerExperienceChangeEvent
2018-03-10 20:04:36 +00:00
Dylan K. Taylor
8a86e0825b
Entity: Moved PrimedTNT and FallingSand to object\PrimedTNT and object\FallingBlock
2018-03-10 16:25:07 +00:00
Dylan K. Taylor
b39bbffdc5
Entity: Moved and renamed entity\Item to entity\object\ItemEntity
2018-03-10 12:36:46 +00:00
Dylan K. Taylor
ad09e8c8d0
Implemented Bottle o' Enchanting
2018-03-10 10:53:03 +00:00