Commit Graph

1014 Commits

Author SHA1 Message Date
4f20a504e3 Level: remove dead function
this is handled by a queue now instead of ondemand, to avoid recursion bugs.
2018-03-13 11:46:23 +00:00
d478661961 Minor cleanup to LevelDB constructor 2018-03-11 18:15:20 +00:00
b8064aa45c LevelDB: fixed more usages of CompoundTag ArrayAccess API 2018-03-11 17:55:35 +00:00
00f596c4f8 Level: typehint hashing methods 2018-03-11 16:42:57 +00:00
3f7b14bf59 Level: Remove dead generator leftovers
This is all handled by the population mechanism now. Nothing uses these things anymore since years.
2018-03-11 13:56:41 +00:00
f2f8c235e7 Explosion: add exception throws for bad arguments 2018-03-11 13:06:29 +00:00
69b3bb183d Explosion: typehints and docs 2018-03-11 13:02:46 +00:00
40b995a435 Level: Fixed botch-job PR #2089
@zKoz210 Do not contribute to this repository again without first testing your changes.
2018-03-10 19:08:30 +00:00
b39bbffdc5 Entity: Moved and renamed entity\Item to entity\object\ItemEntity 2018-03-10 12:36:46 +00:00
bd3d2451bc Level: Added getRandomTickedBlocks() function (#2089) 2018-03-10 11:32:01 +00:00
a8a3eb3866 Added particles for snowballs and eggs 2018-03-09 11:35:07 +00:00
c1a2144f60 Particle: added some new constants 2018-03-09 10:42:59 +00:00
1f77c074e9 Level: Unload chunks prior to save() to avoid saving chunks twice on shutdown
save() calls saveChunks() which saves any chunks found to be modified. But chunk unloading does this anyway, so it's better to unload first and then trigger the save mechanism, to avoid saving chunks twice.
2018-03-07 19:47:54 +00:00
49a39fc7bd Split DestroyBlockParticle into two classes
this level-event is not only used for blocks, it's also used for paintings.
2018-03-04 13:11:38 +00:00
2ff3b12376 Cleaned up projectile "collide" checks 2018-03-04 12:19:41 +00:00
1c5180b720 McRegion: don't assign regions to the index until all exception handling is done
it appears that errors are occurring in the exception handler when handling corrupted regions, leaving regions in the provider index with incomplete location tables. This causes strange-looking errors later down the line.

This moves the region assignment to the end of the condition to avoid leaving incomplete/corrupted regions in the location table when errors occur.
2018-03-02 18:30:45 +00:00
9d018e8d9e Level: cleaned up chunk loading error handling, close #2056
This now removes logging from the level providers (for the most part) and replaces it with exception throws and catches. The implementation using the providers should catch these exceptions if they are thrown.
2018-03-01 12:30:12 +00:00
ae2e1fdd5a McRegion: Make nbtDeserialize() and nbtSerialize() protected
Not really sure why these are still exposed publicly.
2018-03-01 10:42:27 +00:00
06af742bef wtf 2018-03-01 09:30:50 +00:00
d4eba3f4b1 Moved some things out of Server to appropriate init() functions 2018-03-01 09:18:40 +00:00
f0535df96d Remove deprecated things 2018-02-27 11:59:16 +00:00
e7adaef2d2 Level: fix syncChunkLoad timer not getting stopped when no chunk is returned 2018-02-20 10:39:41 +00:00
f27b62027c McRegion: fix some missed ArrayAccess usages of CompoundTag 2018-02-17 14:58:04 +00:00
093cb5b39e Updated PocketMine-NBT dependency 2018-02-17 14:29:20 +00:00
7fc3eeab00 Level: Remove redundant null checks for Item->getBlock()
this is typehinted to return Block, so these checks are pointless.
2018-02-16 10:45:54 +00:00
e7e4645c0b Fixed a wide range of bugs with floating-point coordinates getting incorrectly int-casted
This causes lots of bugs in negative coordinates.

This fixes #1789 after world load & save.
2018-02-15 10:27:42 +00:00
3962d32ffe Chunk: Remove obsolete checks for entity/tile coordinate mismatches
This code is no longer necessary, because entities are constructed with a Level instead of a Chunk since API 3.0.0-ALPHA4. This means that they will not get allocated in the wrong chunk at runtime after having been saved on the wrong chunk by something else (such as an older version of PM). They will instead be allocated in a chunk selected by bitshifting their coordinates.

This is necessary to be able to fix #1789 without causing entities affected by the infamous bitshift-on-floats bugs to inexplicably vanish.
2018-02-14 18:58:52 +00:00
a84aba5517 Replaced some bad usages of Vector3 get*() with their respective getFloor*() 2018-02-14 18:45:10 +00:00
3aef4c5a09 Merge branch 'legacy/alpha11' 2018-02-14 09:13:00 +00:00
cacd0f5d8f Level: fixed global packet mechanism spamming empty batch packets every tick
This also spammed to nobody when the level is empty.

Closes #2020.
2018-02-14 09:12:07 +00:00
8222b16d9a LevelDB: fixed leftover usage of the old CompoundTag API 2018-02-06 11:16:14 +00:00
48dc1c38f7 Generator: fixed misuse of InvalidArgumentCountException 2018-01-27 12:46:09 +00:00
6c8a1a5b80 Item: Remove redundant Level parameter from onActivate()
there are three other sources this could be gotten from, an arbitrary level doesn't make sense.
2018-01-25 10:15:36 +00:00
ecb3f9aeac Level: Allow broadcastLevelEvent() to accept a null position to broadcast to everyone in the Level 2018-01-21 17:41:00 +00:00
f0696f77ef Level: Added global packet broadcast mechanism 2018-01-21 17:40:31 +00:00
3af8cf48b2 Removed setComponents() override in Position 2018-01-18 19:03:53 -05:00
d728154e87 Level: Fixed entities getting deleted when switching levels
So this came from a bugfix (795d6c8ddf) which fixed a memory leak related to entities getting kill()ed on chunk unload.
HOWEVER, me2016 did NOT realize that this code is actually entirely pointless and causes unexpected behaviour.

removeEntity() is used in 2 places in the core code:
1. in Entity->close() (so close() doesn't need to be called again, obviously)
2. in Entity->switchLevel() (which then causes the entirely unexpected behaviour of close()ing the entity on level change.

Conclusion: This code is pointless. This fixes the bugfix.
2018-01-17 11:30:59 +00:00
6f6e3aaa21 Fixed projectiles collding with spectator players
closes #1857
2018-01-17 10:57:04 +00:00
45b02d92d4 Math: Added RayTraceResult, removed dependence on MovingObjectPosition
MOP doesn't make any sense anyway.

RayTraceResult is a container which represents the point at which a line hits a bounding box. No dependence on blocks or entities is wanted or needed.
MovingObjectPosition has API changes to allow it to wrap RayTraceResult, but nothing uses MOP anymore anyway.

This would allow modularisation of the pocketmine\\math namespace.
2018-01-12 14:28:41 +00:00
fe4b5498e6 Level: Fixed 2D block cache not getting counted correctly
Fixes #1903
Closes #1906, which, while a pretty solution, is very inefficient (see PR discussion). This is an optimization of microscopic proportions, but the point still stands.
2018-01-12 11:02:43 +00:00
71d11c73f0 Math: Kill BlockIterator, added a VoxelRayTrace class with level-independent generator functions (#1885)
This is a rather larger commit than I'm happy with, but oh well.

This kills off the enormously overcomplicated BlockIterator and replaces it with a VoxelRayTrace class containing ray tracing generator functions. These functions are independent of any Level. They yield Vector3 objects with current ray trace positions to allow implementations to handle the intercepted blocks in their own ways.

Living->getLineOfSight() now uses VoxelRayTrace instead of BlockIterator.
2018-01-10 20:14:36 +00:00
a0683dbb0f Chunk: Remove useless code in fastDeserialize() 2018-01-08 21:38:30 +00:00
266a253c03 Remove dead imports 2018-01-05 19:48:04 +00:00
c62e1abf2f Kill the instabreak anti-cheat
This is annoying and it requires that the server must match this precisely to not cause bugs. Additionally, this code shits its pants when the client hits a spot of network lag.

This can be implemented easily as a plugin. There is no reason whatsoever for this to be in the core.
2018-01-05 19:43:51 +00:00
8fbd0e58f0 Level: Fixed possible crash with changed blocks handling
Since chunks are unloaded before changed blocks are processed, there is a small chance that a block might get changed in a chunk, and then get unloaded due to not being in use, before the updates are broadcasted.
This is unlikely to ever happen since chunks usually don't get unloaded unless they don't have loaders anyway, but it could happen (?) if a chunk is forcefully unloaded.
2018-01-05 13:46:21 +00:00
0f30467f62 Added Level->dropExperience() and API for splitting XP into orb sizes 2018-01-04 19:32:54 +00:00
f963dbd10d Level: Added getNearestEntity()
This may be used for AI in the future.
2018-01-04 19:10:43 +00:00
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
70982c145b Level: Clarified documentation for loadChunk() and changed misleading parameter name 2018-01-02 18:08:43 +00:00
417f2d8998 Level: Clarified documentation on getChunk() 2018-01-02 18:05:30 +00:00