aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/WorkbenchTile.cpp
blob: cc505fc6a9d5d8cf091a4ccd4505c26fa845dd4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#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;
}