Commit Graph

32 Commits

Author SHA1 Message Date
4fd3bee360 Entity: Address fireticks crashdumps
This will now throw an exception at the source instead of crashing when the entity is saved, which should put the blame on the correct plugin responsible for this.
This also includes magic method hacks to preserve backwards compatibility, since the fireTicks field is now protected.
2019-01-19 16:05:10 +00:00
5f48433c95 Bucket: Added sounds for bucket fill/empty 2018-01-03 14:27:41 +00:00
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
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
d1db27016e s/facePos/clickVector/
clickVector better describes this
2017-10-27 19:05:26 +01:00
d8b1757ebc added some nullable and void typehints to Block API 2017-10-11 18:45:40 +01:00
6d5620606e Block->place() parameter refactor to make things clearer 2017-08-26 14:41:49 +01:00
e1d894057c Changed face position floating-point params to Vector3s 2017-08-20 10:23:34 +01:00
83af4dcd59 Block API typehints 2017-08-17 13:50:19 +01:00
561d8e7a39 Regenerated block/item id lists and refactored some names for consistency with MCPE 2017-08-04 12:17:24 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
dab73d8950 Implemented sky light generation-time population and updating, obsolete and close #160 2017-04-18 13:05:01 +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
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02:00
8169803bb4 Updated Water/Lava to use new methods 2015-03-17 21:22:51 +01:00
116ede3679 Improved flight detection, added Entity->resetFallDistance(), closes #2632 2015-02-15 17:40:17 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
4299ebebcc Bump API version to 1.6.1 2014-10-28 00:55:07 +01:00
823dc933b8 Improved Entity extinguish operations and packet spam 2014-10-13 23:44:11 +02:00
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
62af784d37 Removed unused imports 2014-10-08 17:00:23 +02:00
48bc919a33 Added Liquid flow 2014-09-26 16:56:10 +02:00
ae6f532b1d Partial Liquid flow 2014-09-26 13:25:52 +02:00
3ba099b309 Cobweb, Ladders and Water won't cause fall damage 2014-09-16 10:52:00 +02:00
ac4b4b08fd Fixed Level::setBlock() old calls 2014-09-05 11:00:13 +02:00
c47e359262 Updated blocks bounding boxes 2014-08-24 16:30:56 +02:00
ed90d58e32 Fixed crash when placing water or lava 2014-07-28 12:18:17 +02:00
c1546aac9c Updated Position to use Weak / strong references for Level objects 2014-05-22 04:14:06 +02:00
85f7cdb123 Temporarily fix placing blocks near water crash 2014-04-03 16:34:02 -05:00
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00