Added warped wart blocks, gilded blackstone and crying obsidian

This commit is contained in:
Dylan K. Taylor 2022-07-09 20:00:10 +01:00
parent 99ff78a8a5
commit ad7528e3f3
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
7 changed files with 64 additions and 2 deletions

View File

@ -676,6 +676,9 @@ final class BlockTypeIds{
public const MUD_BRICK_STAIRS = 10649;
public const MUD_BRICK_WALL = 10650;
public const PACKED_MUD = 10651;
public const WARPED_WART_BLOCK = 10652;
public const CRYING_OBSIDIAN = 10653;
public const GILDED_BLACKSTONE = 10654;
public const FIRST_UNUSED_BLOCK_ID = 10652;
public const FIRST_UNUSED_BLOCK_ID = 10655;
}

View File

@ -0,0 +1,40 @@
<?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;
use pocketmine\item\VanillaItems;
final class GildedBlackstone extends Opaque{
public function getDropsForCompatibleTool(Item $item) : array{
if(mt_rand(1, 10) === 1){
return [VanillaItems::GOLD_NUGGET()->setCount(mt_rand(2, 5))];
}
return parent::getDropsForCompatibleTool($item);
}
public function isAffectedBySilkTouch() : bool{ return true; }
}

View File

@ -188,6 +188,7 @@ use function mb_strtolower;
* @method static Wood CRIMSON_STEM()
* @method static WoodenTrapdoor CRIMSON_TRAPDOOR()
* @method static WallSign CRIMSON_WALL_SIGN()
* @method static Opaque CRYING_OBSIDIAN()
* @method static Opaque CUT_RED_SANDSTONE()
* @method static Slab CUT_RED_SANDSTONE_SLAB()
* @method static Opaque CUT_SANDSTONE()
@ -381,6 +382,7 @@ use function mb_strtolower;
* @method static FlowerPot FLOWER_POT()
* @method static FrostedIce FROSTED_ICE()
* @method static Furnace FURNACE()
* @method static GildedBlackstone GILDED_BLACKSTONE()
* @method static Glass GLASS()
* @method static GlassPane GLASS_PANE()
* @method static GlazedTerracotta GLAZED_TERRACOTTA()
@ -679,6 +681,7 @@ use function mb_strtolower;
* @method static Wood WARPED_STEM()
* @method static WoodenTrapdoor WARPED_TRAPDOOR()
* @method static WallSign WARPED_WALL_SIGN()
* @method static Opaque WARPED_WART_BLOCK()
* @method static Water WATER()
* @method static WeightedPressurePlateHeavy WEIGHTED_PRESSURE_PLATE_HEAVY()
* @method static WeightedPressurePlateLight WEIGHTED_PRESSURE_PLATE_LIGHT()
@ -1367,6 +1370,8 @@ final class VanillaBlocks{
self::register("blackstone_stairs", new Stair(new BID(Ids::BLACKSTONE_STAIRS), "Blackstone Stairs", $blackstoneBreakInfo));
self::register("blackstone_wall", new Wall(new BID(Ids::BLACKSTONE_WALL), "Blackstone Wall", $blackstoneBreakInfo));
self::register("gilded_blackstone", new GildedBlackstone(new BID(Ids::GILDED_BLACKSTONE), "Gilded Blackstone", $blackstoneBreakInfo));
//TODO: polished blackstone ought to have 2.0 hardness (as per java) but it's 1.5 in Bedrock (probably parity bug)
$prefix = fn(string $thing) => "Polished Blackstone" . ($thing !== "" ? " $thing" : "");
self::register("polished_blackstone", new Opaque(new BID(Ids::POLISHED_BLACKSTONE), $prefix(""), $blackstoneBreakInfo));
@ -1393,6 +1398,11 @@ final class VanillaBlocks{
self::register("shroomlight", new class(new BID(Ids::SHROOMLIGHT), "Shroomlight", new BreakInfo(1.0, ToolType::HOE)) extends Opaque{
public function getLightLevel() : int{ return 15; }
});
self::register("warped_wart_block", new Opaque(new BID(Ids::WARPED_WART_BLOCK), "Warped Wart Block", new BreakInfo(1.0, ToolType::HOE)));
self::register("crying_obsidian", new class(new BID(Ids::CRYING_OBSIDIAN), "Crying Obsidian", new BreakInfo(35.0 /* 50 in Java */, ToolType::PICKAXE, ToolTier::DIAMOND()->getHarvestLevel())) extends Opaque{
public function getLightLevel() : int{ return 10;}
});
}
private static function registerBlocksR17() : void{

View File

@ -472,6 +472,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
$this->map(Blocks::CRIMSON_STEM(), fn(Wood $block) => Helper::encodeNewLog($block, Ids::CRIMSON_STEM, Ids::STRIPPED_CRIMSON_STEM));
$this->map(Blocks::CRIMSON_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::CRIMSON_TRAPDOOR)));
$this->map(Blocks::CRIMSON_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::CRIMSON_WALL_SIGN)));
$this->mapSimple(Blocks::CRYING_OBSIDIAN(), Ids::CRYING_OBSIDIAN);
$this->map(Blocks::CUT_RED_SANDSTONE(), fn() => Helper::encodeSandstone(Ids::RED_SANDSTONE, StringValues::SAND_STONE_TYPE_CUT));
$this->map(Blocks::CUT_RED_SANDSTONE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab4($block, StringValues::STONE_SLAB_TYPE_4_CUT_RED_SANDSTONE));
$this->map(Blocks::CUT_SANDSTONE(), fn() => Helper::encodeSandstone(Ids::SANDSTONE, StringValues::SAND_STONE_TYPE_CUT));
@ -707,6 +708,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeInt(StateNames::AGE, $block->getAge());
});
$this->map(Blocks::FURNACE(), fn(Furnace $block) => Helper::encodeFurnace($block, Ids::FURNACE, Ids::LIT_FURNACE));
$this->mapSimple(Blocks::GILDED_BLACKSTONE(), Ids::GILDED_BLACKSTONE);
$this->mapSimple(Blocks::GLASS(), Ids::GLASS);
$this->mapSimple(Blocks::GLASS_PANE(), Ids::GLASS_PANE);
$this->map(Blocks::GLAZED_TERRACOTTA(), function(GlazedTerracotta $block) : Writer{
@ -1232,6 +1234,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
$this->map(Blocks::WARPED_STEM(), fn(Wood $block) => Helper::encodeNewLog($block, Ids::WARPED_STEM, Ids::STRIPPED_WARPED_STEM));
$this->map(Blocks::WARPED_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block, new Writer(Ids::WARPED_TRAPDOOR)));
$this->map(Blocks::WARPED_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block, new Writer(Ids::WARPED_WALL_SIGN)));
$this->mapSimple(Blocks::WARPED_WART_BLOCK(), Ids::WARPED_WART_BLOCK);
$this->map(Blocks::WATER(), fn(Water $block) => Helper::encodeLiquid($block, Ids::WATER, Ids::FLOWING_WATER));
$this->map(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(), function(WeightedPressurePlateHeavy $block) : Writer{
return Writer::create(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE)

View File

@ -314,6 +314,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::CRIMSON_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::CRIMSON_STEM(), false, $in));
$this->map(Ids::CRIMSON_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::CRIMSON_TRAPDOOR(), $in));
$this->map(Ids::CRIMSON_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::CRIMSON_WALL_SIGN(), $in));
$this->map(Ids::CRYING_OBSIDIAN, fn() => Blocks::CRYING_OBSIDIAN());
$this->map(Ids::CYAN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::CYAN(), $in));
$this->map(Ids::DARK_OAK_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::DARK_OAK_BUTTON(), $in));
$this->map(Ids::DARK_OAK_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::DARK_OAK_DOOR(), $in));
@ -578,6 +579,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setFacing($in->readHorizontalFacing())
->setLit(false);
});
$this->map(Ids::GILDED_BLACKSTONE, fn() => Blocks::GILDED_BLACKSTONE());
$this->map(Ids::GLASS, fn() => Blocks::GLASS());
$this->map(Ids::GLASS_PANE, fn() => Blocks::GLASS_PANE());
$this->map(Ids::GLOWINGOBSIDIAN, fn() => Blocks::GLOWING_OBSIDIAN());
@ -1187,6 +1189,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::WARPED_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::WARPED_STEM(), false, $in));
$this->map(Ids::WARPED_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::WARPED_TRAPDOOR(), $in));
$this->map(Ids::WARPED_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::WARPED_WALL_SIGN(), $in));
$this->map(Ids::WARPED_WART_BLOCK, fn() => Blocks::WARPED_WART_BLOCK());
$this->map(Ids::WATER, fn(Reader $in) => Helper::decodeStillLiquid(Blocks::WATER(), $in));
$this->map(Ids::WATERLILY, fn() => Blocks::LILY_PAD());
$this->map(Ids::WEB, fn() => Blocks::COBWEB());

View File

@ -239,6 +239,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("crimson_stairs", fn() => Blocks::CRIMSON_STAIRS());
$result->registerBlock("crimson_stem", fn() => Blocks::CRIMSON_STEM()->setStripped(false));
$result->registerBlock("crimson_trapdoor", fn() => Blocks::CRIMSON_TRAPDOOR());
$result->registerBlock("crying_obsidian", fn() => Blocks::CRYING_OBSIDIAN());
$result->registerBlock("cut_red_sandstone", fn() => Blocks::CUT_RED_SANDSTONE());
$result->registerBlock("cut_red_sandstone_slab", fn() => Blocks::CUT_RED_SANDSTONE_SLAB());
$result->registerBlock("cut_sandstone", fn() => Blocks::CUT_SANDSTONE());
@ -593,6 +594,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("frame_block", fn() => Blocks::ITEM_FRAME());
$result->registerBlock("frosted_ice", fn() => Blocks::FROSTED_ICE());
$result->registerBlock("furnace", fn() => Blocks::FURNACE());
$result->registerBlock("gilded_blackstone", fn() => Blocks::GILDED_BLACKSTONE());
$result->registerBlock("glass", fn() => Blocks::GLASS());
$result->registerBlock("glass_pane", fn() => Blocks::GLASS_PANE());
$result->registerBlock("glass_panel", fn() => Blocks::GLASS_PANE());
@ -1031,6 +1033,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("warped_stairs", fn() => Blocks::WARPED_STAIRS());
$result->registerBlock("warped_stem", fn() => Blocks::WARPED_STEM()->setStripped(false));
$result->registerBlock("warped_trapdoor", fn() => Blocks::WARPED_TRAPDOOR());
$result->registerBlock("warped_wart_block", fn() => Blocks::WARPED_WART_BLOCK());
$result->registerBlock("water", fn() => Blocks::WATER());
$result->registerBlock("water_lily", fn() => Blocks::LILY_PAD());
$result->registerBlock("waterlily", fn() => Blocks::LILY_PAD());

File diff suppressed because one or more lines are too long