diff options
author | madmaxoft <github@xoft.cz> | 2014-07-15 22:42:00 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-07-15 22:42:00 +0200 |
commit | 3f8ec7699f0205a0346c32df49e2faf509995850 (patch) | |
tree | b61f06d0001d3fd3238f80b5a2304595bbb28c6e /src | |
parent | Restructured cSplashPotionEntity code. (diff) | |
parent | Merge pull request #1191 from Masy98/Blocks (diff) | |
download | cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.gz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.bz2 cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.lz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.xz cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.tar.zst cuberite-3f8ec7699f0205a0346c32df49e2faf509995850.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/BlockInfo.cpp | 263 | ||||
-rw-r--r-- | src/Blocks/BlockLadder.h | 6 | ||||
-rw-r--r-- | src/Blocks/BlockLilypad.h | 14 | ||||
-rw-r--r-- | src/Blocks/BlockPiston.h | 1 | ||||
-rw-r--r-- | src/Blocks/BlockPumpkin.h | 9 | ||||
-rw-r--r-- | src/Blocks/ClearMetaOnDrop.h | 24 | ||||
-rw-r--r-- | src/World.cpp | 9 |
7 files changed, 246 insertions, 80 deletions
diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index 4fc1d602c..b4b98a2f0 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -14,7 +14,7 @@ cBlockInfo::cBlockInfo() , m_Transparent(false) , m_OneHitDig(false) , m_PistonBreakable(false) - , m_IsSnowable(true) + , m_IsSnowable(false) , m_RequiresSpecialTool(false) , m_IsSolid(true) , m_FullyOccupiesVoxel(false) @@ -65,48 +65,117 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) } // Emissive blocks + a_Info[E_BLOCK_ACTIVE_COMPARATOR ].m_LightValue = 9; + a_Info[E_BLOCK_BEACON ].m_LightValue = 15; + a_Info[E_BLOCK_BREWING_STAND ].m_LightValue = 1; + a_Info[E_BLOCK_BROWN_MUSHROOM ].m_LightValue = 1; + a_Info[E_BLOCK_BURNING_FURNACE ].m_LightValue = 13; + a_Info[E_BLOCK_DRAGON_EGG ].m_LightValue = 1; + a_Info[E_BLOCK_END_PORTAL ].m_LightValue = 15; + a_Info[E_BLOCK_END_PORTAL_FRAME ].m_LightValue = 1; + a_Info[E_BLOCK_ENDER_CHEST ].m_LightValue = 7; a_Info[E_BLOCK_FIRE ].m_LightValue = 15; a_Info[E_BLOCK_GLOWSTONE ].m_LightValue = 15; a_Info[E_BLOCK_JACK_O_LANTERN ].m_LightValue = 15; a_Info[E_BLOCK_LAVA ].m_LightValue = 15; - a_Info[E_BLOCK_STATIONARY_LAVA ].m_LightValue = 15; - a_Info[E_BLOCK_END_PORTAL ].m_LightValue = 15; - a_Info[E_BLOCK_REDSTONE_LAMP_ON ].m_LightValue = 15; - a_Info[E_BLOCK_TORCH ].m_LightValue = 14; - a_Info[E_BLOCK_BURNING_FURNACE ].m_LightValue = 13; a_Info[E_BLOCK_NETHER_PORTAL ].m_LightValue = 11; + a_Info[E_BLOCK_REDSTONE_LAMP_ON ].m_LightValue = 15; a_Info[E_BLOCK_REDSTONE_ORE_GLOWING].m_LightValue = 9; a_Info[E_BLOCK_REDSTONE_REPEATER_ON].m_LightValue = 9; a_Info[E_BLOCK_REDSTONE_TORCH_ON ].m_LightValue = 7; - a_Info[E_BLOCK_BREWING_STAND ].m_LightValue = 1; - a_Info[E_BLOCK_BROWN_MUSHROOM ].m_LightValue = 1; - a_Info[E_BLOCK_DRAGON_EGG ].m_LightValue = 1; + a_Info[E_BLOCK_STATIONARY_LAVA ].m_LightValue = 15; + a_Info[E_BLOCK_TORCH ].m_LightValue = 14; // Spread blocks + a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_ACTIVE_COMPARATOR ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_AIR ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_ANVIL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_BEACON ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_BED ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_BIG_FLOWER ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_BROWN_MUSHROOM ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_BREWING_STAND ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_CACTUS ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_CAKE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_CARPET ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_CARROTS ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_CAULDRON ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_CHEST ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_COBBLESTONE_WALL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_COCOA_POD ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_COBWEB ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_CROPS ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_DANDELION ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_DAYLIGHT_SENSOR ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_DEAD_BUSH ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_DETECTOR_RAIL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_DRAGON_EGG ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_ENDER_CHEST ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_END_PORTAL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_END_PORTAL_FRAME ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_FARMLAND ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_FENCE ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_FENCE_GATE ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_FIRE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_FLOWER ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_FLOWER_POT ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_GLASS ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_GLASS_PANE ].m_SpreadLightFalloff = 1; - a_Info[E_BLOCK_GLOWSTONE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_HEAD ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_HOPPER ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_ICE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_IRON_BARS ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_IRON_DOOR ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_LADDER ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_LEAVES ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_LEVER ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_LILY_PAD ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_MELON_STEM ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_MOB_SPAWNER ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_NETHER_PORTAL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_NETHER_WART ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_NEW_LEAVES ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_PISTON ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_PISTON_EXTENSION ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_PISTON_MOVED_BLOCK ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_POTATOES ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_POWERED_RAIL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_PUMPKIN_STEM ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_RAIL ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_RED_MUSHROOM ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_REDSTONE_REPEATER_OFF].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_REDSTONE_REPEATER_ON].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_REDSTONE_TORCH_OFF ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_REDSTONE_TORCH_ON ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_REDSTONE_WIRE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_SAPLING ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_SIGN_POST ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_SNOW ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STAINED_GLASS ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STAINED_GLASS_PANE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STICKY_PISTON ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STONE_BUTTON ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_STONE_SLAB ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_SUGARCANE ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_TALL_GRASS ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_TORCH ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_TRAPDOOR ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_TRAPPED_CHEST ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_TRIPWIRE ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_TRIPWIRE_HOOK ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_VINES ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_WALLSIGN ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_WOODEN_BUTTON ].m_SpreadLightFalloff = 1; a_Info[E_BLOCK_WOODEN_DOOR ].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_WOODEN_PRESSURE_PLATE].m_SpreadLightFalloff = 1; + a_Info[E_BLOCK_WOODEN_SLAB ].m_SpreadLightFalloff = 1; // Light in water and lava dissapears faster: a_Info[E_BLOCK_LAVA ].m_SpreadLightFalloff = 3; @@ -117,19 +186,34 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) // Transparent blocks a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_Transparent = true; + a_Info[E_BLOCK_ACTIVE_COMPARATOR ].m_Transparent = true; a_Info[E_BLOCK_AIR ].m_Transparent = true; a_Info[E_BLOCK_ANVIL ].m_Transparent = true; + a_Info[E_BLOCK_BEACON ].m_Transparent = true; + a_Info[E_BLOCK_BED ].m_Transparent = true; a_Info[E_BLOCK_BIG_FLOWER ].m_Transparent = true; a_Info[E_BLOCK_BROWN_MUSHROOM ].m_Transparent = true; + a_Info[E_BLOCK_BREWING_STAND ].m_Transparent = true; + a_Info[E_BLOCK_CACTUS ].m_Transparent = true; a_Info[E_BLOCK_CAKE ].m_Transparent = true; + a_Info[E_BLOCK_CARPET ].m_Transparent = true; a_Info[E_BLOCK_CARROTS ].m_Transparent = true; + a_Info[E_BLOCK_CAULDRON ].m_Transparent = true; a_Info[E_BLOCK_CHEST ].m_Transparent = true; a_Info[E_BLOCK_COBBLESTONE_WALL ].m_Transparent = true; + a_Info[E_BLOCK_COCOA_POD ].m_Transparent = true; a_Info[E_BLOCK_COBWEB ].m_Transparent = true; a_Info[E_BLOCK_CROPS ].m_Transparent = true; a_Info[E_BLOCK_DANDELION ].m_Transparent = true; + a_Info[E_BLOCK_DAYLIGHT_SENSOR ].m_Transparent = true; + a_Info[E_BLOCK_DEAD_BUSH ].m_Transparent = true; a_Info[E_BLOCK_DETECTOR_RAIL ].m_Transparent = true; + a_Info[E_BLOCK_DRAGON_EGG ].m_Transparent = true; + a_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_Transparent = true; a_Info[E_BLOCK_ENDER_CHEST ].m_Transparent = true; + a_Info[E_BLOCK_END_PORTAL ].m_Transparent = true; + a_Info[E_BLOCK_END_PORTAL_FRAME ].m_Transparent = true; + a_Info[E_BLOCK_FARMLAND ].m_Transparent = true; a_Info[E_BLOCK_FENCE ].m_Transparent = true; a_Info[E_BLOCK_FENCE_GATE ].m_Transparent = true; a_Info[E_BLOCK_FIRE ].m_Transparent = true; @@ -139,43 +223,61 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_GLASS_PANE ].m_Transparent = true; a_Info[E_BLOCK_HEAD ].m_Transparent = true; a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_Transparent = true; + a_Info[E_BLOCK_HOPPER ].m_Transparent = true; a_Info[E_BLOCK_ICE ].m_Transparent = true; + a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_Transparent = true; + a_Info[E_BLOCK_IRON_BARS ].m_Transparent = true; a_Info[E_BLOCK_IRON_DOOR ].m_Transparent = true; a_Info[E_BLOCK_LADDER ].m_Transparent = true; a_Info[E_BLOCK_LAVA ].m_Transparent = true; a_Info[E_BLOCK_LEAVES ].m_Transparent = true; a_Info[E_BLOCK_LEVER ].m_Transparent = true; + a_Info[E_BLOCK_LILY_PAD ].m_Transparent = true; a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE].m_Transparent = true; a_Info[E_BLOCK_MELON_STEM ].m_Transparent = true; + a_Info[E_BLOCK_MOB_SPAWNER ].m_Transparent = true; a_Info[E_BLOCK_NETHER_BRICK_FENCE ].m_Transparent = true; + a_Info[E_BLOCK_NETHER_PORTAL ].m_Transparent = true; + a_Info[E_BLOCK_NETHER_WART ].m_Transparent = true; a_Info[E_BLOCK_NEW_LEAVES ].m_Transparent = true; + a_Info[E_BLOCK_PISTON ].m_Transparent = true; + a_Info[E_BLOCK_PISTON_EXTENSION ].m_Transparent = true; + a_Info[E_BLOCK_PISTON_MOVED_BLOCK ].m_Transparent = true; a_Info[E_BLOCK_POTATOES ].m_Transparent = true; a_Info[E_BLOCK_POWERED_RAIL ].m_Transparent = true; - a_Info[E_BLOCK_PISTON_EXTENSION ].m_Transparent = true; a_Info[E_BLOCK_PUMPKIN_STEM ].m_Transparent = true; a_Info[E_BLOCK_RAIL ].m_Transparent = true; a_Info[E_BLOCK_RED_MUSHROOM ].m_Transparent = true; + a_Info[E_BLOCK_REDSTONE_REPEATER_OFF].m_Transparent = true; + a_Info[E_BLOCK_REDSTONE_REPEATER_ON].m_Transparent = true; + a_Info[E_BLOCK_REDSTONE_TORCH_OFF ].m_Transparent = true; + a_Info[E_BLOCK_REDSTONE_TORCH_ON ].m_Transparent = true; + a_Info[E_BLOCK_REDSTONE_WIRE ].m_Transparent = true; + a_Info[E_BLOCK_SAPLING ].m_Transparent = true; a_Info[E_BLOCK_SIGN_POST ].m_Transparent = true; a_Info[E_BLOCK_SNOW ].m_Transparent = true; a_Info[E_BLOCK_STAINED_GLASS ].m_Transparent = true; a_Info[E_BLOCK_STAINED_GLASS_PANE ].m_Transparent = true; a_Info[E_BLOCK_STATIONARY_LAVA ].m_Transparent = true; a_Info[E_BLOCK_STATIONARY_WATER ].m_Transparent = true; + a_Info[E_BLOCK_STICKY_PISTON ].m_Transparent = true; a_Info[E_BLOCK_STONE_BUTTON ].m_Transparent = true; a_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_Transparent = true; + a_Info[E_BLOCK_STONE_SLAB ].m_Transparent = true; + a_Info[E_BLOCK_SUGARCANE ].m_Transparent = true; + a_Info[E_BLOCK_TALL_GRASS ].m_Transparent = true; + a_Info[E_BLOCK_TORCH ].m_Transparent = true; + a_Info[E_BLOCK_TRAPDOOR ].m_Transparent = true; a_Info[E_BLOCK_TRAPPED_CHEST ].m_Transparent = true; a_Info[E_BLOCK_TRIPWIRE ].m_Transparent = true; a_Info[E_BLOCK_TRIPWIRE_HOOK ].m_Transparent = true; - a_Info[E_BLOCK_TALL_GRASS ].m_Transparent = true; - a_Info[E_BLOCK_TORCH ].m_Transparent = true; a_Info[E_BLOCK_VINES ].m_Transparent = true; a_Info[E_BLOCK_WALLSIGN ].m_Transparent = true; a_Info[E_BLOCK_WATER ].m_Transparent = true; a_Info[E_BLOCK_WOODEN_BUTTON ].m_Transparent = true; a_Info[E_BLOCK_WOODEN_DOOR ].m_Transparent = true; a_Info[E_BLOCK_WOODEN_PRESSURE_PLATE].m_Transparent = true; - - // TODO: Any other transparent blocks? + a_Info[E_BLOCK_WOODEN_SLAB ].m_Transparent = true; // One hit break blocks: @@ -185,10 +287,12 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_CARROTS ].m_OneHitDig = true; a_Info[E_BLOCK_CROPS ].m_OneHitDig = true; a_Info[E_BLOCK_DANDELION ].m_OneHitDig = true; + a_Info[E_BLOCK_DEAD_BUSH ].m_OneHitDig = true; a_Info[E_BLOCK_FIRE ].m_OneHitDig = true; a_Info[E_BLOCK_FLOWER ].m_OneHitDig = true; a_Info[E_BLOCK_FLOWER_POT ].m_OneHitDig = true; a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_OneHitDig = true; + a_Info[E_BLOCK_LILY_PAD ].m_OneHitDig = true; a_Info[E_BLOCK_MELON_STEM ].m_OneHitDig = true; a_Info[E_BLOCK_POTATOES ].m_OneHitDig = true; a_Info[E_BLOCK_PUMPKIN_STEM ].m_OneHitDig = true; @@ -212,24 +316,32 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_BED ].m_PistonBreakable = true; a_Info[E_BLOCK_BIG_FLOWER ].m_PistonBreakable = true; a_Info[E_BLOCK_BROWN_MUSHROOM ].m_PistonBreakable = true; + a_Info[E_BLOCK_CACTUS ].m_PistonBreakable = true; a_Info[E_BLOCK_CAKE ].m_PistonBreakable = true; + a_Info[E_BLOCK_CARROTS ].m_PistonBreakable = true; + a_Info[E_BLOCK_COCOA_POD ].m_PistonBreakable = true; a_Info[E_BLOCK_COBWEB ].m_PistonBreakable = true; a_Info[E_BLOCK_CROPS ].m_PistonBreakable = true; a_Info[E_BLOCK_DANDELION ].m_PistonBreakable = true; a_Info[E_BLOCK_DEAD_BUSH ].m_PistonBreakable = true; + a_Info[E_BLOCK_DRAGON_EGG ].m_PistonBreakable = true; a_Info[E_BLOCK_FIRE ].m_PistonBreakable = true; a_Info[E_BLOCK_FLOWER ].m_PistonBreakable = true; + a_Info[E_BLOCK_FLOWER_POT ].m_PistonBreakable = true; a_Info[E_BLOCK_HEAD ].m_PistonBreakable = true; 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_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; a_Info[E_BLOCK_LADDER ].m_PistonBreakable = true; a_Info[E_BLOCK_LAVA ].m_PistonBreakable = true; a_Info[E_BLOCK_LEVER ].m_PistonBreakable = true; a_Info[E_BLOCK_MELON ].m_PistonBreakable = true; a_Info[E_BLOCK_MELON_STEM ].m_PistonBreakable = true; + a_Info[E_BLOCK_NETHER_WART ].m_PistonBreakable = true; + a_Info[E_BLOCK_POTATOES ].m_PistonBreakable = true; a_Info[E_BLOCK_PUMPKIN ].m_PistonBreakable = true; a_Info[E_BLOCK_PUMPKIN_STEM ].m_PistonBreakable = true; a_Info[E_BLOCK_REDSTONE_REPEATER_OFF].m_PistonBreakable = true; @@ -239,6 +351,8 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_REDSTONE_WIRE ].m_PistonBreakable = true; a_Info[E_BLOCK_RED_MUSHROOM ].m_PistonBreakable = true; a_Info[E_BLOCK_REEDS ].m_PistonBreakable = true; + a_Info[E_BLOCK_SAPLING ].m_PistonBreakable = true; + a_Info[E_BLOCK_SIGN_POST ].m_PistonBreakable = true; a_Info[E_BLOCK_SNOW ].m_PistonBreakable = true; a_Info[E_BLOCK_STATIONARY_LAVA ].m_PistonBreakable = true; a_Info[E_BLOCK_STATIONARY_WATER ].m_PistonBreakable = true; @@ -246,61 +360,85 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_PistonBreakable = true; a_Info[E_BLOCK_TALL_GRASS ].m_PistonBreakable = true; a_Info[E_BLOCK_TORCH ].m_PistonBreakable = true; + a_Info[E_BLOCK_TRAPDOOR ].m_PistonBreakable = true; a_Info[E_BLOCK_TRIPWIRE ].m_PistonBreakable = true; a_Info[E_BLOCK_TRIPWIRE_HOOK ].m_PistonBreakable = true; a_Info[E_BLOCK_VINES ].m_PistonBreakable = true; + a_Info[E_BLOCK_WALLSIGN ].m_PistonBreakable = true; a_Info[E_BLOCK_WATER ].m_PistonBreakable = true; a_Info[E_BLOCK_WOODEN_BUTTON ].m_PistonBreakable = true; a_Info[E_BLOCK_WOODEN_DOOR ].m_PistonBreakable = true; a_Info[E_BLOCK_WOODEN_PRESSURE_PLATE].m_PistonBreakable = true; - // Blocks that cannot be snowed over: - a_Info[E_BLOCK_ACTIVE_COMPARATOR ].m_IsSnowable = false; - a_Info[E_BLOCK_AIR ].m_IsSnowable = false; - a_Info[E_BLOCK_BIG_FLOWER ].m_IsSnowable = false; - a_Info[E_BLOCK_BROWN_MUSHROOM ].m_IsSnowable = false; - a_Info[E_BLOCK_CACTUS ].m_IsSnowable = false; - a_Info[E_BLOCK_CHEST ].m_IsSnowable = false; - a_Info[E_BLOCK_CROPS ].m_IsSnowable = false; - a_Info[E_BLOCK_COBBLESTONE_WALL ].m_IsSnowable = false; - a_Info[E_BLOCK_DANDELION ].m_IsSnowable = false; - a_Info[E_BLOCK_FIRE ].m_IsSnowable = false; - a_Info[E_BLOCK_FLOWER ].m_IsSnowable = false; - a_Info[E_BLOCK_GLASS ].m_IsSnowable = false; - a_Info[E_BLOCK_ICE ].m_IsSnowable = false; - a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_IsSnowable = false; - a_Info[E_BLOCK_LAVA ].m_IsSnowable = false; - a_Info[E_BLOCK_LILY_PAD ].m_IsSnowable = false; - a_Info[E_BLOCK_REDSTONE_REPEATER_OFF].m_IsSnowable = false; - a_Info[E_BLOCK_REDSTONE_REPEATER_ON].m_IsSnowable = false; - a_Info[E_BLOCK_REDSTONE_TORCH_OFF ].m_IsSnowable = false; - a_Info[E_BLOCK_REDSTONE_TORCH_ON ].m_IsSnowable = false; - a_Info[E_BLOCK_REDSTONE_WIRE ].m_IsSnowable = false; - a_Info[E_BLOCK_RED_MUSHROOM ].m_IsSnowable = false; - a_Info[E_BLOCK_REEDS ].m_IsSnowable = false; - a_Info[E_BLOCK_SAPLING ].m_IsSnowable = false; - a_Info[E_BLOCK_SIGN_POST ].m_IsSnowable = false; - a_Info[E_BLOCK_SNOW ].m_IsSnowable = false; - a_Info[E_BLOCK_STAINED_GLASS ].m_IsSnowable = false; - a_Info[E_BLOCK_STAINED_GLASS_PANE ].m_IsSnowable = false; - a_Info[E_BLOCK_STATIONARY_LAVA ].m_IsSnowable = false; - a_Info[E_BLOCK_STATIONARY_WATER ].m_IsSnowable = false; - a_Info[E_BLOCK_TALL_GRASS ].m_IsSnowable = false; - a_Info[E_BLOCK_TNT ].m_IsSnowable = false; - a_Info[E_BLOCK_TORCH ].m_IsSnowable = false; - a_Info[E_BLOCK_TRAPPED_CHEST ].m_IsSnowable = false; - a_Info[E_BLOCK_TRIPWIRE ].m_IsSnowable = false; - a_Info[E_BLOCK_TRIPWIRE_HOOK ].m_IsSnowable = false; - a_Info[E_BLOCK_VINES ].m_IsSnowable = false; - a_Info[E_BLOCK_WALLSIGN ].m_IsSnowable = false; - a_Info[E_BLOCK_WATER ].m_IsSnowable = false; - a_Info[E_BLOCK_RAIL ].m_IsSnowable = false; - a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSnowable = false; - a_Info[E_BLOCK_POWERED_RAIL ].m_IsSnowable = false; - a_Info[E_BLOCK_DETECTOR_RAIL ].m_IsSnowable = false; - a_Info[E_BLOCK_COBWEB ].m_IsSnowable = false; - a_Info[E_BLOCK_HEAD ].m_IsSnowable = false; + // Blocks that can be snowed over: + a_Info[E_BLOCK_BEDROCK ].m_IsSnowable = true; + a_Info[E_BLOCK_BLOCK_OF_COAL ].m_IsSnowable = true; + a_Info[E_BLOCK_BLOCK_OF_REDSTONE ].m_IsSnowable = true; + a_Info[E_BLOCK_BOOKCASE ].m_IsSnowable = true; + a_Info[E_BLOCK_BRICK ].m_IsSnowable = true; + a_Info[E_BLOCK_CLAY ].m_IsSnowable = true; + a_Info[E_BLOCK_CRAFTING_TABLE ].m_IsSnowable = true; + a_Info[E_BLOCK_COAL_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_COMMAND_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_COBBLESTONE ].m_IsSnowable = true; + a_Info[E_BLOCK_DIAMOND_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_DIAMOND_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_DIRT ].m_IsSnowable = true; + a_Info[E_BLOCK_DISPENSER ].m_IsSnowable = true; + a_Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_IsSnowable = true; + a_Info[E_BLOCK_DOUBLE_WOODEN_SLAB ].m_IsSnowable = true; + a_Info[E_BLOCK_DROPPER ].m_IsSnowable = true; + a_Info[E_BLOCK_EMERALD_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_EMERALD_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_END_STONE ].m_IsSnowable = true; + a_Info[E_BLOCK_FURNACE ].m_IsSnowable = true; + a_Info[E_BLOCK_GLOWSTONE ].m_IsSnowable = true; + a_Info[E_BLOCK_GOLD_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_GOLD_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_GRASS ].m_IsSnowable = true; + a_Info[E_BLOCK_GRAVEL ].m_IsSnowable = true; + a_Info[E_BLOCK_HARDENED_CLAY ].m_IsSnowable = true; + a_Info[E_BLOCK_HAY_BALE ].m_IsSnowable = true; + a_Info[E_BLOCK_HUGE_BROWN_MUSHROOM ].m_IsSnowable = true; + a_Info[E_BLOCK_HUGE_RED_MUSHROOM ].m_IsSnowable = true; + a_Info[E_BLOCK_IRON_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_IRON_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_JACK_O_LANTERN ].m_IsSnowable = true; + a_Info[E_BLOCK_JUKEBOX ].m_IsSnowable = true; + a_Info[E_BLOCK_LAPIS_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_LAPIS_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_LEAVES ].m_IsSnowable = true; + a_Info[E_BLOCK_LIT_FURNACE ].m_IsSnowable = true; + a_Info[E_BLOCK_LOG ].m_IsSnowable = true; + a_Info[E_BLOCK_MELON ].m_IsSnowable = true; + a_Info[E_BLOCK_MOSSY_COBBLESTONE ].m_IsSnowable = true; + a_Info[E_BLOCK_MYCELIUM ].m_IsSnowable = true; + a_Info[E_BLOCK_NETHER_BRICK ].m_IsSnowable = true; + a_Info[E_BLOCK_NETHER_QUARTZ_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_NETHERRACK ].m_IsSnowable = true; + a_Info[E_BLOCK_NEW_LEAVES ].m_IsSnowable = true; + a_Info[E_BLOCK_NEW_LOG ].m_IsSnowable = true; + a_Info[E_BLOCK_NOTE_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_OBSIDIAN ].m_IsSnowable = true; + a_Info[E_BLOCK_PLANKS ].m_IsSnowable = true; + a_Info[E_BLOCK_PUMPKIN ].m_IsSnowable = true; + a_Info[E_BLOCK_QUARTZ_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_REDSTONE_LAMP_OFF ].m_IsSnowable = true; + a_Info[E_BLOCK_REDSTONE_LAMP_ON ].m_IsSnowable = true; + a_Info[E_BLOCK_REDSTONE_ORE ].m_IsSnowable = true; + a_Info[E_BLOCK_REDSTONE_ORE_GLOWING].m_IsSnowable = true; + a_Info[E_BLOCK_SAND ].m_IsSnowable = true; + a_Info[E_BLOCK_SANDSTONE ].m_IsSnowable = true; + a_Info[E_BLOCK_SILVERFISH_EGG ].m_IsSnowable = true; + a_Info[E_BLOCK_SNOW_BLOCK ].m_IsSnowable = true; + a_Info[E_BLOCK_SOULSAND ].m_IsSnowable = true; + a_Info[E_BLOCK_SPONGE ].m_IsSnowable = true; + a_Info[E_BLOCK_STAINED_CLAY ].m_IsSnowable = true; + a_Info[E_BLOCK_STONE ].m_IsSnowable = true; + a_Info[E_BLOCK_STONE_BRICKS ].m_IsSnowable = true; + a_Info[E_BLOCK_TNT ].m_IsSnowable = true; + a_Info[E_BLOCK_WOOL ].m_IsSnowable = true; // Blocks that don't drop without a special tool: @@ -323,6 +461,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_IRON_ORE ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_LAPIS_BLOCK ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_LAPIS_ORE ].m_RequiresSpecialTool = true; + a_Info[E_BLOCK_LEAVES ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE].m_RequiresSpecialTool = true; a_Info[E_BLOCK_MOSSY_COBBLESTONE ].m_RequiresSpecialTool = true; a_Info[E_BLOCK_NETHERRACK ].m_RequiresSpecialTool = true; @@ -455,9 +594,9 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_SILVERFISH_EGG ].m_FullyOccupiesVoxel = true; a_Info[E_BLOCK_SPONGE ].m_FullyOccupiesVoxel = true; a_Info[E_BLOCK_STAINED_CLAY ].m_FullyOccupiesVoxel = true; - a_Info[E_BLOCK_WOOL ].m_FullyOccupiesVoxel = true; a_Info[E_BLOCK_STONE ].m_FullyOccupiesVoxel = true; a_Info[E_BLOCK_STONE_BRICKS ].m_FullyOccupiesVoxel = true; + a_Info[E_BLOCK_WOOL ].m_FullyOccupiesVoxel = true; } diff --git a/src/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index 7efd8e444..120396c7d 100644 --- a/src/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h @@ -3,17 +3,19 @@ #include "BlockHandler.h" #include "../World.h" +#include "ClearMetaOnDrop.h" class cBlockLadderHandler : - public cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> + public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> > { + typedef cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04> > super; public: cBlockLadderHandler(BLOCKTYPE a_BlockType) - : cMetaRotator<cBlockHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType) + : super(a_BlockType) { } diff --git a/src/Blocks/BlockLilypad.h b/src/Blocks/BlockLilypad.h index 2dd4ec768..53277caa5 100644 --- a/src/Blocks/BlockLilypad.h +++ b/src/Blocks/BlockLilypad.h @@ -8,18 +8,14 @@ class cBlockLilypadHandler : - public cBlockHandler + public cClearMetaOnDrop<cBlockHandler> { + typedef cClearMetaOnDrop<cBlockHandler> super; public: - cBlockLilypadHandler(BLOCKTYPE a_BlockType) - : cBlockHandler(a_BlockType) - { - } - - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + + cBlockLilypadHandler(BLOCKTYPE a_BlockType) : + super(a_BlockType) { - // Reset meta to zero - a_Pickups.push_back(cItem(E_BLOCK_LILY_PAD, 1, 0)); } }; diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 27a44d829..1c8ac6a35 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -94,7 +94,6 @@ private: switch (a_BlockType) { case E_BLOCK_ANVIL: - case E_BLOCK_BED: case E_BLOCK_BEDROCK: case E_BLOCK_BREWING_STAND: case E_BLOCK_CHEST: diff --git a/src/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index ac2b9817a..4692a47df 100644 --- a/src/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h @@ -6,13 +6,16 @@ class cBlockPumpkinHandler : - public cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false> + public cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false> > { + typedef cClearMetaOnDrop<cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false> > super; public: - cBlockPumpkinHandler(BLOCKTYPE a_BlockType) - : cMetaRotator<cBlockHandler, 0x07, 0x02, 0x03, 0x00, 0x01, false>(a_BlockType) + + cBlockPumpkinHandler(BLOCKTYPE a_BlockType) : + super(a_BlockType) { } + virtual void OnPlacedByPlayer(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, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override { diff --git a/src/Blocks/ClearMetaOnDrop.h b/src/Blocks/ClearMetaOnDrop.h new file mode 100644 index 000000000..3f8c33819 --- /dev/null +++ b/src/Blocks/ClearMetaOnDrop.h @@ -0,0 +1,24 @@ + +#pragma once + +// mixin for use to clear meta values when the block is converted to a pickup + +// Usage: inherit from this class, passing the parent class as the parameter Base +// For example to use in class Foo which should inherit Bar use +// class Foo : public cClearMetaOnDrop<Bar>; + +template<class Base> +class cClearMetaOnDrop : public Base +{ +public: + + cClearMetaOnDrop(BLOCKTYPE a_BlockType) : + Base(a_BlockType) + {} + + virtual ~cClearMetaOnDrop() {} + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + a_Pickups.push_back(cItem(this->m_BlockType)); + } +}; diff --git a/src/World.cpp b/src/World.cpp index ba8add8f0..bd3613ce2 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -2468,10 +2468,13 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, if (Distance < ClosestDistance) { - if (a_CheckLineOfSight && !LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) + if (a_CheckLineOfSight) { - ClosestDistance = Distance; - ClosestPlayer = *itr; + if(!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) + { + ClosestDistance = Distance; + ClosestPlayer = *itr; + } } else { |