mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
Merge pull request #44 from kotyaralih/better-block-updates
fixed bucket
This commit is contained in:
commit
094c420a26
1 changed files with 6 additions and 2 deletions
|
|
@ -16,10 +16,14 @@ class BucketItem extends Item{
|
||||||
|
|
||||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($this->meta === AIR){
|
if($this->meta === AIR){
|
||||||
if($block instanceof LiquidBlock){
|
if($target instanceof LiquidBlock && $target->getMetadata() == 0){
|
||||||
$level->setBlock($target, new AirBlock(), true, false, true);
|
$level->setBlock($target, new AirBlock(), true, false, true);
|
||||||
if(($player->gamemode & 0x01) === 0){
|
if(($player->gamemode & 0x01) === 0){
|
||||||
$this->meta = ($target instanceof WaterBlock) ? WATER : LAVA;
|
$this->meta = match($target->getID()){
|
||||||
|
WATER, STILL_WATER => WATER,
|
||||||
|
LAVA, STILL_LAVA => LAVA,
|
||||||
|
default => 0
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue