Commit Graph

34 Commits

Author SHA1 Message Date
78bb0145aa Remove unused imports from Block namespace 2018-10-05 18:31:06 +01:00
2600cf5977 Split some block variants into their own classes where behaviour differs 2018-09-28 16:21:03 +01:00
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
f7f06c993d Make block constructors not write to this->meta directly 2018-09-16 14:10:40 +01:00
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
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
6abf880e44 Block: Drop unnecessary parameters for ItemFactory::get() 2017-12-13 18:37:04 +00:00
b9b50dd5dc Added Block->getDropsForCompatibleTool(), removed lots of boilerplate code from subclasses
The function name is a little long-winded, but that can always be refactored later if needed. This provides a way for blocks requiring specific tools to override drops with non-standard stuff without needing to worry about what tool type was used.

It's also possible that passing the Item used here is actually entirely redundant, but again that can be fixed later.
2017-12-12 20:02:50 +00:00
da3640357c Rename Block->canBeBrokenWith() to isCompatibleWithTool() and add documentation
This name better describes it. "can be broken with" implies that items which this returns false for cannot destroy the block at all, which is incorrect. What this actually returns is whether the item is the best tool to use to break the block.
2017-12-12 19:51:31 +00:00
99fe63b2a3 Added harvest level properties to applicable blocks
this fixes block-breaking animations with wrong tools, and also finally resolves the long-standing hierarchy problem in Stair.
2017-12-12 13:54:17 +00:00
55d0684565 Move block-breaking tool-type constants to a BlockToolType interface 2017-12-12 13:45:52 +00:00
2088a43c56 Refactored tool hierarchy 2017-12-12 13:45:51 +00:00
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
f148c366f9 Use Block->getVariant() more, get rid of hardcoded bitmasks 2017-10-18 17:46:24 +01:00
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
d8f0dd6db8 Changed Block->getDrops() to return Item[] 2017-08-18 11:21:33 +01:00
83af4dcd59 Block API typehints 2017-08-17 13:50:19 +01:00
021dbd65d7 Cleaned up some copy-pasted code for coloured blocks names 2017-08-16 14:38:41 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
94b79ac28a Tool tier added to getDrops 2015-10-11 00:52:44 +02:00
9f953fa675 Fixed #3232 2015-07-27 20:31:55 +02:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02: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
6b6222c09c Allow passing a Player source as last parameter on Inventory->addItem() and Inventory->removeItem() 2014-11-04 00:16:25 +01:00
90777014b6 Fixed Stone crash 2014-11-01 16:17:47 +01:00
eab86f5f90 Replaced array() with [] 2014-08-28 17:04:22 +02:00
049103ab7a Improved Block selection and construction performance 2014-08-25 16:39:47 +02:00
758a6af678 Added Chiseled stone brick, red sand, end stone 2014-08-16 13:34:58 +02:00
71bf984e9e Better fix for shared STONE constant, closes #1711 2014-07-17 21:20:15 +02:00
b4e502be13 Added Diorite, Granite, Andesite, and polished versions 2014-06-16 16:16:21 +02:00
6cbd39de9b Added Inventory interfaces and types, updated long array() to [] 2014-05-22 18:59:16 +02:00
dd17652aca Fixed wrong paths 2014-04-01 05:06:12 +02:00