mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-28 06:09:57 +00:00
Item: added some foods, cleaned up Fish abomination
@PEMapModder GET A CLIENT ALREADY
This commit is contained in:
parent
b130374e46
commit
9098502199
38
src/pocketmine/item/Clownfish.php
Normal file
38
src/pocketmine/item/Clownfish.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class Clownfish extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::CLOWNFISH, $meta, "Clownfish");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 0.2;
|
||||
}
|
||||
}
|
@ -23,16 +23,16 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class CookedFish extends Fish{
|
||||
class CookedFish extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
Food::__construct(self::COOKED_FISH, $meta, $meta === self::FISH_SALMON ? "Cooked Salmon" : "Cooked Fish");
|
||||
parent::__construct(self::COOKED_FISH, $meta, "Cooked Fish");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return $this->meta === self::FISH_SALMON ? 6 : 5;
|
||||
return 5;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return $this->meta === self::FISH_SALMON ? 9.6 : 6;
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
38
src/pocketmine/item/CookedMutton.php
Normal file
38
src/pocketmine/item/CookedMutton.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class CookedMutton extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::COOKED_MUTTON, $meta, "Cooked Mutton");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 9.6;
|
||||
}
|
||||
}
|
38
src/pocketmine/item/CookedSalmon.php
Normal file
38
src/pocketmine/item/CookedSalmon.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class CookedSalmon extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::COOKED_SALMON, $meta, "Cooked Salmon");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 9.6;
|
||||
}
|
||||
}
|
@ -132,7 +132,7 @@ class ItemFactory{
|
||||
self::registerItem(new FishingRod());
|
||||
self::registerItem(new Clock());
|
||||
self::registerItem(new Item(Item::GLOWSTONE_DUST, 0, "Glowstone Dust"));
|
||||
self::registerItem(new Fish());
|
||||
self::registerItem(new RawFish());
|
||||
self::registerItem(new CookedFish());
|
||||
self::registerItem(new Dye());
|
||||
self::registerItem(new Item(Item::BONE, 0, "Bone"));
|
||||
@ -177,7 +177,7 @@ class ItemFactory{
|
||||
self::registerItem(new Carrot());
|
||||
self::registerItem(new Potato());
|
||||
self::registerItem(new BakedPotato());
|
||||
//TODO: POISONOUS_POTATO
|
||||
self::registerItem(new PoisonousPotato());
|
||||
//TODO: EMPTYMAP
|
||||
self::registerItem(new GoldenCarrot());
|
||||
self::registerItem(new ItemBlock(Block::SKULL_BLOCK, 0, Item::SKULL));
|
||||
@ -194,9 +194,9 @@ class ItemFactory{
|
||||
//TODO: HOPPER_MINECART
|
||||
self::registerItem(new Item(Item::PRISMARINE_SHARD, 0, "Prismarine Shard"));
|
||||
self::registerItem(new ItemBlock(Block::HOPPER_BLOCK, 0, Item::HOPPER));
|
||||
//TODO: RABBIT
|
||||
self::registerItem(new RawRabbit());
|
||||
self::registerItem(new CookedRabbit());
|
||||
//TODO: RABBIT_STEW
|
||||
self::registerItem(new RabbitStew());
|
||||
self::registerItem(new Item(Item::RABBIT_FOOT, 0, "Rabbit's Foot"));
|
||||
self::registerItem(new Item(Item::RABBIT_HIDE, 0, "Rabbit Hide"));
|
||||
//TODO: HORSEARMORLEATHER
|
||||
@ -206,8 +206,8 @@ class ItemFactory{
|
||||
//TODO: LEAD
|
||||
//TODO: NAMETAG
|
||||
self::registerItem(new Item(Item::PRISMARINE_CRYSTALS, 0, "Prismarine Crystals"));
|
||||
//TODO: MUTTONRAW
|
||||
//TODO: COOKED_MUTTON
|
||||
self::registerItem(new RawMutton());
|
||||
self::registerItem(new CookedMutton());
|
||||
//TODO: ARMOR_STAND
|
||||
//TODO: END_CRYSTAL
|
||||
self::registerItem(new ItemBlock(Block::SPRUCE_DOOR_BLOCK, 0, Item::SPRUCE_DOOR));
|
||||
@ -235,10 +235,10 @@ class ItemFactory{
|
||||
self::registerItem(new Beetroot());
|
||||
self::registerItem(new BeetrootSeeds());
|
||||
self::registerItem(new BeetrootSoup());
|
||||
//TODO: RAW_SALMON
|
||||
//TODO: CLOWNFISH
|
||||
//TODO: PUFFERFISH
|
||||
//TODO: COOKED_SALMON
|
||||
self::registerItem(new RawSalmon());
|
||||
self::registerItem(new Clownfish());
|
||||
self::registerItem(new Pufferfish());
|
||||
self::registerItem(new CookedSalmon());
|
||||
|
||||
self::registerItem(new GoldenAppleEnchanted());
|
||||
|
||||
|
50
src/pocketmine/item/PoisonousPotato.php
Normal file
50
src/pocketmine/item/PoisonousPotato.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\Effect;
|
||||
use pocketmine\entity\EffectInstance;
|
||||
|
||||
class PoisonousPotato extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::POISONOUS_POTATO, $meta, "Poisonous Potato");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 1.2;
|
||||
}
|
||||
|
||||
public function getAdditionalEffects() : array{
|
||||
if(mt_rand(0, 100) > 40){
|
||||
return [
|
||||
new EffectInstance(Effect::getEffect(Effect::POISON), 100)
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
@ -26,55 +26,24 @@ namespace pocketmine\item;
|
||||
use pocketmine\entity\Effect;
|
||||
use pocketmine\entity\EffectInstance;
|
||||
|
||||
class Fish extends Food{
|
||||
public const FISH_FISH = 0;
|
||||
public const FISH_SALMON = 1;
|
||||
public const FISH_CLOWNFISH = 2;
|
||||
public const FISH_PUFFERFISH = 3;
|
||||
|
||||
class Pufferfish extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
$name = "Raw Fish";
|
||||
if($this->meta === self::FISH_SALMON){
|
||||
$name = "Raw Salmon";
|
||||
}elseif($this->meta === self::FISH_CLOWNFISH){
|
||||
$name = "Clownfish";
|
||||
}elseif($this->meta === self::FISH_PUFFERFISH){
|
||||
$name = "Pufferfish";
|
||||
}
|
||||
parent::__construct(self::RAW_FISH, $meta, $name);
|
||||
parent::__construct(self::PUFFERFISH, $meta, "Pufferfish");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
if($this->meta === self::FISH_FISH){
|
||||
return 2;
|
||||
}elseif($this->meta === self::FISH_SALMON){
|
||||
return 2;
|
||||
}elseif($this->meta === self::FISH_CLOWNFISH){
|
||||
return 1;
|
||||
}elseif($this->meta === self::FISH_PUFFERFISH){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
if($this->meta === self::FISH_FISH){
|
||||
return 0.4;
|
||||
}elseif($this->meta === self::FISH_SALMON){
|
||||
return 0.4;
|
||||
}elseif($this->meta === self::FISH_CLOWNFISH){
|
||||
return 0.2;
|
||||
}elseif($this->meta === self::FISH_PUFFERFISH){
|
||||
return 0.2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getAdditionalEffects() : array{
|
||||
return $this->meta === self::FISH_PUFFERFISH ? [
|
||||
return [
|
||||
new EffectInstance(Effect::getEffect(Effect::HUNGER), 300, 2),
|
||||
new EffectInstance(Effect::getEffect(Effect::NAUSEA), 300, 1),
|
||||
new EffectInstance(Effect::getEffect(Effect::POISON), 1200, 3)
|
||||
] : [];
|
||||
new EffectInstance(Effect::getEffect(Effect::POISON), 1200, 3),
|
||||
new EffectInstance(Effect::getEffect(Effect::NAUSEA), 300, 1)
|
||||
];
|
||||
}
|
||||
}
|
46
src/pocketmine/item/RabbitStew.php
Normal file
46
src/pocketmine/item/RabbitStew.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class RabbitStew extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::RABBIT_STEW, $meta, "Rabbit Stew");
|
||||
}
|
||||
|
||||
public function getMaxStackSize() : int{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 10;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 12;
|
||||
}
|
||||
|
||||
public function getResidue(){
|
||||
return ItemFactory::get(Item::BOWL);
|
||||
}
|
||||
}
|
38
src/pocketmine/item/RawFish.php
Normal file
38
src/pocketmine/item/RawFish.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class RawFish extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::RAW_FISH, $meta, "Raw Fish");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 0.4;
|
||||
}
|
||||
}
|
38
src/pocketmine/item/RawMutton.php
Normal file
38
src/pocketmine/item/RawMutton.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class RawMutton extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::RAW_MUTTON, $meta, "Raw Mutton");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 1.2;
|
||||
}
|
||||
}
|
38
src/pocketmine/item/RawRabbit.php
Normal file
38
src/pocketmine/item/RawRabbit.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class RawRabbit extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::RAW_RABBIT, $meta, "Raw Rabbit");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 1.8;
|
||||
}
|
||||
}
|
38
src/pocketmine/item/RawSalmon.php
Normal file
38
src/pocketmine/item/RawSalmon.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
class RawSalmon extends Food{
|
||||
public function __construct(int $meta = 0){
|
||||
parent::__construct(self::RAW_SALMON, $meta, "Raw Salmon");
|
||||
}
|
||||
|
||||
public function getFoodRestore() : int{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getSaturationRestore() : float{
|
||||
return 0.2;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user