670 Commits

Author SHA1 Message Date
Dylan K. Taylor
06a3c7c478 Entity: Write attributes in AddEntityPacket 2018-01-03 11:30:22 +00:00
Dylan K. Taylor
c747c7d025 Throw exceptions when entities/tiles are created on chunks that don't exist
These assertions don't make sense. Since the chunk field is used below in both cases, the chunk should **never** be null no matter what.
2018-01-02 13:12:54 +00:00
Dylan K. Taylor
c9e2e8980f Fixed some places entities/players use their chunk without checking if it is valid
This may be invalid in some cases, such as:
- chunk is not loaded
- entity is not fully constructed
- entity is a Player who has not yet completed the login sequence.
2018-01-02 12:57:04 +00:00
Dylan K. Taylor
547833ae23 Effect: Add constants with vanilla names where missing 2017-12-23 14:48:56 +00:00
Dylan K. Taylor
6e1df36188
Consumables refactor (#1796)
* Removed broken EntityEatEvents - these don't fit the pattern since they only apply to Human entities anyway. PlayerItemConsumeEvent and PlayerInteractEvent can be used for cancellation purposes, and plugins can do custom stuff without mess.

* Restrict item consuming to Living entities only

* Added FoodSource->requiresHunger()

* Only items implementing the Consumable interface can now be consumed.

* The effects from consuming items are now generic-ized by way of the Living->consume() function. This is overridden in Human to allow applying food and hunger.

* Fixed the hardcoded mess for buckets
2017-12-23 13:03:41 +00:00
Dylan K. Taylor
329fe7d844 Effect: Implement Saturation effect
I thought I did this months ago, but apparently not. Whatever, it's here now.
2017-12-23 11:35:01 +00:00
Dylan K. Taylor
b7aaf54a6f Effect: Fixed mistake in bitshifting with effect level in instant effects
This should be the amplifier, otherwise the effect will have double-effect on level 1.
2017-12-23 11:32:58 +00:00
Dylan K. Taylor
6332814a04 Effect: Minor cleanup on Instant Health/Damage effect amplification 2017-12-23 11:23:29 +00:00
Dylan K. Taylor
9d4818d360 Effect: Hunger is supposed to apply every tick
This fixes oddities in the behaviour noticeable with higher effect levels.
2017-12-23 11:15:23 +00:00
Dylan K. Taylor
8d08840ea4 Effect: Better fix for duration bug seen in 3614711a027c55df1723eefae36b4a79397e6e95 2017-12-23 10:45:59 +00:00
Dylan K. Taylor
7f0d0c9d63 Revert "fixed negative effect durations when level tick rate is > 1"
This reverts commit 3614711a027c55df1723eefae36b4a79397e6e95.
2017-12-23 10:44:21 +00:00
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
953f45c50f Altered armour handling, now works for damage other than PvP 2017-12-14 12:37:28 +00:00
Dylan K. Taylor
1822abc862 Living: Apply absorption after effect damage reduction is checked 2017-12-14 12:03:12 +00:00
Dylan K. Taylor
92e966686e Refactor Living->attack() into several methods 2017-12-14 11:39:05 +00:00
Dylan K. Taylor
e75fbd7fb4
Changed Effect colours to use Color objects instead of arrays (#1814) 2017-12-14 10:21:07 +00:00
Dylan K. Taylor
06f605879a Effect: Save and restore ambiency properly 2017-12-14 10:10:26 +00:00
Dylan K. Taylor
4c7038f941 Effect: Added proper documentation on "ambiency" 2017-12-14 09:57:20 +00:00
Dylan K. Taylor
f5ebfc3418 Effect: Added Fatal Poison effect
This is identical to normal Poison, except that it kills the victim. Parrots receive this effect when they are fed cookies.
2017-12-13 18:59:49 +00:00
Dylan K. Taylor
dfc2d1dfe6 Stop hardcoding src/pocketmine/resources everywhere 2017-12-11 19:52:49 +00:00
Dylan K. Taylor
8a90d159fe Cleanup unused imports 2017-12-10 12:09:46 +00:00
Dylan K. Taylor
bf4076766e Living: Fixed passing FloatTag to setHealth() when HealF tag is present, close #1784 2017-12-09 20:31:14 +00:00
Dylan K. Taylor
49dbd8b2c8 Living: Remove superfluous fire resistance check from dealFireDamage()
This is already checked in Living->attack(). It's preferable to allow it to be cancelled there since plugins can then un-cancel EntityDamageEvent to bypass the effect.
2017-12-07 17:32:50 +00:00
Dylan K. Taylor
502dd14c67 Entity: Remove excess whitespace in doOnFireTick() 2017-12-07 17:28:37 +00:00
Dylan K. Taylor
74239eec69 Living: Remove nonsensical >0 condition on boolean
Maybe this once returned integers, but it doesn't anymore.
2017-12-07 16:49:16 +00:00
Dylan K. Taylor
3c936e1be8 Entity: removed dead maxFireTicks property 2017-12-07 16:37:32 +00:00
Dylan K. Taylor
16fd37a039 Entity: Add getter & setter for fireTicks 2017-12-07 16:37:01 +00:00
Dylan K. Taylor
b06ca6eb0b Rename Living->callDeathEvent() to Living->onDeath() 2017-12-07 12:26:49 +00:00
Dylan K. Taylor
5a0afa9f88
Fixed broken logic in EntityEffectEvents, close #1767 (#1768) 2017-12-03 16:14:20 +00:00
Muqsit
92a1f45175 Make Living::addEffect() return bool (#1755) 2017-12-01 16:56:37 +00:00
Dylan K. Taylor
0badaeb8f4 bump max dead ticks to 25 so death smoke cloud works properly
I wish this wasn't client sided... it's a pain to get it synced properly.
2017-11-22 19:55:25 +00:00
Dylan K. Taylor
c5ac6a7606 Remove redundant count() for effects ticking 2017-11-22 19:44:22 +00:00
Dylan K. Taylor
e9951b1b1f Remove redundant condition for setBreathing() 2017-11-22 19:43:09 +00:00
Dylan K. Taylor
47f94eebd1 Use maxDeadTicks instead of hardcoded 20 2017-11-22 18:58:58 +00:00
Dylan K. Taylor
e9e22db1e7 Cleaned up death animation handling, removed dead ticking from non-Living entities 2017-11-22 17:17:47 +00:00
JackNoordhuis
686e1c4470 Implement ender chest (#1462) 2017-11-22 14:25:21 +00:00
Dylan K. Taylor
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
Dylan K. Taylor
a8ad956b29 Fixed keepMovement logic 2017-11-19 19:28:04 +00:00
DaPigGuy
96348e0e44 Fix setMaxAirSupplyTicks() (#1555) 2017-11-19 01:40:46 +00:00
Dylan K. Taylor
db8a835a64 add a default value for Entity->setCanClimb() 2017-11-17 12:19:04 +00:00
Dylan K. Taylor
460d540dbc Further cleanup on ListTag and CompoundTag usage 2017-11-17 11:43:32 +00:00
Dylan K. Taylor
665130561e Further cleanup on NBT dynamic field access
not sure how I missed so many of these... there are probably lots more besides :(
2017-11-17 11:19:36 +00:00
Dylan K. Taylor
3a16985d45 Cleaned up item & arrow pickup code 2017-11-15 12:14:42 +00:00
Dylan K. Taylor
aa399a1109
migrate to new CompoundTag API (#1515) 2017-11-10 15:38:21 +00:00
Dylan K. Taylor
d4494687d1 Fixed collision blocks not being recalculated after teleporting, close #1531 2017-11-09 15:11:42 +00:00
Dylan K. Taylor
0e64c3dad8 fixed misusing isAlive(), close #1523 2017-11-07 09:32:38 +00:00
Dylan K. Taylor
eab7b93483
Fixed misuse of kill() and close() when deleting entities (#1490) 2017-11-04 19:30:48 +00:00
Dylan K. Taylor
a66a757f56 Cleaned up EntityEventPacket handling 2017-11-04 18:31:35 +00:00
Dylan K. Taylor
3614711a02 fixed negative effect durations when level tick rate is > 1
thank you @Sandertv
2017-11-01 09:09:17 +00:00
Dylan K. Taylor
991d321928 improved geometry debloating, also apply on skin changes 2017-10-29 12:14:16 +00:00