-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implements mace item #6468
base: stable
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -324,8 +324,9 @@ private function __construct(){ | |
public const SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE = 20285; | ||
public const PITCHER_POD = 20286; | ||
public const NAME_TAG = 20287; | ||
public const MACE = 20289; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why from 20297 straight to 20289? |
||
public const FIRST_UNUSED_ITEM_ID = 20288; | ||
public const FIRST_UNUSED_ITEM_ID = 20290; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be autogenerated using the composer script included with pocketmine's build tools. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it still in pull request, not merged yet? Relax |
||
|
||
private static int $nextDynamicId = self::FIRST_UNUSED_ITEM_ID; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?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\block\Block; | ||
use pocketmine\block\BlockToolType; | ||
use pocketmine\entity\Entity; | ||
|
||
class Mace extends TieredTool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extending TieredTool implies variants of the tool such as an Iron Mace or Diamond Mace item, which does not exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I have ever. In pull request #6446 |
||
public function getBlockToolType() : int{ | ||
return BlockToolType::MACE; | ||
} | ||
|
||
public function getAttackPoints() : int{ | ||
return $this->tier->getBaseAttackPoints(); | ||
} | ||
|
||
public function getBlockToolHarvestLevel() : int{ | ||
return 1; | ||
} | ||
|
||
public function getMiningEfficiency(bool $isCorrectTool) : float{ | ||
return parent::getMiningEfficiency($isCorrectTool) * 1.5; //swords break any block 1.5x faster than hand | ||
} | ||
|
||
protected function getBaseMiningEfficiency() : float{ | ||
return 10; | ||
} | ||
|
||
public function onDestroyBlock(Block $block, array &$returnedItems) : bool{ | ||
if(!$block->getBreakInfo()->breaksInstantly()){ | ||
return $this->applyDamage(2); | ||
} | ||
return false; | ||
} | ||
|
||
public function onAttackEntity(Entity $victim, array &$returnedItems) : bool{ | ||
return $this->applyDamage(1); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
* @method static ToolTier NETHERITE() | ||
* @method static ToolTier STONE() | ||
* @method static ToolTier WOOD() | ||
* @method static ToolTier MACE() | ||
* | ||
* @phpstan-type TMetadata array{0: int, 1: int, 2: int, 3: int, 4: int} | ||
*/ | ||
|
@@ -47,6 +48,7 @@ enum ToolTier{ | |
case IRON; | ||
case DIAMOND; | ||
case NETHERITE; | ||
case MACE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be obvious MACE is not a tier which can be applied to existing tools in the game. |
||
|
||
/** | ||
* This function exists only to permit the use of named arguments and to make the code easier to read in PhpStorm. | ||
|
@@ -66,7 +68,8 @@ private function getMetadata() : array{ | |
self::STONE => self::meta(3, 132, 6, 4, 5), | ||
self::IRON => self::meta(4, 251, 7, 6, 14), | ||
self::DIAMOND => self::meta(5, 1562, 8, 8, 10), | ||
self::NETHERITE => self::meta(6, 2032, 9, 9, 15) | ||
self::NETHERITE => self::meta(6, 2032, 9, 9, 15), | ||
self::MACE => self::meta(7, 501, 7, 9, 10) | ||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ private function __construct(){ | |
Tags::BOW, | ||
Tags::CROSSBOW, | ||
Tags::BLOCK_TOOLS, | ||
Tags::MACE, | ||
]); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool type only must be added here for variants like diamond and iron versions of the item.