mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Added Buckets
This commit is contained in:
parent
c334bbce12
commit
452df5b2f8
@ -95,6 +95,10 @@ define("PAINTING", 321);
|
|||||||
define("GOLDEN_APPLE", 322);
|
define("GOLDEN_APPLE", 322);
|
||||||
define("SIGN", 323);
|
define("SIGN", 323);
|
||||||
define("WOODEN_DOOR", 324);
|
define("WOODEN_DOOR", 324);
|
||||||
|
define("BUCKET", 325);
|
||||||
|
define("WATER_BUCKET", 326);
|
||||||
|
define("LAVA_BUCKET", 327);
|
||||||
|
|
||||||
|
|
||||||
define("IRON_DOOR", 330);
|
define("IRON_DOOR", 330);
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ class Item{
|
|||||||
MELON_SEEDS => "MelonSeedsItem",
|
MELON_SEEDS => "MelonSeedsItem",
|
||||||
SIGN => "SignItem",
|
SIGN => "SignItem",
|
||||||
WOODEN_DOOR => "WoodenDoorItem",
|
WOODEN_DOOR => "WoodenDoorItem",
|
||||||
|
BUCKET => "BucketItem",
|
||||||
|
WATER_BUCKET => "WaterBucketItem",
|
||||||
|
LAVA_BUCKET => "LavaBucketItem",
|
||||||
IRON_DOOR => "IronDoorItem",
|
IRON_DOOR => "IronDoorItem",
|
||||||
BED => "BedItem",
|
BED => "BedItem",
|
||||||
PAINTING => "PaintingItem",
|
PAINTING => "PaintingItem",
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
44
src/material/item/generic/LavaBucket.php
Normal file
44
src/material/item/generic/LavaBucket.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 LavaBucketItem extends Item{
|
||||||
|
public function __construct($meta = 0, $count = 1){
|
||||||
|
parent::__construct(LAVA_BUCKET, 0, $count, "Lava 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() === AIR){
|
||||||
|
$level->setBlock($target, STILL_LAVA, 0);
|
||||||
|
$player->removeItem($this->getID(), $this->getMetadata(), $this->count);
|
||||||
|
$player->addItem(BUCKET, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
44
src/material/item/generic/WaterBucket.php
Normal file
44
src/material/item/generic/WaterBucket.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 WaterBucketItem extends Item{
|
||||||
|
public function __construct($meta = 0, $count = 1){
|
||||||
|
parent::__construct(WATER_BUCKET, 0, $count, "Water 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() === AIR){
|
||||||
|
$level->setBlock($target, STILL_WATER, 0);
|
||||||
|
$player->removeItem($this->getID(), $this->getMetadata(), $this->count);
|
||||||
|
$player->addItem(BUCKET, 0, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user