Files
MinecraftConsoles/Minecraft.World/WorkbenchTile.cpp
ModMaker101 a9be52c41a Project modernization (#630)
* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
2026-03-08 09:56:03 +07:00

45 lines
1.2 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.entity.player.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.h"
#include "net.minecraft.h"
#include "WorkbenchTile.h"
WorkbenchTile::WorkbenchTile(int id) : Tile(id, Material::wood)
{
iconTop = nullptr;
iconFront = nullptr;
}
Icon *WorkbenchTile::getTexture(int face, int data)
{
if (face == Facing::UP) return iconTop;
if (face == Facing::DOWN) return Tile::wood->getTexture(face);
if (face == Facing::NORTH || face == Facing::WEST) return iconFront;
return icon;
}
void WorkbenchTile::registerIcons(IconRegister *iconRegister)
{
icon = iconRegister->registerIcon(L"workbench_side");
iconTop = iconRegister->registerIcon(L"workbench_top");
iconFront = iconRegister->registerIcon(L"workbench_front");
}
// 4J-PB - Adding a TestUse for tooltip display
bool WorkbenchTile::TestUse()
{
return true;
}
bool WorkbenchTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly ) return false;
if (level->isClientSide)
{
return true;
}
player->startCrafting(x, y, z);
//player->openFireworks(x, y, z);
return true;
}