Added tinted glass

This commit is contained in:
Dylan K. Taylor 2022-07-06 23:01:17 +01:00
parent 986daab511
commit ae70c63798
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
8 changed files with 40 additions and 2 deletions

View File

@ -828,6 +828,8 @@ class BlockFactory{
$this->register(new Slab(new BID(Ids::POLISHED_DEEPSLATE_SLAB), "Polished Deepslate", $polishedDeepslateBreakInfo));
$this->register(new Stair(new BID(Ids::POLISHED_DEEPSLATE_STAIRS), "Polished Deepslate Stairs", $polishedDeepslateBreakInfo));
$this->register(new Wall(new BID(Ids::POLISHED_DEEPSLATE_WALL), "Polished Deepslate Wall", $polishedDeepslateBreakInfo));
$this->register(new TintedGlass(new BID(Ids::TINTED_GLASS), "Tinted Glass", new BreakInfo(0.3)));
}
private function registerMudBlocks() : void{

View File

@ -658,7 +658,7 @@ final class BlockTypeIds{
public const MANGROVE_WALL_SIGN = 10631;
public const CRIMSON_WALL_SIGN = 10632;
public const WARPED_WALL_SIGN = 10633;
public const TINTED_GLASS = 10634;
public const HONEYCOMB = 10635;
public const DEEPSLATE_COAL_ORE = 10636;
public const DEEPSLATE_DIAMOND_ORE = 10637;

31
src/block/TintedGlass.php Normal file
View File

@ -0,0 +1,31 @@
<?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;
final class TintedGlass extends Transparent{
public function getLightFilter() : int{
return 15;
}
}

View File

@ -624,6 +624,7 @@ use pocketmine\utils\CloningRegistryTrait;
* @method static DoublePlant SUNFLOWER()
* @method static SweetBerryBush SWEET_BERRY_BUSH()
* @method static TallGrass TALL_GRASS()
* @method static TintedGlass TINTED_GLASS()
* @method static TNT TNT()
* @method static Torch TORCH()
* @method static TrappedChest TRAPPED_CHEST()
@ -1269,6 +1270,7 @@ final class VanillaBlocks{
self::register("sunflower", $factory->fromTypeId(Ids::SUNFLOWER));
self::register("sweet_berry_bush", $factory->fromTypeId(Ids::SWEET_BERRY_BUSH));
self::register("tall_grass", $factory->fromTypeId(Ids::TALL_GRASS));
self::register("tinted_glass", $factory->fromTypeId(Ids::TINTED_GLASS));
self::register("tnt", $factory->fromTypeId(Ids::TNT));
self::register("torch", $factory->fromTypeId(Ids::TORCH));
self::register("trapped_chest", $factory->fromTypeId(Ids::TRAPPED_CHEST));

View File

@ -1167,6 +1167,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
});
$this->map(Blocks::TALL_GRASS(), fn() => Writer::create(Ids::TALLGRASS)
->writeString(StateNames::TALL_GRASS_TYPE, StringValues::TALL_GRASS_TYPE_TALL));
$this->mapSimple(Blocks::TINTED_GLASS(), Ids::TINTED_GLASS);
$this->map(Blocks::TNT(), function(TNT $block) : Writer{
return Writer::create(Ids::TNT)
->writeBool(StateNames::ALLOW_UNDERWATER_BIT, $block->worksUnderwater())

View File

@ -1119,6 +1119,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
default => throw $in->badValueException(StateNames::TALL_GRASS_TYPE, $type),
};
});
$this->map(Ids::TINTED_GLASS, fn() => Blocks::TINTED_GLASS());
$this->map(Ids::TNT, function(Reader $in) : Block{
return Blocks::TNT()
->setUnstable($in->readBool(StateNames::EXPLODE_BIT))

View File

@ -995,6 +995,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("tall_grass", fn() => Blocks::TALL_GRASS());
$result->registerBlock("tallgrass", fn() => Blocks::FERN());
$result->registerBlock("terracotta", fn() => Blocks::STAINED_CLAY());
$result->registerBlock("tinted_glass", fn() => Blocks::TINTED_GLASS());
$result->registerBlock("tnt", fn() => Blocks::TNT());
$result->registerBlock("torch", fn() => Blocks::TORCH());
$result->registerBlock("trapdoor", fn() => Blocks::OAK_TRAPDOOR());

File diff suppressed because one or more lines are too long