826 Commits

Author SHA1 Message Date
Dylan K. Taylor
4bc0d850b1 Added Block->getRuntimeId(), clean up some mess 2018-09-19 16:16:10 +01:00
Dylan K. Taylor
c7d58db7eb Cleanup Entity age handling, fixed arrows despawning too quickly after long flight 2018-09-08 14:23:06 +01:00
Dylan K. Taylor
4cc7573a64 Merge branch 'release/3.0' into release/3.1 2018-08-22 15:40:43 +01:00
Dylan K. Taylor
9d80802e53 Living: fixed some update conditions not being set 2018-08-22 15:40:32 +01:00
Dylan K. Taylor
ec1e257e21 Entity: Fixed fire damage not taking effect in the void
this is an absurd bug that nobody would ever otherwise notice, but the problem is that the doOnFireTick() call isn't evaluated if hasUpdate is already true.
2018-08-22 15:36:31 +01:00
Dylan K. Taylor
91be5aba0c Merge branch 'release/3.0' into release/3.1 2018-08-19 16:00:25 +01:00
Dylan K. Taylor
5df601c817 Add @see docs so PhpStorm can see dynamic constructor usages
PhpStorm can't see constructor usages when the class name is dynamic. This causes maintenance problems because cross-referencing constructors called like this doesn't show up dynamic calls.
2018-08-19 16:00:15 +01:00
Dylan K. Taylor
4a1d67cb91 Merge branch 'release/3.0' into release/3.1 2018-08-17 19:47:34 +01:00
Dylan K. Taylor
b4694092b7 Painting: fix motive not being saved 2018-08-17 19:47:26 +01:00
Dylan K. Taylor
4e2387edc1 Merge branch 'release/3.0' into release/3.1 2018-08-16 15:52:12 +01:00
Frago9876543210
a5e38576ef ItemEntity: fixed using -1 for infinite pickup delay not working
closes #2382 (squash-merge)
2018-08-16 15:52:05 +01:00
Dylan K. Taylor
142a6d7678 Merge branch 'release/3.0' into release/3.1 2018-08-14 15:03:22 +01:00
Dylan K. Taylor
b2ca364de0 SplashPotion: Don't apply effects to entities which are not alive
fixes #2372
2018-08-14 15:03:15 +01:00
Dylan K. Taylor
699f35cc05 Merge branch 'release/3.0' into release/3.1 2018-08-07 18:49:06 +01:00
Dylan K. Taylor
8fa196efc9 FallingBlock: fixed state not being saved 2018-08-07 18:48:52 +01:00
Sandertv
d0339796b4 Added DATA_FLAG_SHOW_TRIDENT_ROPE 2018-07-24 17:19:06 +01:00
Dylan K. Taylor
b18872fbc6 Merge branch 'release/3.0' into release/3.1 2018-07-20 11:57:06 +01:00
Dylan K. Taylor
2b30ef1671 Revert "Living: fix knockback condition, take 2"
This reverts commit 0081e30a896a730f9598353353f6ee258803850e.

The logic introduced by this commit is correct in MC JAVA 1.9+. Unfortunately, nobody likes 1.9+ for combat.
Some testing in MCPE vanilla made it apparent that this logic isn't correct for MCPE. The old logic is correct for pre-1.9 knockback.
2018-07-20 11:55:10 +01:00
Dylan K. Taylor
93a2f397c6 Merge branch 'mc-broken-ed-1.5' into release/3.1 2018-07-17 18:13:06 +01:00
Dylan K. Taylor
710e1d014d Entity: fixed 0-length motion vectors being passed to move()
this was an interesting bug.

This was discovered by making a projectile's drag 0, making its gravity a factor of its throw force (such that force / gravity = integer value), and then throwing it directly up. At the apex, an error would occur due to trying to do a ray trace with a zero vector.

This also led me to realize that there's an edge case in the current movement system - if an entity's motion reaches 0, it will stop getting movement updates. This can be undesirable when things such as gravity cause motion to become zero when throwing a projectile directly upwards. This will need to be fixed separately.
2018-07-16 12:08:13 +01:00
Dylan K. Taylor
165aac1ba3 Merge branch 'release/3.0' into mc-broken-ed-1.5 2018-07-14 16:09:57 +01:00
Dylan K. Taylor
7fc22d3227 Entity: fixed setNameTagAlwaysVisible()
mojang >.<

this doesn't fix the problem of invisibility making nametags hidden though.
2018-07-14 16:05:46 +01:00
Dylan K. Taylor
4a5ff32d2e hacks for NPC and floating text
I didn't think mojang could break this fucking game any worse
2018-07-11 19:45:48 +01:00
Dylan K. Taylor
b5dcdea6d8 Protocol changes for 1.5.0 "release"
what a piece of shit this version is...
2018-07-11 10:00:15 +01:00
Dylan K. Taylor
a57ec1b1ba Living: fixed death animation not being played when kill() is used
this fixes players having a random delayed despawn when using /kill on themselves
2018-06-29 16:49:40 +01:00
Dylan K. Taylor
905259a4e1 Fixed not being able to place blocks inside dead players
closes #2265
2018-06-29 16:38:35 +01:00
Dylan K. Taylor
d3e54db146 ExperienceOrb: stop tracking targets if they die while being tracked 2018-06-23 16:41:21 +01:00
Dylan K. Taylor
0081e30a89 Living: fix knockback condition, take 2
onGround doesn't necessarily reflect 0 motion, because something else could change the motion prior to the onGround flag getting updated - for example 2 knockbacks in a row.
2018-06-23 14:30:26 +01:00
Dylan K. Taylor
484d34fe04 Living: Reset attack cooldown before applying post damage effects
this fixes things causing damage during post-damage calls coming back and being able to do even more damage
2018-06-22 17:47:11 +01:00
Dylan K. Taylor
a5a236084f Living: don't applyPostDamageEffects() for dead mobs
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.
2018-06-22 14:31:48 +01:00
Dylan K. Taylor
2d3ce9e8b0 Remove some fully qualified function calls
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.
2018-06-18 12:23:19 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
f6481eab8f
Implemented an InventoryEventProcessor, fixes #1986 (#2176)
* 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.
2018-06-09 17:37:10 +01:00
Dylan K. Taylor
8e5aca70b4 Entity: Avoid using close() during initEntity()
this simply conceals bugs and will cause astonishing behaviour.
2018-06-09 17:06:15 +01:00
Dylan K. Taylor
85136b7b4a Entity: Attach to level & chunk after initEntity() call, not before
this avoids leaving garbage entities attached to chunks when exceptions are thrown during initEntity().
2018-06-09 16:59:22 +01:00
Dylan K. Taylor
37b445f210 Updated Math dependency 2018-06-09 13:05:25 +01:00
Dylan K. Taylor
fb484087a8 Entity: Remove unnecessary scheduleUpdate() call from initEntity()
this is already done by the constructor
2018-06-07 12:53:59 +01:00
Dylan K. Taylor
14914781fc Added exception throws when a closed tile or entity attempts to schedule itself for updating
I can't believe it took so long to find what was causing these stdClass bugs.
2018-06-07 12:37:26 +01:00
Dylan K. Taylor
fdd5b7b9c9 Entity: Fixed despawn flagging not kicking in until scheduling updates on entities 2018-06-07 12:34:23 +01:00
Dylan K. Taylor
c83c0eb935 Entity: Move responsibility of checking for despawn to Level
this ensures that flagging for despawn will always work as intended, including when onUpdate() is overridden.
2018-06-07 12:31:21 +01:00
Dylan K. Taylor
0d177d5219 Entity: Clear dirty properties at the end of the constructor
this prevents sending duplicate properties immediately after entity spawn (due to properties getting set in the constructor).
2018-06-04 11:18:42 +01:00
Dylan K. Taylor
0a50b8cb9b Removed imports left over from 4f8f334436c69336d1bc2811717983544eda41e8 2018-05-29 11:42:12 +01:00
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