@@ -19,20 +19,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_ANVIL, 1, a_BlockMeta >> 2));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
cWindow * Window = new cAnvilWindow(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_Player->OpenWindow(Window);
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -58,11 +55,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 6;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ public:
|
||||
a_Pickups.push_back(cItem(E_ITEM_BED, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
// Bed specific helper functions
|
||||
static NIBBLETYPE RotationToMetaData(double a_Rotation)
|
||||
{
|
||||
@@ -77,6 +76,12 @@ public:
|
||||
|
||||
a_ChunkInterface.SetBlockMeta(a_BedPosition.x, a_BedPosition.y, a_BedPosition.z, Meta);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 28;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -32,7 +31,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_BlockMeta & 0x7;
|
||||
@@ -45,7 +43,6 @@ public:
|
||||
a_Pickups.push_back(cItem(E_BLOCK_BIG_FLOWER, 1, Meta));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -78,13 +75,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR) && (a_RelY < cChunkDef::Height - 1) && ((a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ) == E_BLOCK_AIR) || (a_Chunk.GetBlock(a_RelX, a_RelY + 1, a_RelZ) == E_BLOCK_BIG_FLOWER)));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -106,6 +101,12 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 6;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ public:
|
||||
: cMetaRotator<cBlockHandler, 0x07, 0x04, 0x01, 0x03, 0x02, true>(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
@@ -49,7 +48,6 @@ public:
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
@@ -57,13 +55,11 @@ public:
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -76,7 +72,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
|
||||
{
|
||||
switch (a_BlockFace)
|
||||
@@ -99,7 +94,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta & 0x7)
|
||||
@@ -118,7 +112,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta;
|
||||
@@ -129,6 +122,12 @@ public:
|
||||
|
||||
return (a_RelY > 0) && (cBlockInfo::FullyOccupiesVoxel(BlockIsOn));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,14 +16,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -63,12 +61,17 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 14;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -35,18 +34,44 @@ public:
|
||||
a_BlockMeta = a_Player->GetEquippedItem().m_ItemDamage & 0x0f;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_CARPET, 1, a_BlockMeta));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch (a_Meta)
|
||||
{
|
||||
case E_META_CARPET_WHITE: return 14;
|
||||
case E_META_CARPET_ORANGE: return 15;
|
||||
case E_META_CARPET_MAGENTA: return 16;
|
||||
case E_META_CARPET_LIGHTBLUE: return 17;
|
||||
case E_META_CARPET_YELLOW: return 18;
|
||||
case E_META_CARPET_LIGHTGREEN: return 19;
|
||||
case E_META_CARPET_PINK: return 20;
|
||||
case E_META_CARPET_GRAY: return 21;
|
||||
case E_META_CARPET_LIGHTGRAY: return 22;
|
||||
case E_META_CARPET_CYAN: return 23;
|
||||
case E_META_CARPET_PURPLE: return 24;
|
||||
case E_META_CARPET_BLUE: return 25;
|
||||
case E_META_CARPET_BROWN: return 26;
|
||||
case E_META_CARPET_GREEN: return 27;
|
||||
case E_META_CARPET_RED: return 28;
|
||||
case E_META_CARPET_BLACK: return 29;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled meta in carpet handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,12 @@ public:
|
||||
a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta + 1);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 21;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
: cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -65,7 +64,6 @@ public:
|
||||
a_BlockMeta = PlayerYawToMetaData(yaw);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
@@ -73,7 +71,6 @@ public:
|
||||
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
return CanBeAt(a_ChunkInterface, BlockX, a_RelY, BlockZ);
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
@@ -140,7 +137,6 @@ public:
|
||||
return (NumChestNeighbors < 2);
|
||||
}
|
||||
|
||||
|
||||
/** Translates player yaw when placing a chest into the chest block metadata. Valid for single chests only */
|
||||
static NIBBLETYPE PlayerYawToMetaData(double a_Yaw)
|
||||
{
|
||||
@@ -168,8 +164,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true.
|
||||
/** If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true. */
|
||||
bool CheckAndAdjustNeighbor(cChunkInterface & a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta)
|
||||
{
|
||||
if (a_Area.GetRelBlockType(a_RelX, 0, a_RelZ) != m_BlockType)
|
||||
@@ -180,11 +175,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 13;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,34 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch (a_Meta)
|
||||
{
|
||||
case E_META_WOOL_WHITE: return 14;
|
||||
case E_META_WOOL_ORANGE: return 15;
|
||||
case E_META_WOOL_MAGENTA: return 16;
|
||||
case E_META_WOOL_LIGHTBLUE: return 17;
|
||||
case E_META_WOOL_YELLOW: return 18;
|
||||
case E_META_WOOL_LIGHTGREEN: return 19;
|
||||
case E_META_WOOL_PINK: return 20;
|
||||
case E_META_WOOL_GRAY: return 21;
|
||||
case E_META_WOOL_LIGHTGRAY: return 22;
|
||||
case E_META_WOOL_CYAN: return 23;
|
||||
case E_META_WOOL_PURPLE: return 24;
|
||||
case E_META_WOOL_BLUE: return 25;
|
||||
case E_META_WOOL_BROWN: return 26;
|
||||
case E_META_WOOL_GREEN: return 27;
|
||||
case E_META_WOOL_RED: return 28;
|
||||
case E_META_WOOL_BLACK: return 29;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled meta in wool handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,11 +18,16 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 3;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
eBlockFace BlockFace = MetaToBlockFace(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
return ((BlockType == E_BLOCK_LOG) && ((BlockMeta & 0x3) == E_META_LOG_JUNGLE));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
cFastRandom Random;
|
||||
@@ -48,14 +46,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
int GrowState = a_BlockMeta >> 2;
|
||||
a_Pickups.Add(E_ITEM_DYE, ((GrowState >= 2) ? 3 : 1), E_META_DYE_BROWN);
|
||||
}
|
||||
|
||||
|
||||
static eBlockFace MetaToBlockFace(NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta & 0x3)
|
||||
@@ -72,7 +68,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static NIBBLETYPE BlockFaceToMeta(eBlockFace a_BlockFace)
|
||||
{
|
||||
switch (a_BlockFace)
|
||||
@@ -95,6 +90,11 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 34;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ public:
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_AIR, 8, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 10;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ public:
|
||||
: cMetaRotator<cBlockHandler, 0x03, 0x00, 0x01, 0x02, 0x03, true>(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
@@ -26,32 +25,27 @@ public:
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
|
||||
}
|
||||
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
UNUSED(a_ChunkInterface);
|
||||
a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
a_Pickups.push_back(cItem(E_ITEM_COMPARATOR, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -65,7 +59,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static Vector3i GetSideCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta, bool a_bInverse)
|
||||
{
|
||||
if (!a_bInverse)
|
||||
@@ -104,7 +97,6 @@ public:
|
||||
return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
inline static Vector3i GetRearCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta)
|
||||
@@ -124,7 +116,6 @@ public:
|
||||
return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
inline static Vector3i GetFrontCoordinate(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta)
|
||||
@@ -143,6 +134,12 @@ public:
|
||||
|
||||
return Vector3i(a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
|
||||
/// Common class that takes care of carrots, potatoes and wheat
|
||||
/** Common class that takes care of carrots, potatoes and wheat */
|
||||
class cBlockCropsHandler :
|
||||
public cBlockHandler
|
||||
{
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override
|
||||
{
|
||||
cFastRandom rand;
|
||||
@@ -73,7 +72,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta (a_RelX, a_RelY, a_RelZ);
|
||||
@@ -95,11 +93,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -37,6 +36,12 @@ public:
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+18
-3
@@ -9,7 +9,9 @@
|
||||
|
||||
|
||||
|
||||
/// Handler used for both dirt and grass
|
||||
|
||||
|
||||
/** Handler used for all types of dirt and grass */
|
||||
class cBlockDirtHandler :
|
||||
public cBlockHandler
|
||||
{
|
||||
@@ -18,7 +20,6 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
@@ -33,7 +34,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
if (m_BlockType != E_BLOCK_GRASS)
|
||||
@@ -109,6 +109,21 @@ public:
|
||||
}
|
||||
} // for i - repeat twice
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_DIRT: return 10;
|
||||
case E_BLOCK_GRASS: return 1;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in dirt handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterfac
|
||||
case E_BLOCK_JUNGLE_DOOR:
|
||||
case E_BLOCK_SPRUCE_DOOR:
|
||||
case E_BLOCK_IRON_DOOR:
|
||||
case E_BLOCK_WOODEN_DOOR:
|
||||
case E_BLOCK_OAK_DOOR:
|
||||
{
|
||||
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_Player->GetWorld()->BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle());
|
||||
|
||||
+22
-14
@@ -52,7 +52,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
if ((a_BlockMeta & 0x08) != 0) // is top part of door
|
||||
@@ -61,7 +60,7 @@ public:
|
||||
}
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_WOODEN_DOOR:
|
||||
case E_BLOCK_OAK_DOOR:
|
||||
{
|
||||
a_Pickups.Add(E_ITEM_WOODEN_DOOR);
|
||||
break;
|
||||
@@ -104,19 +103,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && CanBeOn(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ), a_Chunk.GetMeta(a_RelX, a_RelY - 1, a_RelZ)));
|
||||
}
|
||||
|
||||
|
||||
/** Returns true if door can be placed on the specified block type. */
|
||||
static bool CanBeOn(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
@@ -140,7 +136,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool CanReplaceBlock(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
switch (a_BlockType)
|
||||
@@ -160,7 +155,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** Converts the player's yaw to placed door's blockmeta */
|
||||
inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw)
|
||||
{
|
||||
@@ -189,7 +183,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Returns a vector pointing one block in the direction the door is facing (where the outside is). */
|
||||
inline static Vector3i GetRelativeDirectionToOutside(NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
@@ -202,7 +195,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Returns true if the specified blocktype is any kind of door */
|
||||
inline static bool IsDoorBlockType(BLOCKTYPE a_Block)
|
||||
{
|
||||
@@ -214,7 +206,7 @@ public:
|
||||
case E_BLOCK_IRON_DOOR:
|
||||
case E_BLOCK_JUNGLE_DOOR:
|
||||
case E_BLOCK_SPRUCE_DOOR:
|
||||
case E_BLOCK_WOODEN_DOOR:
|
||||
case E_BLOCK_OAK_DOOR:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -225,7 +217,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Returns true iff the door at the specified coords is open.
|
||||
The coords may point to either the top part or the bottom part of the door. */
|
||||
static NIBBLETYPE IsOpen(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
@@ -234,7 +225,6 @@ public:
|
||||
return ((Meta & 0x04) != 0);
|
||||
}
|
||||
|
||||
|
||||
/** Returns the complete meta composed from the both parts of the door as (TopMeta << 4) | BottomMeta
|
||||
The coords may point to either part of the door.
|
||||
The returned value has bit 3 (0x08) set iff the coords point to the top part of the door.
|
||||
@@ -267,7 +257,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sets the door to the specified state. If the door is already in that state, does nothing. */
|
||||
static void SetOpen(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Open)
|
||||
{
|
||||
@@ -301,12 +290,31 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Changes the door at the specified coords from open to close or vice versa */
|
||||
static void ChangeDoor(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
SetOpen(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ, !IsOpen(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_OAK_DOOR: return 13;
|
||||
case E_BLOCK_SPRUCE_DOOR: return 34;
|
||||
case E_BLOCK_BIRCH_DOOR: return 2;
|
||||
case E_BLOCK_JUNGLE_DOOR: return 10;
|
||||
case E_BLOCK_DARK_OAK_DOOR: return 26;
|
||||
case E_BLOCK_ACACIA_DOOR: return 15;
|
||||
case E_BLOCK_IRON_DOOR: return 6;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in door handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -49,6 +48,12 @@ public:
|
||||
// Not Facing Up or Down; No change.
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,18 +18,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
cWindow * Window = new cEnchantingWindow(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_Player->OpenWindow(Window);
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 29;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.Add(m_BlockType, 1, 0); // Reset meta to zero
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -35,7 +33,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
NIBBLETYPE OldMetaData = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -55,20 +52,17 @@ public:
|
||||
a_Player->GetWorld()->BroadcastSoundParticleEffect(1003, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player->GetClientHandle());
|
||||
}
|
||||
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// Converts the player's yaw to placed gate's blockmeta
|
||||
/** Converts the player's yaw to placed gate's blockmeta */
|
||||
inline static NIBBLETYPE PlayerYawToMetaData(double a_Yaw)
|
||||
{
|
||||
ASSERT((a_Yaw >= -180) && (a_Yaw < 180));
|
||||
@@ -95,6 +89,25 @@ public:
|
||||
return 0x3;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_OAK_FENCE_GATE: return 13;
|
||||
case E_BLOCK_SPRUCE_FENCE_GATE: return 34;
|
||||
case E_BLOCK_BIRCH_FENCE_GATE: return 2;
|
||||
case E_BLOCK_JUNGLE_FENCE_GATE: return 10;
|
||||
case E_BLOCK_DARK_OAK_FENCE_GATE: return 26;
|
||||
case E_BLOCK_ACACIA_FENCE_GATE: return 15;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in fence gate handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// Portal boundary and direction variables
|
||||
/** Portal boundary and direction variables */
|
||||
// 2014_03_30 _X: What are these used for? Why do we need extra variables?
|
||||
int XZP, XZM;
|
||||
NIBBLETYPE Dir;
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE)
|
||||
/** Finds entire frame in any direction with the coordinates of a base block and fills hole with nether portal (START HERE) */
|
||||
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface)
|
||||
{
|
||||
int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
return (FoundFrameXP && FoundFrameXM);
|
||||
}
|
||||
|
||||
/// Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable
|
||||
/** Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable */
|
||||
bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface & a_ChunkInterface)
|
||||
{
|
||||
Dir = 2;
|
||||
@@ -236,6 +236,12 @@ public:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 15;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,18 +16,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ public:
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_FLOWER_POT, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+19
-7
@@ -18,20 +18,17 @@ public:
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// No pickups
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesIgnoreBuildCollision(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
{
|
||||
switch (m_BlockType)
|
||||
@@ -49,6 +46,17 @@ public:
|
||||
}
|
||||
super::Check(a_ChunkInterface, a_PluginInterface, a_RelX, a_RelY, a_RelZ, a_Chunk);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
if (IsBlockWater(m_BlockType))
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
ASSERT(!"Unhandled blocktype in fluid/water handler!");
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
@@ -66,8 +74,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// Called to tick the block
|
||||
/** Called to tick the block */
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
if (a_Chunk.GetWorld()->ShouldLavaSpawnFire())
|
||||
@@ -80,8 +87,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Tries to start a fire near the lava at given coords. Returns true if fire started.
|
||||
/** Tries to start a fire near the lava at given coords. Returns true if fire started. */
|
||||
static bool TryStartFireNear(int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk)
|
||||
{
|
||||
// Pick a block next to this lava block:
|
||||
@@ -132,6 +138,12 @@ public:
|
||||
} // for i - CrossCoords[]
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 4;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,12 +18,10 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_FURNACE, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -39,6 +37,12 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ public:
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,13 +16,19 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
cFastRandom Random;
|
||||
|
||||
// Add more than one dust
|
||||
a_Pickups.push_back(cItem(E_ITEM_GLOWSTONE_DUST, (char)(2 + Random.NextInt(3)), 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 2;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@ public:
|
||||
a_Pickups.Add(E_BLOCK_GRAVEL, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
case E_BLOCK_DIAMOND_ORE: return new cBlockOreHandler (a_BlockType);
|
||||
case E_BLOCK_DIRT: return new cBlockDirtHandler (a_BlockType);
|
||||
case E_BLOCK_DISPENSER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_NEW_STONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_STONE_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DOUBLE_WOODEN_SLAB: return new cBlockDoubleSlabHandler (a_BlockType);
|
||||
case E_BLOCK_DROPPER: return new cBlockDropSpenserHandler (a_BlockType);
|
||||
@@ -223,7 +223,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE 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 (a_BlockType);
|
||||
case E_BLOCK_FENCE_GATE: return new cBlockFenceGateHandler (a_BlockType);
|
||||
case E_BLOCK_OAK_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);
|
||||
case E_BLOCK_FURNACE: return new cBlockFurnaceHandler (a_BlockType);
|
||||
@@ -266,7 +266,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
case E_BLOCK_NETHER_QUARTZ_ORE: return new cBlockOreHandler (a_BlockType);
|
||||
case E_BLOCK_NEW_LEAVES: return new cBlockLeavesHandler (a_BlockType);
|
||||
case E_BLOCK_NEW_LOG: return new cBlockSidewaysHandler (a_BlockType);
|
||||
case E_BLOCK_NEW_STONE_SLAB: return new cBlockSlabHandler (a_BlockType);
|
||||
case E_BLOCK_RED_SANDSTONE_SLAB: return new cBlockSlabHandler (a_BlockType);
|
||||
case E_BLOCK_NOTE_BLOCK: return new cBlockEntityHandler (a_BlockType);
|
||||
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
||||
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler;
|
||||
@@ -320,10 +320,10 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
||||
case E_BLOCK_WALLSIGN: return new cBlockWallSignHandler (a_BlockType);
|
||||
case E_BLOCK_WATER: return new cBlockFluidHandler (a_BlockType);
|
||||
case E_BLOCK_WOODEN_BUTTON: return new cBlockButtonHandler (a_BlockType);
|
||||
case E_BLOCK_WOODEN_DOOR: return new cBlockDoorHandler (a_BlockType);
|
||||
case E_BLOCK_OAK_DOOR: return new cBlockDoorHandler (a_BlockType);
|
||||
case E_BLOCK_WOODEN_PRESSURE_PLATE: return new cBlockPressurePlateHandler (a_BlockType);
|
||||
case E_BLOCK_WOODEN_SLAB: return new cBlockSlabHandler (a_BlockType);
|
||||
case E_BLOCK_WOODEN_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
case E_BLOCK_OAK_WOOD_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||
case E_BLOCK_WOOL: return new cBlockClothHandler (a_BlockType);
|
||||
case E_BLOCK_WORKBENCH: return new cBlockWorkbenchHandler (a_BlockType);
|
||||
case E_BLOCK_YELLOW_FLOWER: return new cBlockFlowerHandler (a_BlockType);
|
||||
@@ -574,3 +574,13 @@ void cBlockHandler::Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterf
|
||||
|
||||
|
||||
|
||||
|
||||
ColourID cBlockHandler::GetMapBaseColourID(NIBBLETYPE a_Meta)
|
||||
{
|
||||
// Zero for transparent
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -126,6 +126,9 @@ public:
|
||||
By default drops if position no more suitable (CanBeAt(), DoesDropOnUnsuitable(), Drop()),
|
||||
and wakes up all simulators on the block. */
|
||||
virtual void Check(cChunkInterface & ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk);
|
||||
|
||||
/** Returns the base colour ID of the block, as will be represented on a map, as per documentation: http://minecraft.gamepedia.com/Map_item_format */
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta);
|
||||
|
||||
/// <summary>Rotates a given block meta counter-clockwise. Default: no change</summary>
|
||||
/// <returns>Block meta following rotation</returns>
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -40,7 +39,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bit 0x08 is a flag. Lowest three bits are position. 0x08 == 1000
|
||||
@@ -54,6 +52,12 @@ public:
|
||||
// Not Facing Up or Down; No change.
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,13 +17,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// No pickups
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
if (a_Player->IsGameModeCreative() || (a_BlockY <= 0))
|
||||
@@ -44,4 +42,10 @@ public:
|
||||
// This is called later than the real destroying of this ice block
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 5;
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -19,7 +19,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -42,13 +41,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
@@ -70,7 +67,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData)
|
||||
{
|
||||
switch (a_MetaData)
|
||||
@@ -83,7 +79,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 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)
|
||||
{
|
||||
@@ -97,7 +92,6 @@ public:
|
||||
}
|
||||
return BLOCK_FACE_BOTTOM;
|
||||
}
|
||||
|
||||
|
||||
static bool LadderCanBePlacedAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
|
||||
{
|
||||
@@ -111,7 +105,6 @@ public:
|
||||
return cBlockInfo::IsSolid(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
// TODO: Use AdjustCoordsByMeta(), then cChunk::UnboundedRelGetBlock() and finally some comparison
|
||||
@@ -120,6 +113,12 @@ public:
|
||||
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
|
||||
return LadderCanBePlacedAt(a_ChunkInterface, BlockX, a_RelY, BlockZ, BlockFace);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
cFastRandom rand;
|
||||
@@ -74,7 +73,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
|
||||
{
|
||||
// Unset 0x8 bit so this block gets checked for decay:
|
||||
@@ -85,7 +83,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
@@ -128,6 +125,12 @@ public:
|
||||
DropBlock(a_ChunkInterface, a_WorldInterface, a_PluginInterface, nullptr, BlockX, a_RelY, BlockZ);
|
||||
a_ChunkInterface.DigBlock(a_WorldInterface, BlockX, a_RelY, BlockZ);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -27,20 +27,17 @@ public:
|
||||
a_WorldInterface.GetBroadcastManager().BroadcastSoundEffect("random.click", (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 0.5f, (Meta & 0x08) ? 0.6f : 0.5f);
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
a_Pickups.push_back(cItem(E_BLOCK_LEVER, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -53,7 +50,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE LeverDirectionToMetaData(eBlockFace a_Dir)
|
||||
{
|
||||
// Determine lever direction:
|
||||
@@ -73,7 +69,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta & 0x7)
|
||||
@@ -94,7 +89,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
@@ -128,7 +122,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch (a_Meta)
|
||||
@@ -143,7 +136,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch (a_Meta)
|
||||
@@ -157,6 +149,12 @@ public:
|
||||
default: return super::MetaRotateCW(a_Meta); // Wall Rotation
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@ public:
|
||||
super(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
cFastRandom Random;
|
||||
a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + Random.NextInt(5)), 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 19;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@ public:
|
||||
cBlockEntityHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// The drop spawn is in the OnDestroyedByPlayer method
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
@@ -63,6 +61,12 @@ public:
|
||||
|
||||
a_WorldInterface.DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, Callback);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,17 +16,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// TODO: Add Mushroom Spread
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -50,6 +47,12 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ public:
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 24;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_Meta) override
|
||||
{
|
||||
@@ -34,7 +33,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
@@ -43,11 +41,16 @@ public:
|
||||
a_Chunk.FastSetBlock(a_RelX, a_RelY, a_RelZ, E_BLOCK_NETHER_WART, ++Meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
// Needs to be placed on top of a Soulsand block:
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_SOULSAND));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 35;
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -82,6 +82,12 @@ public:
|
||||
static void ExtendPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
static void RetractPiston(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// Returns true if the piston (specified by blocktype) is a sticky piston
|
||||
|
||||
@@ -14,7 +14,6 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -27,6 +26,24 @@ public:
|
||||
a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
switch (a_Meta)
|
||||
{
|
||||
case E_META_PLANKS_BIRCH: return 2;
|
||||
case E_META_PLANKS_JUNGLE: return 10;
|
||||
case E_META_PLANKS_OAK: return 13;
|
||||
case E_META_PLANKS_ACACIA: return 15;
|
||||
case E_META_PLANKS_DARK_OAK: return 26;
|
||||
case E_META_PLANKS_SPRUCE: return 34;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled meta in planks handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+26
-23
@@ -33,7 +33,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// No pickups
|
||||
@@ -64,21 +63,20 @@ public:
|
||||
{
|
||||
case 0x1:
|
||||
{
|
||||
static const struct
|
||||
static const std::array<Vector3i, 4> PortalCheck
|
||||
{
|
||||
int x, y, z;
|
||||
} PortalCheck[] =
|
||||
{
|
||||
{ 0, 1, 0},
|
||||
{ 0, -1, 0},
|
||||
{ 1, 0, 0},
|
||||
{-1, 0, 0},
|
||||
} ;
|
||||
{
|
||||
{ 0, 1, 0 },
|
||||
{ 0, -1, 0 },
|
||||
{ 1, 0, 0 },
|
||||
{ -1, 0, 0 },
|
||||
}
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
||||
for (const auto & Direction : PortalCheck)
|
||||
{
|
||||
BLOCKTYPE Block;
|
||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + Direction.x, a_RelY + Direction.y, a_RelZ + Direction.z, Block);
|
||||
|
||||
if ((Block != E_BLOCK_NETHER_PORTAL) && (Block != E_BLOCK_OBSIDIAN))
|
||||
{
|
||||
@@ -89,21 +87,20 @@ public:
|
||||
}
|
||||
case 0x2:
|
||||
{
|
||||
static const struct
|
||||
static const std::array<Vector3i, 4> PortalCheck
|
||||
{
|
||||
int x, y, z;
|
||||
} PortalCheck[] =
|
||||
{
|
||||
{ 0, 1, 0},
|
||||
{ 0, -1, 0},
|
||||
{ 0, 0, -1},
|
||||
{ 0, 0, 1},
|
||||
} ;
|
||||
{
|
||||
{ 0, 1, 0 },
|
||||
{ 0, -1, 0 },
|
||||
{ 0, 0, -1 },
|
||||
{ 0, 0, 1 },
|
||||
}
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < ARRAYCOUNT(PortalCheck); i++)
|
||||
for (const auto & Direction : PortalCheck)
|
||||
{
|
||||
BLOCKTYPE Block;
|
||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + PortalCheck[i].x, a_RelY + PortalCheck[i].y, a_RelZ + PortalCheck[i].z, Block);
|
||||
a_Chunk.UnboundedRelGetBlockType(a_RelX + Direction.x, a_RelY + Direction.y, a_RelZ + Direction.z, Block);
|
||||
|
||||
if ((Block != E_BLOCK_NETHER_PORTAL) && (Block != E_BLOCK_OBSIDIAN))
|
||||
{
|
||||
@@ -115,6 +112,12 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 24;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,23 @@ public:
|
||||
|
||||
return (cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_STONE_PRESSURE_PLATE: return 11;
|
||||
case E_BLOCK_WOODEN_PRESSURE_PLATE: return 13;
|
||||
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE: return 6;
|
||||
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE: return 30;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in pressure plate handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ public:
|
||||
super(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
@@ -56,6 +55,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 15;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -36,7 +35,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace, NIBBLETYPE a_QuartzMeta)
|
||||
{
|
||||
switch (a_BlockFace)
|
||||
@@ -70,4 +68,10 @@ public:
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 8;
|
||||
}
|
||||
} ;
|
||||
|
||||
+7
-13
@@ -41,7 +41,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnPlaced(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
super::OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta);
|
||||
@@ -57,7 +56,6 @@ public:
|
||||
OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1, BLOCK_FACE_NONE);
|
||||
}
|
||||
|
||||
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
{
|
||||
super::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -73,7 +71,6 @@ public:
|
||||
OnNeighborChanged(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1, BLOCK_FACE_NONE);
|
||||
}
|
||||
|
||||
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_WhichNeighbor) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
@@ -83,13 +80,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
super::ConvertToPickups(a_Pickups, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -258,13 +253,11 @@ public:
|
||||
return Meta;
|
||||
}
|
||||
|
||||
|
||||
inline bool CanThisRailCurve(void)
|
||||
{
|
||||
return m_BlockType == E_BLOCK_RAIL;
|
||||
}
|
||||
|
||||
|
||||
bool IsUnstable(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
if (!IsBlockRail(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ)))
|
||||
@@ -397,7 +390,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool IsNotConnected(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, char a_Pure = 0)
|
||||
{
|
||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false);
|
||||
@@ -495,7 +487,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bit 0x08 is a flag when a_Meta is in the range 0x00--0x05 and 0x0A--0x0F.
|
||||
@@ -532,7 +523,6 @@ public:
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09.
|
||||
@@ -568,7 +558,6 @@ public:
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09.
|
||||
@@ -599,7 +588,6 @@ public:
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bit 0x08 is a flag for value in the range 0x00--0x05 and specifies direction for values withint 0x006--0x09.
|
||||
@@ -629,6 +617,12 @@ public:
|
||||
// To avoid a compiler warning;
|
||||
return a_Meta;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -46,12 +44,17 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ public:
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_LAMP_OFF, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 15;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -31,34 +30,28 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, ((a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) + 0x04) & 0x0f));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
UNUSED(a_ChunkInterface);
|
||||
a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_REPEATER, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -85,7 +78,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE RepeaterRotationToMetaData(double a_Rotation)
|
||||
{
|
||||
a_Rotation += 90 + 45; // So its not aligned with axis
|
||||
@@ -111,6 +103,12 @@ public:
|
||||
return 0x0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,12 +17,17 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Always drop the ON torch, meta 0
|
||||
a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_TORCH_ON, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,21 +17,18 @@ public:
|
||||
: cBlockHandler(a_BlockType)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Only the first 2 bits contain the display information and the 4th bit is for the growth indicator, but, we use 0x07 for forward compatibility
|
||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07));
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
@@ -174,6 +171,12 @@ private:
|
||||
|
||||
return LargeTree;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_SIGN, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -38,7 +36,6 @@ public:
|
||||
return ((Type == E_BLOCK_SIGN_POST) || (Type == E_BLOCK_WALLSIGN) || cBlockInfo::IsSolid(Type));
|
||||
}
|
||||
|
||||
|
||||
static NIBBLETYPE RotationToMetaData(double a_Rotation)
|
||||
{
|
||||
a_Rotation += 180 + (180 / 16); // So it's not aligned with axis
|
||||
@@ -52,19 +49,16 @@ public:
|
||||
return ((char)a_Rotation) % 16;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
return (a_Meta + 4) & 0x0f;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
return (a_Meta + 12) & 0x0f;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Mirrors signs over the XY plane (North-South Mirroring)
|
||||
@@ -74,7 +68,6 @@ public:
|
||||
return (a_Meta < 0x08) ? (0x08 - a_Meta) : (0x18 - a_Meta);
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Mirrors signs over the YZ plane (East-West Mirroring)
|
||||
@@ -83,6 +76,12 @@ public:
|
||||
// These values are equated to angles on a circle; 0x10 = 360 degrees.
|
||||
return 0x0f - a_Meta;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 13;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
+68
-16
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "BlockHandler.h"
|
||||
#include "../Items/ItemHandler.h"
|
||||
#include "Root.h"
|
||||
#include "ChunkInterface.h"
|
||||
#include "../Entities/Player.h"
|
||||
|
||||
@@ -26,13 +25,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, a_BlockMeta & 0x7));
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -87,15 +84,13 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// Returns true if the specified blocktype is one of the slabs handled by this handler
|
||||
/** Returns true if the specified blocktype is one of the slabs handled by this handler */
|
||||
static bool IsAnySlabType(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
return ((a_BlockType == E_BLOCK_WOODEN_SLAB) || (a_BlockType == E_BLOCK_STONE_SLAB) || (a_BlockType == E_BLOCK_NEW_STONE_SLAB));
|
||||
return ((a_BlockType == E_BLOCK_WOODEN_SLAB) || (a_BlockType == E_BLOCK_STONE_SLAB) || (a_BlockType == E_BLOCK_RED_SANDSTONE_SLAB));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
|
||||
{
|
||||
if ((a_BlockFace == BLOCK_FACE_NONE) || (a_Player->GetEquippedItem().m_ItemType != static_cast<short>(m_BlockType)))
|
||||
@@ -103,30 +98,82 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
// Sends the slab back to the client. It's to refuse a doubleslab placement.
|
||||
// Sends the slab back to the client. It's to refuse a doubleslab placement. */
|
||||
a_Player->GetWorld()->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
|
||||
/// Converts the single-slab blocktype to its equivalent double-slab blocktype
|
||||
/** Converts the single-slab blocktype to its equivalent double-slab blocktype */
|
||||
static BLOCKTYPE GetDoubleSlabType(BLOCKTYPE a_SingleSlabBlockType)
|
||||
{
|
||||
switch (a_SingleSlabBlockType)
|
||||
{
|
||||
case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
|
||||
case E_BLOCK_STONE_SLAB: return E_BLOCK_DOUBLE_STONE_SLAB;
|
||||
case E_BLOCK_WOODEN_SLAB: return E_BLOCK_DOUBLE_WOODEN_SLAB;
|
||||
case E_BLOCK_NEW_STONE_SLAB: return E_BLOCK_DOUBLE_NEW_STONE_SLAB;
|
||||
case E_BLOCK_RED_SANDSTONE_SLAB: return E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB;
|
||||
}
|
||||
ASSERT(!"Unhandled slab type!");
|
||||
return E_BLOCK_AIR;
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorXZ(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Toggle the 4th bit - up / down:
|
||||
return (a_Meta ^ 0x08);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
a_Meta &= 0x7;
|
||||
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_STONE_SLAB:
|
||||
{
|
||||
switch (a_Meta)
|
||||
{
|
||||
case E_META_STONE_SLAB_SANDSTONE: return 2;
|
||||
case E_META_STONE_SLAB_PLANKS: return 13;
|
||||
case E_META_STONE_SLAB_STONE_BRICK:
|
||||
case E_META_STONE_SLAB_STONE:
|
||||
case E_META_STONE_SLAB_COBBLESTONE: return 11;
|
||||
case E_META_STONE_SLAB_BRICK: return 28;
|
||||
case E_META_STONE_SLAB_NETHER_BRICK: return 35;
|
||||
case E_META_STONE_SLAB_QUARTZ: return 8;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled meta in slab handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
case E_BLOCK_WOODEN_SLAB:
|
||||
{
|
||||
switch (a_Meta)
|
||||
{
|
||||
case E_META_WOODEN_SLAB_BIRCH: return 2;
|
||||
case E_META_WOODEN_SLAB_JUNGLE: return 10;
|
||||
case E_META_WOODEN_SLAB_OAK: return 13;
|
||||
case E_META_WOODEN_SLAB_ACACIA: return 15;
|
||||
case E_META_WOODEN_SLAB_DARK_OAK: return 26;
|
||||
case E_META_WOODEN_SLAB_SPRUCE: return 34;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled meta in slab handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
case E_BLOCK_RED_SANDSTONE_SLAB:
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in slab handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
@@ -142,7 +189,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
BLOCKTYPE Block = GetSingleSlabType(m_BlockType);
|
||||
@@ -153,13 +199,19 @@ public:
|
||||
{
|
||||
switch (a_BlockType)
|
||||
{
|
||||
case E_BLOCK_DOUBLE_STONE_SLAB: return E_BLOCK_STONE_SLAB;
|
||||
case E_BLOCK_DOUBLE_STONE_SLAB: return E_BLOCK_STONE_SLAB;
|
||||
case E_BLOCK_DOUBLE_WOODEN_SLAB: return E_BLOCK_WOODEN_SLAB;
|
||||
case E_BLOCK_DOUBLE_NEW_STONE_SLAB: return E_BLOCK_NEW_STONE_SLAB;
|
||||
case E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB: return E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB;
|
||||
}
|
||||
ASSERT(!"Unhandled double slab type!");
|
||||
return a_BlockType;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// For doule slabs, the meta values are the same. Only the meaning of the 4th bit changes, but that's ignored in the below handler
|
||||
return BlockHandler(GetSingleSlabType(m_BlockType))->GetMapBaseColourID(a_Meta);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -42,7 +41,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) override
|
||||
{
|
||||
if ((a_Player->GetEquippedItem().m_ItemType == E_BLOCK_SNOW) && (a_Meta < 7))
|
||||
@@ -57,14 +55,12 @@ public:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_SNOWBALL, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY > 0)
|
||||
@@ -82,11 +78,16 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesDropOnUnsuitable(void) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 14;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -54,14 +53,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
static NIBBLETYPE RotationToMetaData(double a_Rotation)
|
||||
{
|
||||
a_Rotation += 90 + 45; // So its not aligned with axis
|
||||
@@ -92,6 +89,32 @@ public:
|
||||
// Toggle bit 3:
|
||||
return (a_Meta & 0x0b) | ((~a_Meta) & 0x04);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_SANDSTONE_STAIRS:
|
||||
case E_BLOCK_BIRCH_WOOD_STAIRS: return 2;
|
||||
case E_BLOCK_QUARTZ_STAIRS: return 8;
|
||||
case E_BLOCK_JUNGLE_WOOD_STAIRS:
|
||||
case E_BLOCK_RED_SANDSTONE_STAIRS: return 10;
|
||||
case E_BLOCK_COBBLESTONE_STAIRS:
|
||||
case E_BLOCK_STONE_BRICK_STAIRS: return 11;
|
||||
case E_BLOCK_OAK_WOOD_STAIRS: return 13;
|
||||
case E_BLOCK_ACACIA_WOOD_STAIRS: return 15;
|
||||
case E_BLOCK_DARK_OAK_WOOD_STAIRS: return 26;
|
||||
case E_BLOCK_BRICK_STAIRS: return 28;
|
||||
case E_BLOCK_NETHER_BRICK_STAIRS: return 35;
|
||||
case E_BLOCK_SPRUCE_WOOD_STAIRS: return 34;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in stairs handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,13 +17,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
short ItemType = (m_BlockType == E_BLOCK_MELON_STEM) ? E_ITEM_MELON_SEEDS : E_ITEM_PUMPKIN_SEEDS;
|
||||
a_Pickups.push_back(cItem(ItemType, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
@@ -42,11 +40,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ public:
|
||||
}
|
||||
a_Pickups.push_back(cItem(E_BLOCK_STONE, 1, a_BlockMeta));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 11;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_SUGARCANE, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -73,11 +71,16 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ public:
|
||||
{
|
||||
a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesIgnoreBuildCollision(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Drop seeds, sometimes
|
||||
@@ -35,7 +33,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop) override
|
||||
{
|
||||
if (a_CanDrop && (a_Digger != nullptr) && (a_Digger->GetEquippedWeapon().m_ItemType == E_ITEM_SHEARS))
|
||||
@@ -70,7 +67,6 @@ public:
|
||||
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_CanDrop);
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
if (a_RelY <= 0)
|
||||
@@ -81,6 +77,12 @@ public:
|
||||
BLOCKTYPE BelowBlock = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ);
|
||||
return IsBlockTypeOfDirt(BelowBlock);
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -47,7 +46,6 @@ public:
|
||||
a_BlockMeta = DirectionToMetaData(a_BlockFace);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction)
|
||||
{
|
||||
@@ -67,7 +65,6 @@ public:
|
||||
};
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
|
||||
inline static eBlockFace MetaDataToDirection(NIBBLETYPE a_MetaData)
|
||||
{
|
||||
@@ -88,7 +85,6 @@ public:
|
||||
return BLOCK_FACE_TOP;
|
||||
}
|
||||
|
||||
|
||||
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, eBlockFace a_BlockFace)
|
||||
{
|
||||
switch (a_BlockType)
|
||||
@@ -119,7 +115,7 @@ public:
|
||||
// Toches can be placed on the top of these slabs only if the occupy the top half of the voxel
|
||||
return ((a_BlockFace == BLOCK_FACE_YP) && ((a_BlockMeta & 0x08) == 0x08));
|
||||
}
|
||||
case E_BLOCK_WOODEN_STAIRS:
|
||||
case E_BLOCK_OAK_WOOD_STAIRS:
|
||||
case E_BLOCK_COBBLESTONE_STAIRS:
|
||||
case E_BLOCK_BRICK_STAIRS:
|
||||
case E_BLOCK_STONE_BRICK_STAIRS:
|
||||
@@ -147,7 +143,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure */
|
||||
static eBlockFace FindSuitableFace(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
@@ -172,7 +167,6 @@ public:
|
||||
return BLOCK_FACE_NONE;
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
eBlockFace Face = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ));
|
||||
@@ -188,12 +182,17 @@ public:
|
||||
return CanBePlacedOn(BlockInQuestion, BlockInQuestionMeta, Face);
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Always drop meta = 0
|
||||
a_Pickups.push_back(cItem(m_BlockType, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
|
||||
{
|
||||
@@ -89,7 +88,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta & 0x3)
|
||||
@@ -106,7 +104,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE Meta;
|
||||
@@ -118,6 +115,21 @@ public:
|
||||
|
||||
return ((a_RelY > 0) && cBlockInfo::IsSolid(BlockIsOn));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
switch (m_BlockType)
|
||||
{
|
||||
case E_BLOCK_TRAPDOOR: return 13;
|
||||
case E_BLOCK_IRON_TRAPDOOR: return 6;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled blocktype in trapdoor handler!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ public:
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -30,7 +29,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline static NIBBLETYPE DirectionToMetadata(eBlockFace a_Direction)
|
||||
{
|
||||
switch (a_Direction)
|
||||
@@ -53,7 +51,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline static eBlockFace MetadataToDirection(NIBBLETYPE a_Meta)
|
||||
{
|
||||
switch (a_Meta & 0x03)
|
||||
@@ -66,7 +63,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
@@ -84,6 +80,12 @@ public:
|
||||
|
||||
return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
+8
-16
@@ -15,7 +15,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual bool GetPlacementBlockTypeMeta(
|
||||
cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
|
||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
|
||||
@@ -39,14 +38,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to zero
|
||||
a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
static NIBBLETYPE DirectionToMetaData(char a_BlockFace)
|
||||
{
|
||||
switch (a_BlockFace)
|
||||
@@ -59,7 +56,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char MetaDataToDirection(NIBBLETYPE a_MetaData)
|
||||
{
|
||||
switch (a_MetaData)
|
||||
@@ -72,8 +68,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Returns true if the specified block type is good for vines to attach to
|
||||
/** Returns true if the specified block type is good for vines to attach to */
|
||||
static bool IsBlockAttachable(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
switch (a_BlockType)
|
||||
@@ -93,8 +88,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Returns the meta that has the maximum allowable sides of the vine, given the surroundings
|
||||
/** Returns the meta that has the maximum allowable sides of the vine, given the surroundings */
|
||||
NIBBLETYPE GetMaxMeta(cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
static const struct
|
||||
@@ -124,7 +118,6 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void Check(cChunkInterface & a_ChunkInterface, cBlockPluginInterface & a_PluginInterface, int a_RelX, int a_RelY, int a_RelZ, cChunk & a_Chunk) override
|
||||
{
|
||||
NIBBLETYPE CurMeta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
|
||||
@@ -164,18 +157,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesIgnoreBuildCollision(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool DoesDropOnUnsuitable(void) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUpdate(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override
|
||||
{
|
||||
@@ -199,33 +189,35 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
return ((a_Meta >> 1) | (a_Meta << 3)) & 0x0f; // Rotate bits to the right
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
return ((a_Meta << 1) | (a_Meta >> 3)) & 0x0f; // Rotate bits to the left
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bits 2 and 4 stay, bits 1 and 3 swap
|
||||
return (NIBBLETYPE)((a_Meta & 0x0a) | ((a_Meta & 0x01) << 2) | ((a_Meta & 0x04) >> 2));
|
||||
}
|
||||
|
||||
|
||||
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
// Bits 1 and 3 stay, bits 2 and 4 swap
|
||||
return (NIBBLETYPE)((a_Meta & 0x05) | ((a_Meta & 0x02) << 2) | ((a_Meta & 0x08) >> 2));
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 7;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_ITEM_SIGN, 1, 0));
|
||||
}
|
||||
|
||||
|
||||
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
||||
{
|
||||
int BlockX = (a_Chunk.GetPosX() * cChunkDef::Width) + a_RelX;
|
||||
@@ -37,7 +35,6 @@ public:
|
||||
return ((Type == E_BLOCK_WALLSIGN) || (Type == E_BLOCK_SIGN_POST) || cBlockInfo::IsSolid(Type));
|
||||
}
|
||||
|
||||
|
||||
static void GetBlockCoordsBehindTheSign(NIBBLETYPE a_BlockMeta, int & a_BlockX, int & a_BlockZ)
|
||||
{
|
||||
switch (a_BlockMeta)
|
||||
@@ -50,7 +47,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static NIBBLETYPE DirectionToMetaData(eBlockFace a_Direction)
|
||||
{
|
||||
switch (a_Direction)
|
||||
@@ -68,6 +64,12 @@ public:
|
||||
}
|
||||
return 0x2;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 13;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -18,18 +18,22 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
|
||||
{
|
||||
cWindow * Window = new cCraftingWindow(a_BlockX, a_BlockY, a_BlockZ);
|
||||
a_Player->OpenWindow(Window);
|
||||
}
|
||||
|
||||
|
||||
virtual bool IsUseable(void) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return 13;
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user