Dylan K. Taylor
0a50b8cb9b
Removed imports left over from 4f8f334436c69336d1bc2811717983544eda41e8
2018-05-29 11:42:12 +01:00
Dylan K. Taylor
6d53350291
Level: Moved LightPopulationTask out of generator namespace
2018-05-29 11:20:27 +01:00
Dylan K. Taylor
ad61d70eee
Level: added getBiome()
...
this will be needed for weather impl, amongst other things.
2018-05-29 11:10:06 +01:00
Dylan K. Taylor
353a1d69db
Level: move getHeightMap() to be more consistent
2018-05-29 11:10:06 +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
71fdd59c4c
Level: fine-tuned getCollisionCubes() a little bit
...
since we're getting the BBs anyway, what's the point in delegating this job to the block?
2018-05-28 17:41:12 +01:00
Dylan K. Taylor
0a9ed059d6
Level: fixed logic of getCollisionBlocks() to match getCollisionCubes()
2018-05-28 17:40:05 +01:00
Dylan K. Taylor
63ab27550a
Level: Use bitshifts instead of division in some cases
2018-05-28 14:02:32 +01:00
Dylan K. Taylor
d612988882
Level: fixed more off-by-one errors
...
these are the same crap as the previous commit, but with whole chunks instead of blocks.
2018-05-28 14:00:00 +01:00
Dylan K. Taylor
c9a0c381b1
Level: fixed logical errors in getCollisionBlocks() and getCollisionCubes()
...
This is the same bug that Entity->getBlocksAround() had, except this actually checks for BB intersections. What this means is that as a result of the bug, one extra layer of blocks is unnecessarily checked on the max sides of the BB.
For example:
Assume you have a BB with maxY -5.5
You're definitely colliding with block -6 (because you're inside it) and you want to check an extra block in case you hit something weird like a fence.
So you want to check _at most_ up to block -5 (inclusive).
Following this maths:
-5.5 + 1 = -4.5
ceil(-4.5) = -4
This causes us to check block -4 unnecessarily. This may be a performance waste - depending on the BB size it could be proportionally a lot of blocks getting unnecessarily checked. This has not been benchmarked.
2018-05-28 12:37:17 +01:00
Dylan K. Taylor
f2511983cf
Level: use increment operation for updating time
2018-05-19 16:05:08 +01:00
Dylan K. Taylor
bac649137b
Level: fixed doc comment for getSafeSpawn()
2018-05-19 14:02:54 +01:00
Dylan K. Taylor
71224f51d5
Level: cleaned up some nonsensical code in getSafeSpawn()
...
it's impossible for this function to return false because $spawn is guaranteed to be a Vector3 when it's checked in instanceof.
2018-05-19 13:18:20 +01:00
Dylan K. Taylor
6c3fc4af46
Level: switch order of addEntity() and removeEntity()
...
now it's consistent with addTile() and removeTile()
2018-05-19 13:14:11 +01:00
Dylan K. Taylor
9bc860f7a8
LevelDB: fixup extra-data handling, don't delete it - just don't read it
...
we'll need this once multi-layer block storages are implemented.
2018-05-19 11:35:54 +01:00
Dylan K. Taylor
66963fbf9a
Nuke block extradata
...
this has been superseded by multi-layer blockstorages in 1.2.14+
2018-05-19 11:03:28 +01:00
Dylan K. Taylor
210e108574
Level: add a null coalesce
...
meant to add this before push but wasn't thinking clearly...
2018-05-18 11:28:52 +01:00
Dylan K. Taylor
813437e3ee
Level: Avoid unnecessary use of getChunk()
...
this is completely pointless.
2018-05-18 11:27:53 +01:00
Dylan K. Taylor
24295ce02f
Level: Avoid creating useless throwaway objects in sensitive functions
2018-05-18 11:05:41 +01:00
Dylan K. Taylor
29fd26627e
Level: Change isInWorld signature to use ints instead of floats
...
this is only used in one place, where it's being given floats, and it's 10% faster to use int for this because it won't convert it.
It is also 25% faster to remove typehints and 60% faster to inline it. We really need a proper PHP preprocessor for inlining.
2018-05-18 11:01:13 +01:00
Dylan K. Taylor
22b91aaa24
SubChunkIteratorManager: Added method invalidate() to allow destroying stale chunk refs conveniently
...
this could be necessary for reusable long-life iterators when chunks get replaced.
2018-05-18 09:52:27 +01:00
Dylan K. Taylor
c285295037
Merge branch 'release/alpha12'
2018-05-17 18:40:24 +01:00
Dylan K. Taylor
ed65e91a3c
Tree: avoid astonishing behaviour with dark-oak and acacia saplings
...
ref #1973 , these should simply not grow at all since they are not implemented yet.
2018-05-12 10:03:20 +01:00
Dylan K. Taylor
b21572774a
Tool: cleanup durability handling, closes #379
...
long overdue... this isn't quite as extensible as the original api3/blocks system was, but this is primarily intended to replace Item->useOn(). If plugins want to use it it can be extended later on.
2018-05-10 19:48:51 +01:00
Dylan K. Taylor
b8523cb304
Merge branch 'remove-weak-position'
2018-05-10 13:53:07 +01:00
Dylan K. Taylor
197102ca3d
Level: fixed blocks not dropping when not broken by player
...
closes #2172
2018-05-05 21:50:28 +01:00
Dylan K. Taylor
8228774ad4
Remove extra data, this time without API breaks
...
this is necessary because the next MCPE release will probably be made before the next PM release.
2018-05-02 12:08:44 +01:00
Dylan K. Taylor
d80c471ae1
Typehints on missed sound and particle APIs
2018-05-02 11:44:18 +01:00
Dylan K. Taylor
5368120f13
Level: remove redundant getAutoSave() condition in close()
...
this is already checked by save() anyway.
2018-05-01 18:47:08 +01:00
Dylan K. Taylor
2e7db552dc
Level: __construct() now accepts a LevelProvider object instead of string, string
...
This is made possible by the removal of LevelProvider dependence on their Levels, and furthers the goal of #2024 .
2018-05-01 18:43:11 +01:00
Dylan K. Taylor
dfa6cd2b7e
Biome: Moved biome classes from level\generator\* to level\biome
2018-05-01 14:07:46 +01:00
Dylan K. Taylor
96d26a77a1
Explosion: set block damage to zero on destruction
2018-04-16 14:30:54 +01:00
Dylan K. Taylor
532269a484
Implemented block break XP drops
2018-04-15 19:03:18 +01:00
Dylan K. Taylor
f47f593555
Level: Removed fire hack from destroyBlockInternal()
...
this was causing unexpected behaviour particularly on burning trees, whereby fire would be unconditionally extinguished if the block below it was removed.
2018-04-10 09:59:40 +01:00
Dylan K. Taylor
646455f6e8
fixed painting particles, removed DestroyParticle
...
it didn't last long because they changed how this works... yuk
2018-04-09 16:26:15 +01:00
Dylan K. Taylor
e85fc54037
LevelSoundEventPacket: found unknown field
...
wtf mojang
2018-04-07 11:35:35 +01:00
Dylan K. Taylor
3134fa2744
Fixed FloatingTextParticle YET AGAIN
...
how many fucking ways can you break nametags Mojang???
2018-04-04 16:59:39 +01:00
Dylan K. Taylor
5b7b2dd0e2
Merge changes from ALPHA11 for 1.2.13
2018-04-04 11:31:39 +01:00
Dylan K. Taylor
5ce55bd3b0
duct tape for block ID remapping
2018-04-04 11:00:39 +01:00
Dylan K. Taylor
eba1ca030c
Fix variadic type docs ...again
...
PhpStorm changed its mind how it wants these documenting in 2018.1, and apparently the correct syntax follows the PHP code.
2018-04-02 12:33:24 +01:00
Dylan K. Taylor
c0c684b12e
Removed the need for paintings to check for destruction on schedule
...
Since we have a mechanism for triggering things on entities anyway, make use of it to do more than just forcing movement updates.
2018-03-25 13:15:10 +01:00
Dylan K. Taylor
a4c50d3204
Remove unused imports
2018-03-24 11:59:15 +00:00
Dylan K. Taylor
5eb1ee3416
Position: use setLevel() in constructor to validate level
2018-03-24 10:02:10 +00:00
Dylan K. Taylor
1648fff916
Replaced Position->getLevel() null checks with isValid()
2018-03-20 11:10:36 +00:00
Dylan K. Taylor
8d645b714f
Position: Destroy references to Level in isValid()
2018-03-20 10:55:24 +00:00
Dylan K. Taylor
403e996d2f
Level: Removed WeakPosition
...
This is a bad fix for an issue found in one specific use-case. This is redundant because the only places this is used are places where it's guaranteed to be valid, or places where it is checked to be valid anyway.
The Level leak originally noted that led to the creation of this class is something I consider to be a non-issue, because all the heavy things will be cleaned up anyway.
2018-03-20 10:49:23 +00:00
Dylan K. Taylor
73e09392b6
Timings: Clean up some terrible code, move namespaces
2018-03-19 19:05:51 +00:00
Dylan K. Taylor
209e28dfe5
Level: Removed MovingObjectPosition
2018-03-19 16:58:45 +00:00
Dylan K. Taylor
ac5a91b67e
Cleaned up bool comparison mess
2018-03-19 14:10:55 +00:00
Dylan K. Taylor
3d89bf5693
Updated PocketMine Math dependency
2018-03-18 18:08:24 +00:00