Browse Source

Grass path: Drop dirt when broken

master
Ryan Fox 5 months ago
parent
commit
0dd8e7d20d
Signed by: flewkey GPG Key ID: 94F56ADFD848851E
  1. 30
      src/Blocks/BlockGrassPath.h
  2. 3
      src/Blocks/BlockHandler.cpp
  3. 1
      src/Blocks/CMakeLists.txt

30
src/Blocks/BlockGrassPath.h

@ -0,0 +1,30 @@
#pragma once
#include "BlockHandler.h"
#include "../FastRandom.h"
#include "../Root.h"
#include "../Bindings/PluginManager.h"
class cBlockGrassPathHandler final :
public cBlockHandler
{
public:
using cBlockHandler::cBlockHandler;
private:
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{
if (!ToolHasSilkTouch(a_Tool))
{
return cItem(E_BLOCK_DIRT, 1, 0);
}
return cItem(E_BLOCK_GRASS_PATH, 1, 0);
}
} ;

3
src/Blocks/BlockHandler.cpp

@ -47,6 +47,7 @@
#include "BlockGlazedTerracotta.h"
#include "BlockGlowstone.h"
#include "BlockGrass.h"
#include "BlockGrassPath.h"
#include "BlockGravel.h"
#include "BlockHopper.h"
#include "BlockHugeMushroom.h"
@ -287,7 +288,7 @@ namespace
constexpr cDefaultBlockHandler BlockGoldBlockHandler (E_BLOCK_GOLD_BLOCK);
constexpr cDefaultOreHandler BlockGoldOreHandler (E_BLOCK_GOLD_ORE);
constexpr cBlockGrassHandler BlockGrassHandler (E_BLOCK_GRASS);
constexpr cDefaultBlockHandler BlockGrassPathHandler (E_BLOCK_GRASS_PATH);
constexpr cBlockGrassPathHandler BlockGrassPathHandler (E_BLOCK_GRASS_PATH);
constexpr cBlockGravelHandler BlockGravelHandler (E_BLOCK_GRAVEL);
constexpr cBlockGlazedTerracottaHandler BlockGrayGlazedTerracottaHandler (E_BLOCK_GRAY_GLAZED_TERRACOTTA);
constexpr cDefaultBlockHandler BlockGrayShulkerBoxHandler (E_BLOCK_GRAY_SHULKER_BOX);

1
src/Blocks/CMakeLists.txt

@ -49,6 +49,7 @@ target_sources(
BlockGlazedTerracotta.h
BlockGlowstone.h
BlockGrass.h
BlockGrassPath.h
BlockGravel.h
BlockHandler.h
BlockHopper.h

Loading…
Cancel
Save