2014-03-16 17:42:23 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
2020-04-11 00:20:51 +01:00
|
|
|
#include "Mixins.h"
|
2014-03-16 17:42:23 +01:00
|
|
|
#include "../Entities/Player.h"
|
2014-12-13 15:06:55 +01:00
|
|
|
#include "../UI/AnvilWindow.h"
|
2014-03-16 17:42:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-05 11:27:14 +01:00
|
|
|
class cBlockAnvilHandler final :
|
2020-04-11 00:20:51 +01:00
|
|
|
public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
|
2014-03-16 17:42:23 +01:00
|
|
|
{
|
2020-04-13 18:38:06 +02:00
|
|
|
using Super = cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>;
|
|
|
|
|
|
2014-03-16 17:42:23 +01:00
|
|
|
public:
|
2020-04-11 00:20:51 +01:00
|
|
|
|
2020-09-20 14:50:52 +01:00
|
|
|
using Super::Super;
|
2019-10-16 10:06:34 +02:00
|
|
|
|
2020-09-20 14:50:52 +01:00
|
|
|
private:
|
2019-10-16 10:06:34 +02:00
|
|
|
|
2021-03-28 14:41:34 +01:00
|
|
|
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
|
2014-03-16 17:42:23 +01:00
|
|
|
{
|
2019-10-16 10:06:34 +02:00
|
|
|
return cItem(m_BlockType, 1, a_BlockMeta >> 2);
|
2014-03-16 17:42:23 +01:00
|
|
|
}
|
2014-05-01 00:47:57 +02:00
|
|
|
|
2019-10-16 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-21 22:19:22 +02:00
|
|
|
virtual bool OnUse(
|
|
|
|
|
cChunkInterface & a_ChunkInterface,
|
|
|
|
|
cWorldInterface & a_WorldInterface,
|
|
|
|
|
cPlayer & a_Player,
|
|
|
|
|
const Vector3i a_BlockPos,
|
|
|
|
|
eBlockFace a_BlockFace,
|
|
|
|
|
const Vector3i a_CursorPos
|
2020-09-20 14:50:52 +01:00
|
|
|
) const override
|
2014-05-01 00:47:57 +02:00
|
|
|
{
|
2020-07-04 17:49:17 -04:00
|
|
|
cWindow * Window = new cAnvilWindow(a_BlockPos);
|
2017-07-31 21:17:52 +01:00
|
|
|
a_Player.OpenWindow(*Window);
|
2015-12-01 23:12:44 +01:00
|
|
|
return true;
|
2014-05-01 00:47:57 +02:00
|
|
|
}
|
2016-02-05 23:45:45 +02:00
|
|
|
|
2020-04-21 22:19:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 14:50:52 +01:00
|
|
|
virtual bool IsUseable() const override
|
2014-03-16 17:42:23 +01:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2015-06-30 15:50:15 +01:00
|
|
|
|
2020-04-21 22:19:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 14:50:52 +01:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
|
2015-06-30 15:50:15 +01:00
|
|
|
{
|
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
|
return 6;
|
|
|
|
|
}
|
2014-03-16 17:42:23 +01:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|