diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-11-30 22:13:13 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-11-30 22:13:13 +0100 |
commit | 67b5a417e35febeb211d29320197d5f1ac2ba291 (patch) | |
tree | 2de5132e2a0cdadcb73e3ec590e2ba095405914f /src | |
parent | Fixed signs and added missing blocks to sand simulators list (diff) | |
download | cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar.gz cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar.bz2 cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar.lz cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar.xz cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.tar.zst cuberite-67b5a417e35febeb211d29320197d5f1ac2ba291.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockInfo.cpp | 1 | ||||
-rw-r--r-- | src/Blocks/BlockBigFlower.h | 23 | ||||
-rw-r--r-- | src/Blocks/BlockButton.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.cpp | 6 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.h | 23 | ||||
-rw-r--r-- | src/Blocks/BlockFlowerPot.h | 7 | ||||
-rw-r--r-- | src/Blocks/BlockLever.h | 11 | ||||
-rw-r--r-- | src/Blocks/BlockSnow.h | 19 | ||||
-rw-r--r-- | src/Blocks/BlockTorch.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockTrapdoor.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockTripwireHook.h | 11 | ||||
-rw-r--r-- | src/Blocks/BlockWallSign.h | 5 | ||||
-rw-r--r-- | src/Simulator/FluidSimulator.cpp | 2 |
13 files changed, 101 insertions, 25 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index bcab21e77..5bcf4da50 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -774,6 +774,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_JUNGLE_DOOR ].m_PlaceSound = "dig.wood"; a_Info[E_BLOCK_ACACIA_DOOR ].m_PlaceSound = "dig.wood"; a_Info[E_BLOCK_DARK_OAK_DOOR ].m_PlaceSound = "dig.wood"; + a_Info[E_BLOCK_BED ].m_PlaceSound = "dig.wood"; } diff --git a/src/Blocks/BlockBigFlower.h b/src/Blocks/BlockBigFlower.h index 3577bdd40..a73633cd0 100644 --- a/src/Blocks/BlockBigFlower.h +++ b/src/Blocks/BlockBigFlower.h @@ -81,7 +81,28 @@ 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) && ((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))); + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return (cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); + } + + if ((a_RelY <= 0) || (a_RelY >= cChunkDef::Height)) + { + return false; + } + + NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); + if ((Meta & 0x08) != 0) + { + // The coords are pointing at the top part of the flower + return (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == m_BlockType); + } + else + { + // The coords are pointing at the bottom part of the flower + return IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); + } } diff --git a/src/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 8e4f04740..63582977a 100644 --- a/src/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h @@ -91,6 +91,12 @@ public: virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return true; + } + NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index 96345a2df..ffb72a680 100644 --- a/src/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp @@ -20,9 +20,9 @@ void cBlockDoorHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldIn { NIBBLETYPE OldMeta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - if (OldMeta & 8) + if ((OldMeta & 0x08) != 0) { - // Was upper part of door + // The coords are pointing at the top part of the door if (IsDoor(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ))) { a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY - 1, a_BlockZ, E_BLOCK_AIR, 0); @@ -30,7 +30,7 @@ void cBlockDoorHandler::OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldIn } else { - // Was lower part + // The coords are pointing at the bottom part of the door if (IsDoor(a_ChunkInterface.GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ))) { a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, E_BLOCK_AIR, 0); diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index 92ad8da12..74e608da8 100644 --- a/src/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h @@ -117,7 +117,28 @@ 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)); + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return (cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); + } + + if ((a_RelY <= 0) || (a_RelY >= cChunkDef::Height)) + { + return false; + } + + NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); + if ((Meta & 0x08) != 0) + { + // The coords are pointing at the top part of the door + return (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == m_BlockType); + } + else + { + // The coords are pointing at the bottom part of the door + return cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); + } } diff --git a/src/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h index fc75ef638..ff31cf4ae 100644 --- a/src/Blocks/BlockFlowerPot.h +++ b/src/Blocks/BlockFlowerPot.h @@ -17,10 +17,17 @@ public: { } + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override { a_Pickups.push_back(cItem(E_ITEM_FLOWER_POT, 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) && cBlockInfo::FullyOccupiesVoxel(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ))); + } } ; diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index f5bedea6c..347c8ff72 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -93,13 +93,17 @@ public: virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return true; + } + NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); - eBlockFace Face = BlockMetaDataToBlockFace(Meta); - AddFaceDirection(a_RelX, a_RelY, a_RelZ, Face, true); - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height -1)) + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) { return false; } @@ -107,7 +111,6 @@ public: BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ, BlockIsOn, Meta); - if (cBlockInfo::FullyOccupiesVoxel(BlockIsOn)) { return true; diff --git a/src/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index 7b6094c9f..4f1712974 100644 --- a/src/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h @@ -67,19 +67,16 @@ 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) + if (a_RelY <= 0) { - BLOCKTYPE BlockBelow = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ); - NIBBLETYPE MetaBelow = a_Chunk.GetMeta(a_RelX, a_RelY - 1, a_RelZ); - - if (cBlockInfo::IsSnowable(BlockBelow) || ((BlockBelow == E_BLOCK_SNOW) && (MetaBelow == 7))) - { - // If block below is snowable, or it is a thin slow block and has a meta of 7 (full thin snow block), say yay - return true; - } + return false; } - - return false; + + BLOCKTYPE BlockBelow = a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ); + NIBBLETYPE MetaBelow = a_Chunk.GetMeta(a_RelX, a_RelY - 1, a_RelZ); + + // If block below is snowable, or it is a thin slow block and has a meta of 7 (full thin snow block), say yay + return (cBlockInfo::IsSnowable(BlockBelow) || ((BlockBelow == E_BLOCK_SNOW) && (MetaBelow == 7))); } diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index e77bbd1b8..0218aa6ea 100644 --- a/src/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h @@ -153,6 +153,12 @@ public: virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return true; + } + eBlockFace Face = MetaDataToDirection(a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ)); AddFaceDirection(a_RelX, a_RelY, a_RelZ, Face, true); diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 8c96de0f1..55a644288 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -100,6 +100,12 @@ public: virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return true; + } + NIBBLETYPE Meta; a_Chunk.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); diff --git a/src/Blocks/BlockTripwireHook.h b/src/Blocks/BlockTripwireHook.h index 88d389711..d7121f65c 100644 --- a/src/Blocks/BlockTripwireHook.h +++ b/src/Blocks/BlockTripwireHook.h @@ -61,14 +61,19 @@ 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.UnboundedRelGetBlockMeta(a_RelX, a_RelY, a_RelZ, Meta); + if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) + { + // In placing + return true; + } + + NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); AddFaceDirection(a_RelX, a_RelY, a_RelZ, MetadataToDirection(Meta), true); BLOCKTYPE BlockIsOn; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockIsOn); - return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn)); + return cBlockInfo::FullyOccupiesVoxel(BlockIsOn); } }; diff --git a/src/Blocks/BlockWallSign.h b/src/Blocks/BlockWallSign.h index 9a7d4aa58..ab280c1e0 100644 --- a/src/Blocks/BlockWallSign.h +++ b/src/Blocks/BlockWallSign.h @@ -42,14 +42,15 @@ public: { if (a_Chunk.GetBlock(a_RelX, a_RelY, a_RelZ) != m_BlockType) { + // In placing return true; } NIBBLETYPE Meta = a_Chunk.GetMeta(a_RelX, a_RelY, a_RelZ); GetBlockCoordsBehindTheSign(Meta, a_RelX, a_RelZ); - cChunk * Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - BLOCKTYPE BehindBlock = Chunk->GetBlock(a_RelX, a_RelY, a_RelZ); + BLOCKTYPE BehindBlock; + a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BehindBlock); return ((BehindBlock == E_BLOCK_WALLSIGN) || (BehindBlock == E_BLOCK_SIGN_POST) || cBlockInfo::IsSolid(BehindBlock)); } diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp index 60220b706..38508323f 100644 --- a/src/Simulator/FluidSimulator.cpp +++ b/src/Simulator/FluidSimulator.cpp @@ -46,6 +46,8 @@ bool cFluidSimulator::CanWashAway(BLOCKTYPE a_BlockType) case E_BLOCK_SNOW: case E_BLOCK_SUGARCANE: case E_BLOCK_TALL_GRASS: + case E_BLOCK_TRIPWIRE: + case E_BLOCK_TRIPWIRE_HOOK: case E_BLOCK_TORCH: case E_BLOCK_YELLOW_FLOWER: case E_BLOCK_VINES: |