summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-09-30 22:53:32 +0200
committerMattes D <github@xoft.cz>2014-09-30 22:53:32 +0200
commit1d185fe2073f4dd68ae9675e9bdbaa554754b8ea (patch)
treeac0c02f236ecc5904558794dc84c882d9512b0d7
parentMerge pull request #1485 from mc-server/PluginMessages (diff)
parentCode improvements (diff)
downloadcuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.gz
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.bz2
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.lz
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.xz
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.tar.zst
cuberite-1d185fe2073f4dd68ae9675e9bdbaa554754b8ea.zip
-rw-r--r--src/BlockID.h1
-rw-r--r--src/BlockInfo.cpp1
-rw-r--r--src/Blocks/BlockDirt.h10
-rw-r--r--src/Blocks/BlockDoor.h18
-rw-r--r--src/Blocks/BlockTrapdoor.h6
-rw-r--r--src/Items/ItemHoe.h27
-rw-r--r--src/Simulator/SandSimulator.cpp1
-rw-r--r--src/World.cpp4
8 files changed, 62 insertions, 6 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index 9a8830710..03a7f63e6 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -477,6 +477,7 @@ enum
// E_BLOCK_DIRT metas:
E_META_DIRT_NORMAL = 0,
E_META_DIRT_GRASSLESS = 1,
+ E_META_DIRT_COARSE = 1,
E_META_DIRT_PODZOL = 2,
// E_BLOCK_DISPENSER / E_BLOCK_DROPPER metas:
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index 14e814084..719ba0550 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -329,6 +329,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_PistonBreakable = true;
a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_PistonBreakable = true;
a_Info[E_BLOCK_IRON_DOOR ].m_PistonBreakable = true;
+ a_Info[E_BLOCK_IRON_TRAPDOOR ].m_PistonBreakable = true;
a_Info[E_BLOCK_JACK_O_LANTERN ].m_PistonBreakable = true;
a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE].m_PistonBreakable = true;
a_Info[E_BLOCK_LILY_PAD ].m_PistonBreakable = true;
diff --git a/src/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h
index 60d81db72..19f889372 100644
--- a/src/Blocks/BlockDirt.h
+++ b/src/Blocks/BlockDirt.h
@@ -21,7 +21,15 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
- a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0));
+ if (a_BlockMeta == E_META_DIRT_COARSE)
+ {
+ // Drop the coarse block (dirt, meta 1)
+ a_Pickups.Add(E_BLOCK_DIRT, 1, E_META_DIRT_COARSE);
+ }
+ else
+ {
+ a_Pickups.Add(E_BLOCK_DIRT, 1, E_META_DIRT_NORMAL);
+ }
}
diff --git a/src/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h
index 0ff8bcfc8..92ad8da12 100644
--- a/src/Blocks/BlockDoor.h
+++ b/src/Blocks/BlockDoor.h
@@ -173,7 +173,23 @@ public:
/** Returns true if the specified blocktype is any kind of door */
inline static bool IsDoor(BLOCKTYPE a_Block)
{
- return (a_Block == E_BLOCK_WOODEN_DOOR) || (a_Block == E_BLOCK_IRON_DOOR);
+ switch (a_Block)
+ {
+ case E_BLOCK_ACACIA_DOOR:
+ case E_BLOCK_BIRCH_DOOR:
+ case E_BLOCK_DARK_OAK_DOOR:
+ case E_BLOCK_IRON_DOOR:
+ case E_BLOCK_JUNGLE_DOOR:
+ case E_BLOCK_SPRUCE_DOOR:
+ case E_BLOCK_WOODEN_DOOR:
+ {
+ return true;
+ }
+ default:
+ {
+ return false;
+ }
+ }
}
diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h
index 41256ae55..8c96de0f1 100644
--- a/src/Blocks/BlockTrapdoor.h
+++ b/src/Blocks/BlockTrapdoor.h
@@ -29,6 +29,12 @@ 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
{
+ if (m_BlockType == E_BLOCK_IRON_TRAPDOOR)
+ {
+ // Iron doors can only be toggled by redstone, not by right-clicking
+ return;
+ }
+
// Flip the ON bit on/off using the XOR bitwise operation
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
diff --git a/src/Items/ItemHoe.h b/src/Items/ItemHoe.h
index de8b9a061..ae3723323 100644
--- a/src/Items/ItemHoe.h
+++ b/src/Items/ItemHoe.h
@@ -24,12 +24,35 @@ public:
{
return false;
}
- BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
BLOCKTYPE UpperBlock = a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ);
+ BLOCKTYPE Block;
+ NIBBLETYPE BlockMeta;
+ a_World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, Block, BlockMeta);
+
if (((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS)) && (UpperBlock == E_BLOCK_AIR))
{
- a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0);
+ BLOCKTYPE NewBlock = E_BLOCK_FARMLAND;
+ if (Block == E_BLOCK_DIRT)
+ {
+ switch (BlockMeta)
+ {
+ case E_META_DIRT_COARSE:
+ {
+ // Transform to normal dirt
+ NewBlock = E_BLOCK_DIRT;
+ break;
+ }
+ case E_META_DIRT_PODZOL:
+ {
+ // You can't transform this block with a hoe in vanilla
+ return false;
+ }
+ default: break;
+ }
+ }
+
+ a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, NewBlock, 0);
a_World->BroadcastSoundEffect("dig.gravel", a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5, 1.0f, 0.8f);
a_Player->UseEquippedItem();
return true;
diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp
index e8887ce59..aad41e463 100644
--- a/src/Simulator/SandSimulator.cpp
+++ b/src/Simulator/SandSimulator.cpp
@@ -160,6 +160,7 @@ bool cSandSimulator::CanContinueFallThrough(BLOCKTYPE a_BlockType)
case E_BLOCK_FIRE:
case E_BLOCK_FLOWER_POT:
case E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE:
+ case E_BLOCK_IRON_TRAPDOOR:
case E_BLOCK_LAVA:
case E_BLOCK_LEVER:
case E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE:
diff --git a/src/World.cpp b/src/World.cpp
index 6059b841f..a3c804b44 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2954,7 +2954,7 @@ bool cWorld::IsTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ)
BLOCKTYPE Block;
NIBBLETYPE Meta;
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, Block, Meta);
- if (Block != E_BLOCK_TRAPDOOR)
+ if ((Block != E_BLOCK_TRAPDOOR) && (Block != E_BLOCK_IRON_TRAPDOOR))
{
return false;
}
@@ -2971,7 +2971,7 @@ bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Op
BLOCKTYPE Block;
NIBBLETYPE Meta;
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, Block, Meta);
- if (Block != E_BLOCK_TRAPDOOR)
+ if ((Block != E_BLOCK_TRAPDOOR) && (Block != E_BLOCK_IRON_TRAPDOOR))
{
return false;
}