summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-12 10:22:34 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-12 10:22:34 +0200
commit007e75de9defc3d96ac61400fa983da812b4b15e (patch)
treedf77165a9f41881d373ec08e5c336c899f387481 /source
parentAdded cWorld::SetSignLines(), re-exported to Lua manually to avoid ghost return values (diff)
downloadcuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar.gz
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar.bz2
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar.lz
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar.xz
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.tar.zst
cuberite-007e75de9defc3d96ac61400fa983da812b4b15e.zip
Diffstat (limited to 'source')
-rw-r--r--source/Bindings.cpp21
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockEntities/DropSpenserEntity.cpp20
-rw-r--r--source/BlockID.h23
-rw-r--r--source/Blocks/BlockHandler.cpp6
-rw-r--r--source/Blocks/BlockHopper.h46
-rw-r--r--source/Defines.h12
7 files changed, 95 insertions, 35 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index f8b645582..a8f600dc7 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/12/13 09:09:44.
+** Generated automatically by tolua++-1.0.92 on 06/12/13 10:17:24.
*/
#ifndef __cplusplus
@@ -26902,13 +26902,12 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_META_CHEST_FACING_ZP",E_META_CHEST_FACING_ZP);
tolua_constant(tolua_S,"E_META_CHEST_FACING_XM",E_META_CHEST_FACING_XM);
tolua_constant(tolua_S,"E_META_CHEST_FACING_XP",E_META_CHEST_FACING_XP);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_YM",E_META_DISPENSER_FACING_YM);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_YP",E_META_DISPENSER_FACING_YP);
- tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_ZM",E_META_DISPENSER_FACING_ZM);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_ZP",E_META_DISPENSER_FACING_ZP);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_XM",E_META_DISPENSER_FACING_XM);
- tolua_constant(tolua_S,"E_META_DISPENSER_FACING_XP",E_META_DISPENSER_FACING_XP);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YM",E_META_DROPSPENSER_FACING_YM);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YP",E_META_DROPSPENSER_FACING_YP);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZM",E_META_DROPSPENSER_FACING_ZM);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZP",E_META_DROPSPENSER_FACING_ZP);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XM",E_META_DROPSPENSER_FACING_XM);
+ tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XP",E_META_DROPSPENSER_FACING_XP);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE",E_META_DOUBLE_STEP_STONE);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_SANDSTONE",E_META_DOUBLE_STEP_SANDSTONE);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_WOODEN",E_META_DOUBLE_STEP_WOODEN);
@@ -26917,6 +26916,12 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_BRICK",E_META_DOUBLE_STEP_STONE_BRICK);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_NETHER_BRICK",E_META_DOUBLE_STEP_NETHER_BRICK);
tolua_constant(tolua_S,"E_META_DOUBLE_STEP_STONE_SECRET",E_META_DOUBLE_STEP_STONE_SECRET);
+ tolua_constant(tolua_S,"E_META_HOPPER_FACING_YM",E_META_HOPPER_FACING_YM);
+ tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED);
+ tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZM",E_META_HOPPER_FACING_ZM);
+ tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZP",E_META_HOPPER_FACING_ZP);
+ tolua_constant(tolua_S,"E_META_HOPPER_FACING_XM",E_META_HOPPER_FACING_XM);
+ tolua_constant(tolua_S,"E_META_HOPPER_FACING_XP",E_META_HOPPER_FACING_XP);
tolua_constant(tolua_S,"E_META_LEAVES_APPLE",E_META_LEAVES_APPLE);
tolua_constant(tolua_S,"E_META_LEAVES_CONIFER",E_META_LEAVES_CONIFER);
tolua_constant(tolua_S,"E_META_LEAVES_BIRCH",E_META_LEAVES_BIRCH);
diff --git a/source/Bindings.h b/source/Bindings.h
index fec4d4f09..348b087aa 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 06/12/13 09:09:45.
+** Generated automatically by tolua++-1.0.92 on 06/12/13 10:17:24.
*/
/* Exported function */
diff --git a/source/BlockEntities/DropSpenserEntity.cpp b/source/BlockEntities/DropSpenserEntity.cpp
index 900ecb172..a9860d812 100644
--- a/source/BlockEntities/DropSpenserEntity.cpp
+++ b/source/BlockEntities/DropSpenserEntity.cpp
@@ -43,12 +43,12 @@ void cDropSpenserEntity::AddDropSpenserDir(int & a_BlockX, int & a_BlockY, int &
{
switch (a_Direction)
{
- case E_META_DISPENSER_FACING_YM: a_BlockY--; return;
- case E_META_DISPENSER_FACING_YP: a_BlockY++; return;
- case E_META_DISPENSER_FACING_ZM: a_BlockZ--; return;
- case E_META_DISPENSER_FACING_ZP: a_BlockZ++; return;
- case E_META_DISPENSER_FACING_XM: a_BlockX--; return;
- case E_META_DISPENSER_FACING_XP: a_BlockX++; return;
+ case E_META_DROPSPENSER_FACING_YM: a_BlockY--; return;
+ case E_META_DROPSPENSER_FACING_YP: a_BlockY++; return;
+ case E_META_DROPSPENSER_FACING_ZM: a_BlockZ--; return;
+ case E_META_DROPSPENSER_FACING_ZP: a_BlockZ++; return;
+ case E_META_DROPSPENSER_FACING_XM: a_BlockX--; return;
+ case E_META_DROPSPENSER_FACING_XP: a_BlockX++; return;
}
LOGWARNING("%s: Unhandled direction: %d", __FUNCTION__, a_Direction);
return;
@@ -89,10 +89,10 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
int SmokeDir = 0;
switch (Meta)
{
- case E_META_DISPENSER_FACING_XM: SmokeDir = 3; break;
- case E_META_DISPENSER_FACING_XP: SmokeDir = 5; break;
- case E_META_DISPENSER_FACING_ZM: SmokeDir = 1; break;
- case E_META_DISPENSER_FACING_ZP: SmokeDir = 7; break;
+ case E_META_DROPSPENSER_FACING_XM: SmokeDir = 3; break;
+ case E_META_DROPSPENSER_FACING_XP: SmokeDir = 5; break;
+ case E_META_DROPSPENSER_FACING_ZM: SmokeDir = 1; break;
+ case E_META_DROPSPENSER_FACING_ZP: SmokeDir = 7; break;
}
m_World->BroadcastSoundParticleEffect(2000, m_PosX * 8, m_PosY * 8, m_PosZ * 8, SmokeDir);
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.0f);
diff --git a/source/BlockID.h b/source/BlockID.h
index 44d1b3ad1..19dbb29da 100644
--- a/source/BlockID.h
+++ b/source/BlockID.h
@@ -380,14 +380,13 @@ enum
E_META_CHEST_FACING_XM = 4,
E_META_CHEST_FACING_XP = 5,
- // E_BLOCK_DISPENSER / E_BLOCK_DROPPER / E_BLOCK_HOPPER metas:
- E_META_DISPENSER_FACING_YM = 0,
- E_META_DISPENSER_FACING_YP = 1,
- E_META_HOPPER_UNATTACHED = 1, // Hopper doesn't move items up
- E_META_DISPENSER_FACING_ZM = 2,
- E_META_DISPENSER_FACING_ZP = 3,
- E_META_DISPENSER_FACING_XM = 4,
- E_META_DISPENSER_FACING_XP = 5,
+ // E_BLOCK_DISPENSER / E_BLOCK_DROPPER metas:
+ E_META_DROPSPENSER_FACING_YM = 0,
+ E_META_DROPSPENSER_FACING_YP = 1,
+ E_META_DROPSPENSER_FACING_ZM = 2,
+ E_META_DROPSPENSER_FACING_ZP = 3,
+ E_META_DROPSPENSER_FACING_XM = 4,
+ E_META_DROPSPENSER_FACING_XP = 5,
// E_BLOCK_DOUBLE_STEP metas:
E_META_DOUBLE_STEP_STONE = 0,
@@ -399,6 +398,14 @@ enum
E_META_DOUBLE_STEP_NETHER_BRICK = 6,
E_META_DOUBLE_STEP_STONE_SECRET = 7,
+ // E_BLOCK_HOPPER metas:
+ E_META_HOPPER_FACING_YM = 0,
+ E_META_HOPPER_UNATTACHED = 1, // Hopper doesn't move items up, there's no YP
+ E_META_HOPPER_FACING_ZM = 2,
+ E_META_HOPPER_FACING_ZP = 3,
+ E_META_HOPPER_FACING_XM = 4,
+ E_META_HOPPER_FACING_XP = 5,
+
// E_BLOCK_LEAVES metas:
E_META_LEAVES_APPLE = 0,
E_META_LEAVES_CONIFER = 1,
diff --git a/source/Blocks/BlockHandler.cpp b/source/Blocks/BlockHandler.cpp
index e1cc939ab..20f42d0c5 100644
--- a/source/Blocks/BlockHandler.cpp
+++ b/source/Blocks/BlockHandler.cpp
@@ -58,6 +58,7 @@
#include "BlockCobWeb.h"
#include "BlockTNT.h"
#include "BlockDeadBush.h"
+#include "BlockHopper.h"
@@ -109,6 +110,8 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_COBBLESTONE_STAIRS: return new cBlockStairsHandler (a_BlockType);
case E_BLOCK_COBWEB: return new cBlockCobWebHandler (a_BlockType);
case E_BLOCK_CROPS: return new cBlockCropsHandler (a_BlockType);
+ case E_BLOCK_DEAD_BUSH: return new cBlockDeadBushHandler (a_BlockType);
+ case E_BLOCK_DETECTOR_RAIL: return new cBlockRailHandler (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);
@@ -127,6 +130,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_GLASS: return new cBlockGlassHandler (a_BlockType);
case E_BLOCK_GRASS: return new cBlockDirtHandler (a_BlockType);
case E_BLOCK_GRAVEL: return new cBlockGravelHandler (a_BlockType);
+ case E_BLOCK_HOPPER: return new cBlockHopperHandler (a_BlockType);
case E_BLOCK_ICE: return new cBlockIceHandler (a_BlockType);
case E_BLOCK_IRON_DOOR: return new cBlockDoorHandler (a_BlockType);
case E_BLOCK_IRON_ORE: return new cBlockOreHandler (a_BlockType);
@@ -150,8 +154,6 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_POTATOES: return new cBlockCropsHandler (a_BlockType);
case E_BLOCK_POWERED_RAIL: return new cBlockRailHandler (a_BlockType);
- case E_BLOCK_DEAD_BUSH: return new cBlockDeadBushHandler (a_BlockType);
- case E_BLOCK_DETECTOR_RAIL: return new cBlockRailHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_ORE_GLOWING: return new cBlockOreHandler (a_BlockType);
case E_BLOCK_REDSTONE_REPEATER_OFF: return new cBlockRedstoneRepeaterHandler(a_BlockType);
diff --git a/source/Blocks/BlockHopper.h b/source/Blocks/BlockHopper.h
new file mode 100644
index 000000000..10f865564
--- /dev/null
+++ b/source/Blocks/BlockHopper.h
@@ -0,0 +1,46 @@
+
+// BlockHopper.h
+
+// Declares the cBlockHopperHandler class representing the handler for the Hopper block
+
+
+
+
+
+class cBlockHopperHandler :
+ public cBlockEntityHandler
+{
+public:
+ cBlockHopperHandler(BLOCKTYPE a_BlockType)
+ : cBlockEntityHandler(a_BlockType)
+ {
+ }
+
+
+ virtual bool GetPlacementBlockTypeMeta(
+ cWorld * a_World, cPlayer * a_Player,
+ int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace,
+ int a_CursorX, int a_CursorY, int a_CursorZ,
+ BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
+ ) override
+ {
+ a_BlockType = m_BlockType;
+
+ // Convert the blockface into meta:
+ switch (a_BlockFace)
+ {
+ case BLOCK_FACE_BOTTOM: a_BlockMeta = E_META_HOPPER_FACING_YM; break;
+ case BLOCK_FACE_TOP: a_BlockMeta = E_META_HOPPER_FACING_YM; break;
+ case BLOCK_FACE_EAST: a_BlockMeta = E_META_HOPPER_FACING_XM; break;
+ case BLOCK_FACE_NORTH: a_BlockMeta = E_META_HOPPER_FACING_ZP; break;
+ case BLOCK_FACE_SOUTH: a_BlockMeta = E_META_HOPPER_FACING_ZM; break;
+ case BLOCK_FACE_WEST: a_BlockMeta = E_META_HOPPER_FACING_XP; break;
+ default: a_BlockMeta = E_META_HOPPER_UNATTACHED; break;
+ }
+ return true;
+ }
+} ;
+
+
+
+
diff --git a/source/Defines.h b/source/Defines.h
index b76da2f29..f52050a9b 100644
--- a/source/Defines.h
+++ b/source/Defines.h
@@ -37,12 +37,12 @@ extern bool g_BlockOneHitDig[];
enum
{
BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air
- BLOCK_FACE_BOTTOM = 0, // Interacting with the bottom face of the block
- BLOCK_FACE_TOP = 1, // Interacting with the top face of the block
- BLOCK_FACE_NORTH = 2, // Interacting with the northern face of the block
- BLOCK_FACE_SOUTH = 3, // Interacting with the southern face of the block
- BLOCK_FACE_WEST = 4, // Interacting with the western face of the block
- BLOCK_FACE_EAST = 5, // Interacting with the eastern face of the block
+ BLOCK_FACE_BOTTOM = 0, // Interacting with the bottom face of the block (YM)
+ BLOCK_FACE_TOP = 1, // Interacting with the top face of the block (YP)
+ BLOCK_FACE_NORTH = 2, // Interacting with the northern face of the block (ZP)
+ BLOCK_FACE_SOUTH = 3, // Interacting with the southern face of the block (ZM)
+ BLOCK_FACE_WEST = 4, // Interacting with the western face of the block (XP)
+ BLOCK_FACE_EAST = 5, // Interacting with the eastern face of the block (XM)
} ;