mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
Added Buckets
This commit is contained in:
parent
c334bbce12
commit
452df5b2f8
5 changed files with 139 additions and 0 deletions
44
src/material/item/generic/Bucket.php
Normal file
44
src/material/item/generic/Bucket.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|
||||
-
|
||||
/ \
|
||||
/ \
|
||||
/ PocketMine \
|
||||
/ MP \
|
||||
|\ @shoghicp /|
|
||||
|. \ / .|
|
||||
| .. \ / .. |
|
||||
| .. | .. |
|
||||
| .. | .. |
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
\ | /
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
class BucketItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(BUCKET, 0, $count, "Empty Bucket");
|
||||
$this->isActivable = true;
|
||||
$this->maxStackSize = 1;
|
||||
}
|
||||
|
||||
public function onActivate(BlockAPI $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->getID() === STILL_WATER or $target->getID() === STILL_LAVA){
|
||||
$level->setBlock($target, AIR, 0);
|
||||
$player->removeItem($this->getID(), $this->getMetadata(), $this->count);
|
||||
$player->addItem(($target->getID() === STILL_LAVA ? LAVA_BUCKET:WATER_BUCKET), 0, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue