6763 Commits

Author SHA1 Message Date
Dylan K. Taylor
66562f24fb Made Leaves drops more generic, fix dark oak leaves not dropping apples 1.7dev-501 api/3.0.0-ALPHA10 2017-12-13 12:57:58 +00:00
Dylan K. Taylor
dc064dfa2e Level: Fixed some unnecessary double uses of Level::blockHash() 2017-12-13 11:25:36 +00:00
Dylan K. Taylor
131a6a4d19 Cache fix related to #1813: Don't cache blocks for chunks that don't exist 2017-12-13 10:47:12 +00:00
Dylan K. Taylor
67a576722c Fixed item frames placed on invalid blocks, close #1804 2017-12-13 09:46:18 +00:00
Dylan K. Taylor
3beccc47cd SlotChangeAction: Remove superfluous >= 0 inventorySlot check
This is done by slotExists() anyway.
2017-12-12 10:36:53 +00:00
Dylan K. Taylor
dfc2d1dfe6 Stop hardcoding src/pocketmine/resources everywhere 2017-12-11 19:52:49 +00:00
Dylan K. Taylor
1f1531810d Added \pocketmine\RESOURCE_PATH and Server->getResourcePath() 2017-12-11 19:52:20 +00:00
Dylan K. Taylor
a5fc77749f Added -file (-f) option to start.ps1
This allows specifying a PocketMine-MP PHP file to execute (phar or source) to use to run the server, like start.sh. If not specified, auto-detection is used.
2017-12-11 19:40:02 +00:00
Dylan K. Taylor
98cb7f2e10 Removed redundant filePath from Server constructor
This parameter is hardcoded to \pocketmine\PATH in PocketMine.php. Additionally, it does not make sense for the server source path to not be the server source path. \pocketmine\PATH is accessible from the Server context, therefore it should be used and does not need to be stored.
2017-12-11 19:25:06 +00:00
Dylan K. Taylor
e58db75396 Level: Remove redundant null checks from useBreakOn()
These checks are not needed as of 3eae7a187524233f35deae028b01cf58ccd48157.
2017-12-11 16:31:43 +00:00
Dylan K. Taylor
a94c669730 Fixed sword efficiency on anything that's not cobwebs 2017-12-11 12:57:18 +00:00
Dylan K. Taylor
45ee115b67 Player: Fixed bad effects killing creative players
Players aren't supposed to take magic damage in creative... I don't know who added this, but it's wrong.
2017-12-10 20:50:50 +00:00
Dylan K. Taylor
44e06f6a32 Player: Stop abusing getItemInHand() when we already have it stored 2017-12-10 17:08:56 +00:00
Dylan K. Taylor
2e62c084a4 Oops! composer.lock wasn't up to date 2017-12-10 12:34:01 +00:00
Dylan K. Taylor
a3622dfa9d Updated PocketMine-SPL dependency 2017-12-10 12:26:48 +00:00
Dylan K. Taylor
7c8a29151c MemoryManager: Remove unused field (leftover from 59d9d6a7df92a986ef5896dc0f2afbbe4606114f) 2017-12-10 12:12:43 +00:00
Dylan K. Taylor
8a90d159fe Cleanup unused imports 2017-12-10 12:09:46 +00:00
Dylan K. Taylor
bf4076766e Living: Fixed passing FloatTag to setHealth() when HealF tag is present, close #1784 2017-12-09 20:31:14 +00:00
Dylan K. Taylor
49dbd8b2c8 Living: Remove superfluous fire resistance check from dealFireDamage()
This is already checked in Living->attack(). It's preferable to allow it to be cancelled there since plugins can then un-cancel EntityDamageEvent to bypass the effect.
2017-12-07 17:32:50 +00:00
Dylan K. Taylor
502dd14c67 Entity: Remove excess whitespace in doOnFireTick() 2017-12-07 17:28:37 +00:00
Dylan K. Taylor
74239eec69 Living: Remove nonsensical >0 condition on boolean
Maybe this once returned integers, but it doesn't anymore.
2017-12-07 16:49:16 +00:00
Dylan K. Taylor
3c936e1be8 Entity: removed dead maxFireTicks property 2017-12-07 16:37:32 +00:00
Dylan K. Taylor
16fd37a039 Entity: Add getter & setter for fireTicks 2017-12-07 16:37:01 +00:00
Dylan K. Taylor
1ce961f688 Merge branch 'command-reader-fix' 2017-12-07 13:55:48 +00:00
Dylan K. Taylor
d80f711d18 CommandReader: Removed redundant else branch 2017-12-07 13:50:24 +00:00
Dylan K. Taylor
ebd3d207e4 Fixed server not accepting commands after pressing ctrl+D (non-readline) 2017-12-07 13:42:34 +00:00
Dylan K. Taylor
31f0437c96 fix readline crash when user presses ctrl+D 2017-12-07 13:41:58 +00:00
Dylan K. Taylor
b06ca6eb0b Rename Living->callDeathEvent() to Living->onDeath() 2017-12-07 12:26:49 +00:00
Dylan K. Taylor
67a09a9b16 Bump versions for 1.2.6
No changes. Mojang sucks.
2017-12-06 18:12:45 +00:00
Dylan K. Taylor
51cec525ee Added methods for calculating sun angle and sky light level reduction by day time
Use real sky light level in Level->getFullLightAt()

close #1471
2017-12-06 12:40:52 +00:00
Dylan K. Taylor
a5f4dda918 Added documentation for Level->addChunkPacket()
this method is confusingly named
2017-12-06 11:15:17 +00:00
Dylan K. Taylor
e2d66ac96d Use Player->isBanned() instead of repeating code 2017-12-06 10:38:02 +00:00
Dylan K. Taylor
d03fdd5f72
Liquids refactor, bug fixes and performance improvements (#1753)
* Added Liquid->getLiquidLevelDecreasePerBlock()

* Fixed lava turning into cobblestone when flowing over water

* Cache liquid flow vectors for faster entity movement

* Removed a condition that made lava impossible to get rid of
In the PC code, the equivalent code makes the delay between scheduled ticks 4 times longer. Here, it just breaks the code. I don't know what the 4x stuff is about, but this code does not produce the expected behaviour and lava works fine regardless.

* Fixed strange behaviour with liquids trying to flow into other liquids
Liquids should consider other liquids as a path of least resistance. However, they should not actually flow into them. This fixes a variety of CPU leak issues with falling water in large water bodies such as oceans.
This also fixes the plus-shape effect that liquid is supposed to produce when a source is placed above ground.

* Removed a bad optimization making liquids flowing down slopes behave undesirably

* Optimize performance of slope searching by limiting recursion depth based on previous path lengths
If we already found a step down on a previous run after 2 blocks, it doesn't make sense to continue allowing checking 4 blocks because the results will just be ignored. This allows limiting the number of recursion steps, which significantly improves the performance when flowing down slopes.
However, this will still be just as bad for performance on flat terrain as it was to start with.

* Make some Liquid methods only accept Blocks as parameters
these are only ever passed blocks anyway, doesn't make sense to allow vectors.

* Moved some things to local variables
these are each only used in one function, so it doesn't make sense for them to be class members.

* Fixed water flow down slopes going everywhere, but degraded performance again

* Lava should only search 2 blocks for a slope

* Stop wasting CPU calculating optimal flow directions for liquids with too-high decay
It calculates the flow directions and THEN doesn't use them when it
realizes the flow decay is too high. This is completely pointless.

* Use a less hacky method to handle lava flowing into water

* Doubled flow performance on flat terrain
Since calculateFlowCost() usually ends up visiting the same blocks about 6 times when on flat terrain, it makes sense to cache some stuff for when blocks get revisited so expensive dumb checks don't need to keep on being done. On my machine this produces a 50-60% performance improvement when flowing on flat terrain.

* Fixed missing return values in Liquid->onUpdate()
these return values aren't used anywhere, but we should be consistent

* Don't allow flowing back in the same direction we just came from
This reduces the recursions by about 30%, providing about the same percentage performance improvement.

* Remove Liquid's temporalVector (it's not used anymore)
primitive types for the win!

* Move liquid collide to its own method

* add sound for lava/water mix
2017-12-04 10:09:35 +00:00
Dylan K. Taylor
990a48d858 Better error message when a level is unloaded during its level tick
Plugins may cause this issue unexpectedly by unloading levels directly during events such as EntityDamageEvent. This adds a better error message to allow developers to understand what is going on and create appropriate workarounds.
2017-12-04 10:01:55 +00:00
Dylan K. Taylor
af68125872 Make Level->getName() less volatile
this resolves problems with crashes when getName() is called on an unloaded level. This obviously doesn't solve the root cause of the issue (level being accessed after unload) but since many things use the level name without checking if it's unloaded first, it's a bad idea for it to be volatile.

This resolves the server crash issue noted in #1527, where an exception is raised due to level unload during a tick, which subsequently causes a crash when trying to log the exception.
2017-12-04 09:57:53 +00:00
Dylan K. Taylor
5a0afa9f88
Fixed broken logic in EntityEffectEvents, close #1767 (#1768) 2017-12-03 16:14:20 +00:00
Dylan K. Taylor
c301788864 API bump 2017-12-02 17:22:05 +00:00
Dylan K. Taylor
472bf1a1ef Kill off the JSON garbage in commands
kill it with fire!
2017-12-02 16:33:19 +00:00
Dylan K. Taylor
1a4b653d07 Color: Fixed a confusing inconsistency in documentation 2017-12-02 16:17:27 +00:00
Dylan K. Taylor
d9f0546cb3 Added Color::mix() 2017-12-02 16:17:12 +00:00
Muqsit
92a1f45175 Make Living::addEffect() return bool (#1755) 2017-12-01 16:56:37 +00:00
Dylan K. Taylor
0afe20c382 Remove redundant overridden meta property from Air 2017-11-30 11:10:07 +00:00
Dylan K. Taylor
e94db980d7 Fixed not being able to wear armour 2017-11-29 19:51:38 +00:00
Dylan K. Taylor
2cb81b5f8d NetworkInventoryAction: Allow returning null to ignore weird transactions
Revert "Return null on unmatched inventory action and log details"

This reverts commit fd7fb10223f7373919701008970e7e87abc2654e.
2017-11-29 12:44:41 +00:00
Dylan K. Taylor
78cf875080 Quick-fix for crafting with big crafting grid after cancelling PlayerInteractEvent on a crafting table
this is not an ideal solution, but it works. Crafting is messy and is going to need more refactoring. Fixes #1480
2017-11-28 19:23:26 +00:00
Dylan K. Taylor
878f1bffb9 CraftingTransaction: Don't hardcode crafting grid sizes 2017-11-28 17:29:53 +00:00
Dylan K. Taylor
98ac6fc7be Check inventory slot is in range in SlotChangeAction 2017-11-28 16:56:02 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
d3e5733ea0 Significantly improved light population performance using subchunk
direct accessing

These changes produce upwards of 2x better performance (YMMV, also
depends on the circumstances).
2017-11-28 11:20:22 +00:00
Dylan K. Taylor
4703715063 Added a SubChunkIteratorManager class for faster subchunk handling 2017-11-28 11:20:14 +00:00