Fixed some meta resetting bugs

* Fixes #1174
* Fixes #1171
master
Tiger Wang 2014-07-14 21:57:44 +01:00
parent ad6494fb36
commit 5b1552435f
6 changed files with 28 additions and 27 deletions

View File

@ -16,13 +16,6 @@ public:
{
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.push_back(cItem(E_BLOCK_WOOL, 1, a_BlockMeta));
}
virtual const char * GetStepSound(void) override
{
return "step.cloth";

View File

@ -19,15 +19,13 @@
class cBlockFarmlandHandler :
public cBlockHandler
{
typedef cBlockHandler super;
public:
cBlockFarmlandHandler(void) :
super(E_BLOCK_FARMLAND)
cBlockFarmlandHandler(BLOCKTYPE a_BlockType) :
cBlockHandler(a_BlockType)
{
}
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
{
bool Found = false;
@ -105,6 +103,11 @@ public:
}
}
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(E_BLOCK_DIRT, 1, 0); // Reset meta
}
} ;

View File

@ -211,7 +211,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_EMERALD_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_ENCHANTMENT_TABLE: return new cBlockEnchantmentTableHandler(a_BlockType);
case E_BLOCK_ENDER_CHEST: return new cBlockEnderchestHandler (a_BlockType);
case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler ( );
case E_BLOCK_FARMLAND: return new cBlockFarmlandHandler (a_BlockType);
case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
case E_BLOCK_FIRE: return new cBlockFireHandler (a_BlockType);
case E_BLOCK_FLOWER_POT: return new cBlockFlowerPotHandler (a_BlockType);

View File

@ -1,7 +1,6 @@
#pragma once
#include "BlockHandler.h"
#include "BlockSideways.h"

View File

@ -41,21 +41,27 @@ public:
}
static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction) // tolua_export
{ // tolua_export
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(m_BlockType, 1, 0); // Reset meta
}
static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction)
{
switch (a_Direction)
{
case BLOCK_FACE_ZM: return 0x2;
case BLOCK_FACE_ZP: return 0x3;
case BLOCK_FACE_XM: return 0x4;
case BLOCK_FACE_XP: return 0x5;
default: return 0x2;
default: return 0x2;
}
} // tolua_export
}
static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData) // tolua_export
{ // tolua_export
static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData)
{
switch (a_MetaData)
{
case 0x2: return BLOCK_FACE_ZM;
@ -64,10 +70,10 @@ public:
case 0x5: return BLOCK_FACE_XP;
default: return BLOCK_FACE_ZM;
}
} // tolua_export
}
/// Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure
/** Finds a suitable Direction for the Ladder. Returns BLOCK_FACE_BOTTOM on failure */
static eBlockFace FindSuitableBlockFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
{
for (int FaceInt = BLOCK_FACE_ZM; FaceInt <= BLOCK_FACE_XP; FaceInt++)

View File

@ -32,36 +32,36 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3);
a_Pickups.Add(m_BlockType, 1, a_BlockMeta & 0x3); // Reset meta
}
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_WoodMeta)
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_Meta)
{
switch (a_BlockFace)
{
case BLOCK_FACE_YM:
case BLOCK_FACE_YP:
{
return a_WoodMeta; // Top or bottom, just return original
return a_Meta; // Top or bottom, just return original
}
case BLOCK_FACE_ZP:
case BLOCK_FACE_ZM:
{
return a_WoodMeta | 0x8; // North or south
return a_Meta | 0x8; // North or south
}
case BLOCK_FACE_XP:
case BLOCK_FACE_XM:
{
return a_WoodMeta | 0x4; // East or west
return a_Meta | 0x4; // East or west
}
default:
{
ASSERT(!"Unhandled block face!");
return a_WoodMeta | 0xC; // No idea, give a special meta (all sides bark)
return a_Meta | 0xC; // No idea, give a special meta
}
}
}