50 Commits

Author SHA1 Message Date
Dylan K. Taylor
79ef8e0803 Replace all legacy blockID references with BlockIds:: 2019-03-23 19:44:33 +00:00
Dylan K. Taylor
0f7f5362b8 Revert "Block: Get rid of state bitmasks"
This reverts commit b7b05e729e4fcfbe74786342882d011f004658fa.

Apparently this was premature, because we still need these things to deal with default state remapping.
2019-02-24 18:30:18 +00:00
Dylan K. Taylor
b7b05e729e Block: Get rid of state bitmasks
This story dates back to the days when getVariantBitmask() was introduced. The purpose of this function was to allow the variant info to be extracted from the metadata, for use with item drops. This was later changed to state bitmask for reasons I don't clearly recall.
In the great 4.0 refactor, we now store variant magic numbers separately, so we don't need any generic bitmask to split up variant and state information anymore. Variant is now only ever serialized and never deserialized. The same thing goes for blockIDs. States are read from the world by matching the full stateID against a table of prefilled known blocks, so the variant doesn't need to be deserialized - only the state does, and the state metadata readers already do bit fuckery by themselves and don't need this mask - notice how little actual changes were required to get rid of this?
2019-02-24 14:42:53 +00:00
Dylan K. Taylor
a5c260352d Infect remaining places with PHP 7.1 nullable typehints 2019-02-22 12:16:45 +00:00
Dylan K. Taylor
635fb5dde4 Clean up ID flattening hacks 2019-02-21 10:38:29 +00:00
Dylan K. Taylor
b8adfd6948 edu: implement coloured and underwater torches 2019-02-18 11:37:57 +00:00
Dylan K. Taylor
78a80a6958 Tighten validity checks for block metadata
This filters out over 200 invalid states which were previously considered just fine, including zero-width cakes, buttons with broken facing values, furnace/chest with crazy values, and more.
2018-12-28 14:33:09 +00:00
Dylan K. Taylor
873b64259d Torch: remove trailing comma 2018-10-12 19:07:43 +01:00
Andrew
a944641509 Torch: Fix placement issues when clicking the bottom of a block, closes #2453 (#2474) 2018-10-12 12:26:44 +01:00
Dylan K. Taylor
9d2e9e1663 Fixed torch facing bug with wrong metadata
torches cannot face down
2018-09-21 19:45:52 +01:00
Dylan K. Taylor
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
Dylan K. Taylor
31e4093882 Remove some remaining hardcoded meta maps 2018-09-16 18:00:16 +01:00
Dylan K. Taylor
8aab51c532 Merge branch 'release/3.3' 2018-09-16 17:47:41 +01:00
Dylan K. Taylor
e9b84ecc8b Fixed incorrect break check for torch 2018-09-16 17:46:50 +01:00
Dylan K. Taylor
f7f06c993d Make block constructors not write to this->meta directly 2018-09-16 14:10:40 +01:00
Dylan K. Taylor
c0962a47be Block: Use parent::place() instead of setBlock() directly 2018-09-13 12:54:03 +01:00
Dylan K. Taylor
f218868338 Separate facing/bearing handling from Vector3, deobfusticate a ton of @shoghicp old code 2018-09-05 19:56:14 +01:00
Dylan K. Taylor
ac5a91b67e Cleaned up bool comparison mess 2018-03-19 14:10:55 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
4f8e4f0522
Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
Dylan K. Taylor
d1db27016e s/facePos/clickVector/
clickVector better describes this
2017-10-27 19:05:26 +01:00
Dylan K. Taylor
6b78ba8c25 replace some hardcoded values with Vec3 constants 2017-10-18 17:03:18 +01:00
Dylan K. Taylor
6d5620606e Block->place() parameter refactor to make things clearer 2017-08-26 14:41:49 +01:00
Dylan K. Taylor
8ce833bf74 Stripped redundant trailing commas 2017-08-25 12:41:49 +01:00
Dylan K. Taylor
c394aea803 Replaced more literal ints with Vector3 constants 2017-08-20 10:43:48 +01:00
Dylan K. Taylor
e1d894057c Changed face position floating-point params to Vector3s 2017-08-20 10:23:34 +01:00
Dylan K. Taylor
41c6cb6f97 Added Block->getVariantBitmask(0 to cut down on getDrops() boilerplate, fixed several blocks incorrectly retaining meta when broken 2017-08-18 19:49:28 +01:00
Dylan K. Taylor
d8f0dd6db8 Changed Block->getDrops() to return Item[] 2017-08-18 11:21:33 +01:00
Dylan K. Taylor
83af4dcd59 Block API typehints 2017-08-17 13:50:19 +01:00
Dylan K. Taylor
2103c981a9 Replaced literal ints with Vector3 constants for Block->getSide() calls 2017-08-04 13:33:23 +01:00
Dylan K. Taylor
561d8e7a39 Regenerated block/item id lists and refactored some names for consistency with MCPE 2017-08-04 12:17:24 +01:00
Dylan K. Taylor
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
5926bab323 Block light bug fixes (#454)
* Fixed an age-old light calculation bug causing solid blocks to filter their own light, fixed #375, probably fixed #288
Light spread reduction should be done based on the _target's_ light filter level, not the source.

* Revert "Fix Glowing Obsidian lighting"
This hack is no longer necessary.
This reverts commit 35c33ba980887e9680d62bbcb65f8537bb063f2c.

* Fixed wrong light levels for torch and redstone torch

* Take adjacent light levels and opacity changes into account, block light will now spread when an obstruction is removed, close #455

* Added timings for Level->setBlock() and lighting updates
2017-03-24 17:56:26 +00:00
Dylan K. Taylor
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
Shoghi Cervantes
547e152e40
Fixed #2615, closes #2634 invalid pull request 2015-02-15 15:12:33 +01:00
Shoghi Cervantes
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
Shoghi Cervantes
a98da3bab1 Renamed old getID() calls to getId() 2014-12-07 15:21:32 +01:00
Shoghi Cervantes
af82d616c1 Block creating and property handling rewrite, part2 2014-12-07 02:20:26 +01:00
Shoghi Cervantes
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
Shoghi Cervantes
b3c3f896a3 Implemented light population, added Level->getFullLight() 2014-11-28 14:44:27 +01:00
Shoghi Cervantes
883f93cc8c Improved item drop spawning 2014-10-13 22:45:04 +02:00
Shoghi Cervantes
48041b2f19 Basic entity motion on water 2014-09-27 00:09:38 +02:00
Shoghi Cervantes
529bf743db Added torch drop 2014-09-26 23:07:43 +02:00
Shoghi Cervantes
ac4b4b08fd Fixed Level::setBlock() old calls 2014-09-05 11:00:13 +02:00
Shoghi Cervantes
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
Shoghi Cervantes
c47e359262 Updated blocks bounding boxes 2014-08-24 16:30:56 +02:00
Shoghi Cervantes
0be679c9d5 Updated method names: getMetadata() & setMetadata() to getDamage() & setDamage() on Block and Item classes 2014-05-22 18:37:28 +02:00
Shoghi Cervantes
c1546aac9c Updated Position to use Weak / strong references for Level objects 2014-05-22 04:14:06 +02:00
Shoghi Cervantes
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00