Implemented slime blocks

This commit is contained in:
Dylan K. Taylor 2021-09-05 20:46:59 +01:00
parent 8e2486b96a
commit df3b112877
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
4 changed files with 48 additions and 3 deletions

View File

@ -323,7 +323,7 @@ class BlockFactory{
$this->register(new SeaLantern(new BID(Ids::SEALANTERN, 0), "Sea Lantern", new BlockBreakInfo(0.3)));
$this->register(new SeaPickle(new BID(Ids::SEA_PICKLE, 0), "Sea Pickle", BlockBreakInfo::instant()));
$this->register(new Skull(new BID(Ids::MOB_HEAD_BLOCK, 0, ItemIds::SKULL, TileSkull::class), "Mob Head", new BlockBreakInfo(1.0)));
$this->register(new Slime(new BID(Ids::SLIME, 0), "Slime Block", BlockBreakInfo::instant()));
$this->register(new Snow(new BID(Ids::SNOW, 0), "Snow Block", new BlockBreakInfo(0.2, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel())));
$this->register(new SnowLayer(new BID(Ids::SNOW_LAYER, 0), "Snow Layer", new BlockBreakInfo(0.1, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel())));
$this->register(new SoulSand(new BID(Ids::SOUL_SAND, 0), "Soul Sand", new BlockBreakInfo(0.5, BlockToolType::SHOVEL)));
@ -580,7 +580,6 @@ class BlockFactory{
//TODO: minecraft:repeating_command_block
//TODO: minecraft:scaffolding
//TODO: minecraft:seagrass
//TODO: minecraft:slime
//TODO: minecraft:smithing_table
//TODO: minecraft:sticky_piston
//TODO: minecraft:stonecutter_block

44
src/block/Slime.php Normal file
View File

@ -0,0 +1,44 @@
<?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\entity\Entity;
use pocketmine\entity\Living;
final class Slime extends Transparent{
public function getFrictionFactor() : float{
return 0.8; //???
}
public function onEntityLand(Entity $entity) : ?float{
if($entity instanceof Living && $entity->isSneaking()){
return null;
}
$entity->resetFallDistance();
return -$entity->getMotion()->y;
}
//TODO: slime blocks should slow entities walking on them to about 0.4x original speed
}

View File

@ -489,6 +489,7 @@ use function assert;
* @method static SeaLantern SEA_LANTERN()
* @method static SeaPickle SEA_PICKLE()
* @method static ShulkerBox SHULKER_BOX()
* @method static Slime SLIME()
* @method static Furnace SMOKER()
* @method static Opaque SMOOTH_QUARTZ()
* @method static Slab SMOOTH_QUARTZ_SLAB()
@ -1054,6 +1055,7 @@ final class VanillaBlocks{
self::register("sea_lantern", $factory->get(169, 0));
self::register("sea_pickle", $factory->get(411, 0));
self::register("shulker_box", $factory->get(205, 0));
self::register("slime", $factory->get(165, 0));
self::register("smoker", $factory->get(453, 2));
self::register("smooth_quartz", $factory->get(155, 3));
self::register("smooth_quartz_slab", $factory->get(421, 1));

File diff suppressed because one or more lines are too long