Commit Graph

91 Commits

Author SHA1 Message Date
95c32d26df Explosion: fixed ray trace getting stuck on a block when it encounters an empty subchunk
this might have caused unexpected behaviour in large caves.
2019-12-13 18:07:59 +00:00
cd2b60a860 Initial update to 1.13 2019-10-30 21:36:08 -04:00
247875e3d5 Explosion: add documentation for explodeA() and explodeB()
these functions really ought to be renamed, or possibly redesigned entirely. However, that's no task for a patch version.

[ci skip]
2019-10-07 09:44:17 +01:00
562179bdd6 Backport 58cafc853f: s/level/world (strings only)
we should look at doing this for code too, but for now I'm not planning to break everyone's plugins.
2019-03-10 11:35:46 +00:00
5364e4de68 Explosion: fix chest unpairing (root cause of #2701)
not ready to call this "fixed" yet because any chests that were already affected by the bug will still be affected. This change will prevent the creation of more broken chests like this.
2019-01-29 13:58:47 +00:00
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
d563b9e31b Level: Added API method broadcastPacketToViewers()
This supersedes addChunkPacket() in most cases, and has a more clear name. It broadcasts the given packet to every player who has the target position within their chunk load radius.
2018-10-20 15:14:41 +01:00
1dd6591ac1 Migrate a bunch of PluginManager->callEvent() usages to Event->call
This has the triple bonus effect of a) making a lot of code easier to read, b) reducing Server::getInstance() usages, and c) removing a whole bunch of Server dependencies.

The network and block namespaces are untouched by this commit due to potential for merge conflicts. These should be dealt with separately on master.
2018-10-05 17:30:06 +01:00
76174f1920 Explosion: avoid leaving arrows stuck in nonexistent blocks 2018-06-23 13:03:46 +01:00
0a50b8cb9b Removed imports left over from 4f8f334436 2018-05-29 11:42:12 +01:00
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
96d26a77a1 Explosion: set block damage to zero on destruction 2018-04-16 14:30:54 +01:00
1648fff916 Replaced Position->getLevel() null checks with isValid() 2018-03-20 11:10:36 +00:00
86eee429bb Block: Split onUpdate() into several functions, removed Level::BLOCK_UPDATE_* constants
This allows the removal of lots of ugly code, and also exposes lots of similarities with how this update type was handled. This can be further improved in the future to more generically handle cases.

I realized in the process of changing this, that it might actually be simpler to treat to treat scheduled updates and neighbour updates as one and the same. They use the same mechanism for being saved on chunks (TileTicks),
and doing that would make updating only require one queue instead of two.

RedstoneOre: use onActivate() to trigger glowing
this is not technically correct behaviour, but this preserves the current behaviour.
2018-03-13 17:29:46 +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
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
88318d740a Use standard subchunk iterator code in Explosion
this causes a slight performance loss (<10%), but in a sane language this would be inlined anyway
2017-11-28 11:20:22 +00:00
c1a6711514 Fix for explosions modifying the wrong subchunks under some circumstances 2017-11-27 17:11:52 +00:00
91c256f1a9 Added Level->getTileAt() 2017-10-30 13:36:42 +00:00
18e4e5364f Fixed getBlock() performance degradation caused by 781de3efab, added Level->getBlockAt() to avoid creating vectors everywhere 2017-10-20 13:22:49 +01:00
fd847f02ad Added BaseInventory->dropContents() 2017-10-16 12:18:06 +01:00
a6d1cc27ec Fix for explosions not removing tiles, close #1450 (#1463) 2017-10-13 13:57:50 +01:00
445a67954d Merge changes from master 2017-08-22 14:13:31 +01:00
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
604d11a8fd import cleanup and fixed an inspection 2017-08-21 17:39:02 +01:00
456ddd3fb3 Removed obsolete parameters from Entity->attack() and Entity->heal() 2017-08-21 13:25:11 +01:00
1f70a7830e Branch merge 2017-08-20 21:07:19 +01:00
02f42eba48 Move block registration to its own class 2017-08-20 18:05:01 +01:00
da83b879c0 Major performance improvement to explosions
These changes produce about 3x performance improvements. Some numbers
from my machine (i7-7700k @ 4.5GHz) with TNT:
- before changes: 35ms
- after changes: 11ms

in powersave mode (0.9GHz):
- before changes: 170ms
- after changes: 60ms
2017-08-20 16:12:30 +01:00
cd02f1e4be Minor performance improvement to explosions
This improves calculation time by 20-25% per explosion on flat terrain.
2017-08-20 13:28:31 +01:00
eeedcf7332 Refactor Block->getResistance() -> Block->getBlastResistance() and added some documentation 2017-08-20 13:25:43 +01:00
e5e76d4c93 Merge branch 'master' into mcpe-1.2 2017-08-18 18:39:39 +01:00
d8f0dd6db8 Changed Block->getDrops() to return Item[] 2017-08-18 11:21:33 +01:00
9be1b929a5 Added PhpDoc for packet field types and changed float x,y,z to Vector3 2017-08-13 20:02:07 +01:00
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
0f79b19fdc Removed masks for Y coordinates, fixed bugs related to out-of-bounds coordinates, fixed #914 (#915) 2017-06-21 10:55:38 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
50f7d04044 Import cleanup 2017-05-07 16:55:10 +01:00
13fd8b681e Added some sounds, fixed DestroyBlockParticle wrong particles for blocks with different meta values 2017-05-04 16:50:13 +01:00
f3ab45e7d5 Merged in 1.0.6 changes, added autogenerated data for 1.1.0.3 (doesn't work yet) and deliberately made the same merge error as Mojang 2017-04-14 13:00:43 +01:00
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
c21197ef17 Removed entanglement between chunks and providers. WARNING: BREAKING API CHANGES.
- All entity and tile constructors now require a \pocketmine\level\Level instead of a \pocketmine\level\format\Chunk.
- Chunk->getProvider() and Chunk->setProvider() have been removed.
- Chunk::__construct() has had the $provider parameter removed.
- Chunk->unload() has had the unused $save parameter removed.
- ChunkEvents now take a Level parameter instead of going through the Chunk

API bump to 3.0.0-ALPHA4
2017-02-21 17:08:45 +00:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
2930cf80b4 Merge branch 'master' into mcpe-1.0 2016-12-16 10:29:58 +00:00
5e6d452678 Fix TNT flashing, add explosion particles and add DATA_FUSE_LENGTH entity data constant 2016-12-09 17:20:07 +00:00
35b3259053 Fix explosions over 128 do not damage blocks 2016-12-02 00:01:38 +00:00
6fc435da0e Imports rearrangement 2016-10-03 00:43:46 +08:00
3ffdb8e552 Removed @deprecated classes, methods and properties, added some type hints 2015-09-12 17:10:11 +02:00