Minetest  5.4.0
MapNode Struct Reference

#include <mapnode.h>

Public Member Functions

 MapNode ()=default
 
 MapNode (content_t content, u8 a_param1=0, u8 a_param2=0) noexcept
 
bool operator== (const MapNode &other) const noexcept
 
content_t getContent () const noexcept
 
void setContent (content_t c) noexcept
 
u8 getParam1 () const noexcept
 
void setParam1 (u8 p) noexcept
 
u8 getParam2 () const noexcept
 
void setParam2 (u8 p) noexcept
 
void getColor (const ContentFeatures &f, video::SColor *color) const
 
void setLight (LightBank bank, u8 a_light, const ContentFeatures &f) noexcept
 
void setLight (LightBank bank, u8 a_light, const NodeDefManager *nodemgr)
 
bool isLightDayNightEq (const NodeDefManager *nodemgr) const
 Check if the light value for night differs from the light value for day. More...
 
u8 getLight (LightBank bank, const NodeDefManager *nodemgr) const
 
u8 getLightRaw (LightBank bank, const ContentFeatures &f) const noexcept
 
u8 getLightNoChecks (LightBank bank, const ContentFeatures *f) const noexcept
 This function differs from getLight(LightBank bank, NodeDefManager *nodemgr) in that the ContentFeatures of the node in question are not retrieved by the function itself. More...
 
bool getLightBanks (u8 &lightday, u8 &lightnight, const NodeDefManager *nodemgr) const
 
u8 getLightBlend (u32 daylight_factor, const NodeDefManager *nodemgr) const
 
u8 getFaceDir (const NodeDefManager *nodemgr, bool allow_wallmounted=false) const
 
u8 getWallMounted (const NodeDefManager *nodemgr) const
 
v3s16 getWallMountedDir (const NodeDefManager *nodemgr) const
 
void rotateAlongYAxis (const NodeDefManager *nodemgr, Rotation rot)
 
u8 getNeighbors (v3s16 p, Map *map) const
 
void getNodeBoxes (const NodeDefManager *nodemgr, std::vector< aabb3f > *boxes, u8 neighbors=0) const
 
void getSelectionBoxes (const NodeDefManager *nodemg, std::vector< aabb3f > *boxes, u8 neighbors=0) const
 
void getCollisionBoxes (const NodeDefManager *nodemgr, std::vector< aabb3f > *boxes, u8 neighbors=0) const
 
u8 getMaxLevel (const NodeDefManager *nodemgr) const
 
u8 getLevel (const NodeDefManager *nodemgr) const
 
s8 setLevel (const NodeDefManager *nodemgr, s16 level=1)
 
s8 addLevel (const NodeDefManager *nodemgr, s16 add=1)
 
void serialize (u8 *dest, u8 version) const
 
void deSerialize (u8 *source, u8 version)
 

Static Public Member Functions

static u32 serializedLength (u8 version)
 
static void serializeBulk (std::ostream &os, int version, const MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width, int compression_level)
 
static void deSerializeBulk (std::istream &is, int version, MapNode *nodes, u32 nodecount, u8 content_width, u8 params_width)
 

Public Attributes

u16 param0
 
u8 param1
 
u8 param2
 

Private Member Functions

void deSerialize_pre22 (const u8 *source, u8 version)
 

Constructor & Destructor Documentation

◆ MapNode() [1/2]

MapNode::MapNode ( )
default

◆ MapNode() [2/2]

MapNode::MapNode ( content_t  content,
u8  a_param1 = 0,
u8  a_param2 = 0 
)
inlinenoexcept

Member Function Documentation

◆ addLevel()

s8 MapNode::addLevel ( const NodeDefManager nodemgr,
s16  add = 1 
)

References getLevel(), and setLevel().

Referenced by ModApiEnvMod::l_add_node_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerialize()

void MapNode::deSerialize ( u8 *  source,
u8  version 
)

References deSerialize_pre22(), param0, param1, param2, readU16(), readU8(), and ser_ver_supported().

Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerialize_pre22()

void MapNode::deSerialize_pre22 ( const u8 *  source,
u8  version 
)
private

References CONTENT_AIR, CONTENT_IGNORE, mapnode_translate_to_internal(), param0, param1, and param2.

Referenced by deSerialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deSerializeBulk()

void MapNode::deSerializeBulk ( std::istream &  is,
int  version,
MapNode nodes,
u32  nodecount,
u8  content_width,
u8  params_width 
)
static

References decompressZlib(), FATAL_ERROR, param0, param1, param2, readU16(), readU8(), and ser_ver_supported().

Referenced by MapBlock::deSerialize(), and Schematic::deserializeFromMts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCollisionBoxes()

void MapNode::getCollisionBoxes ( const NodeDefManager nodemgr,
std::vector< aabb3f > *  boxes,
u8  neighbors = 0 
) const

References ContentFeatures::collision_box, NodeBox::fixed, NodeDefManager::get(), ContentFeatures::node_box, and transformNodeBox().

Referenced by collisionMoveSimple(), LocalPlayer::old_move(), and LocalPlayer::updateSneakNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor()

void MapNode::getColor ( const ContentFeatures f,
video::SColor *  color 
) const

Returns the color of the node.

Parameters
fcontent features of this node
coloroutput, contains the node's color.

References ContentFeatures::color, ContentFeatures::palette, and param2.

Referenced by Minimap::blitMinimapPixelsToImageSurface(), ParticleManager::getNodeParticleParams(), getNodeTileN(), and MapblockMeshGenerator::getSpecialTile().

+ Here is the caller graph for this function:

◆ getContent()

content_t MapNode::getContent ( ) const
inlinenoexcept

References param0.

Referenced by MapBlock::actuallyUpdateDayNightDiff(), Map::addNodeAndUpdate(), analyze_block(), ABMHandler::apply(), LBMManager::applyLBMs(), Schematic::blitToVManip(), Decoration::canPlaceDecoration(), CavesRandomWalk::carveRoute(), CavesV6::carveRoute(), collisionMoveSimple(), correctBlockNodeIds(), MapBlock::deSerialize_pre22(), MapblockMeshGenerator::drawFirelikeNode(), MapblockMeshGenerator::drawGlasslikeFramedNode(), MapblockMeshGenerator::drawGlasslikeNode(), MapgenBasic::dustTopNodes(), voxalgo::fill_with_sunlight(), MapgenV6::find_stone_level(), DungeonGen::findPlaceForDoor(), Server::findSpawnPos(), MapgenV6::flowMud(), OreScatter::generate(), OreSheet::generate(), OrePuff::generate(), OreBlob::generate(), OreVein::generate(), OreStratum::generate(), DecoSimple::generate(), DungeonGen::generate(), generate_nodelist_and_update_ids(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), NodeDefManager::get(), getBlockNodeIdMapping(), MapblockMeshGenerator::getLiquidNeighborhood(), MinimapMapblock::getMinimapNodes(), getSmoothLightCombined(), getTileInfo(), getVisibleBrightness(), MapgenV6::growGrass(), LocalPlayer::handleAutojump(), Server::handleCommand_Interact(), voxalgo::is_sunlight_above(), ReflowScan::isLiquidFlowableTo(), Mapgen::isLiquidHorizontallyFlowable(), MapblockMeshGenerator::isSameRail(), ModApiEnvMod::l_dig_node(), ModApiEnvMod::l_find_node_near(), ModApiEnvMod::l_find_nodes_in_area(), ModApiEnvMod::l_find_nodes_in_area_under_air(), LuaVoxelManip::l_get_data(), ModApiEnvMod::l_place_node(), ModApiEnvMod::l_punch_node(), ModApiMapgen::l_read_schematic(), treegen::make_jungletree(), treegen::make_pine_tree(), treegen::make_tree(), MapgenSinglenode::makeChunk(), DungeonGen::makeCorridor(), DungeonGen::makeDungeon(), mapnode_translate_to_internal(), LocalPlayer::move(), MapgenV6::moveMud(), ScriptApiNode::node_on_receive_fields(), ScriptApiNodemeta::nodemeta_inventory_AllowMove(), ScriptApiNodemeta::nodemeta_inventory_AllowPut(), ScriptApiNodemeta::nodemeta_inventory_AllowTake(), ScriptApiNodemeta::nodemeta_inventory_OnMove(), ScriptApiNodemeta::nodemeta_inventory_OnPut(), ScriptApiNodemeta::nodemeta_inventory_OnTake(), LocalPlayer::old_move(), MapgenV6::placeTreesAndJungleGrass(), MapblockMeshGenerator::prepareLiquidNodeDrawing(), VoxelManipulator::print(), Mapgen::propagateSunlight(), Schematic::resolveNodeNames(), ReflowScan::scanColumn(), Schematic::serializeToLua(), Map::setNode(), ParticleSpawner::spawnParticle(), voxalgo::spread_light(), Mapgen::spreadLight(), PlayerSAO::step(), TestMapNode::testNodeProperties(), Map::transformLiquids(), treegen::tree_fruit_placement(), treegen::tree_leaves_placement(), treegen::tree_single_leaves_placement(), treegen::tree_trunk_placement(), voxalgo::unspread_light(), GameUI::update(), ClientMap::updateDrawList(), and Mapgen::updateLiquid().

◆ getFaceDir()

u8 MapNode::getFaceDir ( const NodeDefManager nodemgr,
bool  allow_wallmounted = false 
) const

References CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_WALLMOUNTED, NodeDefManager::get(), getParam2(), ContentFeatures::param_type_2, and wallmounted_to_facedir.

Referenced by MapblockMeshGenerator::drawMeshNode(), getNodeTile(), and transformNodeBox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLevel()

u8 MapNode::getLevel ( const NodeDefManager nodemgr) const

References CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), getParam2(), ContentFeatures::leveled, LEVELED_MASK, ContentFeatures::leveled_max, LIQUID_FLOWING, LIQUID_LEVEL_MASK, LIQUID_LEVEL_SOURCE, LIQUID_SOURCE, ContentFeatures::liquid_type, and ContentFeatures::param_type_2.

Referenced by addLevel(), ModApiEnvMod::l_get_node_level(), and transformNodeBox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLight()

u8 MapNode::getLight ( LightBank  bank,
const NodeDefManager nodemgr 
) const

References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, LIGHTBANK_DAY, MYMAX, param1, and ContentFeatures::param_type.

Referenced by getFaceLight(), getInteriorLight(), getVisibleBrightness(), voxalgo::is_light_locally_correct(), voxalgo::is_sunlight_above(), voxalgo::is_sunlight_above_block(), VoxelManipulator::print(), TestMapNode::testNodeProperties(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLightBanks()

bool MapNode::getLightBanks ( u8 &  lightday,
u8 &  lightnight,
const NodeDefManager nodemgr 
) const

References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, param1, and ContentFeatures::param_type.

Referenced by getLightBlend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLightBlend()

u8 MapNode::getLightBlend ( u32  daylight_factor,
const NodeDefManager nodemgr 
) const
inline

References blend_light(), and getLightBanks().

Referenced by SmokePuffCSO::SmokePuffCSO(), ClientMap::getBackgroundBrightness(), getVisibleBrightness(), ModApiEnvMod::l_get_node_light(), Particle::updateLight(), and GenericCAO::updateLight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLightNoChecks()

u8 MapNode::getLightNoChecks ( LightBank  bank,
const ContentFeatures f 
) const
noexcept

This function differs from getLight(LightBank bank, NodeDefManager *nodemgr) in that the ContentFeatures of the node in question are not retrieved by the function itself.

Thus, if you have already called nodemgr->get() to get the ContentFeatures you pass it to this function instead of the function getting ContentFeatures itself. Since NodeDefManager::get() is relatively expensive this can lead to significant performance improvements in some situations. Call this function if (and only if) you have already retrieved the ContentFeatures by calling NodeDefManager::get() for the node you're working with and the pre-conditions listed are true.

Precondition
f != NULL
f->param_type == CPT_LIGHT

References LIGHTBANK_DAY, and MYMAX.

Referenced by voxalgo::blit_back_with_light(), voxalgo::finish_bulk_light_update(), getSmoothLightCombined(), voxalgo::is_light_locally_correct(), and voxalgo::repair_block_light().

+ Here is the caller graph for this function:

◆ getLightRaw()

u8 MapNode::getLightRaw ( LightBank  bank,
const ContentFeatures f 
) const
noexcept

Returns the node's light level from param1. If the node emits light, it is ignored.

Parameters
fthe ContentFeatures of this node.

References CPT_LIGHT, and LIGHTBANK_DAY.

Referenced by voxalgo::propagate_block_sunlight(), voxalgo::spread_light(), and voxalgo::unspread_light().

+ Here is the caller graph for this function:

◆ getMaxLevel()

u8 MapNode::getMaxLevel ( const NodeDefManager nodemgr) const

References CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), ContentFeatures::leveled, ContentFeatures::leveled_max, LIQUID_FLOWING, LIQUID_LEVEL_MAX, ContentFeatures::liquid_type, and ContentFeatures::param_type_2.

Referenced by ModApiEnvMod::l_get_node_max_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNeighbors()

u8 MapNode::getNeighbors ( v3s16  p,
Map map 
) const

Checks which neighbors does this node connect to.

Parameters
pcoordinates of the node

References ContentFeatures::drawtype, NodeDefManager::get(), getNeighborConnectingFace(), Map::getNodeDefManager(), NDT_NODEBOX, ContentFeatures::node_box, NODEBOX_CONNECTED, p(), and NodeBox::type.

Referenced by Environment::continueRaycast(), and Game::updatePointedThing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNodeBoxes()

void MapNode::getNodeBoxes ( const NodeDefManager nodemgr,
std::vector< aabb3f > *  boxes,
u8  neighbors = 0 
) const

References NodeDefManager::get(), ContentFeatures::node_box, and transformNodeBox().

Referenced by MapblockMeshGenerator::drawNodeboxNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParam1()

u8 MapNode::getParam1 ( ) const
inlinenoexcept

References param1.

Referenced by MapBlock::deSerialize_pre22(), and pushnode().

+ Here is the caller graph for this function:

◆ getParam2()

u8 MapNode::getParam2 ( ) const
inlinenoexcept

References param2.

Referenced by MapBlock::deSerialize_pre22(), MapblockMeshGenerator::drawGlasslikeFramedNode(), getFaceDir(), getLevel(), getWallMounted(), pushnode(), setLevel(), and GameUI::update().

+ Here is the caller graph for this function:

◆ getSelectionBoxes()

void MapNode::getSelectionBoxes ( const NodeDefManager nodemg,
std::vector< aabb3f > *  boxes,
u8  neighbors = 0 
) const

References NodeDefManager::get(), ContentFeatures::selection_box, and transformNodeBox().

Referenced by Environment::continueRaycast(), and Game::updatePointedThing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWallMounted()

u8 MapNode::getWallMounted ( const NodeDefManager nodemgr) const

References CPT2_COLORED_WALLMOUNTED, CPT2_WALLMOUNTED, NodeDefManager::get(), getParam2(), and ContentFeatures::param_type_2.

Referenced by MapblockMeshGenerator::drawMeshNode(), MapblockMeshGenerator::drawSignlikeNode(), MapblockMeshGenerator::drawTorchlikeNode(), and getWallMountedDir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWallMountedDir()

v3s16 MapNode::getWallMountedDir ( const NodeDefManager nodemgr) const

References getWallMounted().

Referenced by transformNodeBox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLightDayNightEq()

bool MapNode::isLightDayNightEq ( const NodeDefManager nodemgr) const

Check if the light value for night differs from the light value for day.

Returns
If the light values are equal, returns true; otherwise false

References CPT_LIGHT, NodeDefManager::get(), ContentFeatures::light_source, MYMAX, param1, and ContentFeatures::param_type.

Referenced by MapBlock::actuallyUpdateDayNightDiff().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator==()

bool MapNode::operator== ( const MapNode other) const
inlinenoexcept

References param0, param1, and param2.

◆ rotateAlongYAxis()

void MapNode::rotateAlongYAxis ( const NodeDefManager nodemgr,
Rotation  rot 
)

References CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_FACEDIR, CPT2_WALLMOUNTED, NodeDefManager::get(), param2, ContentFeatures::param_type_2, rot_to_wallmounted, and wallmounted_to_rot.

Referenced by Schematic::blitToVManip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

void MapNode::serialize ( u8 *  dest,
u8  version 
) const

References param0, param1, param2, ser_ver_supported(), writeU16(), and writeU8().

+ Here is the call graph for this function:

◆ serializeBulk()

void MapNode::serializeBulk ( std::ostream &  os,
int  version,
const MapNode nodes,
u32  nodecount,
u8  content_width,
u8  params_width,
int  compression_level 
)
static

References compressZlib(), param0, param1, param2, sanity_check, ser_ver_supported(), writeU16(), and writeU8().

Referenced by MapBlock::serialize(), and Schematic::serializeToMts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializedLength()

u32 MapNode::serializedLength ( u8  version)
static

References ser_ver_supported().

Referenced by MapBlock::deSerialize_pre22(), and Client::handleCommand_AddNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContent()

◆ setLevel()

s8 MapNode::setLevel ( const NodeDefManager nodemgr,
s16  level = 1 
)

References CONTENT_AIR, CPT2_FLOWINGLIQUID, CPT2_LEVELED, NodeDefManager::get(), getParam2(), LEVELED_MASK, ContentFeatures::leveled_max, ContentFeatures::liquid_alternative_flowing_id, ContentFeatures::liquid_alternative_source_id, LIQUID_FLOWING, LIQUID_LEVEL_MASK, LIQUID_LEVEL_SOURCE, LIQUID_SOURCE, ContentFeatures::liquid_type, ContentFeatures::param_type_2, setContent(), and setParam2().

Referenced by addLevel(), and ModApiEnvMod::l_set_node_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLight() [1/2]

void MapNode::setLight ( LightBank  bank,
u8  a_light,
const ContentFeatures f 
)
noexcept

◆ setLight() [2/2]

void MapNode::setLight ( LightBank  bank,
u8  a_light,
const NodeDefManager nodemgr 
)

References NodeDefManager::get(), and setLight().

+ Here is the call graph for this function:

◆ setParam1()

void MapNode::setParam1 ( u8  p)
inlinenoexcept

References p(), and param1.

Referenced by MapBlock::deSerialize_pre22().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParam2()

void MapNode::setParam2 ( u8  p)
inlinenoexcept

References p(), and param2.

Referenced by MapBlock::deSerialize_pre22(), and setLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ param0

◆ param1

◆ param2


The documentation for this struct was generated from the following files: