Merge branch 'master' into Inventory2
Conflicts: src/BlockInfo.cpp
This commit is contained in:
commit
ba36e79bc5
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,6 +15,7 @@ cloc.xsl
|
||||
*.suo
|
||||
/EveryNight.cmd
|
||||
/UploadLuaAPI.cmd
|
||||
AllFiles.lst
|
||||
|
||||
# IDE Stuff
|
||||
## Sublime Text
|
||||
|
@ -28,7 +28,7 @@ endmacro()
|
||||
macro(set_flags)
|
||||
# Add coverage processing, if requested:
|
||||
if (NOT MSVC)
|
||||
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
|
||||
message("Including CodeCoverage")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/cmake-coverage/")
|
||||
@ -85,7 +85,7 @@ macro(set_flags)
|
||||
|
||||
# We use a signed char (fixes #640 on RasPi)
|
||||
add_flags_cxx("-fsigned-char")
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ macro(enable_profile)
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugProfile;ReleaseProfile;Coverage" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(set_exe_flags)
|
||||
# Remove disabling the maximum warning level:
|
||||
# clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings
|
||||
@ -216,22 +216,22 @@ macro(set_exe_flags)
|
||||
string(REPLACE "-w" "" CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}")
|
||||
string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}")
|
||||
add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch")
|
||||
|
||||
|
||||
# we support non-IEEE 754 fpus so can make no guarentees about error
|
||||
add_flags_cxx("-ffast-math")
|
||||
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not provide the __extern_always_inline macro and a part of libm depends on this when using fast-math
|
||||
add_flags_cxx("-D__extern_always_inline=inline")
|
||||
add_flags_cxx("-Werror -Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion")
|
||||
add_flags_cxx("-Wno-extra-semi -Wno-error=switch-enum -Wno-documentation")
|
||||
add_flags_cxx("-Wno-error=switch-enum -Wno-documentation -Wno-exit-time-destructors")
|
||||
add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded")
|
||||
add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal")
|
||||
add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor")
|
||||
add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow")
|
||||
add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow -Wno-error=old-style-cast")
|
||||
add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations")
|
||||
add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough")
|
||||
add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum -Wno-exit-time-destructors")
|
||||
add_flags_cxx("-Wno-error=extra-semi -Wno-weak-vtables -Wno-switch-enum")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -240,7 +240,7 @@ template <typename Type> class cItemCallback
|
||||
public:
|
||||
/// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating
|
||||
virtual bool Item(Type * a_Type) = 0;
|
||||
virtual ~cItemCallback() {};
|
||||
virtual ~cItemCallback() {}
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ set (BINDING_OUTPUTS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc
|
||||
)
|
||||
|
||||
set(BINDING_DEPENDECIES
|
||||
set(BINDING_DEPENDENCIES
|
||||
tolua
|
||||
../Bindings/virtual_method_hooks.lua
|
||||
../Bindings/AllToLua.pkg
|
||||
@ -122,7 +122,7 @@ if (NOT MSVC)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
# add any new generation dependencies here
|
||||
DEPENDS ${BINDING_DEPENDECIES}
|
||||
DEPENDS ${BINDING_DEPENDENCIES}
|
||||
)
|
||||
endif ()
|
||||
set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
|
||||
|
@ -175,32 +175,6 @@ static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S)
|
||||
|
||||
|
||||
|
||||
/* get function: g_BlockRequiresSpecialTool */
|
||||
#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockRequiresSpecialTool
|
||||
static int tolua_get_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S)
|
||||
{
|
||||
int BlockType;
|
||||
#ifndef TOLUA_RELEASE
|
||||
{
|
||||
tolua_Error tolua_err;
|
||||
if (!tolua_isnumber(tolua_S, 2, 0, &tolua_err))
|
||||
tolua_error(tolua_S, "#vinvalid type in array indexing.", &tolua_err);
|
||||
}
|
||||
#endif
|
||||
BlockType = (int)tolua_tonumber(tolua_S, 2, 0);
|
||||
if ((BlockType < 0) || (BlockType > E_BLOCK_MAX_TYPE_ID))
|
||||
{
|
||||
tolua_error(tolua_S, "array indexing out of range.", NULL);
|
||||
}
|
||||
tolua_pushboolean(tolua_S, cBlockInfo::RequiresSpecialTool((BLOCKTYPE)BlockType));
|
||||
return 1;
|
||||
}
|
||||
#endif // #ifndef TOLUA_DISABLE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* get function: g_BlockIsSolid */
|
||||
#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid
|
||||
static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S)
|
||||
@ -263,7 +237,6 @@ void DeprecatedBindings::Bind(lua_State * tolua_S)
|
||||
tolua_array(tolua_S, "g_BlockOneHitDig", tolua_get_AllToLua_g_BlockOneHitDig, NULL);
|
||||
tolua_array(tolua_S, "g_BlockPistonBreakable", tolua_get_AllToLua_g_BlockPistonBreakable, NULL);
|
||||
tolua_array(tolua_S, "g_BlockIsSnowable", tolua_get_AllToLua_g_BlockIsSnowable, NULL);
|
||||
tolua_array(tolua_S, "g_BlockRequiresSpecialTool", tolua_get_AllToLua_g_BlockRequiresSpecialTool, NULL);
|
||||
tolua_array(tolua_S, "g_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, NULL);
|
||||
tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL);
|
||||
|
||||
|
@ -115,10 +115,10 @@ public:
|
||||
virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) = 0;
|
||||
|
||||
/// All bound commands are to be removed, do any language-dependent cleanup here
|
||||
virtual void ClearCommands(void) {} ;
|
||||
virtual void ClearCommands(void) {}
|
||||
|
||||
/// All bound console commands are to be removed, do any language-dependent cleanup here
|
||||
virtual void ClearConsoleCommands(void) {} ;
|
||||
virtual void ClearConsoleCommands(void) {}
|
||||
|
||||
// tolua_begin
|
||||
const AString & GetName(void) const { return m_Name; }
|
||||
|
@ -38,9 +38,9 @@ protected:
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
virtual ~cBlockEntity() {}; // force a virtual destructor in all descendants
|
||||
virtual ~cBlockEntity() {} // force a virtual destructor in all descendants
|
||||
|
||||
virtual void Destroy(void) {};
|
||||
virtual void Destroy(void) {}
|
||||
|
||||
void SetWorld(cWorld * a_World)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
static const char * GetClassStatic(void) { return "cJukeboxEntity"; }
|
||||
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle &) override { };
|
||||
virtual void SendTo(cClientHandle &) override {}
|
||||
|
||||
private:
|
||||
int m_Record;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
// tolua_end
|
||||
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle &) override { };
|
||||
virtual void SendTo(cClientHandle &) override {}
|
||||
|
||||
static const char * GetClassStatic(void) { return "cNoteEntity"; }
|
||||
|
||||
|
@ -15,7 +15,6 @@ cBlockInfo::cBlockInfo()
|
||||
, m_OneHitDig(false)
|
||||
, m_PistonBreakable(false)
|
||||
, m_IsSnowable(false)
|
||||
, m_RequiresSpecialTool(false)
|
||||
, m_IsSolid(true)
|
||||
, m_FullyOccupiesVoxel(false)
|
||||
, m_Handler(NULL)
|
||||
@ -440,52 +439,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
|
||||
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:
|
||||
a_Info[E_BLOCK_BRICK ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_CAULDRON ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_COAL_ORE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_COBBLESTONE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_COBBLESTONE_WALL ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_COBBLESTONE_STAIRS ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_COBWEB ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_DIAMOND_BLOCK ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_DIAMOND_ORE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_EMERALD_ORE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_END_STONE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_VINES ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_GOLD_BLOCK ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_GOLD_ORE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_IRON_BLOCK ].m_RequiresSpecialTool = true;
|
||||
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;
|
||||
a_Info[E_BLOCK_NETHER_BRICK ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_NETHER_BRICK_STAIRS ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_OBSIDIAN ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_REDSTONE_ORE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_REDSTONE_ORE_GLOWING].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_SANDSTONE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_SANDSTONE_STAIRS ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_SNOW ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_STONE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_STONE_BRICKS ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_STONE_BRICK_STAIRS ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_STONE_PRESSURE_PLATE].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_STONE_SLAB ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_VINES ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_FURNACE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_LIT_FURNACE ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_ANVIL ].m_RequiresSpecialTool = true;
|
||||
a_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_RequiresSpecialTool = true;
|
||||
|
||||
|
||||
// Nonsolid blocks:
|
||||
a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSolid = false;
|
||||
a_Info[E_BLOCK_AIR ].m_IsSolid = false;
|
||||
|
@ -39,9 +39,6 @@ public:
|
||||
/** Can this block hold snow atop? */
|
||||
bool m_IsSnowable;
|
||||
|
||||
/** Does this block require a tool to drop? */
|
||||
bool m_RequiresSpecialTool;
|
||||
|
||||
/** Is this block solid (player cannot walk through)? */
|
||||
bool m_IsSolid;
|
||||
|
||||
@ -61,7 +58,6 @@ public:
|
||||
inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; }
|
||||
inline static bool IsPistonBreakable (BLOCKTYPE a_Type) { return Get(a_Type).m_PistonBreakable; }
|
||||
inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; }
|
||||
inline static bool RequiresSpecialTool (BLOCKTYPE a_Type) { return Get(a_Type).m_RequiresSpecialTool; }
|
||||
inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; }
|
||||
inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; }
|
||||
|
||||
|
@ -19,16 +19,16 @@ public:
|
||||
}
|
||||
|
||||
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ) override
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim) override
|
||||
{
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
if (Meta & 0x8)
|
||||
{
|
||||
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ);
|
||||
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY - 1, a_BlockZ, a_CanDrop, a_DropVerbatim);
|
||||
}
|
||||
else
|
||||
{
|
||||
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ);
|
||||
super::DropBlock(a_ChunkInterface, a_WorldInterface, a_BlockPluginInterface, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_CanDrop, a_DropVerbatim);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,39 +408,6 @@ void cBlockHandler::NeighborChanged(cChunkInterface & a_ChunkInterface, int a_Bl
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnDigging(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer *a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
// Setting the meta to a_BlockMeta keeps most textures. The few other blocks have to override this.
|
||||
@ -451,11 +418,23 @@ void cBlockHandler::ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta)
|
||||
|
||||
|
||||
|
||||
void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||
void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop, bool a_DropVerbatim)
|
||||
{
|
||||
cItems Pickups;
|
||||
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||
ConvertToPickups(Pickups, Meta);
|
||||
|
||||
if (a_CanDrop)
|
||||
{
|
||||
if (!a_DropVerbatim)
|
||||
{
|
||||
ConvertToPickups(Pickups, Meta);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Add a proper overridable function for this
|
||||
Pickups.Add(m_BlockType, 1, Meta);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow plugins to modify the pickups:
|
||||
a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups);
|
||||
|
@ -60,25 +60,29 @@ public:
|
||||
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Called when a direct neighbor of this block has been changed (The position is the own position, not the neighbor position)
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) {}
|
||||
|
||||
/// Notifies all neighbors of the given block about a change
|
||||
static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
|
||||
/// Called while the player diggs the block.
|
||||
virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
virtual void OnDigging(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) {}
|
||||
|
||||
/// Called if the user right clicks the block and the block is useable
|
||||
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);
|
||||
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) {}
|
||||
|
||||
/** Called when a Right Click to this Block is cancelled */
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace);
|
||||
/** Called when a right click to this block is cancelled */
|
||||
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) {}
|
||||
|
||||
/// <summary>Called when the item is mined to convert it into pickups. Pickups may specify multiple items. Appends items to a_Pickups, preserves its original contents</summary>
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta);
|
||||
|
||||
/// Handles the dropping of a block based on what ConvertToDrops() returns. This will not destroy the block. a_Digger is the entity causing the drop; it may be NULL
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ);
|
||||
/** Handles the dropping, but not destruction, of a block based on what ConvertTo(Verbatim)Pickups() returns, including the spawning of pickups and alertion of plugins
|
||||
@param a_Digger The entity causing the drop; it may be NULL
|
||||
@param a_CanDrop Informs the handler whether the block should be dropped at all. One example when this is false is when stone is destroyed by hand
|
||||
@param a_DropVerbatim Calls ConvertToVerbatimPickups() instead of its counterpart, meaning the block itself is dropped by default (due to a speical tool or enchantment)
|
||||
*/
|
||||
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop = true, bool a_DropVerbatim = false);
|
||||
|
||||
/// Returns step sound name of block
|
||||
virtual const char * GetStepSound(void);
|
||||
|
@ -40,14 +40,20 @@ public:
|
||||
{
|
||||
cFastRandom rand;
|
||||
|
||||
// Only the first 2 bits contain the display information, the others are for growing
|
||||
// Old leaves - 3 bits contain display; new leaves - 1st bit, shifted left two for saplings to understand
|
||||
if (rand.NextInt(6) == 0)
|
||||
{
|
||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 3));
|
||||
a_Pickups.push_back(
|
||||
cItem(
|
||||
E_BLOCK_SAPLING,
|
||||
1,
|
||||
(m_BlockType == E_BLOCK_LEAVES) ? (a_BlockMeta & 0x03) : (2 << (a_BlockMeta & 0x01))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 1 % chance of dropping an apple, if the leaves' type is Apple Leaves
|
||||
if ((a_BlockMeta & 3) == E_META_LEAVES_APPLE)
|
||||
if ((m_BlockType == E_BLOCK_LEAVES) && ((a_BlockMeta & 0x03) == E_META_LEAVES_APPLE))
|
||||
{
|
||||
if (rand.NextInt(101) == 0)
|
||||
{
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Only the first 2 bits contain the display information, the others are for growing
|
||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x7));
|
||||
// Only the first 2 bits contain the display information and the 4th bit is for the growth indicator, but, we use 0x07 for forward compatibility
|
||||
a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07));
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +56,7 @@ SET (SRCS
|
||||
Root.cpp
|
||||
Scoreboard.cpp
|
||||
Server.cpp
|
||||
SetChunkData.cpp
|
||||
Statistics.cpp
|
||||
StringCompression.cpp
|
||||
StringUtils.cpp
|
||||
@ -124,6 +125,7 @@ SET (HDRS
|
||||
Root.h
|
||||
Scoreboard.h
|
||||
Server.h
|
||||
SetChunkData.h
|
||||
StackWalker.h
|
||||
Statistics.h
|
||||
StringCompression.h
|
||||
@ -265,7 +267,7 @@ if (MSVC)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/
|
||||
|
||||
# add any new generation dependencies here
|
||||
DEPENDS ${BINDING_DEPENDECIES}
|
||||
DEPENDS ${BINDING_DEPENDENCIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "MobCensus.h"
|
||||
#include "MobSpawner.h"
|
||||
#include "BlockInServerPluginInterface.h"
|
||||
#include "SetChunkData.h"
|
||||
|
||||
#include "json/json.h"
|
||||
|
||||
@ -265,41 +266,34 @@ void cChunk::GetAllData(cChunkDataCallback & a_Callback)
|
||||
|
||||
|
||||
|
||||
void cChunk::SetAllData(
|
||||
const BLOCKTYPE * a_BlockTypes,
|
||||
const NIBBLETYPE * a_BlockMeta,
|
||||
const NIBBLETYPE * a_BlockLight,
|
||||
const NIBBLETYPE * a_BlockSkyLight,
|
||||
const HeightMap * a_HeightMap,
|
||||
const BiomeMap & a_BiomeMap,
|
||||
cBlockEntityList & a_BlockEntities
|
||||
)
|
||||
void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
|
||||
{
|
||||
memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap));
|
||||
|
||||
if (a_HeightMap != NULL)
|
||||
{
|
||||
memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap));
|
||||
}
|
||||
|
||||
if (a_HeightMap == NULL)
|
||||
{
|
||||
CalculateHeightmap(a_BlockTypes);
|
||||
}
|
||||
|
||||
m_ChunkData.SetBlockTypes(a_BlockTypes);
|
||||
m_ChunkData.SetMetas(a_BlockMeta);
|
||||
m_ChunkData.SetBlockLight(a_BlockLight);
|
||||
m_ChunkData.SetSkyLight(a_BlockSkyLight);
|
||||
ASSERT(a_SetChunkData.IsHeightMapValid());
|
||||
ASSERT(a_SetChunkData.AreBiomesValid());
|
||||
|
||||
m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL);
|
||||
memcpy(m_BiomeMap, a_SetChunkData.GetBiomes(), sizeof(m_BiomeMap));
|
||||
memcpy(m_HeightMap, a_SetChunkData.GetHeightMap(), sizeof(m_HeightMap));
|
||||
|
||||
m_ChunkData.SetBlockTypes(a_SetChunkData.GetBlockTypes());
|
||||
m_ChunkData.SetMetas(a_SetChunkData.GetBlockMetas());
|
||||
if (a_SetChunkData.IsLightValid())
|
||||
{
|
||||
m_ChunkData.SetBlockLight(a_SetChunkData.GetBlockLight());
|
||||
m_ChunkData.SetSkyLight(a_SetChunkData.GetSkyLight());
|
||||
m_IsLightValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IsLightValid = false;
|
||||
}
|
||||
|
||||
// Clear the block entities present - either the loader / saver has better, or we'll create empty ones:
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
}
|
||||
std::swap(a_BlockEntities, m_BlockEntities);
|
||||
m_BlockEntities.clear();
|
||||
std::swap(a_SetChunkData.GetBlockEntities(), m_BlockEntities);
|
||||
|
||||
// Set all block entities' World variable:
|
||||
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
|
||||
|
20
src/Chunk.h
20
src/Chunk.h
@ -95,16 +95,10 @@ public:
|
||||
/** Gets all chunk data, calls the a_Callback's methods for each data type */
|
||||
void GetAllData(cChunkDataCallback & a_Callback);
|
||||
|
||||
/** Sets all chunk data */
|
||||
void SetAllData(
|
||||
const BLOCKTYPE * a_BlockTypes,
|
||||
const NIBBLETYPE * a_BlockMeta,
|
||||
const NIBBLETYPE * a_BlockLight,
|
||||
const NIBBLETYPE * a_BlockSkyLight,
|
||||
const cChunkDef::HeightMap * a_HeightMap,
|
||||
const cChunkDef::BiomeMap & a_BiomeMap,
|
||||
cBlockEntityList & a_BlockEntities
|
||||
);
|
||||
/** Sets all chunk data as either loaded from the storage or generated.
|
||||
BlockLight and BlockSkyLight are optional, if not present, chunk will be marked as unlighted.
|
||||
Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk. */
|
||||
void SetAllData(cSetChunkData & a_SetChunkData);
|
||||
|
||||
void SetLight(
|
||||
const cChunkDef::BlockNibbles & a_BlockLight,
|
||||
@ -386,9 +380,9 @@ public:
|
||||
cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return &m_RedstoneSimulatorData; }
|
||||
cRedstoneSimulatorChunkData * GetRedstoneSimulatorQueuedData(void) { return &m_RedstoneSimulatorQueuedData; }
|
||||
cIncrementalRedstoneSimulator::PoweredBlocksList * GetRedstoneSimulatorPoweredBlocksList(void) { return &m_RedstoneSimulatorPoweredBlocksList; }
|
||||
cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; };
|
||||
cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; };
|
||||
cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; };
|
||||
cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; }
|
||||
cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; }
|
||||
cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; }
|
||||
bool IsRedstoneDirty(void) const { return m_IsRedstoneDirty; }
|
||||
void SetIsRedstoneDirty(bool a_Flag) { m_IsRedstoneDirty = a_Flag; }
|
||||
|
||||
|
@ -29,25 +29,25 @@ public:
|
||||
(only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
|
||||
If false is returned, the chunk is skipped.
|
||||
*/
|
||||
virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; };
|
||||
virtual bool Coords(int a_ChunkX, int a_ChunkZ) { UNUSED(a_ChunkX); UNUSED(a_ChunkZ); return true; }
|
||||
|
||||
/// Called once to provide heightmap data
|
||||
virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) {UNUSED(a_HeightMap); };
|
||||
virtual void HeightMap(const cChunkDef::HeightMap * a_HeightMap) { UNUSED(a_HeightMap); }
|
||||
|
||||
/// Called once to provide biome data
|
||||
virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) {UNUSED(a_BiomeMap); };
|
||||
virtual void BiomeData(const cChunkDef::BiomeMap * a_BiomeMap) { UNUSED(a_BiomeMap); }
|
||||
|
||||
/// Called once to let know if the chunk lighting is valid. Return value is ignored
|
||||
virtual void LightIsValid(bool a_IsLightValid) {UNUSED(a_IsLightValid); };
|
||||
virtual void LightIsValid(bool a_IsLightValid) { UNUSED(a_IsLightValid); }
|
||||
|
||||
/// Called once to export block info
|
||||
virtual void ChunkData(const cChunkData & a_Buffer) {UNUSED(a_Buffer); };
|
||||
virtual void ChunkData(const cChunkData & a_Buffer) { UNUSED(a_Buffer); }
|
||||
|
||||
/// Called for each entity in the chunk
|
||||
virtual void Entity(cEntity * a_Entity) {UNUSED(a_Entity); };
|
||||
virtual void Entity(cEntity * a_Entity) { UNUSED(a_Entity); }
|
||||
|
||||
/// Called for each blockentity in the chunk
|
||||
virtual void BlockEntity(cBlockEntity * a_Entity) {UNUSED(a_Entity); };
|
||||
virtual void BlockEntity(cBlockEntity * a_Entity) { UNUSED(a_Entity); }
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "MobCensus.h"
|
||||
#include "MobSpawner.h"
|
||||
#include "BoundingBox.h"
|
||||
#include "SetChunkData.h"
|
||||
|
||||
#include "Entities/Pickup.h"
|
||||
|
||||
@ -912,28 +913,20 @@ void cChunkMap::MarkChunkSaved (int a_ChunkX, int a_ChunkZ)
|
||||
|
||||
|
||||
|
||||
void cChunkMap::SetChunkData(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
const BLOCKTYPE * a_BlockTypes,
|
||||
const NIBBLETYPE * a_BlockMeta,
|
||||
const NIBBLETYPE * a_BlockLight,
|
||||
const NIBBLETYPE * a_BlockSkyLight,
|
||||
const cChunkDef::HeightMap * a_HeightMap,
|
||||
const cChunkDef::BiomeMap & a_BiomeMap,
|
||||
cBlockEntityList & a_BlockEntities,
|
||||
bool a_MarkDirty
|
||||
)
|
||||
void cChunkMap::SetChunkData(cSetChunkData & a_SetChunkData)
|
||||
{
|
||||
int ChunkX = a_SetChunkData.GetChunkX();
|
||||
int ChunkZ = a_SetChunkData.GetChunkZ();
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ);
|
||||
cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ);
|
||||
if (Chunk == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Chunk->SetAllData(a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, a_HeightMap, a_BiomeMap, a_BlockEntities);
|
||||
Chunk->SetAllData(a_SetChunkData);
|
||||
|
||||
if (a_MarkDirty)
|
||||
if (a_SetChunkData.ShouldMarkDirty())
|
||||
{
|
||||
Chunk->MarkDirty();
|
||||
}
|
||||
@ -942,7 +935,7 @@ void cChunkMap::SetChunkData(
|
||||
cChunkStays ToBeDisabled;
|
||||
for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr)
|
||||
{
|
||||
if ((*itr)->ChunkAvailable(a_ChunkX, a_ChunkZ))
|
||||
if ((*itr)->ChunkAvailable(ChunkX, ChunkZ))
|
||||
{
|
||||
// The chunkstay wants to be disabled, add it to a list of to-be-disabled chunkstays for later processing:
|
||||
ToBeDisabled.push_back(*itr);
|
||||
@ -957,7 +950,7 @@ void cChunkMap::SetChunkData(
|
||||
}
|
||||
|
||||
// Notify plugins of the chunk becoming available
|
||||
cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ);
|
||||
cPluginManager::Get()->CallHookChunkAvailable(m_World, ChunkX, ChunkZ);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ class cChunkDataSerializer;
|
||||
class cBlockArea;
|
||||
class cMobCensus;
|
||||
class cMobSpawner;
|
||||
class cSetChunkData;
|
||||
|
||||
typedef std::list<cClientHandle *> cClientHandleList;
|
||||
typedef cChunk * cChunkPtr;
|
||||
@ -112,22 +113,11 @@ public:
|
||||
void MarkChunkSaved (int a_ChunkX, int a_ChunkZ);
|
||||
|
||||
/** Sets the chunk data as either loaded from the storage or generated.
|
||||
a_BlockLight and a_BlockSkyLight are optional, if not present, chunk will be marked as unlighted.
|
||||
a_BiomeMap is optional, if not present, biomes will be calculated by the generator
|
||||
a_HeightMap is optional, if not present, will be calculated.
|
||||
If a_MarkDirty is set, the chunk is set as dirty (used after generating)
|
||||
BlockLight and BlockSkyLight are optional, if not present, chunk will be marked as unlighted.
|
||||
If MarkDirty is set, the chunk is set as dirty (used after generating)
|
||||
Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk.
|
||||
*/
|
||||
void SetChunkData(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
const BLOCKTYPE * a_BlockTypes,
|
||||
const NIBBLETYPE * a_BlockMeta,
|
||||
const NIBBLETYPE * a_BlockLight,
|
||||
const NIBBLETYPE * a_BlockSkyLight,
|
||||
const cChunkDef::HeightMap * a_HeightMap,
|
||||
const cChunkDef::BiomeMap & a_BiomeMap,
|
||||
cBlockEntityList & a_BlockEntities,
|
||||
bool a_MarkDirty
|
||||
);
|
||||
void SetChunkData(cSetChunkData & a_SetChunkData);
|
||||
|
||||
void ChunkLighted(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
|
@ -56,8 +56,8 @@ public:
|
||||
#else
|
||||
static const int DEFAULT_VIEW_DISTANCE = 10;
|
||||
#endif
|
||||
static const int MAX_VIEW_DISTANCE = 15;
|
||||
static const int MIN_VIEW_DISTANCE = 3;
|
||||
static const int MAX_VIEW_DISTANCE = 32;
|
||||
static const int MIN_VIEW_DISTANCE = 1;
|
||||
|
||||
cClientHandle(const cSocket * a_Socket, int a_ViewDistance);
|
||||
virtual ~cClientHandle();
|
||||
@ -151,7 +151,7 @@ public:
|
||||
void SendMapInfo (int a_ID, unsigned int a_Scale);
|
||||
void SendPaintingSpawn (const cPainting & a_Painting);
|
||||
void SendPickupSpawn (const cPickup & a_Pickup);
|
||||
void SendEntityAnimation (const cEntity & a_Entity, char a_Animation);
|
||||
void SendEntityAnimation (const cEntity & a_Entity, char a_Animation); // tolua_export
|
||||
void SendParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount);
|
||||
void SendPlayerAbilities (void);
|
||||
void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline);
|
||||
|
@ -14,16 +14,16 @@ Descendants override that function to provide specific processing of the output.
|
||||
class cCommandOutputCallback
|
||||
{
|
||||
public:
|
||||
virtual ~cCommandOutputCallback() {}; // Force a virtual destructor in subclasses
|
||||
virtual ~cCommandOutputCallback() {} // Force a virtual destructor in subclasses
|
||||
|
||||
/// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a "\n"
|
||||
/// Syntax sugar function, calls Out() with Printf()-ed parameters; appends a newline"
|
||||
void Out(const char * a_Fmt, ...) FORMATSTRING(2, 3);
|
||||
|
||||
/// Called when the command wants to output anything; may be called multiple times
|
||||
virtual void Out(const AString & a_Text) = 0;
|
||||
|
||||
/// Called when the command processing has been finished
|
||||
virtual void Finished(void) {};
|
||||
virtual void Finished(void) {}
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -470,7 +470,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
|
||||
{
|
||||
int Y = a_BlockY;
|
||||
AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse);
|
||||
a_BlockY = Clamp<unsigned char>(Y, 0, 255);
|
||||
a_BlockY = Clamp<unsigned char>((unsigned char)Y, 0, 255);
|
||||
}
|
||||
|
||||
|
||||
@ -715,14 +715,5 @@ namespace ItemCategory
|
||||
// tolua_end
|
||||
|
||||
|
||||
inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
if (!IsValidBlock(a_BlockType)) return false;
|
||||
return cBlockInfo::RequiresSpecialTool(a_BlockType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#undef ntohll
|
||||
#define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32))
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cArrowEntity);
|
||||
CLASS_PROTODEF(cArrowEntity)
|
||||
|
||||
/// Creates a new arrow with psNoPickup state and default damage modifier coeff
|
||||
cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
@ -21,7 +21,7 @@ class cBoat :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cBoat);
|
||||
CLASS_PROTODEF(cBoat)
|
||||
|
||||
// cEntity overrides:
|
||||
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
||||
|
@ -15,7 +15,7 @@ class cEnderCrystal :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cEnderCrystal);
|
||||
CLASS_PROTODEF(cEnderCrystal)
|
||||
|
||||
cEnderCrystal(double a_X, double a_Y, double a_Z);
|
||||
|
||||
|
@ -428,7 +428,7 @@ public:
|
||||
// tolua_end
|
||||
|
||||
/// Called when the specified player right-clicks this entity
|
||||
virtual void OnRightClicked(cPlayer &) {};
|
||||
virtual void OnRightClicked(cPlayer &) {}
|
||||
|
||||
/// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy().
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL)
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
@param a_OtherEffect The other effect to copy */
|
||||
cEntityEffect & operator=(cEntityEffect a_OtherEffect);
|
||||
|
||||
virtual ~cEntityEffect(void) {};
|
||||
virtual ~cEntityEffect(void) {}
|
||||
|
||||
/** Creates a pointer to the proper entity effect from the effect type
|
||||
@warning This function creates raw pointers that must be manually managed.
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cExpBottleEntity);
|
||||
CLASS_PROTODEF(cExpBottleEntity)
|
||||
|
||||
cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -16,7 +16,7 @@ class cExpOrb :
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cExpOrb);
|
||||
CLASS_PROTODEF(cExpOrb)
|
||||
|
||||
cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward);
|
||||
cExpOrb(const Vector3d & a_Pos, int a_Reward);
|
||||
|
@ -20,7 +20,7 @@ class cFallingBlock :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cFallingBlock);
|
||||
CLASS_PROTODEF(cFallingBlock)
|
||||
|
||||
/// Creates a new falling block. a_BlockPosition is expected in world coords
|
||||
cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cFireChargeEntity);
|
||||
CLASS_PROTODEF(cFireChargeEntity)
|
||||
|
||||
cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cFireworkEntity);
|
||||
CLASS_PROTODEF(cFireworkEntity)
|
||||
|
||||
cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item);
|
||||
const cItem & GetItem(void) const { return m_FireworkItem; }
|
||||
|
@ -16,7 +16,7 @@ class cFloater :
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cFloater);
|
||||
CLASS_PROTODEF(cFloater)
|
||||
|
||||
cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime);
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cGhastFireballEntity);
|
||||
CLASS_PROTODEF(cGhastFireballEntity)
|
||||
|
||||
cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -16,7 +16,7 @@ class cHangingEntity :
|
||||
|
||||
public:
|
||||
|
||||
CLASS_PROTODEF(cHangingEntity);
|
||||
CLASS_PROTODEF(cHangingEntity)
|
||||
|
||||
cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
private:
|
||||
|
||||
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override {};
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override {}
|
||||
|
||||
eBlockFace m_BlockFace;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class cItemFrame :
|
||||
|
||||
public:
|
||||
|
||||
CLASS_PROTODEF(cItemFrame);
|
||||
CLASS_PROTODEF(cItemFrame)
|
||||
|
||||
cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
|
||||
|
||||
@ -24,7 +24,7 @@ public:
|
||||
const cItem & GetItem(void) { return m_Item; } // tolua_export
|
||||
|
||||
/** Set the item in the frame */
|
||||
void SetItem(cItem & a_Item) { m_Item = a_Item; }; // tolua_export
|
||||
void SetItem(cItem & a_Item) { m_Item = a_Item; } // tolua_export
|
||||
|
||||
/** Returns the rotation from the item in the frame */
|
||||
Byte GetRotation(void) const { return m_Rotation; } // tolua_export
|
||||
|
@ -21,7 +21,7 @@ class cMinecart :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cMinecart);
|
||||
CLASS_PROTODEF(cMinecart)
|
||||
|
||||
/** Minecart payload, values correspond to packet subtype */
|
||||
enum ePayload
|
||||
@ -89,7 +89,7 @@ class cRideableMinecart :
|
||||
typedef cMinecart super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cRideableMinecart);
|
||||
CLASS_PROTODEF(cRideableMinecart)
|
||||
|
||||
cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height);
|
||||
|
||||
@ -113,7 +113,7 @@ class cMinecartWithChest :
|
||||
typedef cMinecart super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cMinecartWithChest);
|
||||
CLASS_PROTODEF(cMinecartWithChest)
|
||||
|
||||
/// Number of item slots in the chest
|
||||
static const int NumSlots = 9 * 3;
|
||||
@ -144,7 +144,7 @@ class cMinecartWithFurnace :
|
||||
typedef cMinecart super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cMinecartWithFurnace);
|
||||
CLASS_PROTODEF(cMinecartWithFurnace)
|
||||
|
||||
cMinecartWithFurnace(double a_X, double a_Y, double a_Z);
|
||||
|
||||
@ -176,7 +176,7 @@ class cMinecartWithTNT :
|
||||
typedef cMinecart super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cMinecartWithTNT);
|
||||
CLASS_PROTODEF(cMinecartWithTNT)
|
||||
|
||||
cMinecartWithTNT(double a_X, double a_Y, double a_Z);
|
||||
} ;
|
||||
@ -191,7 +191,7 @@ class cMinecartWithHopper :
|
||||
typedef cMinecart super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cMinecartWithHopper);
|
||||
CLASS_PROTODEF(cMinecartWithHopper)
|
||||
|
||||
cMinecartWithHopper(double a_X, double a_Y, double a_Z);
|
||||
} ;
|
||||
|
@ -15,7 +15,7 @@ class cPainting :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cPainting);
|
||||
CLASS_PROTODEF(cPainting)
|
||||
|
||||
cPainting(const AString & a_Name, int a_Direction, double a_X, double a_Y, double a_Z);
|
||||
const AString & GetName(void) const { return m_Name; } // tolua_export
|
||||
|
@ -16,7 +16,7 @@ class cPawn :
|
||||
typedef cEntity super;
|
||||
|
||||
public:
|
||||
CLASS_PROTODEF(cPawn);
|
||||
CLASS_PROTODEF(cPawn)
|
||||
|
||||
cPawn(eEntityType a_EntityType, double a_Width, double a_Height);
|
||||
|
||||
|
@ -23,7 +23,7 @@ class cPickup :
|
||||
public:
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cPickup);
|
||||
CLASS_PROTODEF(cPickup)
|
||||
|
||||
cPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, bool IsPlayerCreated, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); };
|
||||
virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); }
|
||||
|
||||
/** Returns the curently equipped weapon; empty item if none */
|
||||
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cProjectileEntity);
|
||||
CLASS_PROTODEF(cProjectileEntity)
|
||||
|
||||
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height);
|
||||
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height);
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cSplashPotionEntity);
|
||||
CLASS_PROTODEF(cSplashPotionEntity)
|
||||
|
||||
cSplashPotionEntity(
|
||||
cEntity * a_Creator,
|
||||
|
@ -14,7 +14,7 @@ class cTNTEntity :
|
||||
|
||||
public:
|
||||
// tolua_end
|
||||
CLASS_PROTODEF(cTNTEntity);
|
||||
CLASS_PROTODEF(cTNTEntity)
|
||||
|
||||
cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80);
|
||||
cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80);
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cThrownEggEntity);
|
||||
CLASS_PROTODEF(cThrownEggEntity)
|
||||
|
||||
cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cThrownEnderPearlEntity);
|
||||
CLASS_PROTODEF(cThrownEnderPearlEntity)
|
||||
|
||||
cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cThrownSnowballEntity);
|
||||
CLASS_PROTODEF(cThrownSnowballEntity)
|
||||
|
||||
cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
CLASS_PROTODEF(cWitherSkullEntity);
|
||||
CLASS_PROTODEF(cWitherSkullEntity)
|
||||
|
||||
cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
{
|
||||
public:
|
||||
cGenerator(cChunkGenerator & a_ChunkGenerator);
|
||||
virtual ~cGenerator() {} ; // Force a virtual destructor
|
||||
virtual ~cGenerator() {} // Force a virtual destructor
|
||||
|
||||
/// Called to initialize the generator on server startup.
|
||||
virtual void Initialize(cIniFile & a_IniFile);
|
||||
|
@ -415,6 +415,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "TallGrass") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenTallGrass(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "TestRails") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cTestRailsGen(Seed, 100, 1, 7, 50));
|
||||
|
@ -675,6 +675,8 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
|
||||
case biForestHills:
|
||||
case biTaigaHills:
|
||||
case biExtremeHillsEdge:
|
||||
case biExtremeHillsPlus:
|
||||
case biExtremeHills:
|
||||
case biJungle:
|
||||
case biJungleHills:
|
||||
case biJungleEdge:
|
||||
@ -750,18 +752,6 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
|
||||
return;
|
||||
}
|
||||
|
||||
case biExtremeHillsPlus:
|
||||
case biExtremeHills:
|
||||
{
|
||||
// Select the pattern to use - stone or grass:
|
||||
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX;
|
||||
NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ;
|
||||
NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY);
|
||||
const sBlockInfo * Pattern = (Val < -0.1) ? patStone.Get() : patGrass.Get();
|
||||
FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern);
|
||||
return;
|
||||
}
|
||||
|
||||
case biExtremeHillsPlusM:
|
||||
case biExtremeHillsM:
|
||||
{
|
||||
@ -769,7 +759,7 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
|
||||
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX;
|
||||
NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ;
|
||||
NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY);
|
||||
const sBlockInfo * Pattern = (Val < -0.9) ? patStone.Get() : ((Val > 0) ? patGravel.Get() : patGrass.Get());
|
||||
const sBlockInfo * Pattern = (Val < 0.0) ? patStone.Get() : patGrass.Get();
|
||||
FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern);
|
||||
return;
|
||||
}
|
||||
|
@ -45,42 +45,14 @@ static inline bool IsWater(BLOCKTYPE a_BlockType)
|
||||
|
||||
void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
double ChunkX = a_ChunkDesc.GetChunkX() + 0.1; // We can't devide through 0 so lets add 0.1 to all the chunk coordinates.
|
||||
double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1;
|
||||
|
||||
NOISE_DATATYPE Val1 = m_Noise.CubicNoise2D((float) (ChunkX * ChunkZ * 0.01f), (float) (ChunkZ / ChunkX * 0.01f));
|
||||
NOISE_DATATYPE Val2 = m_Noise.CubicNoise2D((float) (ChunkX / ChunkZ / 0.01f), (float) (ChunkZ * ChunkX / 0.01f));
|
||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||
|
||||
if (Val1 < 0)
|
||||
{
|
||||
Val1 = -Val1;
|
||||
}
|
||||
|
||||
if (Val2 < 0)
|
||||
{
|
||||
Val2 = -Val2;
|
||||
}
|
||||
int Val1 = m_Noise.IntNoise2DInt(ChunkX ^ ChunkZ, ChunkZ + ChunkX);
|
||||
int Val2 = m_Noise.IntNoise2DInt(ChunkZ ^ ChunkX, ChunkZ - ChunkX);
|
||||
|
||||
int PosX, PosZ;
|
||||
// Calculate PosX
|
||||
if (Val1 <= 1)
|
||||
{
|
||||
PosX = (int) floor(Val1 * 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
PosX = (int) floor(16 / Val1);
|
||||
}
|
||||
|
||||
// Calculate PosZ
|
||||
if (Val2 <= 1)
|
||||
{
|
||||
PosZ = (int) floor(Val2 * 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
PosZ = (int) floor(16 / Val2);
|
||||
}
|
||||
int PosX = Val1 % 16;
|
||||
int PosZ = Val2 % 16;
|
||||
|
||||
for (int y = 1; y < cChunkDef::Height; y++)
|
||||
{
|
||||
@ -88,12 +60,14 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cBlockInfo::IsSolid(a_ChunkDesc.GetBlockType(PosX, y - 1, PosZ))) // Only place on solid blocks
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NOISE_DATATYPE BlockType = m_Noise.CubicNoise1D((float) (ChunkX * ChunkZ) / (y * 0.1f));
|
||||
// Choose what block to use.
|
||||
NOISE_DATATYPE BlockType = m_Noise.IntNoise3D((int) ChunkX, y, (int) ChunkZ);
|
||||
if (BlockType < -0.7)
|
||||
{
|
||||
TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM);
|
||||
@ -119,12 +93,17 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
|
||||
for (int x = a_RelX - 4; x < a_RelX + 4; x++)
|
||||
{
|
||||
float xx = (float) a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
|
||||
int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
|
||||
for (int z = a_RelZ - 4; z < a_RelZ + 4; z++)
|
||||
{
|
||||
float zz = (float) a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
|
||||
int zz = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
|
||||
for (int y = a_RelY - 2; y < a_RelY + 2; y++)
|
||||
{
|
||||
if ((y < 1) || (y > cChunkDef::Height))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) // Don't replace non air blocks.
|
||||
{
|
||||
continue;
|
||||
@ -144,9 +123,8 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NOISE_DATATYPE Val = m_Noise.CubicNoise2D(xx, zz);
|
||||
if (Val < -0.70)
|
||||
NOISE_DATATYPE Val = m_Noise.IntNoise2D(xx, zz);
|
||||
if (Val < -0.5)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(x, y, z, a_Block);
|
||||
}
|
||||
@ -159,6 +137,65 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cFinishGenTallGrass:
|
||||
|
||||
void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
int xx = x + a_ChunkDesc.GetChunkX() * cChunkDef::Width;
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
{
|
||||
int zz = z + a_ChunkDesc.GetChunkZ() * cChunkDef::Width;
|
||||
int BiomeDensity = GetBiomeDensity(a_ChunkDesc.GetBiome(x, z));
|
||||
|
||||
// Choose if we want to place long grass here. If not then bail out:
|
||||
if ((m_Noise.IntNoise2DInt(xx + m_Noise.IntNoise1DInt(xx), zz + m_Noise.IntNoise1DInt(zz)) / 7 % 100) > BiomeDensity)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the top block + 1. This is the place where the grass would finaly be placed:
|
||||
int y = a_ChunkDesc.GetHeight(x, z) + 1;
|
||||
|
||||
// Check if long grass can be placed:
|
||||
if (
|
||||
(a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) ||
|
||||
((a_ChunkDesc.GetBlockType(x, y - 1, z) != E_BLOCK_GRASS) && (a_ChunkDesc.GetBlockType(x, y - 1, z) != E_BLOCK_DIRT))
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Choose what long grass meta we should use:
|
||||
int GrassType = m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 100;
|
||||
if (GrassType < 60)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 1);
|
||||
}
|
||||
else if (GrassType < 90)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If double long grass we have to choose what type we should use:
|
||||
if (a_ChunkDesc.GetBlockType(x, y + 1, z) == E_BLOCK_AIR)
|
||||
{
|
||||
NIBBLETYPE Meta = (m_Noise.IntNoise2DInt(xx * 100, zz * 100) / 7 % 100) > 25 ? 2 : 3;
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_BIG_FLOWER, Meta);
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, y + 1, z, E_BLOCK_BIG_FLOWER, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// cFinishGenSprinkleFoliage:
|
||||
|
||||
|
@ -69,6 +69,54 @@ protected:
|
||||
|
||||
|
||||
|
||||
class cFinishGenTallGrass :
|
||||
public cFinishGen
|
||||
{
|
||||
public:
|
||||
cFinishGenTallGrass(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
||||
|
||||
protected:
|
||||
cNoise m_Noise;
|
||||
int m_Seed;
|
||||
|
||||
// cFinishGen override:
|
||||
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||
|
||||
int GetBiomeDensity(EMCSBiome a_Biome)
|
||||
{
|
||||
switch (a_Biome)
|
||||
{
|
||||
case biSavanna:
|
||||
case biSavannaM:
|
||||
case biSavannaPlateau:
|
||||
case biSavannaPlateauM:
|
||||
case biPlains:
|
||||
{
|
||||
return 70;
|
||||
}
|
||||
|
||||
case biExtremeHillsEdge:
|
||||
case biExtremeHillsPlus:
|
||||
case biExtremeHills:
|
||||
case biExtremeHillsPlusM:
|
||||
case biExtremeHillsM:
|
||||
case biIceMountains:
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cFinishGenSprinkleFoliage :
|
||||
public cFinishGen
|
||||
{
|
||||
|
@ -2367,9 +2367,9 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] =
|
||||
"a: 24: 2\n" /* sandstone */
|
||||
"b: 4: 0\n" /* cobblestone */
|
||||
"c: 24: 0\n" /* sandstone */
|
||||
"d: 12: 0\n" /* sand */
|
||||
"e: 13: 0\n" /* gravel */
|
||||
"f: 5: 0\n" /* wood */
|
||||
"d: 13: 0\n" /* gravel */
|
||||
"e: 5: 0\n" /* wood */
|
||||
"f: 12: 0\n" /* sand */
|
||||
"g: 64: 3\n" /* wooddoorblock */
|
||||
"h: 85: 0\n" /* fence */
|
||||
"i: 64: 0\n" /* wooddoorblock */
|
||||
@ -2392,26 +2392,26 @@ const cPrefab::sDef g_AlchemistVillagePrefabs[] =
|
||||
/* * 012345678901234 */
|
||||
/* 0 */ "mmmabbbammmmmmm"
|
||||
/* 1 */ "mmmmbbbmmmmmmmm"
|
||||
/* 2 */ "acccccccccadddd"
|
||||
/* 3 */ "cccccccccccdddd"
|
||||
/* 4 */ "cccccccccccdddd"
|
||||
/* 5 */ "cccccccccccdddd"
|
||||
/* 6 */ "cccccccccccdddd"
|
||||
/* 7 */ "cccccccccccdddd"
|
||||
/* 8 */ "acccccccccadddd"
|
||||
/* 2 */ "acccccccccacccc"
|
||||
/* 3 */ "ccccccccccccccc"
|
||||
/* 4 */ "ccccccccccccccc"
|
||||
/* 5 */ "ccccccccccccccc"
|
||||
/* 6 */ "ccccccccccccccc"
|
||||
/* 7 */ "ccccccccccccccc"
|
||||
/* 8 */ "acccccccccacccc"
|
||||
|
||||
// Level 1
|
||||
/* z\x* 11111 */
|
||||
/* * 012345678901234 */
|
||||
/* 0 */ "mmmaeeeammmmmmm"
|
||||
/* 1 */ "mmmmeeemmmmmmmm"
|
||||
/* 2 */ "accccfccccadddd"
|
||||
/* 3 */ "cfffffffffcdddd"
|
||||
/* 4 */ "cfffffffffcdddd"
|
||||
/* 5 */ "cffffffffffdddd"
|
||||
/* 6 */ "cfffffffffcdddd"
|
||||
/* 7 */ "cfffffffffcdddd"
|
||||
/* 8 */ "acccccccccadddd"
|
||||
/* 0 */ "mmmadddammmmmmm"
|
||||
/* 1 */ "mmmmdddmmmmmmmm"
|
||||
/* 2 */ "acccceccccaffff"
|
||||
/* 3 */ "ceeeeeeeeecffff"
|
||||
/* 4 */ "ceeeeeeeeecffff"
|
||||
/* 5 */ "ceeeeeeeeeeffff"
|
||||
/* 6 */ "ceeeeeeeeecffff"
|
||||
/* 7 */ "ceeeeeeeeecffff"
|
||||
/* 8 */ "acccccccccaffff"
|
||||
|
||||
// Level 2
|
||||
/* z\x* 11111 */
|
||||
|
@ -134,11 +134,11 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
||||
// The data has been exported from the gallery Plains, area index 166, ID 554, created by Aloe_vera
|
||||
{
|
||||
// Size:
|
||||
11, 7, 13, // SizeX = 11, SizeY = 7, SizeZ = 13
|
||||
11, 8, 13, // SizeX = 11, SizeY = 8, SizeZ = 13
|
||||
|
||||
// Hitbox (relative to bounding box):
|
||||
0, 0, 0, // MinX, MinY, MinZ
|
||||
10, 6, 12, // MaxX, MaxY, MaxZ
|
||||
10, 7, 12, // MaxX, MaxY, MaxZ
|
||||
|
||||
// Block definitions:
|
||||
".: 0: 0\n" /* air */
|
||||
@ -150,6 +150,7 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
||||
"f: 59: 7\n" /* crops */
|
||||
"g: 83: 0\n" /* reedblock */
|
||||
"h:113: 0\n" /* netherbrickfence */
|
||||
"i: 50: 5\n" /* torch */
|
||||
"m: 19: 0\n" /* sponge */,
|
||||
|
||||
// Block data:
|
||||
@ -270,7 +271,24 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ ".h.......h."
|
||||
/* 11 */ "hhh.....hhh"
|
||||
/* 12 */ ".h.......h.",
|
||||
/* 12 */ ".h.......h."
|
||||
|
||||
// Level 7
|
||||
/* z\x* 1 */
|
||||
/* * 01234567890 */
|
||||
/* 0 */ ".i.......i."
|
||||
/* 1 */ "i.i.....i.i"
|
||||
/* 2 */ ".i.......i."
|
||||
/* 3 */ "..........."
|
||||
/* 4 */ "..........."
|
||||
/* 5 */ "..........."
|
||||
/* 6 */ "..........."
|
||||
/* 7 */ "..........."
|
||||
/* 8 */ "..........."
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ ".i.......i."
|
||||
/* 11 */ "i.i.....i.i"
|
||||
/* 12 */ ".i.......i.",
|
||||
|
||||
// Connectors:
|
||||
"-1: 10, 2, 6: 5\n" /* Type -1, direction X+ */,
|
||||
@ -2195,33 +2213,33 @@ const cPrefab::sDef g_JapaneseVillagePrefabs[] =
|
||||
|
||||
// Level 1
|
||||
/* z\x* 0123456 */
|
||||
/* 0 */ "bmmmmmm"
|
||||
/* 1 */ "bmmmmmm"
|
||||
/* 2 */ "bmmmmmm"
|
||||
/* 3 */ "bmmmmmm"
|
||||
/* 4 */ "bmmmmmm"
|
||||
/* 5 */ "bmmmmmm"
|
||||
/* 0 */ "bbbbbbb"
|
||||
/* 1 */ "bbbbbbb"
|
||||
/* 2 */ "bbbbbbb"
|
||||
/* 3 */ "bbbabbb"
|
||||
/* 4 */ "bbbbbbb"
|
||||
/* 5 */ "bbbbbbb"
|
||||
/* 6 */ "bbbbbbb"
|
||||
|
||||
// Level 2
|
||||
/* z\x* 0123456 */
|
||||
/* 0 */ "......."
|
||||
/* 1 */ "..c.c.."
|
||||
/* 0 */ "mm...mm"
|
||||
/* 1 */ "m.c...m"
|
||||
/* 2 */ ".dccdc."
|
||||
/* 3 */ "..cefc."
|
||||
/* 4 */ ".ccfgh."
|
||||
/* 5 */ "..ccc.."
|
||||
/* 6 */ "......."
|
||||
/* 5 */ "m.ccc.m"
|
||||
/* 6 */ "mm...mm"
|
||||
|
||||
// Level 3
|
||||
/* z\x* 0123456 */
|
||||
/* 0 */ "......."
|
||||
/* 0 */ "m.....m"
|
||||
/* 1 */ "......."
|
||||
/* 2 */ "......."
|
||||
/* 3 */ "...e..."
|
||||
/* 4 */ "......."
|
||||
/* 5 */ "......."
|
||||
/* 6 */ "......."
|
||||
/* 6 */ "m.....m"
|
||||
|
||||
// Level 4
|
||||
/* z\x* 0123456 */
|
||||
|
@ -356,8 +356,8 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
"e: 8: 0\n" /* water */
|
||||
"f: 50: 5\n" /* torch */
|
||||
"g: 59: 7\n" /* crops */
|
||||
"h: 59: 0\n" /* crops */
|
||||
"i: 59: 1\n" /* crops */
|
||||
"h: 59: 3\n" /* crops */
|
||||
"i: 59: 5\n" /* crops */
|
||||
"m: 19: 0\n" /* sponge */,
|
||||
|
||||
// Block data:
|
||||
@ -368,7 +368,7 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 1 */ "aaaaaaaaaaaaaaa"
|
||||
/* 2 */ "aaaaaaaaaaaaaaa"
|
||||
/* 3 */ "aaaaaaaaaaaaaaa"
|
||||
/* 4 */ "aaaaaaaaaaaaaaa"
|
||||
/* 4 */ "aaaaaaabaaaaaaa"
|
||||
/* 5 */ "aaaaaaabaaaaaaa"
|
||||
/* 6 */ "aaaaaaabaaaaaaa"
|
||||
/* 7 */ "aaaaaaabaaaaaaa"
|
||||
@ -405,12 +405,12 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* * 012345678901234 */
|
||||
/* 0 */ "f.....f.f.....f"
|
||||
/* 1 */ ".gg.gg...gg.gg."
|
||||
/* 2 */ ".gh.hg...gg.gg."
|
||||
/* 3 */ ".gh.ih...gg.gg."
|
||||
/* 4 */ ".gg.hg...gg.gg."
|
||||
/* 5 */ ".gg.hg...gg.gg."
|
||||
/* 6 */ ".ig.hg...gg.gg."
|
||||
/* 7 */ ".hg.gh...gg.gg."
|
||||
/* 2 */ ".gg.hg...gg.gg."
|
||||
/* 3 */ ".gg.gi...gg.gg."
|
||||
/* 4 */ ".gg.gg...gg.gg."
|
||||
/* 5 */ ".gg.gg...gg.gg."
|
||||
/* 6 */ ".gg.gg...gg.gg."
|
||||
/* 7 */ ".gg.gg...gg.gg."
|
||||
/* 8 */ "f.....f.f.....f"
|
||||
|
||||
// Level 4
|
||||
@ -3603,8 +3603,8 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
|
||||
// Block definitions:
|
||||
".: 0: 0\n" /* air */
|
||||
"a: 2: 0\n" /* grass */
|
||||
"b: 3: 0\n" /* dirt */
|
||||
"a: 3: 0\n" /* dirt */
|
||||
"b: 2: 0\n" /* grass */
|
||||
"c: 4: 0\n" /* cobblestone */
|
||||
"d: 67: 0\n" /* stairs */
|
||||
"e: 67: 2\n" /* stairs */
|
||||
@ -3629,19 +3629,19 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
// Level 0
|
||||
/* z\x* 1 */
|
||||
/* * 01234567890 */
|
||||
/* 0 */ "aaaabbbaaaa"
|
||||
/* 1 */ "abbbbbbbbba"
|
||||
/* 2 */ "abbbbbbbbba"
|
||||
/* 3 */ "abbbbbbbbba"
|
||||
/* 4 */ "abbbbbbbbba"
|
||||
/* 5 */ "abbbbbbbbba"
|
||||
/* 6 */ "abbbbbbbbba"
|
||||
/* 7 */ "abbbbbbbbba"
|
||||
/* 8 */ "aabbbbbbbaa"
|
||||
/* 9 */ "aabbbbbbbaa"
|
||||
/* 10 */ "aabbbbbbbaa"
|
||||
/* 11 */ "aabbbbbbbaa"
|
||||
/* 12 */ "aabbbbbbbaa"
|
||||
/* 0 */ "aaaaaaaaaaa"
|
||||
/* 1 */ "aaaaaaaaaaa"
|
||||
/* 2 */ "aaaaaaaaaaa"
|
||||
/* 3 */ "aaaaaaaaaaa"
|
||||
/* 4 */ "aaaaaaaaaab"
|
||||
/* 5 */ "baaaaaaaaab"
|
||||
/* 6 */ "aaaaaaaaaaa"
|
||||
/* 7 */ "baaaaaaaaaa"
|
||||
/* 8 */ "baaaaaaaaaa"
|
||||
/* 9 */ "baaaaaaaaab"
|
||||
/* 10 */ "aaaaaaaaaaa"
|
||||
/* 11 */ "aaaaaaaaaba"
|
||||
/* 12 */ "aaaaaaaaaba"
|
||||
|
||||
// Level 1
|
||||
/* z\x* 1 */
|
||||
@ -3654,11 +3654,11 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 5 */ "mcccccccccm"
|
||||
/* 6 */ "mcccccccccm"
|
||||
/* 7 */ "mcccccccccm"
|
||||
/* 8 */ "mmbbbbbbbmm"
|
||||
/* 9 */ "mmbbbbbbbmm"
|
||||
/* 10 */ "mmbbbbbbbmm"
|
||||
/* 11 */ "mmbbbbbbbmm"
|
||||
/* 12 */ "mmbbbbbbbmm"
|
||||
/* 8 */ "mmaaaaaaamm"
|
||||
/* 9 */ "mmaaaaaaamm"
|
||||
/* 10 */ "mmaaaaaaamm"
|
||||
/* 11 */ "mmaaaaaaamm"
|
||||
/* 12 */ "mmaaaaaaamm"
|
||||
|
||||
// Level 2
|
||||
/* z\x* 1 */
|
||||
@ -3671,11 +3671,11 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 5 */ ".cggggcccc."
|
||||
/* 6 */ ".cggggcccc."
|
||||
/* 7 */ ".ccccccccc."
|
||||
/* 8 */ "..aaaaaaa.."
|
||||
/* 9 */ "..aaaaaaa.."
|
||||
/* 10 */ "..aaaaaaa.."
|
||||
/* 11 */ "..aaaaaaa.."
|
||||
/* 12 */ "..aaaaaaa.."
|
||||
/* 8 */ "..bbbbbbb.."
|
||||
/* 9 */ "mmbbbbbbbmm"
|
||||
/* 10 */ "mmbbbbbbbmm"
|
||||
/* 11 */ "mmbbbbbbbmm"
|
||||
/* 12 */ "mmbbbbbbbmm"
|
||||
|
||||
// Level 3
|
||||
/* z\x* 1 */
|
||||
@ -3689,10 +3689,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ ".i.......i."
|
||||
/* 7 */ ".hiiijiiih."
|
||||
/* 8 */ "..l.....l.."
|
||||
/* 9 */ "..l.....l.."
|
||||
/* 10 */ "..l.....l.."
|
||||
/* 11 */ "..l.....l.."
|
||||
/* 12 */ "..lllllll.."
|
||||
/* 9 */ "mml.....lmm"
|
||||
/* 10 */ "mml.....lmm"
|
||||
/* 11 */ "mml.....lmm"
|
||||
/* 12 */ "mmlllllllmm"
|
||||
|
||||
// Level 4
|
||||
/* z\x* 1 */
|
||||
@ -3706,10 +3706,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ ".o.......o."
|
||||
/* 7 */ ".hooipiooh."
|
||||
/* 8 */ "..........."
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ "..........."
|
||||
/* 11 */ "..........."
|
||||
/* 12 */ "..........."
|
||||
/* 9 */ "mm.......mm"
|
||||
/* 10 */ "mm.......mm"
|
||||
/* 11 */ "mm.......mm"
|
||||
/* 12 */ "mm.......mm"
|
||||
|
||||
// Level 5
|
||||
/* z\x* 1 */
|
||||
@ -3723,10 +3723,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ ".i.......i."
|
||||
/* 7 */ "uiiiiiiiiiu"
|
||||
/* 8 */ "kkkkkkkkkkk"
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ "..........."
|
||||
/* 11 */ "..........."
|
||||
/* 12 */ "..........."
|
||||
/* 9 */ "mm.......mm"
|
||||
/* 10 */ "mm.......mm"
|
||||
/* 11 */ "mm.......mm"
|
||||
/* 12 */ "mm.......mm"
|
||||
|
||||
// Level 6
|
||||
/* z\x* 1 */
|
||||
@ -3740,10 +3740,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ "uiiiiiiiiiu"
|
||||
/* 7 */ "kkkkkkkkkkk"
|
||||
/* 8 */ "..........."
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ "..........."
|
||||
/* 11 */ "..........."
|
||||
/* 12 */ "..........."
|
||||
/* 9 */ "mm.......mm"
|
||||
/* 10 */ "mm.......mm"
|
||||
/* 11 */ "mm.......mm"
|
||||
/* 12 */ "mm.......mm"
|
||||
|
||||
// Level 7
|
||||
/* z\x* 1 */
|
||||
@ -3757,10 +3757,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ "kkkkkkkkkkk"
|
||||
/* 7 */ "..........."
|
||||
/* 8 */ "..........."
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ "..........."
|
||||
/* 11 */ "..........."
|
||||
/* 12 */ "..........."
|
||||
/* 9 */ "mm.......mm"
|
||||
/* 10 */ "mm.......mm"
|
||||
/* 11 */ "mm.......mm"
|
||||
/* 12 */ "mm.......mm"
|
||||
|
||||
// Level 8
|
||||
/* z\x* 1 */
|
||||
@ -3774,10 +3774,10 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 6 */ "..........."
|
||||
/* 7 */ "..........."
|
||||
/* 8 */ "..........."
|
||||
/* 9 */ "..........."
|
||||
/* 10 */ "..........."
|
||||
/* 11 */ "..........."
|
||||
/* 12 */ "...........",
|
||||
/* 9 */ "mm.......mm"
|
||||
/* 10 */ "mm.......mm"
|
||||
/* 11 */ "mm.......mm"
|
||||
/* 12 */ "mm.......mm",
|
||||
|
||||
// Connectors:
|
||||
"-1: 5, 2, 0: 2\n" /* Type -1, direction Z- */,
|
||||
@ -4237,30 +4237,29 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
// Block definitions:
|
||||
".: 0: 0\n" /* air */
|
||||
"a: 4: 0\n" /* cobblestone */
|
||||
"b: 2: 0\n" /* grass */
|
||||
"c: 67: 0\n" /* stairs */
|
||||
"d: 67: 2\n" /* stairs */
|
||||
"e: 67: 1\n" /* stairs */
|
||||
"f: 5: 0\n" /* wood */
|
||||
"g: 67: 3\n" /* stairs */
|
||||
"h: 17: 0\n" /* tree */
|
||||
"i: 64: 7\n" /* wooddoorblock */
|
||||
"j: 64: 5\n" /* wooddoorblock */
|
||||
"k:102: 0\n" /* glasspane */
|
||||
"l: 64:12\n" /* wooddoorblock */
|
||||
"b: 67: 0\n" /* stairs */
|
||||
"c: 67: 2\n" /* stairs */
|
||||
"d: 67: 1\n" /* stairs */
|
||||
"e: 5: 0\n" /* wood */
|
||||
"f: 67: 3\n" /* stairs */
|
||||
"g: 17: 0\n" /* tree */
|
||||
"h: 64: 7\n" /* wooddoorblock */
|
||||
"i: 64: 5\n" /* wooddoorblock */
|
||||
"j:102: 0\n" /* glasspane */
|
||||
"k: 64:12\n" /* wooddoorblock */
|
||||
"l: 53: 2\n" /* woodstairs */
|
||||
"m: 19: 0\n" /* sponge */
|
||||
"n: 53: 2\n" /* woodstairs */
|
||||
"o: 53: 1\n" /* woodstairs */
|
||||
"p: 53: 7\n" /* woodstairs */
|
||||
"q: 53: 6\n" /* woodstairs */
|
||||
"r: 53: 3\n" /* woodstairs */
|
||||
"s: 53: 0\n" /* woodstairs */
|
||||
"t: 53: 5\n" /* woodstairs */
|
||||
"u: 53: 4\n" /* woodstairs */
|
||||
"v: 50: 3\n" /* torch */
|
||||
"w: 50: 2\n" /* torch */
|
||||
"x: 50: 4\n" /* torch */
|
||||
"y: 50: 1\n" /* torch */,
|
||||
"n: 53: 1\n" /* woodstairs */
|
||||
"o: 53: 7\n" /* woodstairs */
|
||||
"p: 53: 6\n" /* woodstairs */
|
||||
"q: 53: 3\n" /* woodstairs */
|
||||
"r: 53: 0\n" /* woodstairs */
|
||||
"s: 53: 5\n" /* woodstairs */
|
||||
"t: 53: 4\n" /* woodstairs */
|
||||
"u: 50: 3\n" /* torch */
|
||||
"v: 50: 2\n" /* torch */
|
||||
"w: 50: 4\n" /* torch */
|
||||
"x: 50: 1\n" /* torch */,
|
||||
|
||||
// Block data:
|
||||
// Level 0
|
||||
@ -4274,134 +4273,134 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 5 */ "maaaaaaaaaaaaaam"
|
||||
/* 6 */ "maaaaaaaaaaaaaam"
|
||||
/* 7 */ "maaaaaaaaaaaaaam"
|
||||
/* 8 */ "bbbbbaaaaaaaaaam"
|
||||
/* 9 */ "bbbbbbbbaaaaaaam"
|
||||
/* 10 */ "bbbbbbbbaaaaaaam"
|
||||
/* 11 */ "bbbbbbbbaaaaaaam"
|
||||
/* 12 */ "bbbbbbbbaaaaaaam"
|
||||
/* 13 */ "bbbbbbbbaaaaaaam"
|
||||
/* 14 */ "bbbbbbbbaaaaaaam"
|
||||
/* 15 */ "bbbbbbbbmmmmmmmm"
|
||||
/* 8 */ "mmmmmaaaaaaaaaam"
|
||||
/* 9 */ "mmmmmmmmaaaaaaam"
|
||||
/* 10 */ "mmmmmmmmaaaaaaam"
|
||||
/* 11 */ "mmmmmmmmaaaaaaam"
|
||||
/* 12 */ "mmmmmmmmaaaaaaam"
|
||||
/* 13 */ "mmmmmmmmaaaaaaam"
|
||||
/* 14 */ "mmmmmmmmaaaaaaam"
|
||||
/* 15 */ "mmmmmmmmmmmmmmmm"
|
||||
|
||||
// Level 1
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "........cde....."
|
||||
/* 0 */ "........bcd....."
|
||||
/* 1 */ ".aaaaaaaaaaaaaa."
|
||||
/* 2 */ ".affffffffffffa."
|
||||
/* 3 */ ".affffffffffffa."
|
||||
/* 4 */ ".affffffffffffa."
|
||||
/* 5 */ ".affffffffffffa."
|
||||
/* 6 */ ".affffffffffffa."
|
||||
/* 7 */ ".aaaaaaaafffffa."
|
||||
/* 8 */ ".....cgeafffffa."
|
||||
/* 9 */ "........afffffa."
|
||||
/* 10 */ "........afffffa."
|
||||
/* 11 */ "........afffffa."
|
||||
/* 12 */ "........afffffa."
|
||||
/* 13 */ "........afffffa."
|
||||
/* 14 */ "........aaaaaaa."
|
||||
/* 15 */ "................"
|
||||
/* 2 */ ".aeeeeeeeeeeeea."
|
||||
/* 3 */ ".aeeeeeeeeeeeea."
|
||||
/* 4 */ ".aeeeeeeeeeeeea."
|
||||
/* 5 */ ".aeeeeeeeeeeeea."
|
||||
/* 6 */ ".aeeeeeeeeeeeea."
|
||||
/* 7 */ ".aaaaaaaaeeeeea."
|
||||
/* 8 */ ".....bfdaeeeeea."
|
||||
/* 9 */ "mmmm....aeeeeea."
|
||||
/* 10 */ "mmmmmmm.aeeeeea."
|
||||
/* 11 */ "mmmmmmm.aeeeeea."
|
||||
/* 12 */ "mmmmmmm.aeeeeea."
|
||||
/* 13 */ "mmmmmmm.aeeeeea."
|
||||
/* 14 */ "mmmmmmm.aaaaaaa."
|
||||
/* 15 */ "mmmmmmm........."
|
||||
|
||||
// Level 2
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "................"
|
||||
/* 1 */ ".hffffffhihfffh."
|
||||
/* 2 */ ".f............f."
|
||||
/* 3 */ ".f............f."
|
||||
/* 4 */ ".f............f."
|
||||
/* 5 */ ".f............f."
|
||||
/* 6 */ ".f............f."
|
||||
/* 7 */ ".hffffjfh.....f."
|
||||
/* 8 */ "........f.....f."
|
||||
/* 9 */ "........f.....f."
|
||||
/* 10 */ "........f.....f."
|
||||
/* 11 */ "........f.....f."
|
||||
/* 12 */ "........f.....f."
|
||||
/* 13 */ "........f.....f."
|
||||
/* 14 */ "........hfffffh."
|
||||
/* 15 */ "................"
|
||||
/* 1 */ ".geeeeeeghgeeeg."
|
||||
/* 2 */ ".e............e."
|
||||
/* 3 */ ".e............e."
|
||||
/* 4 */ ".e............e."
|
||||
/* 5 */ ".e............e."
|
||||
/* 6 */ ".e............e."
|
||||
/* 7 */ ".geeeeieg.....e."
|
||||
/* 8 */ "........e.....e."
|
||||
/* 9 */ "mmmm....e.....e."
|
||||
/* 10 */ "mmmmmmm.e.....e."
|
||||
/* 11 */ "mmmmmmm.e.....e."
|
||||
/* 12 */ "mmmmmmm.e.....e."
|
||||
/* 13 */ "mmmmmmm.e.....e."
|
||||
/* 14 */ "mmmmmmm.geeeeeg."
|
||||
/* 15 */ "mmmmmmm........."
|
||||
|
||||
// Level 3
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "................"
|
||||
/* 1 */ ".hfkkfkkhlhkkfh."
|
||||
/* 2 */ ".k............f."
|
||||
/* 3 */ ".k............k."
|
||||
/* 4 */ ".k............k."
|
||||
/* 5 */ ".k............f."
|
||||
/* 6 */ ".k............k."
|
||||
/* 7 */ ".hfkkflfh.....k."
|
||||
/* 8 */ "........f.....f."
|
||||
/* 9 */ "........k.....k."
|
||||
/* 10 */ "........k.....k."
|
||||
/* 11 */ "........f.....f."
|
||||
/* 12 */ "........k.....k."
|
||||
/* 13 */ "........k.....k."
|
||||
/* 14 */ "........hkkkkkh."
|
||||
/* 15 */ "................"
|
||||
/* 1 */ ".gejjejjgkgjjeg."
|
||||
/* 2 */ ".j............e."
|
||||
/* 3 */ ".j............j."
|
||||
/* 4 */ ".j............j."
|
||||
/* 5 */ ".j............e."
|
||||
/* 6 */ ".j............j."
|
||||
/* 7 */ ".gejjekeg.....j."
|
||||
/* 8 */ "........e.....e."
|
||||
/* 9 */ "mmmm....j.....j."
|
||||
/* 10 */ "mmmmmmm.j.....j."
|
||||
/* 11 */ "mmmmmmm.e.....e."
|
||||
/* 12 */ "mmmmmmm.j.....j."
|
||||
/* 13 */ "mmmmmmm.j.....j."
|
||||
/* 14 */ "mmmmmmm.gjjjjjg."
|
||||
/* 15 */ "mmmmmmm........."
|
||||
|
||||
// Level 4
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "nnnnnnnnnnnnnnno"
|
||||
/* 1 */ "phffffffhfhfffho"
|
||||
/* 2 */ ".f............fo"
|
||||
/* 3 */ ".f............fo"
|
||||
/* 4 */ ".f............fo"
|
||||
/* 5 */ ".f............fo"
|
||||
/* 6 */ ".f............fo"
|
||||
/* 7 */ "qhffffffh.....fo"
|
||||
/* 8 */ "rrrrrrrsf.....fo"
|
||||
/* 9 */ ".......sf.....fo"
|
||||
/* 10 */ ".......sf.....fo"
|
||||
/* 11 */ ".......sf.....fo"
|
||||
/* 12 */ ".......sf.....fo"
|
||||
/* 13 */ ".......sf.....fo"
|
||||
/* 14 */ ".......shfffffho"
|
||||
/* 15 */ ".......st.....uo"
|
||||
/* 0 */ "llllllllllllllln"
|
||||
/* 1 */ "ogeeeeeegegeeegn"
|
||||
/* 2 */ ".e............en"
|
||||
/* 3 */ ".e............en"
|
||||
/* 4 */ ".e............en"
|
||||
/* 5 */ ".e............en"
|
||||
/* 6 */ ".e............en"
|
||||
/* 7 */ "pgeeeeeeg.....en"
|
||||
/* 8 */ "qqqqqqqre.....en"
|
||||
/* 9 */ "mmmm...re.....en"
|
||||
/* 10 */ "mmmmmmmre.....en"
|
||||
/* 11 */ "mmmmmmmre.....en"
|
||||
/* 12 */ "mmmmmmmre.....en"
|
||||
/* 13 */ "mmmmmmmre.....en"
|
||||
/* 14 */ "mmmmmmmrgeeeeegn"
|
||||
/* 15 */ "mmmmmmmrs.....tn"
|
||||
|
||||
// Level 5
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "................"
|
||||
/* 1 */ "nnnnnnnnnnnnnnn."
|
||||
/* 2 */ "pfffffffffffffo."
|
||||
/* 3 */ ".f.........v.fo."
|
||||
/* 4 */ ".f..........wfo."
|
||||
/* 5 */ ".f......x....fo."
|
||||
/* 6 */ "qfffffffff...fo."
|
||||
/* 7 */ "rrrrrrrrsfy..fo."
|
||||
/* 8 */ "........sf...fo."
|
||||
/* 9 */ "........sf...fo."
|
||||
/* 10 */ "........sf...fo."
|
||||
/* 11 */ "........sf...fo."
|
||||
/* 12 */ "........sf...fo."
|
||||
/* 13 */ "........sf...fo."
|
||||
/* 14 */ "........sfffffo."
|
||||
/* 15 */ "........st...uo."
|
||||
/* 1 */ "lllllllllllllll."
|
||||
/* 2 */ "oeeeeeeeeeeeeen."
|
||||
/* 3 */ ".e.........u.en."
|
||||
/* 4 */ ".e..........ven."
|
||||
/* 5 */ ".e......w....en."
|
||||
/* 6 */ "peeeeeeeee...en."
|
||||
/* 7 */ "qqqqqqqqrex..en."
|
||||
/* 8 */ "........re...en."
|
||||
/* 9 */ "mmmm....re...en."
|
||||
/* 10 */ "mmmmmmm.re...en."
|
||||
/* 11 */ "mmmmmmm.re...en."
|
||||
/* 12 */ "mmmmmmm.re...en."
|
||||
/* 13 */ "mmmmmmm.re...en."
|
||||
/* 14 */ "mmmmmmm.reeeeen."
|
||||
/* 15 */ "mmmmmmm.rs...tn."
|
||||
|
||||
// Level 6
|
||||
/* z\x* 111111 */
|
||||
/* * 0123456789012345 */
|
||||
/* 0 */ "................"
|
||||
/* 1 */ "................"
|
||||
/* 2 */ "nnnnnnnnnnnnno.."
|
||||
/* 3 */ "pffffffffffffo.."
|
||||
/* 4 */ ".fy.........fo.."
|
||||
/* 5 */ "qffffffffff.fo.."
|
||||
/* 6 */ "rrrrrrrrrsf.fo.."
|
||||
/* 7 */ ".........sf.fo.."
|
||||
/* 8 */ ".........sf.fo.."
|
||||
/* 9 */ ".........sf.fo.."
|
||||
/* 10 */ ".........sf.fo.."
|
||||
/* 11 */ ".........sf.fo.."
|
||||
/* 12 */ ".........sf.fo.."
|
||||
/* 13 */ ".........sfxfo.."
|
||||
/* 14 */ ".........sfffo.."
|
||||
/* 15 */ ".........st.uo.."
|
||||
/* 2 */ "llllllllllllln.."
|
||||
/* 3 */ "oeeeeeeeeeeeen.."
|
||||
/* 4 */ ".ex.........en.."
|
||||
/* 5 */ "peeeeeeeeee.en.."
|
||||
/* 6 */ "qqqqqqqqqre.en.."
|
||||
/* 7 */ ".........re.en.."
|
||||
/* 8 */ ".........re.en.."
|
||||
/* 9 */ "mmmm.....re.en.."
|
||||
/* 10 */ "mmmmmmm..re.en.."
|
||||
/* 11 */ "mmmmmmm..re.en.."
|
||||
/* 12 */ "mmmmmmm..re.en.."
|
||||
/* 13 */ "mmmmmmm..rewen.."
|
||||
/* 14 */ "mmmmmmm..reeen.."
|
||||
/* 15 */ "mmmmmmm..rs.tn.."
|
||||
|
||||
// Level 7
|
||||
/* z\x* 111111 */
|
||||
@ -4409,19 +4408,19 @@ const cPrefab::sDef g_PlainsVillagePrefabs[] =
|
||||
/* 0 */ "................"
|
||||
/* 1 */ "................"
|
||||
/* 2 */ "................"
|
||||
/* 3 */ "nnnnnnnnnnnnn..."
|
||||
/* 4 */ "ffffffffffffo..."
|
||||
/* 5 */ "rrrrrrrrrrsfo..."
|
||||
/* 6 */ "..........sfo..."
|
||||
/* 7 */ "..........sfo..."
|
||||
/* 8 */ "..........sfo..."
|
||||
/* 9 */ "..........sfo..."
|
||||
/* 10 */ "..........sfo..."
|
||||
/* 11 */ "..........sfo..."
|
||||
/* 12 */ "..........sfo..."
|
||||
/* 13 */ "..........sfo..."
|
||||
/* 14 */ "..........sfo..."
|
||||
/* 15 */ "..........sfo...",
|
||||
/* 3 */ "lllllllllllll..."
|
||||
/* 4 */ "eeeeeeeeeeeen..."
|
||||
/* 5 */ "qqqqqqqqqqren..."
|
||||
/* 6 */ "..........ren..."
|
||||
/* 7 */ "..........ren..."
|
||||
/* 8 */ "..........ren..."
|
||||
/* 9 */ "mmmm......ren..."
|
||||
/* 10 */ "mmmmmmm...ren..."
|
||||
/* 11 */ "mmmmmmm...ren..."
|
||||
/* 12 */ "mmmmmmm...ren..."
|
||||
/* 13 */ "mmmmmmm...ren..."
|
||||
/* 14 */ "mmmmmmm...ren..."
|
||||
/* 15 */ "mmmmmmm...ren...",
|
||||
|
||||
// Connectors:
|
||||
"-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */,
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
cHTTPMessage(eKind a_Kind);
|
||||
|
||||
// Force a virtual destructor in all descendants
|
||||
virtual ~cHTTPMessage() {};
|
||||
virtual ~cHTTPMessage() {}
|
||||
|
||||
/** Adds a header into the internal map of headers. Recognizes special headers: Content-Type and Content-Length */
|
||||
void AddHeader(const AString & a_Key, const AString & a_Value);
|
||||
|
@ -328,12 +328,9 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
|
||||
|
||||
if (a_Player->IsGameModeSurvival())
|
||||
{
|
||||
if (!BlockRequiresSpecialTool(Block) || CanHarvestBlock(Block))
|
||||
{
|
||||
cChunkInterface ChunkInterface(a_World->GetChunkMap());
|
||||
cBlockInServerPluginInterface PluginInterface(*a_World);
|
||||
Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
cChunkInterface ChunkInterface(a_World->GetChunkMap());
|
||||
cBlockInServerPluginInterface PluginInterface(*a_World);
|
||||
Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block), a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0);
|
||||
}
|
||||
|
||||
if (!cBlockInfo::IsOneHitDig(Block))
|
||||
@ -542,9 +539,50 @@ bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
|
||||
|
||||
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
|
||||
{
|
||||
UNUSED(a_BlockType);
|
||||
|
||||
return false;
|
||||
switch (a_BlockType)
|
||||
{
|
||||
case E_BLOCK_ANVIL:
|
||||
case E_BLOCK_ENCHANTMENT_TABLE:
|
||||
case E_BLOCK_FURNACE:
|
||||
case E_BLOCK_LIT_FURNACE:
|
||||
case E_BLOCK_COAL_ORE:
|
||||
case E_BLOCK_STONE:
|
||||
case E_BLOCK_COBBLESTONE:
|
||||
case E_BLOCK_END_STONE:
|
||||
case E_BLOCK_MOSSY_COBBLESTONE:
|
||||
case E_BLOCK_SANDSTONE_STAIRS:
|
||||
case E_BLOCK_SANDSTONE:
|
||||
case E_BLOCK_STONE_BRICKS:
|
||||
case E_BLOCK_NETHER_BRICK:
|
||||
case E_BLOCK_NETHERRACK:
|
||||
case E_BLOCK_STONE_SLAB:
|
||||
case E_BLOCK_DOUBLE_STONE_SLAB:
|
||||
case E_BLOCK_STONE_PRESSURE_PLATE:
|
||||
case E_BLOCK_BRICK:
|
||||
case E_BLOCK_COBBLESTONE_STAIRS:
|
||||
case E_BLOCK_COBBLESTONE_WALL:
|
||||
case E_BLOCK_STONE_BRICK_STAIRS:
|
||||
case E_BLOCK_NETHER_BRICK_STAIRS:
|
||||
case E_BLOCK_CAULDRON:
|
||||
case E_BLOCK_OBSIDIAN:
|
||||
case E_BLOCK_DIAMOND_BLOCK:
|
||||
case E_BLOCK_DIAMOND_ORE:
|
||||
case E_BLOCK_GOLD_BLOCK:
|
||||
case E_BLOCK_GOLD_ORE:
|
||||
case E_BLOCK_REDSTONE_ORE:
|
||||
case E_BLOCK_REDSTONE_ORE_GLOWING:
|
||||
case E_BLOCK_EMERALD_ORE:
|
||||
case E_BLOCK_IRON_BLOCK:
|
||||
case E_BLOCK_IRON_ORE:
|
||||
case E_BLOCK_LAPIS_ORE:
|
||||
case E_BLOCK_LAPIS_BLOCK:
|
||||
case E_BLOCK_SNOW:
|
||||
case E_BLOCK_VINES:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
class cItemPickaxeHandler :
|
||||
public cItemHandler
|
||||
{
|
||||
typedef cItemHandler super;
|
||||
public:
|
||||
cItemPickaxeHandler(int a_ItemType)
|
||||
: cItemHandler(a_ItemType)
|
||||
@ -84,7 +85,7 @@ public:
|
||||
return PickaxeLevel() >= 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return super::CanHarvestBlock(a_BlockType);
|
||||
}
|
||||
|
||||
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
} // switch (a_BlockType)
|
||||
return false;
|
||||
return super::CanHarvestBlock(a_BlockType);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
class cItemShovelHandler : public cItemHandler
|
||||
{
|
||||
typedef cItemHandler super;
|
||||
public:
|
||||
cItemShovelHandler(int a_ItemType)
|
||||
: cItemHandler(a_ItemType)
|
||||
@ -39,7 +40,11 @@ public:
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
return (a_BlockType == E_BLOCK_SNOW);
|
||||
if (a_BlockType == E_BLOCK_SNOW)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super::CanHarvestBlock(a_BlockType);
|
||||
}
|
||||
|
||||
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
|
||||
|
@ -22,7 +22,11 @@ public:
|
||||
|
||||
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
||||
{
|
||||
return (a_BlockType == E_BLOCK_COBWEB);
|
||||
if (a_BlockType == E_BLOCK_COBWEB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return super::CanHarvestBlock(a_BlockType);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cBat :
|
||||
public:
|
||||
cBat(void);
|
||||
|
||||
CLASS_PROTODEF(cBat);
|
||||
CLASS_PROTODEF(cBat)
|
||||
|
||||
bool IsHanging(void) const {return false; }
|
||||
} ;
|
||||
|
@ -15,7 +15,7 @@ class cBlaze :
|
||||
public:
|
||||
cBlaze(void);
|
||||
|
||||
CLASS_PROTODEF(cBlaze);
|
||||
CLASS_PROTODEF(cBlaze)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void Attack(float a_Dt) override;
|
||||
|
@ -14,7 +14,7 @@ class cCaveSpider :
|
||||
public:
|
||||
cCaveSpider(void);
|
||||
|
||||
CLASS_PROTODEF(cCaveSpider);
|
||||
CLASS_PROTODEF(cCaveSpider)
|
||||
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
virtual void Attack(float a_Dt) override;
|
||||
|
@ -14,7 +14,7 @@ class cChicken :
|
||||
public:
|
||||
cChicken(void);
|
||||
|
||||
CLASS_PROTODEF(cChicken);
|
||||
CLASS_PROTODEF(cChicken)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
@ -15,7 +15,7 @@ class cCow :
|
||||
public:
|
||||
cCow();
|
||||
|
||||
CLASS_PROTODEF(cCow);
|
||||
CLASS_PROTODEF(cCow)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void OnRightClicked(cPlayer & a_Player) override;
|
||||
|
@ -15,7 +15,7 @@ class cCreeper :
|
||||
public:
|
||||
cCreeper(void);
|
||||
|
||||
CLASS_PROTODEF(cCreeper);
|
||||
CLASS_PROTODEF(cCreeper)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
||||
|
@ -15,7 +15,7 @@ class cEnderDragon :
|
||||
public:
|
||||
cEnderDragon(void);
|
||||
|
||||
CLASS_PROTODEF(cEnderDragon);
|
||||
CLASS_PROTODEF(cEnderDragon)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
} ;
|
||||
|
@ -15,7 +15,7 @@ class cEnderman :
|
||||
public:
|
||||
cEnderman(void);
|
||||
|
||||
CLASS_PROTODEF(cEnderman);
|
||||
CLASS_PROTODEF(cEnderman)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cGhast :
|
||||
public:
|
||||
cGhast(void);
|
||||
|
||||
CLASS_PROTODEF(cGhast);
|
||||
CLASS_PROTODEF(cGhast)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void Attack(float a_Dt) override;
|
||||
|
@ -15,7 +15,7 @@ class cGiant :
|
||||
public:
|
||||
cGiant(void);
|
||||
|
||||
CLASS_PROTODEF(cGiant);
|
||||
CLASS_PROTODEF(cGiant)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
} ;
|
||||
|
@ -15,7 +15,7 @@ class cHorse :
|
||||
public:
|
||||
cHorse(int Type, int Color, int Style, int TameTimes);
|
||||
|
||||
CLASS_PROTODEF(cHorse);
|
||||
CLASS_PROTODEF(cHorse)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
@ -15,7 +15,7 @@ class cIronGolem :
|
||||
public:
|
||||
cIronGolem(void);
|
||||
|
||||
CLASS_PROTODEF(cIronGolem);
|
||||
CLASS_PROTODEF(cIronGolem)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
/// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest
|
||||
cMagmaCube(int a_Size);
|
||||
|
||||
CLASS_PROTODEF(cMagmaCube);
|
||||
CLASS_PROTODEF(cMagmaCube)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
int GetSize(void) const { return m_Size; }
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
*/
|
||||
cMonster(const AString & a_ConfigName, eType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
|
||||
|
||||
CLASS_PROTODEF(cMonster);
|
||||
CLASS_PROTODEF(cMonster)
|
||||
|
||||
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cMooshroom :
|
||||
public:
|
||||
cMooshroom(void);
|
||||
|
||||
CLASS_PROTODEF(cMooshroom);
|
||||
CLASS_PROTODEF(cMooshroom)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void OnRightClicked(cPlayer & a_Player) override;
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
CLASS_PROTODEF(cOcelot);
|
||||
CLASS_PROTODEF(cOcelot)
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cPig :
|
||||
public:
|
||||
cPig(void);
|
||||
|
||||
CLASS_PROTODEF(cPig);
|
||||
CLASS_PROTODEF(cPig)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void OnRightClicked(cPlayer & a_Player) override;
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
with the GenerateNaturalRandomColor() function. */
|
||||
cSheep(int a_Color = -1);
|
||||
|
||||
CLASS_PROTODEF(cSheep);
|
||||
CLASS_PROTODEF(cSheep)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void OnRightClicked(cPlayer & a_Player) override;
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
CLASS_PROTODEF(cSilverfish);
|
||||
CLASS_PROTODEF(cSilverfish)
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cSkeleton :
|
||||
public:
|
||||
cSkeleton(bool IsWither);
|
||||
|
||||
CLASS_PROTODEF(cSkeleton);
|
||||
CLASS_PROTODEF(cSkeleton)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void MoveToPosition(const Vector3d & a_Position) override;
|
||||
@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual bool IsUndead(void) override { return true; }
|
||||
|
||||
bool IsWither(void) const { return m_bIsWither; };
|
||||
bool IsWither(void) const { return m_bIsWither; }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
/** Creates a slime of the specified size; size can be 1, 2 or 4, with 1 is the smallest and 4 is the tallest. */
|
||||
cSlime(int a_Size);
|
||||
|
||||
CLASS_PROTODEF(cSlime);
|
||||
CLASS_PROTODEF(cSlime)
|
||||
|
||||
// cAggressiveMonster overrides:
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
@ -15,7 +15,7 @@ class cSnowGolem :
|
||||
public:
|
||||
cSnowGolem(void);
|
||||
|
||||
CLASS_PROTODEF(cSnowGolem);
|
||||
CLASS_PROTODEF(cSnowGolem)
|
||||
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
@ -15,7 +15,7 @@ class cSpider :
|
||||
public:
|
||||
cSpider(void);
|
||||
|
||||
CLASS_PROTODEF(cSpider);
|
||||
CLASS_PROTODEF(cSpider)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
} ;
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
CLASS_PROTODEF(cSquid);
|
||||
CLASS_PROTODEF(cSquid)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
cVillager(eVillagerType VillagerType);
|
||||
|
||||
CLASS_PROTODEF(cVillager);
|
||||
CLASS_PROTODEF(cVillager)
|
||||
|
||||
// cEntity overrides
|
||||
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
||||
|
@ -16,7 +16,7 @@ class cWitch :
|
||||
public:
|
||||
cWitch();
|
||||
|
||||
CLASS_PROTODEF(cWitch);
|
||||
CLASS_PROTODEF(cWitch)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
|
||||
|
@ -15,7 +15,7 @@ class cWither :
|
||||
public:
|
||||
cWither(void);
|
||||
|
||||
CLASS_PROTODEF(cWither);
|
||||
CLASS_PROTODEF(cWither)
|
||||
|
||||
unsigned int GetWitherInvulnerableTicks(void) const { return m_WitherInvulnerableTicks; }
|
||||
|
||||
|
@ -16,7 +16,7 @@ class cWolf :
|
||||
public:
|
||||
cWolf(void);
|
||||
|
||||
CLASS_PROTODEF(cWolf);
|
||||
CLASS_PROTODEF(cWolf)
|
||||
|
||||
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;
|
||||
virtual void OnRightClicked(cPlayer & a_Player) override;
|
||||
|
@ -14,7 +14,7 @@ class cZombie :
|
||||
public:
|
||||
cZombie(bool a_IsVillagerZombie);
|
||||
|
||||
CLASS_PROTODEF(cZombie);
|
||||
CLASS_PROTODEF(cZombie)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void MoveToPosition(const Vector3d & a_Position) override;
|
||||
|
@ -14,7 +14,7 @@ class cZombiePigman :
|
||||
public:
|
||||
cZombiePigman(void);
|
||||
|
||||
CLASS_PROTODEF(cZombiePigman);
|
||||
CLASS_PROTODEF(cZombiePigman)
|
||||
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
|
||||
virtual void KilledBy(TakeDamageInfo & a_TDI) override;
|
||||
|
@ -26,14 +26,14 @@ struct cQueueFuncs
|
||||
public:
|
||||
|
||||
/// Called when an Item is deleted from the queue without being returned
|
||||
static void Delete(T) {};
|
||||
static void Delete(T) {}
|
||||
|
||||
/// Called when an Item is inserted with EnqueueItemIfNotPresent and there is another equal value already inserted
|
||||
static void Combine(T & a_existing, const T & a_new)
|
||||
{
|
||||
UNUSED(a_existing);
|
||||
UNUSED(a_new);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ protected:
|
||||
virtual void SendData(const char * a_Data, size_t a_Size) = 0;
|
||||
|
||||
/// Called after writing each packet, enables descendants to flush their buffers
|
||||
virtual void Flush(void) {};
|
||||
virtual void Flush(void) {}
|
||||
|
||||
// Helpers for writing partial packet data, write using SendData()
|
||||
void WriteByte(Byte a_Value)
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override;
|
||||
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {};
|
||||
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override {}
|
||||
virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
|
||||
virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||
virtual void SendWeather (eWeather a_Weather) override;
|
||||
|
115
src/SetChunkData.cpp
Normal file
115
src/SetChunkData.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
|
||||
// SetChunkData.cpp
|
||||
|
||||
// Implements the cSetChunkData class used for sending loaded / generated chunk
|
||||
|
||||
#include "Globals.h"
|
||||
#include "SetChunkData.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cSetChunkData::cSetChunkData(int a_ChunkX, int a_ChunkZ, bool a_ShouldMarkDirty) :
|
||||
m_ChunkX(a_ChunkX),
|
||||
m_ChunkZ(a_ChunkZ),
|
||||
m_ShouldMarkDirty(a_ShouldMarkDirty)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cSetChunkData::cSetChunkData(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
const BLOCKTYPE * a_BlockTypes,
|
||||
const NIBBLETYPE * a_BlockMetas,
|
||||
const NIBBLETYPE * a_BlockLight,
|
||||
const NIBBLETYPE * a_SkyLight,
|
||||
const cChunkDef::HeightMap * a_HeightMap,
|
||||
const cChunkDef::BiomeMap * a_Biomes,
|
||||
cEntityList & a_Entities,
|
||||
cBlockEntityList & a_BlockEntities,
|
||||
bool a_ShouldMarkDirty
|
||||
) :
|
||||
m_ChunkX(a_ChunkX),
|
||||
m_ChunkZ(a_ChunkZ),
|
||||
m_ShouldMarkDirty(a_ShouldMarkDirty)
|
||||
{
|
||||
// Check the params' validity:
|
||||
ASSERT(a_BlockTypes != NULL);
|
||||
ASSERT(a_BlockMetas != NULL);
|
||||
ASSERT(a_Biomes != NULL);
|
||||
|
||||
// Copy block types and metas:
|
||||
memcpy(m_BlockTypes, a_BlockTypes, sizeof(cChunkDef::BlockTypes));
|
||||
memcpy(m_BlockMetas, a_BlockMetas, sizeof(cChunkDef::BlockNibbles));
|
||||
|
||||
// Copy lights, if both given:
|
||||
if ((a_BlockLight != NULL) && (a_SkyLight != NULL))
|
||||
{
|
||||
memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight));
|
||||
memcpy(m_SkyLight, a_SkyLight, sizeof(m_SkyLight));
|
||||
m_IsLightValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IsLightValid = false;
|
||||
}
|
||||
|
||||
// Copy the heightmap, if available:
|
||||
if (a_HeightMap != NULL)
|
||||
{
|
||||
memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap));
|
||||
m_IsHeightMapValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_IsHeightMapValid = false;
|
||||
}
|
||||
|
||||
// Copy biomes, if available:
|
||||
if (a_Biomes != NULL)
|
||||
{
|
||||
memcpy(m_Biomes, a_Biomes, sizeof(m_Biomes));
|
||||
m_AreBiomesValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_AreBiomesValid = false;
|
||||
}
|
||||
|
||||
// Move entities and blockentities:
|
||||
std::swap(m_Entities, a_Entities);
|
||||
std::swap(m_BlockEntities, a_BlockEntities);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cSetChunkData::CalculateHeightMap(void)
|
||||
{
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
{
|
||||
for (int y = cChunkDef::Height - 1; y > -1; y--)
|
||||
{
|
||||
int index = cChunkDef::MakeIndexNoCheck(x, y, z);
|
||||
if (m_BlockTypes[index] != E_BLOCK_AIR)
|
||||
{
|
||||
m_HeightMap[x + z * cChunkDef::Width] = (HEIGHTTYPE)y;
|
||||
break;
|
||||
}
|
||||
} // for y
|
||||
} // for z
|
||||
} // for x
|
||||
m_IsHeightMapValid = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user