diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 71682f756..de1e1f26a 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -2048,9 +2048,17 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ Item::CARROT => 4, Item::POTATO => 1, Item::BAKED_POTATO => 6, - //Item::COOKIE => 2, - //Item::COOKED_FISH => 5, - //Item::RAW_FISH => 2, + Item::COOKIE => 2, + Item::COOKED_FISH => [ + 0 => 5, + 1 => 6 + ], + Item::RAW_FISH => [ + 0 => 2, + 1 => 2, + 2 => 1, + 3 => 1 + ], ]; $slot = $this->inventory->getItemInHand(); if($this->getHealth() < 20 and isset($items[$slot->getId()])){ @@ -2068,6 +2076,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ Server::broadcastPacket($this->getViewers(), $pk); $amount = $items[$slot->getId()]; + if(is_array($amount)){ + $amount = isset($amount[$slot->getDamage()]) ? $amount[$slot->getDamage()] : 0; + } $ev = new EntityRegainHealthEvent($this, $amount, EntityRegainHealthEvent::CAUSE_EATING); $this->heal($ev->getAmount(), $ev); @@ -2075,6 +2086,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->inventory->setItemInHand($slot, $this); if($slot->getId() === Item::MUSHROOM_STEW or $slot->getId() === Item::BEETROOT_SOUP){ $this->inventory->addItem(Item::get(Item::BOWL, 0, 1)); + }elseif($slot->getId() === Item::RAW_FISH and $slot->getDamage() === 3){ //Pufferfish + //$this->addEffect(Effect::getEffect(Effect::HUNGER)->setAmplifier(2)->setDuration(15 * 20)); + $this->addEffect(Effect::getEffect(Effect::NAUSEA)->setAmplifier(1)->setDuration(15 * 20)); + $this->addEffect(Effect::getEffect(Effect::POISON)->setAmplifier(3)->setDuration(60 * 20)); } } break; diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 948acfbb2..0b808250b 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -200,6 +200,8 @@ class Block extends Position implements Metadatable{ const CARROT_BLOCK = 141; const POTATO_BLOCK = 142; + const REDSTONE_BLOCK = 152; + const QUARTZ_BLOCK = 155; const QUARTZ_STAIRS = 156; const DOUBLE_WOOD_SLAB = 157; @@ -351,6 +353,7 @@ class Block extends Position implements Metadatable{ [Item::LAPIS_BLOCK, 0], [Item::COAL_BLOCK, 0], [Item::EMERALD_BLOCK, 0], + [Item::REDSTONE_BLOCK, 0], [Item::SNOW_LAYER, 0], [Item::GLASS, 0], [Item::GLOWSTONE_BLOCK, 0], @@ -504,6 +507,12 @@ class Block extends Position implements Metadatable{ [Item::POTATO, 0], [Item::BEETROOT_SEEDS, 0], [Item::EGG, 0], + [Item::RAW_FISH, 0], + [Item::RAW_FISH, 1], + [Item::RAW_FISH, 2], + [Item::RAW_FISH, 3], + [Item::COOKED_FISH, 0], + [Item::COOKED_FISH, 1], [Item::DYE, 0], [Item::DYE, 7], [Item::DYE, 6], diff --git a/src/pocketmine/block/Redstone.php b/src/pocketmine/block/Redstone.php new file mode 100644 index 000000000..499083d70 --- /dev/null +++ b/src/pocketmine/block/Redstone.php @@ -0,0 +1,68 @@ +isPickaxe()){ + case 5: + return 0.95; + case 4: + return 1.25; + case 3: + return 1.9; + case 2: + return 0.65; + case 1: + return 3.75; + default: + return 25; + } + } + + public function getDrops(Item $item){ + if($item->isPickaxe() >= 1){ + return [ + [Item::REDSTONE_BLOCK, 0, 1], + ]; + }else{ + return []; + } + } +} \ No newline at end of file diff --git a/src/pocketmine/command/defaults/EffectCommand.php b/src/pocketmine/command/defaults/EffectCommand.php index 0746ca6c1..0777691eb 100644 --- a/src/pocketmine/command/defaults/EffectCommand.php +++ b/src/pocketmine/command/defaults/EffectCommand.php @@ -104,7 +104,7 @@ class EffectCommand extends VanillaCommand{ $effect->setDuration($duration)->setAmplifier($amplification); $player->addEffect($effect); - self::broadcastCommandMessage($sender, "Given ". $effect->getName() ." (ID ". $effect->getId()." ) * ". $effect->getAmplifier()." to ". $player->getDisplayName() ." for ". ($effect->getDuration() / 20) ." seconds"); + self::broadcastCommandMessage($sender, "Given ". $effect->getName() ." (ID ". $effect->getId().") * ". $effect->getAmplifier()." to ". $player->getDisplayName() ." for ". ($effect->getDuration() / 20) ." seconds"); } diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index a6bbf4123..056bed28c 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -128,7 +128,8 @@ class CraftingManager{ $this->registerRecipe(new FurnaceRecipe(Item::get(Item::NETHER_BRICK, 0, 1), Item::get(Item::NETHERRACK, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::COOKED_PORKCHOP, 0, 1), Item::get(Item::RAW_PORKCHOP, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::BRICK, 0, 1), Item::get(Item::CLAY, 0, 1))); - //$this->registerRecipe(new FurnaceRecipe(Item::get(Item::COOKED_FISH, 0, 1), Item::get(Item::RAW_FISH, 0, 1))); + $this->registerRecipe(new FurnaceRecipe(Item::get(Item::COOKED_FISH, 0, 1), Item::get(Item::RAW_FISH, 0, 1))); + $this->registerRecipe(new FurnaceRecipe(Item::get(Item::COOKED_FISH, 1, 1), Item::get(Item::RAW_FISH, 1, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::DYE, 2, 1), Item::get(Item::CACTUS, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::DYE, 1, 1), Item::get(Item::RED_MUSHROOM, 0, 1))); $this->registerRecipe(new FurnaceRecipe(Item::get(Item::STEAK, 0, 1), Item::get(Item::RAW_BEEF, 0, 1))); diff --git a/src/pocketmine/item/CookedFish.php b/src/pocketmine/item/CookedFish.php new file mode 100644 index 000000000..4b4089fbe --- /dev/null +++ b/src/pocketmine/item/CookedFish.php @@ -0,0 +1,33 @@ +meta === 1){ + $this->name = "Cooked Salmon"; + } + } + +} \ No newline at end of file diff --git a/src/pocketmine/item/Fish.php b/src/pocketmine/item/Fish.php new file mode 100644 index 000000000..e56df941c --- /dev/null +++ b/src/pocketmine/item/Fish.php @@ -0,0 +1,37 @@ +meta === 1){ + $this->name = "Raw Salmon"; + }elseif($this->meta === 2){ + $this->name = "Clownfish"; + }elseif($this->meta === 3){ + $this->name = "Pufferfish"; + } + } + +} \ No newline at end of file diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 905b927c1..312cd059b 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -192,6 +192,8 @@ class Item{ const CARROT_BLOCK = 141; const POTATO_BLOCK = 142; + const REDSTONE_BLOCK = 152; + const QUARTZ_BLOCK = 155; const QUARTZ_STAIRS = 156; const DOUBLE_WOOD_SLAB = 157; @@ -339,8 +341,8 @@ class Item{ const CLOCK = 347; const GLOWSTONE_DUST = 348; - //const RAW_FISH = 349; - //const COOKED_FISH = 350; + const RAW_FISH = 349; + const COOKED_FISH = 350; const DYE = 351; const BONE = 352; const SUGAR = 353; @@ -348,7 +350,7 @@ class Item{ const BED = 355; - //const COOKIE = 357; + const COOKIE = 357; const SHEARS = 359; @@ -479,6 +481,9 @@ class Item{ self::$list[self::SHEARS] = Shears::class; self::$list[self::BOW] = Bow::class; + self::$list[self::RAW_FISH] = Fish::class; + self::$list[self::COOKED_FISH] = CookedFish::class; + for($i = 0; $i < 256; ++$i){ if(Block::$list[$i] !== null){ self::$list[$i] = Block::$list[$i];