992 Commits

Author SHA1 Message Date
Dylan T
c266f86b1b
ItemEntity: introduce controls for despawn timers (#2769)
This opts _not_ to expose item "age" a la #2753 because "age" is a misleading term for it. In addition, further inspection of the problem led me to realize that exposing control of that AND despawn timeout was more complicated than simply having a despawn delay timer exactly like the pickup delay one. Everyone knows a countdown timer stops at 0, so this way we don't need any method to control the limit.

Closes #2667
Closes #2753
2019-03-10 12:05:21 +00:00
Dylan K. Taylor
6bd43a8215 Firehose auto-tick-rate anti-feature, closes #2665 2019-03-03 13:24:53 +00:00
Dylan K. Taylor
6c8fa8ae28 More nullable and void typehints 2019-03-02 10:29:11 +00:00
Dylan K. Taylor
9ad0ea85c7 Rename two misleadingly-named functions 2019-02-27 12:59:12 +00:00
Dylan K. Taylor
440dd21550 Merge branch '3.6' 2019-02-26 19:59:24 +00:00
Dylan K. Taylor
2164dbae67 Fixed reloaded arrows not despawning, closes #2781 2019-02-26 19:58:21 +00:00
Dylan K. Taylor
0bd1c1529e Block: Rename getItem() to asItem()
this has clearer meaning and is less likely to collide with other things.
2019-02-24 10:23:40 +00:00
Dylan K. Taylor
7170d9009d Enchantment: more static getters, firehose magic numbers
This is similar in nature to 646fea5a4ecbbdf3f0cbfc590d874dedc1a7bfc0.

On a side note: Migrating this way is a pain in the ass due to lack of types. What the heck is int supposed to mean?!?!?!?! At least if we wanted to go _back_ to magic numbers, it would be easy to locate everything with an Enchantment typehint...
2019-02-20 13:45:50 +00:00
Dylan K. Taylor
646fea5a4e Effect: Introduce a bunch of static getters, change a bunch of API to use objects
This introduces static getters for every currently-known effect type. At some point in the near future, the magic number constants (which are really network IDs, by the way) will disappear.

Migrating:
- If you used constants (like any sensible person would): for the most part it's just a case of adding a () anywhere you used an Effect constant.
- If you hardcoded magic numbers: ... well, have fun fixing your code, and I reserve the right to say "I told you so" :)

This achieves multiple goals:
1) creating an EffectInstance for application is much less verbose (see diff for examples, especially the Potion class)
2) plugin devs cannot use magic numbers to apply effects anymore and are forced to use type-safe objects. :)

This is a warning shot for plugin devs who use magic numbers. More changes like this are coming in the not-too-distant future.
2019-02-20 12:05:17 +00:00
Dylan K. Taylor
a4c3ee20b2 Extract Fallable into trait + interface
Traits are inferior to components in pretty much every aspect imaginable :(
2019-02-19 09:58:10 +00:00
Dylan K. Taylor
3bbc0b5d5f Merge branch '3.6' 2019-02-17 17:08:44 +00:00
Dylan K. Taylor
074baf7e1c Merge branch '3.5' into 3.6 2019-02-17 17:08:15 +00:00
Dylan K. Taylor
2e0dd574e0 Set default health attribute value when changing max health, closes #2771 2019-02-17 17:06:32 +00:00
Dylan K. Taylor
c2735286ab Merge branch '3.6' 2019-02-17 11:35:07 +00:00
Dylan K. Taylor
e16d8e31af Merge branch '3.5' into 3.6 2019-02-17 11:33:46 +00:00
Dylan K. Taylor
3c93a57397 Entity: add a hack to prevent client-side movement when entity is not moving
this fixes #2227.
2019-02-17 11:33:34 +00:00
Dylan K. Taylor
6424dc9c82 Merge branch '3.6' 2019-02-14 16:04:32 +00:00
Dylan K. Taylor
e71e18fc88 Merge branch '3.5' into 3.6 2019-02-14 16:02:30 +00:00
Dylan K. Taylor
e1bacb5c6d Human: fixed hunger underflow when value is a fraction, closes #2761 2019-02-14 16:01:25 +00:00
Dylan K. Taylor
9ebd559907 Merge branch '3.6' 2019-02-10 13:59:44 +00:00
Dylan K. Taylor
9da7c6af27 new metadata properties 2019-02-10 13:59:21 +00:00
Dylan K. Taylor
c6a5829a92 Entity: remove dead function 2019-02-04 19:54:18 +00:00
Dylan K. Taylor
c872b120d0 Entity->entityBaseTick() is now protected 2019-02-04 19:54:06 +00:00
Dylan K. Taylor
acd0a8f2d4 fix possible crash in Projectile 2019-02-04 19:53:55 +00:00
Dylan K. Taylor
537afbc23b EffectInstance: Require positive amplifiers, closes #2723 2019-02-04 19:53:28 +00:00
Dylan K. Taylor
002f030970 EnderPearl: make a hack less messy 2019-02-04 19:51:49 +00:00
Dylan K. Taylor
c9f9f551f4 Merge branch '3.5' into master-rollback 2019-02-04 19:47:21 +00:00
Dylan K. Taylor
791b4d8ef3 SplashPotion: measure distance from eye height instead of base
this fixes effect durations being off (mostly), closes #2650
there are still some minor differences, but this is closer matching than the previous version.
2019-02-03 11:32:47 +00:00
Dylan K. Taylor
c3bbb8905c Human: simplify setFood() 2019-01-28 17:33:58 +00:00
Dylan K. Taylor
78dfcc5f2d Move Effect and EffectInstance to entity\effect namespace 2019-01-28 15:41:07 +00:00
Dylan K. Taylor
9ec40c421f Split up Effects into a bunch of classes
Server-side levitation now works too.
2019-01-27 19:45:15 +00:00
Dylan K. Taylor
ac551cf248 Entity: add addMotion() to allow updating motion vector
this allows updating motion without needing to create new objects for the task.
2019-01-27 15:43:57 +00:00
Dylan K. Taylor
bccc07633c Entity: Allow disabling gravity for a mob 2019-01-27 15:42:46 +00:00
Dylan K. Taylor
6ee484e401 ChunkLoader: remove getLoaderId() (take 2) 2019-01-25 18:58:01 +00:00
Dylan K. Taylor
61e04d5284 Merge branch '3.5' 2019-01-23 16:48:12 +00:00
Dylan K. Taylor
187f36fe38 ExperienceOrb: clean up some confusing code 2019-01-23 16:46:18 +00:00
Dylan K. Taylor
dc89b48354 Human: Fixed XP drop amount to match vanilla
In vanilla it doesn't drop the exact number of points you collected. Rather, you lose a little for every level above 1 you had (1 level requires 7 points, later levels require +2 per level), and can recover at most 100 points. Hence, if you had 10 levels, you get back enough points to fill 5 levels and most of a 6th. 14-15 levels gets you the upper bound of about 7.5 levels.
2019-01-23 12:39:25 +00:00
Dylan K. Taylor
e6d1c1dfbc Living: Get rid of delayed XP spawning, closes #2644
This is not identical to vanilla, but I don't care because it gets rid of edge cases and also makes it easier to integrate with EntityDeathEvent in the future.
2019-01-23 12:31:05 +00:00
Dylan K. Taylor
4ae6428641 Level: rename getCollisionCubes() -> getCollisionBoxes()
these aren't cubes! shoghi, please read the dictionary.
2019-01-20 18:11:20 +00:00
Dylan K. Taylor
425ad6101f Block: rename onEntityCollide() -> onEntityInside()
this better describes what the hook is for.
2019-01-20 18:09:47 +00:00
Dylan K. Taylor
ae7d6cc4a2 Merge branch '3.5' 2019-01-20 15:53:47 +00:00
Dylan K. Taylor
a27c9409f1 ExperienceOrb: fixed wrong condition 2019-01-20 12:30:24 +00:00
Dylan K. Taylor
854f851525 ExperienceOrb: don't follow players in other worlds 2019-01-20 12:30:09 +00:00
Dylan K. Taylor
6df983da3e Merge branch '3.5' 2019-01-19 16:24:41 +00:00
Dylan K. Taylor
4fd3bee360 Entity: Address fireticks crashdumps
This will now throw an exception at the source instead of crashing when the entity is saved, which should put the blame on the correct plugin responsible for this.
This also includes magic method hacks to preserve backwards compatibility, since the fireTicks field is now protected.
2019-01-19 16:05:10 +00:00
Dylan K. Taylor
797aabdf15 Entity: Protect move() to avoid stupidity 2019-01-14 19:57:46 +00:00
Dylan K. Taylor
9c53b41851 Added PlayerInfo, Player is no longer accessible during PlayerPreLoginEvent 2019-01-13 19:32:30 +00:00
Dylan K. Taylor
5052b75565 Separate Level management functionality from Server, clean up a bunch of mess 2019-01-12 19:11:05 +00:00
Dylan K. Taylor
19614ed25e Entity: move some NBT usages out of constructor, fix missing property defaults 2019-01-10 21:01:19 +00:00
Dylan K. Taylor
7d827a1c65 Introduce EntityFactory
This contains all of the static stuff that was previously embedded in the Entity static root. This solves a bunch of problems like circular dependencies between parent and child classes, encapsulating logic and reducing the size of the enormous Entity.php.
2019-01-06 23:54:29 +00:00