mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Revamp Tile creation (again)
This breaks down the handling of tile creation even further. - Introduced a static Tile::override() method to allow overriding the construction class for a specific type of chest. This applies to classes as opposed to save IDs, so you can override Chest::class with MyCustomChest::class and it will take effect for any Chest save ID. - Removed MCPE stringy save ID constants from public Tile interface. These are now only used for creating saved tiles from a stored chunk, and saving them. - Renamed Tile::registerTile() to register() - Tile::create() and Tile::createFromItem() now accept a class parameter instead of a stringy save ID. - Tile::create() and Tile::createFromItem() were changed to throw \InvalidArgumentException on unknown/unregistered tile types. They also now never return null, but always (except in exception cases) return an object which is an instanceof the base class specified.
This commit is contained in:
@ -85,9 +85,7 @@ class ItemFrame extends Flowable{
|
||||
$this->facing = $face;
|
||||
|
||||
if(parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player)){
|
||||
if(($tile = Tile::createFromItem(Tile::ITEM_FRAME, $this->getLevel(), $this->asVector3(), $item)) !== null){
|
||||
$this->level->addTile($tile);
|
||||
}
|
||||
$this->level->addTile(Tile::createFromItem(TileItemFrame::class, $this->getLevel(), $this->asVector3(), $item));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user