470 Commits

Author SHA1 Message Date
Dylan K. Taylor
060c300d50 Bed::setOccupied() no longer sets itself into the world
setting itself into the world is very annoying when trying to simply set up a blockstate.
2020-08-05 20:59:59 +01:00
Dylan K. Taylor
764f92c456 BlockLegacyIdHelper: fixed a mistake in exception message 2020-08-03 23:59:06 +01:00
Dylan K. Taylor
977f9ec497 Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/VersionInfo.php
#	src/pocketmine/block/Podzol.php
2020-07-21 11:57:24 +01:00
Dylan K. Taylor
213afa42dd BlockFactory: make registerElements() a bit less wide 2020-07-19 13:09:48 +01:00
Dylan K. Taylor
915d63a2e8 Button: rename powered property to pressed 2020-07-17 14:54:51 +01:00
Dylan K. Taylor
b09b619a30 updated VanillaBlocks 2020-07-17 14:23:32 +01:00
Dylan K. Taylor
2226efd7a0 added base data handling for Lab Table, Compound Creator, Element Constructor and Material Reducer
these also have a blockentity which needs to be implemented as well.
2020-07-11 17:44:50 +01:00
Dylan K. Taylor
d4f6dc8179 BlockFactory: make color block registration slightly less painful to look at 2020-07-11 10:50:02 +01:00
Dylan K. Taylor
62815f6c9b Furnace: get rid of entirely unnecessary ItemFactory usage 2020-07-10 21:38:29 +01:00
Dylan K. Taylor
279abb871d Remove all usages of CompoundTag->hasTag()
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
Frago9876543210
c1a815a458
Sign (block): added setText() (#3100) 2020-07-09 13:43:42 +01:00
Dylan K. Taylor
909f3f39de Block: get rid of getRuntimeId()
the runtime ID mapping should be non-global in case of multiple protocols.
2020-07-06 11:18:29 +01:00
Dylan K. Taylor
68c408268c Separate dye colour ID management from DyeColor enum 2020-07-05 19:04:22 +01:00
Dylan K. Taylor
bf5da596f7 Get rid of WALL metadata mapping 2020-07-05 18:27:10 +01:00
Dylan K. Taylor
79d8bf898a Moved glazed-terracotta ID-mapping table to BlockLegacyIdHelper 2020-07-05 18:20:41 +01:00
Dylan K. Taylor
eddb2b7fdd Moved some legacyID mapping code to a separate BlockLegacyIdHelper
this makes the code more reusable and will facilitate getting rid of legacy IDs from within the core code.
2020-07-05 16:52:42 +01:00
Dylan K. Taylor
2219f61ea0 BlockLegacyMetadata: added constants for chemistry table variants 2020-07-05 11:13:29 +01:00
Dylan K. Taylor
740ed2013f Merge commit '57b6451e1'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/Ladder.php
2020-07-04 22:22:22 +01:00
Dylan K. Taylor
2cd67aed72 Block: fixed crash on block factory clone 2020-06-29 22:40:35 +01:00
Dylan K. Taylor
da3f0752a6 Block: make getAllSides() and getHorizontalSides() use underlying Vector3 generators 2020-06-29 22:13:07 +01:00
Dylan K. Taylor
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
Dylan K. Taylor
fc22fd80d8 Eradicate remaining usages of Position->getWorld() 2020-06-29 21:03:55 +01:00
Dylan K. Taylor
43ae1a5cb4 Block: make getAllSides() and getHorizontalSides() return generators 2020-06-29 20:54:51 +01:00
Dylan K. Taylor
e61a08a56b Make SignText immutable 2020-06-29 20:18:10 +01:00
Dylan K. Taylor
42f543b405 SignText: fixed crash when fetching lines of text if not all lines were provided to the constructor 2020-06-29 19:35:38 +01:00
Dylan K. Taylor
0b05fd1987 added missing file 2020-06-29 18:54:47 +01:00
Dylan T
d585081c22
Separate consumable item interfaces from general consumable interfaces (#3595)
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
2020-06-28 17:53:03 +01:00
Dylan K. Taylor
01d221b794 imports cleanup 2020-06-28 17:50:49 +01:00
Dylan K. Taylor
f1048aeaa3 Block: rework addVelocityToEntity() to avoid vector3 mutation 2020-06-27 21:38:24 +01:00
Dylan K. Taylor
7e391a8123 Tile: use phpstan-friendly way to pass block NBT
fixes 1 level 8 error
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
9484220bd5 ContainerTrait: use a static-analysis-friendly way to read NBT, fixes 4 phpstan level 8 errors 2020-06-27 13:09:05 +01:00
Dylan K. Taylor
f039a077cd ItemFrame: fixed a phpstan level 8 error 2020-06-27 13:09:05 +01:00
Dylan K. Taylor
7e6adc41f0 Merge 1.16 support into PM4 (with changes) 2020-06-26 22:21:09 +01:00
Dylan K. Taylor
1ef6e5e17b TileFactory now only manages loading tiles from NBT, not direct creation
my objective is to make this use proper constructors like entities, but there's a couple of obstacles to get around first.
2020-06-21 00:47:02 +01:00
Dylan K. Taylor
42637f97c6 Liquid: eliminate some unnecessary Vector3 field mutations 2020-06-20 21:32:24 +01:00
Dylan K. Taylor
4b528aa637 NBT is no longer needed to create an entity
it's still able to be provided, but shouldn't be needed in the majority of cases (constructor args and/or API methods should be sufficient).
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
1205432c34 Extract mandatory parameters into constructor parameters
the goal is obviously to ditch NBT entirely here, but there's more work to be done before that becomes possible.
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
6a26c0bebf EntityFactory now exclusively handles loading data from disk
this commit removes the ability to replace centrally registered entity classes in favour of using constructors directly.
In future commits I may introduce a dedicated factory interface which allows an _actual_ factory pattern (e.g. factory->createArrow(world, pos, shooter, isCritical) with proper static analysability) but for now it's peripheral to my intended objective.
The purpose of this change is to facilitate untangling of NBT from entity constructors so that they can be properly created without using NBT at all, and instead use nice APIs.

Spawn eggs now support arbitrary entity creation functions like EntityFactory does, allowing much more flexibility in what can be passed to an entity's constructor (e.g. a Plugin reference can be injected by use()ing it in a closure or via traditional DI.
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
921aa091e0 Merge commit '04191ec44a00dd058f5d7e9e315d451e44285494'
# Conflicts:
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
2020-06-17 20:40:12 +01:00
Dylan K. Taylor
017afead3b extract FurnaceRecipeManager unit from CraftingManager
I'd like to have this directly provided to Furnace, but I don't know how to short of making into a singleton. Since I want to have per-furnace recipe managers (e.g. for stuff like blast furnace vs regular furnace etc), a singleton isn't really an option.
2020-06-03 18:59:59 +01:00
Dylan K. Taylor
e250553670 Merge commit '3f2455f09'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/SnowLayer.php
2020-06-03 12:43:36 +01:00
Dylan K. Taylor
d7ae86b30c Merge commit '9d26a224a'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/DoublePlant.php
2020-06-03 12:35:59 +01:00
Dylan K. Taylor
0a730db030 Merge commit '4199c3796f4c6d8da0eccba64fe4cd9812acadeb'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/block/Water.php
2020-05-31 14:46:51 +01:00
Dylan K. Taylor
ec8ee29291 moving sneak & sprint properties to Living 2020-05-21 19:55:58 +01:00
Dylan K. Taylor
f93bc0739c Force types of RegistryTrait usages to shut PHPStan up
we need generic traits to solve this problem properly.
2020-05-21 19:12:48 +01:00
Dylan K. Taylor
8e2b9b686b Block: Invert default behaviour of silk touch (more logical)
Now, blocks do not respond to silk touch unless specifically opted into. Since this always involves custom drops in one way or another, it's easy enough to figure out which blocks need to be marked for silk touch - anything that overrides getDrops, getDropsForCompatibleTool or getSilkTouchDrops is a block which _might_ need to be flagged. Using these criteria to reduce the number of blocks needing to be checked, I was able to manually invert the behaviour as needed.

This fixes reoccurring bugs with blocks erroneously dropping themselves whenever new blocks are added and someone forgot to set that flag, granting players access to internal blocks with strange behaviour.
2020-05-21 13:02:36 +01:00
Dylan K. Taylor
72f59eca3c Slab: ignore silk touch on breaking tools, closes #2794 2020-05-21 11:46:43 +01:00
Dylan K. Taylor
8ec2ba79de Unhackify Registry member cloning, fixes #3519 2020-05-21 11:38:02 +01:00
Dylan K. Taylor
3f1f135a59 remove a couple more Position->getWorld() usages 2020-05-19 21:38:51 +01:00
Dylan K. Taylor
337addf1de Eradicate remaining usages of public Position->world field
and as an added bonus, ditch a bunch of extra phpstan errors
2020-05-19 19:14:56 +01:00