Implemented Sculk (#5489)

This commit is contained in:
ipad54 2023-01-04 23:10:46 +03:00 committed by GitHub
parent 42db3abf5e
commit 85231215e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 2 deletions

View File

@ -707,8 +707,9 @@ final class BlockTypeIds{
public const TWISTING_VINES = 10680;
public const WEEPING_VINES = 10681;
public const CHAIN = 10682;
public const SCULK = 10683;
public const FIRST_UNUSED_BLOCK_ID = 10683;
public const FIRST_UNUSED_BLOCK_ID = 10684;
private static int $nextDynamicId = self::FIRST_UNUSED_BLOCK_ID;

41
src/block/Sculk.php Normal file
View File

@ -0,0 +1,41 @@
<?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\block;
use pocketmine\item\Item;
final class Sculk extends Opaque{
public function getDropsForCompatibleTool(Item $item) : array{
return [];
}
public function isAffectedBySilkTouch() : bool{
return true;
}
public function getXpDropAmount() : int{
return 1;
}
}

View File

@ -629,6 +629,7 @@ use function mb_strtolower;
* @method static Slab SANDSTONE_SLAB()
* @method static Stair SANDSTONE_STAIRS()
* @method static Wall SANDSTONE_WALL()
* @method static Sculk SCULK()
* @method static SeaLantern SEA_LANTERN()
* @method static SeaPickle SEA_PICKLE()
* @method static Opaque SHROOMLIGHT()
@ -1186,6 +1187,7 @@ final class VanillaBlocks{
self::register("mangrove_roots", new MangroveRoots(new BID(Ids::MANGROVE_ROOTS), "Mangrove Roots", new Info(BreakInfo::axe(0.7))));
self::register("muddy_mangrove_roots", new SimplePillar(new BID(Ids::MUDDY_MANGROVE_ROOTS), "Muddy Mangrove Roots", new Info(BreakInfo::shovel(0.7), [Tags::MUD])));
self::register("froglight", new Froglight(new BID(Ids::FROGLIGHT), "Froglight", new Info(new BreakInfo(0.3))));
self::register("sculk", new Sculk(new BID(Ids::SCULK), "Sculk", new Info(new BreakInfo(0.6, ToolType::HOE))));
self::registerBlocksR13();
self::registerBlocksR14();

View File

@ -549,6 +549,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
$this->mapSimple(Blocks::RED_MUSHROOM(), Ids::RED_MUSHROOM);
$this->mapSimple(Blocks::RED_NETHER_BRICKS(), Ids::RED_NETHER_BRICK);
$this->mapSimple(Blocks::RESERVED6(), Ids::RESERVED6);
$this->mapSimple(Blocks::SCULK(), Ids::SCULK);
$this->mapSimple(Blocks::SEA_LANTERN(), Ids::SEA_LANTERN);
$this->mapSimple(Blocks::SHROOMLIGHT(), Ids::SHROOMLIGHT);
$this->mapSimple(Blocks::SHULKER_BOX(), Ids::UNDYED_SHULKER_BOX);

View File

@ -407,6 +407,7 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
$this->mapSimple(Ids::RED_NETHER_BRICK, fn() => Blocks::RED_NETHER_BRICKS());
$this->mapSimple(Ids::REDSTONE_BLOCK, fn() => Blocks::REDSTONE());
$this->mapSimple(Ids::RESERVED6, fn() => Blocks::RESERVED6());
$this->mapSimple(Ids::SCULK, fn() => Blocks::SCULK());
$this->mapSimple(Ids::SEA_LANTERN, fn() => Blocks::SEA_LANTERN());
$this->mapSimple(Ids::SHROOMLIGHT, fn() => Blocks::SHROOMLIGHT());
$this->mapSimple(Ids::SLIME, fn() => Blocks::SLIME());

View File

@ -936,6 +936,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("sandstone_stairs", fn() => Blocks::SANDSTONE_STAIRS());
$result->registerBlock("sandstone_wall", fn() => Blocks::SANDSTONE_WALL());
$result->registerBlock("sapling", fn() => Blocks::OAK_SAPLING());
$result->registerBlock("sculk", fn() => Blocks::SCULK());
$result->registerBlock("sea_lantern", fn() => Blocks::SEA_LANTERN());
$result->registerBlock("sea_pickle", fn() => Blocks::SEA_PICKLE());
$result->registerBlock("sealantern", fn() => Blocks::SEA_LANTERN());

File diff suppressed because one or more lines are too long