Files
LegacyRenouveau/Minecraft.World/GrassPathTile.cpp
T
Fireblade 1011c714c4 fix: grass path
fixes:
- grass path not being on the shovel's diggable list, hence the slow breaking speed whilst mining the block
- grass path AABB collisions, creating a discrepency between farmland + the grass path tile where the former could walk up more tiles than the latter
2026-07-18 19:01:12 -04:00

69 lines
1.5 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.phys.h"
#include "Material.h"
#include "IconRegister.h"
#include "Facing.h"
#include "GrassPathTile.h"
GrassPathTile::GrassPathTile(int id) : Tile(id, Material::dirt), iconTop(nullptr), iconBottom(nullptr)
{
}
void GrassPathTile::updateDefaultShape()
{
setShape(0, 0, 0, 1, 15 / 16.0f, 1);
}
bool GrassPathTile::isSolidRender(bool isServerLevel)
{
return false;
}
bool GrassPathTile::isCubeShaped()
{
return false;
}
AABB *GrassPathTile::getAABB(Level *level, int x, int y, int z)
{
return AABB::newTemp(x + 0, y + 0, z + 0, x + 1, y + 1, z + 1);
}
void GrassPathTile::registerIcons(IconRegister *iconRegister)
{
iconTop = iconRegister->registerIcon(L"grass_path_top");
iconBottom = iconRegister->registerIcon(L"dirt");
icon = iconRegister->registerIcon(L"grass_path_side");
}
Icon *GrassPathTile::getTexture(int face, int data)
{
if (face == Facing::UP) return iconTop;
if (face == Facing::DOWN) return iconBottom;
return icon;
}
void GrassPathTile::checkAndConvert(Level *level, int x, int y, int z)
{
if (level->getMaterial(x, y + 1, z)->blocksMotion())
{
level->setTileAndUpdate(x, y, z, Tile::dirt_Id);
}
}
void GrassPathTile::neighborChanged(Level *level, int x, int y, int z, int neighborId)
{
checkAndConvert(level, x, y, z);
}
int GrassPathTile::getResource(int data, Random *random, int playerBonusLevel)
{
return Tile::dirt_Id;
}
int GrassPathTile::getResourceCount(Random *random)
{
return 1;
}