Item: added some foods, cleaned up Fish abomination

@PEMapModder GET A CLIENT ALREADY
This commit is contained in:
Dylan K. Taylor 2018-03-09 19:54:42 +00:00
parent b130374e46
commit 9098502199
12 changed files with 384 additions and 53 deletions

View 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;
}
}

View File

@ -23,16 +23,16 @@ declare(strict_types=1);
namespace pocketmine\item; namespace pocketmine\item;
class CookedFish extends Fish{ class CookedFish extends Food{
public function __construct(int $meta = 0){ 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{ public function getFoodRestore() : int{
return $this->meta === self::FISH_SALMON ? 6 : 5; return 5;
} }
public function getSaturationRestore() : float{ public function getSaturationRestore() : float{
return $this->meta === self::FISH_SALMON ? 9.6 : 6; return 6;
} }
} }

View 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;
}
}

View 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;
}
}

View File

@ -132,7 +132,7 @@ class ItemFactory{
self::registerItem(new FishingRod()); self::registerItem(new FishingRod());
self::registerItem(new Clock()); self::registerItem(new Clock());
self::registerItem(new Item(Item::GLOWSTONE_DUST, 0, "Glowstone Dust")); 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 CookedFish());
self::registerItem(new Dye()); self::registerItem(new Dye());
self::registerItem(new Item(Item::BONE, 0, "Bone")); self::registerItem(new Item(Item::BONE, 0, "Bone"));
@ -177,7 +177,7 @@ class ItemFactory{
self::registerItem(new Carrot()); self::registerItem(new Carrot());
self::registerItem(new Potato()); self::registerItem(new Potato());
self::registerItem(new BakedPotato()); self::registerItem(new BakedPotato());
//TODO: POISONOUS_POTATO self::registerItem(new PoisonousPotato());
//TODO: EMPTYMAP //TODO: EMPTYMAP
self::registerItem(new GoldenCarrot()); self::registerItem(new GoldenCarrot());
self::registerItem(new ItemBlock(Block::SKULL_BLOCK, 0, Item::SKULL)); self::registerItem(new ItemBlock(Block::SKULL_BLOCK, 0, Item::SKULL));
@ -194,9 +194,9 @@ class ItemFactory{
//TODO: HOPPER_MINECART //TODO: HOPPER_MINECART
self::registerItem(new Item(Item::PRISMARINE_SHARD, 0, "Prismarine Shard")); self::registerItem(new Item(Item::PRISMARINE_SHARD, 0, "Prismarine Shard"));
self::registerItem(new ItemBlock(Block::HOPPER_BLOCK, 0, Item::HOPPER)); self::registerItem(new ItemBlock(Block::HOPPER_BLOCK, 0, Item::HOPPER));
//TODO: RABBIT self::registerItem(new RawRabbit());
self::registerItem(new CookedRabbit()); 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_FOOT, 0, "Rabbit's Foot"));
self::registerItem(new Item(Item::RABBIT_HIDE, 0, "Rabbit Hide")); self::registerItem(new Item(Item::RABBIT_HIDE, 0, "Rabbit Hide"));
//TODO: HORSEARMORLEATHER //TODO: HORSEARMORLEATHER
@ -206,8 +206,8 @@ class ItemFactory{
//TODO: LEAD //TODO: LEAD
//TODO: NAMETAG //TODO: NAMETAG
self::registerItem(new Item(Item::PRISMARINE_CRYSTALS, 0, "Prismarine Crystals")); self::registerItem(new Item(Item::PRISMARINE_CRYSTALS, 0, "Prismarine Crystals"));
//TODO: MUTTONRAW self::registerItem(new RawMutton());
//TODO: COOKED_MUTTON self::registerItem(new CookedMutton());
//TODO: ARMOR_STAND //TODO: ARMOR_STAND
//TODO: END_CRYSTAL //TODO: END_CRYSTAL
self::registerItem(new ItemBlock(Block::SPRUCE_DOOR_BLOCK, 0, Item::SPRUCE_DOOR)); 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 Beetroot());
self::registerItem(new BeetrootSeeds()); self::registerItem(new BeetrootSeeds());
self::registerItem(new BeetrootSoup()); self::registerItem(new BeetrootSoup());
//TODO: RAW_SALMON self::registerItem(new RawSalmon());
//TODO: CLOWNFISH self::registerItem(new Clownfish());
//TODO: PUFFERFISH self::registerItem(new Pufferfish());
//TODO: COOKED_SALMON self::registerItem(new CookedSalmon());
self::registerItem(new GoldenAppleEnchanted()); self::registerItem(new GoldenAppleEnchanted());

View 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 [];
}
}

View File

@ -26,55 +26,24 @@ namespace pocketmine\item;
use pocketmine\entity\Effect; use pocketmine\entity\Effect;
use pocketmine\entity\EffectInstance; use pocketmine\entity\EffectInstance;
class Fish extends Food{ class Pufferfish extends Food{
public const FISH_FISH = 0;
public const FISH_SALMON = 1;
public const FISH_CLOWNFISH = 2;
public const FISH_PUFFERFISH = 3;
public function __construct(int $meta = 0){ public function __construct(int $meta = 0){
$name = "Raw Fish"; parent::__construct(self::PUFFERFISH, $meta, "Pufferfish");
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);
} }
public function getFoodRestore() : int{ 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; return 1;
}elseif($this->meta === self::FISH_PUFFERFISH){
return 1;
}
return 0;
} }
public function getSaturationRestore() : float{ 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; return 0.2;
}elseif($this->meta === self::FISH_PUFFERFISH){
return 0.2;
}
return 0;
} }
public function getAdditionalEffects() : array{ public function getAdditionalEffects() : array{
return $this->meta === self::FISH_PUFFERFISH ? [ return [
new EffectInstance(Effect::getEffect(Effect::HUNGER), 300, 2), 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)
] : []; ];
} }
} }

View 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);
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}