Implement Ice Bomb (#5452)

Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
This commit is contained in:
zSALLAZAR
2024-11-24 16:01:26 +01:00
committed by GitHub
parent 8338ebaffd
commit a5f607138c
8 changed files with 179 additions and 1 deletions

48
src/item/IceBomb.php Normal file
View File

@ -0,0 +1,48 @@
<?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\Location;
use pocketmine\entity\projectile\IceBomb as IceBombEntity;
use pocketmine\entity\projectile\Throwable;
use pocketmine\player\Player;
class IceBomb extends ProjectileItem{
public function getMaxStackSize() : int{
return 16;
}
protected function createEntity(Location $location, Player $thrower) : Throwable{
return new IceBombEntity($location, $thrower);
}
public function getThrowForce() : float{
return 1.5;
}
public function getCooldownTicks() : int{
return 10;
}
}

View File

@ -326,8 +326,9 @@ final class ItemTypeIds{
public const NAME_TAG = 20287;
public const GOAT_HORN = 20288;
public const END_CRYSTAL = 20289;
public const ICE_BOMB = 20290;
public const FIRST_UNUSED_ITEM_ID = 20290;
public const FIRST_UNUSED_ITEM_ID = 20291;
private static int $nextDynamicId = self::FIRST_UNUSED_ITEM_ID;

View File

@ -1378,6 +1378,7 @@ final class StringToItemParser extends StringToTParser{
$result->register("honey_bottle", fn() => Items::HONEY_BOTTLE());
$result->register("host_armor_trim_smithing_template", fn() => Items::HOST_ARMOR_TRIM_SMITHING_TEMPLATE());
$result->register("honeycomb", fn() => Items::HONEYCOMB());
$result->register("ice_bomb", fn() => Items::ICE_BOMB());
$result->register("ink_sac", fn() => Items::INK_SAC());
$result->register("iron_axe", fn() => Items::IRON_AXE());
$result->register("iron_boots", fn() => Items::IRON_BOOTS());

View File

@ -192,6 +192,7 @@ use function strtolower;
* @method static Item HONEYCOMB()
* @method static HoneyBottle HONEY_BOTTLE()
* @method static Item HOST_ARMOR_TRIM_SMITHING_TEMPLATE()
* @method static IceBomb ICE_BOMB()
* @method static Item INK_SAC()
* @method static Axe IRON_AXE()
* @method static Armor IRON_BOOTS()
@ -504,6 +505,7 @@ final class VanillaItems{
self::register("heart_of_the_sea", fn(IID $id) => new Item($id, "Heart of the Sea"));
self::register("honey_bottle", fn(IID $id) => new HoneyBottle($id, "Honey Bottle"));
self::register("honeycomb", fn(IID $id) => new Item($id, "Honeycomb"));
self::register("ice_bomb", fn(IID $id) => new IceBomb($id, "Ice Bomb"));
self::register("ink_sac", fn(IID $id) => new Item($id, "Ink Sac"));
self::register("iron_ingot", fn(IID $id) => new Item($id, "Iron Ingot"));
self::register("iron_nugget", fn(IID $id) => new Item($id, "Iron Nugget"));