Shield 5.46.0
Extends Durable
Implements Releasable
Blocks melee and projectile attacks coming from the front while raised.
Vanilla (https://minecraft.wiki/w/Shield): 336 durability on Java, 337 on Bedrock; repaired with planks. On Bedrock the shield is raised by sneaking with it in either hand; it starts blocking 5 ticks after being raised. Blocked attacks of 3 or more damage cost durability equal to the damage rounded up. A hit from an axe disables the shield for 5 seconds.
Constants
AXE_DISABLE_TICKS
public const AXE_DISABLE_TICKS = 100Ticks a shield stays disabled after being hit by an axe.
BLOCK_DELAY_TICKS
public const BLOCK_DELAY_TICKS = 5Ticks the shield must be raised before it blocks (Java value; Bedrock's delay isn't documented).
MIN_DAMAGE_FOR_DURABILITY_LOSS
public const MIN_DAMAGE_FOR_DURABILITY_LOSS = 3.0Blocked attacks below this damage don't wear the shield down.
Methods
canStartUsingItem()
public function canStartUsingItem(\pocketmine\player\Player $player) : boolgetCooldownTag()
public function getCooldownTag() : ?stringgetDurabilityCost()
public static function getDurabilityCost(float $damage) : intReturns the durability a blocked attack of the given damage costs.
getMaxDurability()
public function getMaxDurability() : intgetMaxStackSize()
public function getMaxStackSize() : intisAttackFromFront()
public static function isAttackFromFront(float $yaw, \pocketmine\math\Vector3 $defenderPosition, \pocketmine\math\Vector3 $sourcePosition) : boolReturns whether an attack from $sourcePosition can be blocked by a shield held by an entity at $defenderPosition facing $yaw. Only the horizontal direction counts (pitch is ignored): the attack must come from the half-space in front of the defender, i.e. within 90 degrees of where it faces.
isValidRepairMaterial()
public function isValidRepairMaterial(\pocketmine\item\Item $item) : boolReturns whether the given item can repair this shield in an anvil.
