diff --git a/src/block/BaseBanner.php b/src/block/BaseBanner.php index c66458350..9fa9a7550 100644 --- a/src/block/BaseBanner.php +++ b/src/block/BaseBanner.php @@ -75,6 +75,10 @@ abstract class BaseBanner extends Transparent{ return false; } + public function getMaxStackSize() : int{ + return 16; + } + /** * @return BannerPatternLayer[] * @phpstan-return list diff --git a/src/block/BaseSign.php b/src/block/BaseSign.php index 8b8d72ae0..c2eedd1d0 100644 --- a/src/block/BaseSign.php +++ b/src/block/BaseSign.php @@ -68,6 +68,10 @@ abstract class BaseSign extends Transparent{ return false; } + public function getMaxStackSize() : int{ + return 16; + } + /** * @return AxisAlignedBB[] */ diff --git a/src/block/Block.php b/src/block/Block.php index 737bfd7c6..ad10e710d 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -439,6 +439,13 @@ class Block{ return 0; } + /** + * Returns the maximum number of this block that can fit into a single item stack. + */ + public function getMaxStackSize() : int{ + return 64; + } + /** * Returns the chance that the block will catch fire from nearby fire sources. Higher values lead to faster catching * fire. diff --git a/src/item/Banner.php b/src/item/Banner.php index 506af7620..18d0f1081 100644 --- a/src/item/Banner.php +++ b/src/item/Banner.php @@ -66,10 +66,6 @@ class Banner extends ItemBlockWallOrFloor{ return DyeColorIdMap::getInstance()->toInvertedId($this->color); } - public function getMaxStackSize() : int{ - return 16; - } - /** * @return BannerPatternLayer[] * @phpstan-return list diff --git a/src/item/ItemBlock.php b/src/item/ItemBlock.php index 4e3941429..0836d86e1 100644 --- a/src/item/ItemBlock.php +++ b/src/item/ItemBlock.php @@ -45,4 +45,8 @@ class ItemBlock extends Item{ public function getFuelTime() : int{ return $this->getBlock()->getFuelTime(); } + + public function getMaxStackSize() : int{ + return $this->getBlock()->getMaxStackSize(); + } } diff --git a/src/item/ItemBlockWallOrFloor.php b/src/item/ItemBlockWallOrFloor.php index fa157c61a..92a6afcf5 100644 --- a/src/item/ItemBlockWallOrFloor.php +++ b/src/item/ItemBlockWallOrFloor.php @@ -51,4 +51,8 @@ class ItemBlockWallOrFloor extends Item{ public function getFuelTime() : int{ return $this->getBlock()->getFuelTime(); } + + public function getMaxStackSize() : int{ + return $this->getBlock()->getMaxStackSize(); + } } diff --git a/src/item/ItemFactory.php b/src/item/ItemFactory.php index 19f8b5c1a..1727b6648 100644 --- a/src/item/ItemFactory.php +++ b/src/item/ItemFactory.php @@ -240,12 +240,12 @@ class ItemFactory{ $this->register(new Redstone(new ItemIdentifier(ItemIds::REDSTONE, 0), "Redstone")); $this->register(new RottenFlesh(new ItemIdentifier(ItemIds::ROTTEN_FLESH, 0), "Rotten Flesh")); $this->register(new Shears(new ItemIdentifier(ItemIds::SHEARS, 0), "Shears")); - $this->register(new Sign(new ItemIdentifier(ItemIds::SIGN, 0), VanillaBlocks::OAK_SIGN(), VanillaBlocks::OAK_WALL_SIGN())); - $this->register(new Sign(new ItemIdentifier(ItemIds::SPRUCE_SIGN, 0), VanillaBlocks::SPRUCE_SIGN(), VanillaBlocks::SPRUCE_WALL_SIGN())); - $this->register(new Sign(new ItemIdentifier(ItemIds::BIRCH_SIGN, 0), VanillaBlocks::BIRCH_SIGN(), VanillaBlocks::BIRCH_WALL_SIGN())); - $this->register(new Sign(new ItemIdentifier(ItemIds::JUNGLE_SIGN, 0), VanillaBlocks::JUNGLE_SIGN(), VanillaBlocks::JUNGLE_WALL_SIGN())); - $this->register(new Sign(new ItemIdentifier(ItemIds::ACACIA_SIGN, 0), VanillaBlocks::ACACIA_SIGN(), VanillaBlocks::ACACIA_WALL_SIGN())); - $this->register(new Sign(new ItemIdentifier(ItemIds::DARKOAK_SIGN, 0), VanillaBlocks::DARK_OAK_SIGN(), VanillaBlocks::DARK_OAK_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::SIGN, 0), VanillaBlocks::OAK_SIGN(), VanillaBlocks::OAK_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::SPRUCE_SIGN, 0), VanillaBlocks::SPRUCE_SIGN(), VanillaBlocks::SPRUCE_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::BIRCH_SIGN, 0), VanillaBlocks::BIRCH_SIGN(), VanillaBlocks::BIRCH_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::JUNGLE_SIGN, 0), VanillaBlocks::JUNGLE_SIGN(), VanillaBlocks::JUNGLE_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::ACACIA_SIGN, 0), VanillaBlocks::ACACIA_SIGN(), VanillaBlocks::ACACIA_WALL_SIGN())); + $this->register(new ItemBlockWallOrFloor(new ItemIdentifier(ItemIds::DARKOAK_SIGN, 0), VanillaBlocks::DARK_OAK_SIGN(), VanillaBlocks::DARK_OAK_WALL_SIGN())); $this->register(new Snowball(new ItemIdentifier(ItemIds::SNOWBALL, 0), "Snowball")); $this->register(new SpiderEye(new ItemIdentifier(ItemIds::SPIDER_EYE, 0), "Spider Eye")); $this->register(new Steak(new ItemIdentifier(ItemIds::STEAK, 0), "Steak")); diff --git a/src/item/Sign.php b/src/item/Sign.php deleted file mode 100644 index f95240e37..000000000 --- a/src/item/Sign.php +++ /dev/null @@ -1,31 +0,0 @@ -