Dylan K. Taylor
debfbf0d93
Math: Added solveQuadratic()
...
will be used in future for XP. This is extracted from the experience work branch.
2018-01-04 15:58:54 +00:00
Dylan K. Taylor
5c37d298a6
Player: Changed canInteract() default max diff to sqrt(3) / 2
...
This is needed because players can break blocks that are outside of their field of view. A player can be inside a block and be able to break that block, while looking up, which places its centre (which is where the interact check is done from) actually behind the player's field of view. This causes anti-cheat to be triggered and makes it impossible to break blocks one is inside.
This commit changes the max negative diff to be half of the distance between a block's centre and its corners (M_SQRT_3 / 2).
2018-01-04 15:46:49 +00:00
Dylan K. Taylor
3ca162f23f
Revert "Player: Remove obsolete maxDiff parameter from canInteract()"
...
This reverts commit a5c3fbdd7a648d4a774e167570d2fc0165c66a80.
2018-01-04 15:33:23 +00:00
Dylan K. Taylor
5f48433c95
Bucket: Added sounds for bucket fill/empty
2018-01-03 14:27:41 +00:00
Dylan K. Taylor
33352638a9
Bucket: Fixed appearing empty when picking up still liquids
...
Buckets already affected by this bug will still appear empty until used. After that they'll work fine.
2018-01-03 14:22:53 +00:00
Dylan K. Taylor
db52501462
Bucket: Fixed stack size handling for empty buckets
...
GOD this code is horrible
close #1472
2018-01-03 14:12:04 +00:00
Dylan K. Taylor
3a0cbd1cd4
Block: Cleaned up double-block break handling, close #1862 , close #1525
...
This now removes the need for recursing around for structures comprised of multiple blocks. Instead, override getAffectedBlocks() to return all blocks that need to be deleted when the current block is deleted, and make sure that only one half of the block drops something. When a player breaks one of the blocks, all the blocks affected by that block will also be destroyed, creating particles and sounds where appropriate.
This fixes creative drops for double plants and beds.
2018-01-03 13:01:05 +00:00
Dylan K. Taylor
1bdb68b7da
EnderChest: Remove dead onBreak() code (follow-up to previous commit)
2018-01-03 12:10:36 +00:00
Dylan K. Taylor
6ce728169e
Chest: Remove redundant unpairing code from onBreak()
...
This is already done in the Level.
2018-01-03 12:08:35 +00:00
Dylan K. Taylor
06a3c7c478
Entity: Write attributes in AddEntityPacket
2018-01-03 11:30:22 +00:00
Dylan K. Taylor
70982c145b
Level: Clarified documentation for loadChunk() and changed misleading parameter name
2018-01-02 18:08:43 +00:00
Dylan K. Taylor
417f2d8998
Level: Clarified documentation on getChunk()
2018-01-02 18:05:30 +00:00
Dylan K. Taylor
7339c4ac2f
Player: Fixed not being able to interact with blocks in adventure mode, close #1848
...
This allows other undesired behaviour like flint&steel, buckets to work in adventure mode when they shouldn't, but that's a bug for another time.
2018-01-02 16:26:59 +00:00
Dylan K. Taylor
43a0ede9d2
Player: Fix floating-point errors when float Vector3s are given to sleepOn()
...
In the future this will change to block positions and the Vector3 issue will cease to be an issue.
Closes #1871
2018-01-02 16:09:58 +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
9a956692de
Fixed wasteful throwaway objects used for spawn positions
2018-01-02 12:21:11 +00:00
Dylan K. Taylor
d30a6b60b7
.gitignore: Ignore crashdumps directory
...
How did this never become a problem before?!
2018-01-02 12:09:31 +00:00
Dylan K. Taylor
41873bb115
Merge PR #1864 : LevelProviders refactor
2018-01-02 11:47:11 +00:00
Dylan K. Taylor
8064152777
LevelProvider: Add documentation for doGarbageCollection() and close()
2018-01-02 11:39:51 +00:00
Dylan K. Taylor
872df446bd
Level: Remove redundant duplicate condition in unloadChunk()
2018-01-02 11:16:20 +00:00
Dylan K. Taylor
376a615634
thanks for the warning PhpStorm... not
2018-01-02 11:14:01 +00:00
Dylan K. Taylor
c16c9efdf3
Chunk: Rename unload() to onUnload()
...
this more accurately describes what the function does.
2018-01-02 10:50:22 +00:00
Dylan K. Taylor
c3cc6f9880
Chunk: Clean up unnecessary checks in unload()
2018-01-02 10:48:01 +00:00
Dylan K. Taylor
1e139743b8
Level: Do level provider GC every 5 minutes from level tick
...
this should solve #1183 , pending further testing.
2018-01-02 10:23:57 +00:00
Dylan K. Taylor
bde0ba1100
Level: Set chunk coordinates in setChunk()
...
The level provider used to do this in LevelProvider->setChunk(), but it does not anymore.
2018-01-01 13:13:47 +00:00
Dylan K. Taylor
50f273c041
Vector2: Fixed ceil() and floor() totally broken logic
...
"So if I Vector2->ceil()->ceil() my vector2 magically gets incrementing values..." @Sandertv 2018
2018-01-01 12:57:34 +00:00
Dylan K. Taylor
db095f9705
Updated PreProcessor submodule
2018-01-01 12:54:18 +00:00
Dylan K. Taylor
f580f27ec7
LevelProvider: Updated documentation
2018-01-01 11:59:22 +00:00
Dylan K. Taylor
a46029c0f6
LevelProvider: Nuked the complicated mess out of level providers
...
Level providers are now cut back to just an interface to a world's data. They don't keep their own chunk registries or any stupid shit like that because the Level already does that.
This furthers the goal of being able to move level I/O off the main thread, and also drastically decreases the complication of implementing level providers.
2018-01-01 11:21:46 +00:00
Dylan K. Taylor
1a615591e2
LevelProvider: Remove cyclic dependency between Level and LevelProvider
...
This will now allow LevelProviders to be constructed on threads.
2018-01-01 10:50:13 +00:00
Dylan K. Taylor
d19683b7dd
LevelProvider: Remove some dead methods
2017-12-31 18:35:23 +00:00
Dylan K. Taylor
f17b3b2a3b
LevelProvider: Refactor providers to drop lots of duplicated code
2017-12-31 18:35:23 +00:00
Dylan K. Taylor
a0a2ea01bc
LevelDB: Check for LEVELDB_ZLIB_RAW_COMPRESSION when checking for the extension's presence
...
We always want to validate that the leveldb provided supports the world format.
2017-12-31 17:49:02 +00:00
Dylan K. Taylor
5132ab6cd9
LevelDB: Remove redundant folder creation in generate()
...
This is pointless because the call below - which is _also_ recursively creating directories - will create this directory anyway.
2017-12-31 17:46:07 +00:00
Dylan K. Taylor
256bdf2581
McRegion: Use MainLogger::getLogger()
...
another one bites the dust
2017-12-31 16:06:08 +00:00
Dylan K. Taylor
8a3f8b4706
LevelProvider: Remove redundant method requestChunkTask()
...
This removes one more dependency that LevelProvider has on Level.
2017-12-31 16:05:58 +00:00
Dylan K. Taylor
7264ce43ae
McRegion: Added method pathToRegion()
2017-12-31 14:25:17 +00:00
Dylan K. Taylor
66e475cbb8
Region: Remove RegionLoader/McRegion cyclic dependency
2017-12-30 19:59:35 +00:00
Dylan K. Taylor
1e896efff9
McRegion: Added an assert
2017-12-30 19:49:44 +00:00
Dylan K. Taylor
4db7a7e57f
Region: Change chunk offset calculation in regions to use bitmasks
...
I don't know why it wasn't done like this to start with. However this has not been tested yet, so this goes on a different branch for now to test.
2017-12-30 19:41:58 +00:00
Dylan K. Taylor
54b23968e7
McRegion: Refactor some ambiguous variable names
2017-12-30 18:59:01 +00:00
Dylan K. Taylor
bcb080e2b9
Level: Make sleepTicks private, don't write directly
2017-12-30 18:41:13 +00:00
Dylan K. Taylor
e5c58f9b04
Player: Add typehint for maxDistance parameter of canInteract()
...
Not sure why this was missing :<
2017-12-30 17:43:12 +00:00
SOFe
af7aef70db
Implemented TextFormat::colorize() ( #1837 )
...
Implemented TextFormat::colorize()
See 4c46087ffccc7f26835a1fc5bbf2ac60397884f9 for the initial discussion
2017-12-30 16:51:04 +00:00
Dylan K. Taylor
3ea72a0bf9
Merge PR #1775 : NBT streams refactor
2017-12-30 15:53:47 +00:00
Dylan K. Taylor
be02fbb352
NBT: Add typehints to PHP 7.2 standards
2017-12-30 15:07:50 +00:00
Dylan K. Taylor
a67f7e3930
Add header includes and preprocessor checks
2017-12-30 14:56:29 +00:00
Dylan K. Taylor
965c19375f
NBT: Split up concerns of endianness and varint NBT into their own classes, separate stream handling from NBT class
...
The remaining methods, constants and fields in the NBT class now pertain to generic NBT functionality (except for the matchList()/matchTree() methods, but that's a job for another time). All NBT I/O specific logic has now been moved to NBTStream and its descendents.
2017-12-30 14:55:45 +00:00
Dylan K. Taylor
63edcb8934
Updated PreProcessor submodule
2017-12-30 14:15:33 +00:00