summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Bindings/DeprecatedBindings.cpp39
-rw-r--r--src/BlockInfo.cpp88
-rw-r--r--src/BlockInfo.h17
3 files changed, 54 insertions, 90 deletions
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp
index 031b69356..a4e5c372b 100644
--- a/src/Bindings/DeprecatedBindings.cpp
+++ b/src/Bindings/DeprecatedBindings.cpp
@@ -347,6 +347,44 @@ static int tolua_set_cBlockInfo_m_PlaceSound(lua_State * tolua_S)
+static int tolua_get_cBlockInfo_m_IsSnowable(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ if (!L.CheckParamSelf("const cBlockInfo"))
+ {
+ return 0;
+ }
+
+ const cBlockInfo * Self = nullptr;
+ L.GetStackValue(1, Self);
+
+ L.Push(cBlockInfo::IsSnowable(Self->m_BlockType));
+ LOGWARNING("cBlockInfo.m_IsSnowable is deprecated");
+ L.LogStackTrace(0);
+ return 1;
+}
+
+
+
+
+
+static int tolua_set_cBlockInfo_m_IsSnowable(lua_State * tolua_S)
+{
+ cLuaState L(tolua_S);
+ if (!L.CheckParamSelf("cBlockInfo"))
+ {
+ return 0;
+ }
+
+ LOGWARNING("cBlockInfo.m_IsSnowable is deprecated in favour of cBlockInfo::IsSnowable()");
+ L.LogStackTrace(0);
+ return 0;
+}
+
+
+
+
+
static int tolua_get_cItem_m_Lore(lua_State * tolua_S)
{
// Maintain legacy m_Lore variable as Lore table split by ` (grave-accent)
@@ -550,6 +588,7 @@ void DeprecatedBindings::Bind(lua_State * tolua_S)
tolua_beginmodule(tolua_S, "cBlockInfo");
tolua_function(tolua_S, "GetPlaceSound", tolua_cBlockInfo_GetPlaceSound);
tolua_variable(tolua_S, "m_PlaceSound", tolua_get_cBlockInfo_m_PlaceSound, tolua_set_cBlockInfo_m_PlaceSound);
+ tolua_variable(tolua_S, "m_IsSnowable", tolua_get_cBlockInfo_m_IsSnowable, tolua_set_cBlockInfo_m_IsSnowable);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cItem");
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp
index c2f248a26..eaa41c82b 100644
--- a/src/BlockInfo.cpp
+++ b/src/BlockInfo.cpp
@@ -17,7 +17,8 @@ cBlockInfo::cBlockInfoArray::cBlockInfoArray()
for (size_t i = 0; i < Info.size(); ++i)
{
- Info[i].m_Handler.reset(cBlockHandler::CreateBlockHandler(static_cast<BLOCKTYPE>(i)));
+ Info[i].m_BlockType = static_cast<BLOCKTYPE>(i);
+ Info[i].m_Handler.reset(cBlockHandler::CreateBlockHandler(Info[i].m_BlockType));
}
// Emissive blocks
@@ -313,6 +314,7 @@ cBlockInfo::cBlockInfoArray::cBlockInfoArray()
Info[E_BLOCK_SANDSTONE_STAIRS ].m_Transparent = true;
Info[E_BLOCK_SAPLING ].m_Transparent = true;
Info[E_BLOCK_SIGN_POST ].m_Transparent = true;
+ Info[E_BLOCK_SNOW ].m_Transparent = true;
Info[E_BLOCK_SPRUCE_DOOR ].m_Transparent = true;
Info[E_BLOCK_SPRUCE_FENCE ].m_Transparent = true;
Info[E_BLOCK_SPRUCE_FENCE_GATE ].m_Transparent = true;
@@ -474,90 +476,6 @@ cBlockInfo::cBlockInfoArray::cBlockInfoArray()
Info[E_BLOCK_STANDING_BANNER ].m_IsRainBlocker = true;
- // Blocks that can be snowed over:
- Info[E_BLOCK_BEDROCK ].m_IsSnowable = true;
- Info[E_BLOCK_BLOCK_OF_COAL ].m_IsSnowable = true;
- Info[E_BLOCK_BLOCK_OF_REDSTONE ].m_IsSnowable = true;
- Info[E_BLOCK_BONE_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_BOOKCASE ].m_IsSnowable = true;
- Info[E_BLOCK_BRICK ].m_IsSnowable = true;
- Info[E_BLOCK_CHAIN_COMMAND_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_CLAY ].m_IsSnowable = true;
- Info[E_BLOCK_CRAFTING_TABLE ].m_IsSnowable = true;
- Info[E_BLOCK_COAL_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_COMMAND_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_COBBLESTONE ].m_IsSnowable = true;
- Info[E_BLOCK_DIAMOND_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_DIAMOND_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_DIRT ].m_IsSnowable = true;
- Info[E_BLOCK_DISPENSER ].m_IsSnowable = true;
- Info[E_BLOCK_DOUBLE_RED_SANDSTONE_SLAB ].m_IsSnowable = true;
- Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_IsSnowable = true;
- Info[E_BLOCK_DOUBLE_WOODEN_SLAB ].m_IsSnowable = true;
- Info[E_BLOCK_DROPPER ].m_IsSnowable = true;
- Info[E_BLOCK_EMERALD_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_EMERALD_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_END_BRICKS ].m_IsSnowable = true;
- Info[E_BLOCK_END_STONE ].m_IsSnowable = true;
- Info[E_BLOCK_FURNACE ].m_IsSnowable = true;
- Info[E_BLOCK_GLOWSTONE ].m_IsSnowable = true;
- Info[E_BLOCK_GOLD_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_GOLD_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_GRASS ].m_IsSnowable = true;
- Info[E_BLOCK_GRAVEL ].m_IsSnowable = true;
- Info[E_BLOCK_HARDENED_CLAY ].m_IsSnowable = true;
- Info[E_BLOCK_HAY_BALE ].m_IsSnowable = true;
- Info[E_BLOCK_HUGE_BROWN_MUSHROOM ].m_IsSnowable = true;
- Info[E_BLOCK_HUGE_RED_MUSHROOM ].m_IsSnowable = true;
- Info[E_BLOCK_IRON_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_IRON_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_JACK_O_LANTERN ].m_IsSnowable = true;
- Info[E_BLOCK_JUKEBOX ].m_IsSnowable = true;
- Info[E_BLOCK_LAPIS_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_LAPIS_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_LEAVES ].m_IsSnowable = true;
- Info[E_BLOCK_LIT_FURNACE ].m_IsSnowable = true;
- Info[E_BLOCK_LOG ].m_IsSnowable = true;
- Info[E_BLOCK_MELON ].m_IsSnowable = true;
- Info[E_BLOCK_MOSSY_COBBLESTONE ].m_IsSnowable = true;
- Info[E_BLOCK_MYCELIUM ].m_IsSnowable = true;
- Info[E_BLOCK_NETHER_BRICK ].m_IsSnowable = true;
- Info[E_BLOCK_NETHER_QUARTZ_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_NETHER_WART_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_NETHERRACK ].m_IsSnowable = true;
- Info[E_BLOCK_NEW_LEAVES ].m_IsSnowable = true;
- Info[E_BLOCK_NEW_LOG ].m_IsSnowable = true;
- Info[E_BLOCK_NOTE_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_OBSERVER ].m_IsSnowable = true;
- Info[E_BLOCK_OBSIDIAN ].m_IsSnowable = true;
- Info[E_BLOCK_PLANKS ].m_IsSnowable = true;
- Info[E_BLOCK_PRISMARINE_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_PUMPKIN ].m_IsSnowable = true;
- Info[E_BLOCK_PURPUR_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_PURPUR_DOUBLE_SLAB ].m_IsSnowable = true;
- Info[E_BLOCK_PURPUR_PILLAR ].m_IsSnowable = true;
- Info[E_BLOCK_QUARTZ_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_RED_NETHER_BRICK ].m_IsSnowable = true;
- Info[E_BLOCK_RED_SANDSTONE ].m_IsSnowable = true;
- Info[E_BLOCK_REDSTONE_LAMP_OFF ].m_IsSnowable = true;
- Info[E_BLOCK_REDSTONE_LAMP_ON ].m_IsSnowable = true;
- Info[E_BLOCK_REDSTONE_ORE ].m_IsSnowable = true;
- Info[E_BLOCK_REDSTONE_ORE_GLOWING ].m_IsSnowable = true;
- Info[E_BLOCK_REPEATING_COMMAND_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_SAND ].m_IsSnowable = true;
- Info[E_BLOCK_SANDSTONE ].m_IsSnowable = true;
- Info[E_BLOCK_SEA_LANTERN ].m_IsSnowable = true;
- Info[E_BLOCK_SILVERFISH_EGG ].m_IsSnowable = true;
- Info[E_BLOCK_SNOW_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_SOULSAND ].m_IsSnowable = true;
- Info[E_BLOCK_SPONGE ].m_IsSnowable = true;
- Info[E_BLOCK_STAINED_CLAY ].m_IsSnowable = true;
- Info[E_BLOCK_STONE ].m_IsSnowable = true;
- Info[E_BLOCK_STONE_BRICKS ].m_IsSnowable = true;
- Info[E_BLOCK_STRUCTURE_BLOCK ].m_IsSnowable = true;
- Info[E_BLOCK_TNT ].m_IsSnowable = true;
- Info[E_BLOCK_WOOL ].m_IsSnowable = true;
-
// Nonsolid blocks:
Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSolid = false;
Info[E_BLOCK_AIR ].m_IsSolid = false;
diff --git a/src/BlockInfo.h b/src/BlockInfo.h
index e7544bf2d..e8bf9142e 100644
--- a/src/BlockInfo.h
+++ b/src/BlockInfo.h
@@ -43,9 +43,6 @@ public:
/** Does this block disperse sky light? (only relevant for transparent blocks) */
bool m_IsSkylightDispersant;
- /** Can this block hold snow atop? */
- bool m_IsSnowable;
-
/** Is this block solid (player cannot walk through)? */
bool m_IsSolid;
@@ -75,6 +72,9 @@ public:
/** Associated block handler. */
std::unique_ptr<cBlockHandler, sHandlerDeleter> m_Handler;
+ /** The block type associated with this cBlockInfo. Needed for DeprecatedBindings.cpp */
+ BLOCKTYPE m_BlockType;
+
// tolua_begin
inline static NIBBLETYPE GetLightValue (BLOCKTYPE a_Type) { return Get(a_Type).m_LightValue; }
@@ -87,7 +87,14 @@ public:
{
return ((Get(a_Type).m_IsSkylightDispersant) || (Get(a_Type).m_SpreadLightFalloff > 1));
}
- inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; }
+ inline static bool IsSnowable (BLOCKTYPE a_Type)
+ {
+ return (
+ (a_Type == E_BLOCK_ICE)
+ || (a_Type == E_BLOCK_LEAVES)
+ || (!Get(a_Type).m_Transparent && (a_Type != E_BLOCK_PACKED_ICE))
+ );
+ }
inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; }
inline static bool IsUseableBySpectator (BLOCKTYPE a_Type) { return Get(a_Type).m_UseableBySpectator; }
inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; }
@@ -108,7 +115,6 @@ public:
, m_PistonBreakable(false)
, m_IsRainBlocker(false)
, m_IsSkylightDispersant(false)
- , m_IsSnowable(false)
, m_IsSolid(true)
, m_UseableBySpectator(false)
, m_FullyOccupiesVoxel(false)
@@ -116,6 +122,7 @@ public:
, m_BlockHeight(1.0)
, m_Hardness(0.0f)
, m_Handler()
+ , m_BlockType(E_BLOCK_AIR)
{}
private: