1
0

Added mechanics placeable on halfslabs

This commit is contained in:
Julian Laubstein 2014-10-19 15:01:01 +02:00
parent 3ee47df118
commit 403f8581cf
5 changed files with 84 additions and 14 deletions

View File

@ -6,10 +6,12 @@ derouinw
Diusrex Diusrex
Duralex Duralex
FakeTruth (founder) FakeTruth (founder)
Howaner
keyboard keyboard
Lapayo Lapayo
Luksor Luksor
marmot21 marmot21
Masy98
mborland mborland
mgueydan mgueydan
MikeHunsinger MikeHunsinger
@ -18,6 +20,7 @@ nesco
rs2k rs2k
SamJBarney SamJBarney
Sofapriester Sofapriester
SphinxC0re
STR_Warrior STR_Warrior
structinf (xdot) structinf (xdot)
Sxw1212 Sxw1212
@ -25,11 +28,9 @@ Taugeshtu
tigerw (Tiger Wang) tigerw (Tiger Wang)
tonibm19 tonibm19
UltraCoderRU UltraCoderRU
WebFreak001
worktycho worktycho
xoft xoft
Yeeeeezus (Donated AlchemistVillage prefabs) Yeeeeezus (Donated AlchemistVillage prefabs)
Howaner
Masy98
WebFreak001
Please add yourself to this list if you contribute to MCServer. Please add yourself to this list if you contribute to MCServer.

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "BlockHandler.h" #include "BlockHandler.h"
#include "../Chunk.h"
#include "MetaRotator.h" #include "MetaRotator.h"
#include "BlockSlab.h"
class cBlockLeverHandler : class cBlockLeverHandler :
@ -93,13 +93,35 @@ public:
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
NIBBLETYPE Meta; NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ);
a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta);
AddFaceDirection(a_RelX, a_RelY, a_RelZ, BlockMetaDataToBlockFace(Meta), true); eBlockFace Face = BlockMetaDataToBlockFace(Meta);
BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn);
return (a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn); AddFaceDirection(a_RelX, a_RelY, a_RelZ, Face, true);
if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height -1))
{
return false;
}
BLOCKTYPE BlockIsOn;
a_Chunk.UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ, BlockIsOn, Meta);
if (cBlockInfo::FullyOccupiesVoxel(BlockIsOn))
{
return true;
}
else if (cBlockSlabHandler::IsAnySlabType(BlockIsOn))
{
// Check if the slab is turned up side down
if (((Meta & 0x08) == 0x08) && (Face == BLOCK_FACE_TOP))
{
return true;
}
}
return false;
} }

View File

@ -3,6 +3,7 @@
#include "BlockHandler.h" #include "BlockHandler.h"
#include "../World.h" #include "../World.h"
#include "BlockSlab.h"
@ -18,9 +19,31 @@ public:
} }
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); if (a_RelY <= 0)
{
return false;
}
BLOCKTYPE BelowBlock;
NIBBLETYPE BelowBlockMeta;
a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY - 1, a_RelZ, BelowBlock, BelowBlockMeta);
if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
{
return true;
}
else if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
{
// Check if the slab is turned up side down
if ((BelowBlockMeta & 0x08) == 0x08)
{
return true;
}
}
return false;
} }

View File

@ -5,6 +5,7 @@
#include "Chunk.h" #include "Chunk.h"
#include "MetaRotator.h" #include "MetaRotator.h"
#include "ChunkInterface.h" #include "ChunkInterface.h"
#include "BlockSlab.h"
@ -44,6 +45,7 @@ public:
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to zero // Reset meta to zero
@ -59,7 +61,28 @@ public:
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
return ((a_RelY > 0) && cBlockInfo::IsSolid(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); if (a_RelY <= 0)
{
return false;
}
BLOCKTYPE BelowBlock;
NIBBLETYPE BelowBlockMeta;
a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY - 1, a_RelZ, BelowBlock, BelowBlockMeta);
if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
{
return true;
}
else if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
{
// Check if the slab is turned up side down
if ((BelowBlockMeta & 0x08) == 0x08)
{
return true;
}
}
return false;
} }

View File

@ -13,6 +13,7 @@
#include "../Items/ItemHandler.h" #include "../Items/ItemHandler.h"
#include "Root.h" #include "Root.h"
#include "ChunkInterface.h" #include "ChunkInterface.h"
#include "../Entities/Player.h"