mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 16:34:05 +00:00
Remove ItemFrame drops hack
This commit is contained in:
parent
6adc813a7f
commit
976d5583cc
@ -58,17 +58,6 @@ class ItemFrame extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item, Player $player = null) : bool{
|
|
||||||
$tile = $this->level->getTile($this);
|
|
||||||
if($tile instanceof TileItemFrame){
|
|
||||||
//TODO: add events
|
|
||||||
if(lcg_value() <= $tile->getItemDropChance() and $tile->getItem()->getId() !== Item::AIR){
|
|
||||||
$this->level->dropItem($tile->getBlock(), $tile->getItem());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parent::onBreak($item, $player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onUpdate(int $type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$sides = [
|
$sides = [
|
||||||
@ -109,4 +98,18 @@ class ItemFrame extends Flowable{
|
|||||||
public function getVariantBitmask() : int{
|
public function getVariantBitmask() : int{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDrops(Item $item) : array{
|
||||||
|
$drops = parent::getDrops($item);
|
||||||
|
|
||||||
|
$tile = $this->level->getTile($this);
|
||||||
|
if($tile instanceof TileItemFrame){
|
||||||
|
$tileItem = $tile->getItem();
|
||||||
|
if(lcg_value() <= $tile->getItemDropChance() and !$tileItem->isNull()){
|
||||||
|
$drops[] = $tileItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $drops;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user