Skip to content

Shield 5.46.0 ​

class · pocketmine\item\Shield · source

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 ​

php
public const AXE_DISABLE_TICKS = 100

Ticks a shield stays disabled after being hit by an axe.

BLOCK_DELAY_TICKS ​

php
public const BLOCK_DELAY_TICKS = 5

Ticks the shield must be raised before it blocks (Java value; Bedrock's delay isn't documented).

MIN_DAMAGE_FOR_DURABILITY_LOSS ​

php
public const MIN_DAMAGE_FOR_DURABILITY_LOSS = 3.0

Blocked attacks below this damage don't wear the shield down.

Methods ​

canStartUsingItem() ​

php
public function canStartUsingItem(\pocketmine\player\Player $player) : bool

getCooldownTag() ​

php
public function getCooldownTag() : ?string

getDurabilityCost() ​

php
public static function getDurabilityCost(float $damage) : int

Returns the durability a blocked attack of the given damage costs.

getMaxDurability() ​

php
public function getMaxDurability() : int

getMaxStackSize() ​

php
public function getMaxStackSize() : int

isAttackFromFront() ​

php
public static function isAttackFromFront(float $yaw, \pocketmine\math\Vector3 $defenderPosition, \pocketmine\math\Vector3 $sourcePosition) : bool

Returns 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() ​

php
public function isValidRepairMaterial(\pocketmine\item\Item $item) : bool

Returns whether the given item can repair this shield in an anvil.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.