1
0

Merge branch 'master' into portals

Conflicts:
	src/World.h
This commit is contained in:
Tiger Wang 2014-07-29 15:27:19 +01:00
commit 8811837aea
123 changed files with 1753 additions and 700 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ cloc.xsl
*.suo *.suo
/EveryNight.cmd /EveryNight.cmd
/UploadLuaAPI.cmd /UploadLuaAPI.cmd
AllFiles.lst
# IDE Stuff # IDE Stuff
## Sublime Text ## Sublime Text

View File

@ -28,7 +28,7 @@ endmacro()
macro(set_flags) macro(set_flags)
# Add coverage processing, if requested: # Add coverage processing, if requested:
if (NOT MSVC) if (NOT MSVC)
if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE") if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
message("Including CodeCoverage") message("Including CodeCoverage")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/cmake-coverage/") 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) # We use a signed char (fixes #640 on RasPi)
add_flags_cxx("-fsigned-char") add_flags_cxx("-fsigned-char")
endif() endif()
@ -202,7 +202,7 @@ macro(enable_profile)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugProfile;ReleaseProfile;Coverage" CACHE STRING "" FORCE) set(CMAKE_CONFIGURATION_TYPES "Debug;Release;DebugProfile;ReleaseProfile;Coverage" CACHE STRING "" FORCE)
endif() endif()
endmacro() endmacro()
macro(set_exe_flags) macro(set_exe_flags)
# Remove disabling the maximum warning level: # 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 # 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_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE}")
string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}") string(REPLACE "-w" "" CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE}")
add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch") add_flags_cxx("-Wall -Wextra -Wno-unused-parameter -Wno-error=switch")
# we support non-IEEE 754 fpus so can make no guarentees about error # we support non-IEEE 754 fpus so can make no guarentees about error
add_flags_cxx("-ffast-math") add_flags_cxx("-ffast-math")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 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 # 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("-D__extern_always_inline=inline")
add_flags_cxx("-Werror -Weverything -Wno-c++98-compat-pedantic -Wno-string-conversion") 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=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=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=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=exit-time-destructors -Wno-error=missing-variable-declarations")
add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") 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()
endif() endif()

View File

@ -240,7 +240,7 @@ template <typename Type> class cItemCallback
public: public:
/// Called for each item in the internal list; return true to stop the loop, or false to continue enumerating /// 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 bool Item(Type * a_Type) = 0;
virtual ~cItemCallback() {}; virtual ~cItemCallback() {}
} ; } ;

View File

@ -39,7 +39,7 @@ set (BINDING_OUTPUTS
${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Call.inc
) )
set(BINDING_DEPENDECIES set(BINDING_DEPENDENCIES
tolua tolua
../Bindings/virtual_method_hooks.lua ../Bindings/virtual_method_hooks.lua
../Bindings/AllToLua.pkg ../Bindings/AllToLua.pkg
@ -122,7 +122,7 @@ if (NOT MSVC)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
# add any new generation dependencies here # add any new generation dependencies here
DEPENDS ${BINDING_DEPENDECIES} DEPENDS ${BINDING_DEPENDENCIES}
) )
endif () endif ()
set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE) set_source_files_properties(Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)

View File

@ -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 */ /* get function: g_BlockIsSolid */
#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid #ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid
static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S) 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_BlockOneHitDig", tolua_get_AllToLua_g_BlockOneHitDig, NULL);
tolua_array(tolua_S, "g_BlockPistonBreakable", tolua_get_AllToLua_g_BlockPistonBreakable, 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_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_BlockIsSolid", tolua_get_AllToLua_g_BlockIsSolid, NULL);
tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL); tolua_array(tolua_S, "g_BlockFullyOccupiesVoxel", tolua_get_AllToLua_g_BlockFullyOccupiesVoxel, NULL);

View File

@ -115,10 +115,10 @@ public:
virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) = 0; virtual bool HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) = 0;
/// All bound commands are to be removed, do any language-dependent cleanup here /// 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 /// All bound console commands are to be removed, do any language-dependent cleanup here
virtual void ClearConsoleCommands(void) {} ; virtual void ClearConsoleCommands(void) {}
// tolua_begin // tolua_begin
const AString & GetName(void) const { return m_Name; } const AString & GetName(void) const { return m_Name; }

View File

@ -38,9 +38,9 @@ protected:
public: public:
// tolua_end // 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) void SetWorld(cWorld * a_World)
{ {

View File

@ -58,7 +58,7 @@ public:
static const char * GetClassStatic(void) { return "cJukeboxEntity"; } static const char * GetClassStatic(void) { return "cJukeboxEntity"; }
virtual void UsedBy(cPlayer * a_Player) override; virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle &) override { }; virtual void SendTo(cClientHandle &) override {}
private: private:
int m_Record; int m_Record;

View File

@ -52,7 +52,7 @@ public:
// tolua_end // tolua_end
virtual void UsedBy(cPlayer * a_Player) override; virtual void UsedBy(cPlayer * a_Player) override;
virtual void SendTo(cClientHandle &) override { }; virtual void SendTo(cClientHandle &) override {}
static const char * GetClassStatic(void) { return "cNoteEntity"; } static const char * GetClassStatic(void) { return "cNoteEntity"; }

View File

@ -15,7 +15,6 @@ cBlockInfo::cBlockInfo()
, m_OneHitDig(false) , m_OneHitDig(false)
, m_PistonBreakable(false) , m_PistonBreakable(false)
, m_IsSnowable(false) , m_IsSnowable(false)
, m_RequiresSpecialTool(false)
, m_IsSolid(true) , m_IsSolid(true)
, m_FullyOccupiesVoxel(false) , m_FullyOccupiesVoxel(false)
, m_Handler(NULL) , m_Handler(NULL)
@ -440,51 +439,6 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_TNT ].m_IsSnowable = true; a_Info[E_BLOCK_TNT ].m_IsSnowable = true;
a_Info[E_BLOCK_WOOL ].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_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: // Nonsolid blocks:
a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSolid = false; a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_IsSolid = false;
a_Info[E_BLOCK_AIR ].m_IsSolid = false; a_Info[E_BLOCK_AIR ].m_IsSolid = false;

View File

@ -39,9 +39,6 @@ public:
/** Can this block hold snow atop? */ /** Can this block hold snow atop? */
bool m_IsSnowable; bool m_IsSnowable;
/** Does this block require a tool to drop? */
bool m_RequiresSpecialTool;
/** Is this block solid (player cannot walk through)? */ /** Is this block solid (player cannot walk through)? */
bool m_IsSolid; bool m_IsSolid;
@ -61,7 +58,6 @@ public:
inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; } 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 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 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 IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; }
inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; } inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; }

View File

@ -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); NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (Meta & 0x8) 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 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);
} }
} }

View File

@ -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) 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. // 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; cItems Pickups;
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); 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: // Allow plugins to modify the pickups:
a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups);

View File

@ -60,25 +60,29 @@ public:
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ); 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) /// 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 /// 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); static void NeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ);
/// Called while the player diggs the block. /// 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 /// 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 */ /** 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); 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> /// <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); 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 /** 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
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ); @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 /// Returns step sound name of block
virtual const char * GetStepSound(void); virtual const char * GetStepSound(void);

View File

@ -40,14 +40,20 @@ public:
{ {
cFastRandom rand; 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) 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 // 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) if (rand.NextInt(101) == 0)
{ {
@ -55,22 +61,6 @@ public:
} }
} }
} }
void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
cBlockHandler::OnDestroyed(a_ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ);
// 0.5% chance of dropping an apple, if the leaves' type is Apple Leaves:
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
cFastRandom rand;
if (((Meta & 3) == E_META_LEAVES_APPLE) && (rand.NextInt(201) == 100))
{
cItems Drops;
Drops.push_back(cItem(E_ITEM_RED_APPLE, 1, 0));
a_WorldInterface.SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
}
}
virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override virtual void OnNeighborChanged(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override

View File

@ -20,8 +20,8 @@ public:
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Only the first 2 bits contain the display information, the others are for growing // 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 & 0x7)); a_Pickups.push_back(cItem(E_BLOCK_SAPLING, 1, a_BlockMeta & 0x07));
} }

View File

@ -43,8 +43,9 @@ public:
cItems Pickups; cItems Pickups;
Pickups.Add(E_BLOCK_TALL_GRASS, 1, Meta); Pickups.Add(E_BLOCK_TALL_GRASS, 1, Meta);
a_WorldInterface.SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ); a_WorldInterface.SpawnItemPickups(Pickups, a_BlockX, a_BlockY, a_BlockZ);
a_Player->UseEquippedItem();
} }
a_Player->UseEquippedItem();
} }

View File

@ -44,6 +44,13 @@ public:
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Reset meta to 0
a_Pickups.push_back(cItem(E_BLOCK_VINES, 1, 0));
}
static NIBBLETYPE DirectionToMetaData(char a_BlockFace) static NIBBLETYPE DirectionToMetaData(char a_BlockFace)
{ {
switch (a_BlockFace) switch (a_BlockFace)

View File

@ -56,6 +56,7 @@ SET (SRCS
Root.cpp Root.cpp
Scoreboard.cpp Scoreboard.cpp
Server.cpp Server.cpp
SetChunkData.cpp
Statistics.cpp Statistics.cpp
StringCompression.cpp StringCompression.cpp
StringUtils.cpp StringUtils.cpp
@ -124,6 +125,7 @@ SET (HDRS
Root.h Root.h
Scoreboard.h Scoreboard.h
Server.h Server.h
SetChunkData.h
StackWalker.h StackWalker.h
Statistics.h Statistics.h
StringCompression.h StringCompression.h
@ -265,7 +267,7 @@ if (MSVC)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/
# add any new generation dependencies here # add any new generation dependencies here
DEPENDS ${BINDING_DEPENDECIES} DEPENDS ${BINDING_DEPENDENCIES}
) )
endif() endif()

View File

@ -34,6 +34,7 @@
#include "MobCensus.h" #include "MobCensus.h"
#include "MobSpawner.h" #include "MobSpawner.h"
#include "BlockInServerPluginInterface.h" #include "BlockInServerPluginInterface.h"
#include "SetChunkData.h"
#include "json/json.h" #include "json/json.h"
@ -265,41 +266,34 @@ void cChunk::GetAllData(cChunkDataCallback & a_Callback)
void cChunk::SetAllData( void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
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
)
{ {
memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap)); ASSERT(a_SetChunkData.IsHeightMapValid());
ASSERT(a_SetChunkData.AreBiomesValid());
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);
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: // 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) for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)
{ {
delete *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: // Set all block entities' World variable:
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr)

View File

@ -95,16 +95,10 @@ public:
/** Gets all chunk data, calls the a_Callback's methods for each data type */ /** Gets all chunk data, calls the a_Callback's methods for each data type */
void GetAllData(cChunkDataCallback & a_Callback); void GetAllData(cChunkDataCallback & a_Callback);
/** Sets all chunk data */ /** Sets all chunk data as either loaded from the storage or generated.
void SetAllData( BlockLight and BlockSkyLight are optional, if not present, chunk will be marked as unlighted.
const BLOCKTYPE * a_BlockTypes, Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk. */
const NIBBLETYPE * a_BlockMeta, void SetAllData(cSetChunkData & a_SetChunkData);
const NIBBLETYPE * a_BlockLight,
const NIBBLETYPE * a_BlockSkyLight,
const cChunkDef::HeightMap * a_HeightMap,
const cChunkDef::BiomeMap & a_BiomeMap,
cBlockEntityList & a_BlockEntities
);
void SetLight( void SetLight(
const cChunkDef::BlockNibbles & a_BlockLight, const cChunkDef::BlockNibbles & a_BlockLight,
@ -386,9 +380,9 @@ public:
cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return &m_RedstoneSimulatorData; } cRedstoneSimulatorChunkData * GetRedstoneSimulatorData(void) { return &m_RedstoneSimulatorData; }
cRedstoneSimulatorChunkData * GetRedstoneSimulatorQueuedData(void) { return &m_RedstoneSimulatorQueuedData; } cRedstoneSimulatorChunkData * GetRedstoneSimulatorQueuedData(void) { return &m_RedstoneSimulatorQueuedData; }
cIncrementalRedstoneSimulator::PoweredBlocksList * GetRedstoneSimulatorPoweredBlocksList(void) { return &m_RedstoneSimulatorPoweredBlocksList; } cIncrementalRedstoneSimulator::PoweredBlocksList * GetRedstoneSimulatorPoweredBlocksList(void) { return &m_RedstoneSimulatorPoweredBlocksList; }
cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; }; cIncrementalRedstoneSimulator::LinkedBlocksList * GetRedstoneSimulatorLinkedBlocksList(void) { return &m_RedstoneSimulatorLinkedBlocksList; }
cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; }; cIncrementalRedstoneSimulator::SimulatedPlayerToggleableList * GetRedstoneSimulatorSimulatedPlayerToggleableList(void) { return &m_RedstoneSimulatorSimulatedPlayerToggleableList; }
cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; }; cIncrementalRedstoneSimulator::RepeatersDelayList * GetRedstoneSimulatorRepeatersDelayList(void) { return &m_RedstoneSimulatorRepeatersDelayList; }
bool IsRedstoneDirty(void) const { return m_IsRedstoneDirty; } bool IsRedstoneDirty(void) const { return m_IsRedstoneDirty; }
void SetIsRedstoneDirty(bool a_Flag) { m_IsRedstoneDirty = a_Flag; } void SetIsRedstoneDirty(bool a_Flag) { m_IsRedstoneDirty = a_Flag; }

View File

@ -29,25 +29,25 @@ public:
(only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()). (only in processes where multiple chunks can be processed, such as cWorld::ForEachChunkInRect()).
If false is returned, the chunk is skipped. 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 /// 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 /// 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 /// 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 /// 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 /// 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 /// 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); }
} ; } ;

View File

@ -16,6 +16,7 @@
#include "MobCensus.h" #include "MobCensus.h"
#include "MobSpawner.h" #include "MobSpawner.h"
#include "BoundingBox.h" #include "BoundingBox.h"
#include "SetChunkData.h"
#include "Entities/Pickup.h" #include "Entities/Pickup.h"
@ -912,28 +913,20 @@ void cChunkMap::MarkChunkSaved (int a_ChunkX, int a_ChunkZ)
void cChunkMap::SetChunkData( void cChunkMap::SetChunkData(cSetChunkData & a_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
)
{ {
int ChunkX = a_SetChunkData.GetChunkX();
int ChunkZ = a_SetChunkData.GetChunkZ();
{ {
cCSLock Lock(m_CSLayers); 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) if (Chunk == NULL)
{ {
return; 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(); Chunk->MarkDirty();
} }
@ -942,7 +935,7 @@ void cChunkMap::SetChunkData(
cChunkStays ToBeDisabled; cChunkStays ToBeDisabled;
for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr) 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: // The chunkstay wants to be disabled, add it to a list of to-be-disabled chunkstays for later processing:
ToBeDisabled.push_back(*itr); ToBeDisabled.push_back(*itr);
@ -957,7 +950,7 @@ void cChunkMap::SetChunkData(
} }
// Notify plugins of the chunk becoming available // Notify plugins of the chunk becoming available
cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ); cPluginManager::Get()->CallHookChunkAvailable(m_World, ChunkX, ChunkZ);
} }

View File

@ -34,6 +34,7 @@ class cChunkDataSerializer;
class cBlockArea; class cBlockArea;
class cMobCensus; class cMobCensus;
class cMobSpawner; class cMobSpawner;
class cSetChunkData;
typedef std::list<cClientHandle *> cClientHandleList; typedef std::list<cClientHandle *> cClientHandleList;
typedef cChunk * cChunkPtr; typedef cChunk * cChunkPtr;
@ -112,22 +113,11 @@ public:
void MarkChunkSaved (int a_ChunkX, int a_ChunkZ); void MarkChunkSaved (int a_ChunkX, int a_ChunkZ);
/** Sets the chunk data as either loaded from the storage or generated. /** 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. BlockLight and 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 If MarkDirty is set, the chunk is set as dirty (used after generating)
a_HeightMap is optional, if not present, will be calculated. Modifies the BlockEntity list in a_SetChunkData - moves the block entities into the chunk.
If a_MarkDirty is set, the chunk is set as dirty (used after generating)
*/ */
void SetChunkData( void SetChunkData(cSetChunkData & a_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 ChunkLighted( void ChunkLighted(
int a_ChunkX, int a_ChunkZ, int a_ChunkX, int a_ChunkZ,

View File

@ -56,8 +56,8 @@ public:
#else #else
static const int DEFAULT_VIEW_DISTANCE = 10; static const int DEFAULT_VIEW_DISTANCE = 10;
#endif #endif
static const int MAX_VIEW_DISTANCE = 15; static const int MAX_VIEW_DISTANCE = 32;
static const int MIN_VIEW_DISTANCE = 3; static const int MIN_VIEW_DISTANCE = 1;
cClientHandle(const cSocket * a_Socket, int a_ViewDistance); cClientHandle(const cSocket * a_Socket, int a_ViewDistance);
virtual ~cClientHandle(); virtual ~cClientHandle();
@ -151,7 +151,7 @@ public:
void SendMapInfo (int a_ID, unsigned int a_Scale); void SendMapInfo (int a_ID, unsigned int a_Scale);
void SendPaintingSpawn (const cPainting & a_Painting); void SendPaintingSpawn (const cPainting & a_Painting);
void SendPickupSpawn (const cPickup & a_Pickup); 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 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 SendPlayerAbilities (void);
void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline); void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline);

View File

@ -14,16 +14,16 @@ Descendants override that function to provide specific processing of the output.
class cCommandOutputCallback class cCommandOutputCallback
{ {
public: 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); void Out(const char * a_Fmt, ...) FORMATSTRING(2, 3);
/// Called when the command wants to output anything; may be called multiple times /// Called when the command wants to output anything; may be called multiple times
virtual void Out(const AString & a_Text) = 0; virtual void Out(const AString & a_Text) = 0;
/// Called when the command processing has been finished /// Called when the command processing has been finished
virtual void Finished(void) {}; virtual void Finished(void) {}
} ; } ;

View File

@ -715,14 +715,5 @@ namespace ItemCategory
// tolua_end // tolua_end
inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
{
if (!IsValidBlock(a_BlockType)) return false;
return cBlockInfo::RequiresSpecialTool(a_BlockType);
}

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#undef ntohll
#define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32)) #define ntohll(x) ((((UInt64)ntohl((u_long)x)) << 32) + ntohl(x >> 32))

View File

@ -28,7 +28,7 @@ public:
// tolua_end // tolua_end
CLASS_PROTODEF(cArrowEntity); CLASS_PROTODEF(cArrowEntity)
/// Creates a new arrow with psNoPickup state and default damage modifier coeff /// 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); cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -21,7 +21,7 @@ class cBoat :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cBoat); CLASS_PROTODEF(cBoat)
// cEntity overrides: // cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void SpawnOn(cClientHandle & a_ClientHandle) override;

View File

@ -15,7 +15,7 @@ class cEnderCrystal :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cEnderCrystal); CLASS_PROTODEF(cEnderCrystal)
cEnderCrystal(double a_X, double a_Y, double a_Z); cEnderCrystal(double a_X, double a_Y, double a_Z);

View File

@ -12,6 +12,7 @@
#include "../Bindings/PluginManager.h" #include "../Bindings/PluginManager.h"
#include "../Tracer.h" #include "../Tracer.h"
#include "Player.h" #include "Player.h"
#include "Items/ItemHandler.h"
@ -290,11 +291,6 @@ void cEntity::SetPitchFromSpeed(void)
bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
{ {
if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI))
{
return false;
}
if (m_Health <= 0) if (m_Health <= 0)
{ {
// Can't take damage if already dead // Can't take damage if already dead
@ -307,10 +303,17 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
return false; return false;
} }
if (cRoot::Get()->GetPluginManager()->CallHookTakeDamage(*this, a_TDI))
{
return false;
}
if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer())) if ((a_TDI.Attacker != NULL) && (a_TDI.Attacker->IsPlayer()))
{ {
cPlayer * Player = (cPlayer *)a_TDI.Attacker; cPlayer * Player = (cPlayer *)a_TDI.Attacker;
Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this);
// IsOnGround() only is false if the player is moving downwards // IsOnGround() only is false if the player is moving downwards
// TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain) // TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain)
if (!Player->IsOnGround()) if (!Player->IsOnGround())

View File

@ -447,7 +447,7 @@ public:
// tolua_end // tolua_end
/// Called when the specified player right-clicks this entity /// 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(). /// 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) virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL)

View File

@ -7,6 +7,130 @@
int cEntityEffect::GetPotionColor(short a_ItemDamage)
{
// Lowest six bits
return (a_ItemDamage & 0x3f);
}
cEntityEffect::eType cEntityEffect::GetPotionEffectType(short a_ItemDamage)
{
// Lowest four bits
// Potion effect bits are different from entity effect values
// For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits
switch (a_ItemDamage & 0x0f)
{
case 0x01: return cEntityEffect::effRegeneration;
case 0x02: return cEntityEffect::effSpeed;
case 0x03: return cEntityEffect::effFireResistance;
case 0x04: return cEntityEffect::effPoison;
case 0x05: return cEntityEffect::effInstantHealth;
case 0x06: return cEntityEffect::effNightVision;
case 0x08: return cEntityEffect::effWeakness;
case 0x09: return cEntityEffect::effStrength;
case 0x0a: return cEntityEffect::effSlowness;
case 0x0c: return cEntityEffect::effInstantDamage;
case 0x0d: return cEntityEffect::effWaterBreathing;
case 0x0e: return cEntityEffect::effInvisibility;
// No effect potions
case 0x00:
case 0x07:
case 0x0b: // Will be potion of leaping in 1.8
case 0x0f:
{
break;
}
}
return cEntityEffect::effNoEffect;
}
short cEntityEffect::GetPotionEffectIntensity(short a_ItemDamage)
{
// Level II potion if the fifth lowest bit is set
return ((a_ItemDamage & 0x20) != 0) ? 1 : 0;
}
int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
{
// Base duration in ticks
int base = 0;
double TierCoeff = 1, ExtCoeff = 1, SplashCoeff = 1;
switch (GetPotionEffectType(a_ItemDamage))
{
case cEntityEffect::effRegeneration:
case cEntityEffect::effPoison:
{
base = 900;
break;
}
case cEntityEffect::effSpeed:
case cEntityEffect::effFireResistance:
case cEntityEffect::effNightVision:
case cEntityEffect::effStrength:
case cEntityEffect::effWaterBreathing:
case cEntityEffect::effInvisibility:
{
base = 3600;
break;
}
case cEntityEffect::effWeakness:
case cEntityEffect::effSlowness:
{
base = 1800;
break;
}
}
// If potion is level II, half the duration. If not, stays the same
TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1;
// If potion is extended, multiply duration by 8/3. If not, stays the same
// Extended potion if sixth lowest bit is set
ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1;
// If potion is splash potion, multiply duration by 3/4. If not, stays the same
SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75;
// Ref.:
// http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit
return (int)(base * TierCoeff * ExtCoeff * SplashCoeff);
}
bool cEntityEffect::IsPotionDrinkable(short a_ItemDamage)
{
// Drinkable potion if 13th lowest bit is set
// Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table
return ((a_ItemDamage & 0x2000) != 0);
}
cEntityEffect::cEntityEffect(): cEntityEffect::cEntityEffect():
m_Ticks(0), m_Ticks(0),
m_Duration(0), m_Duration(0),

View File

@ -36,6 +36,24 @@ public:
effSaturation = 23, effSaturation = 23,
} ; } ;
/** Returns the potion color (used by the client for visuals), based on the potion's damage value */
static int GetPotionColor(short a_ItemDamage);
/** Translates the potion's damage value into the entity effect that the potion gives */
static cEntityEffect::eType GetPotionEffectType(short a_ItemDamage);
/** Retrieves the intensity level from the potion's damage value. Returns 0 for level I potions, 1 for level II potions. */
static short GetPotionEffectIntensity(short a_ItemDamage);
/** Returns the effect duration, in ticks, based on the potion's damage value */
static int GetPotionEffectDuration(short a_ItemDamage);
/** Returns true if the potion with the given damage is drinkable */
static bool IsPotionDrinkable(short a_ItemDamage);
// tolua_end // tolua_end
/** Creates an empty entity effect */ /** Creates an empty entity effect */
@ -55,7 +73,7 @@ public:
@param a_OtherEffect The other effect to copy */ @param a_OtherEffect The other effect to copy */
cEntityEffect & operator=(cEntityEffect a_OtherEffect); cEntityEffect & operator=(cEntityEffect a_OtherEffect);
virtual ~cEntityEffect(void) {}; virtual ~cEntityEffect(void) {}
/** Creates a pointer to the proper entity effect from the effect type /** Creates a pointer to the proper entity effect from the effect type
@warning This function creates raw pointers that must be manually managed. @warning This function creates raw pointers that must be manually managed.

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cExpBottleEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -16,7 +16,7 @@ class cExpOrb :
public: public:
// tolua_end // tolua_end
CLASS_PROTODEF(cExpOrb); CLASS_PROTODEF(cExpOrb)
cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward); cExpOrb(double a_X, double a_Y, double a_Z, int a_Reward);
cExpOrb(const Vector3d & a_Pos, int a_Reward); cExpOrb(const Vector3d & a_Pos, int a_Reward);

View File

@ -20,7 +20,7 @@ class cFallingBlock :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cFallingBlock); CLASS_PROTODEF(cFallingBlock)
/// Creates a new falling block. a_BlockPosition is expected in world coords /// Creates a new falling block. a_BlockPosition is expected in world coords
cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cFireChargeEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); 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; } const cItem & GetItem(void) const { return m_FireworkItem; }

View File

@ -16,7 +16,7 @@ class cFloater :
public: public:
// tolua_end // 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); cFloater(double a_X, double a_Y, double a_Z, Vector3d a_Speed, int a_PlayerID, int a_CountDownTime);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cGhastFireballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -16,7 +16,7 @@ class cHangingEntity :
public: public:
CLASS_PROTODEF(cHangingEntity); CLASS_PROTODEF(cHangingEntity)
cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z); cHangingEntity(eEntityType a_EntityType, eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z);
@ -38,7 +38,7 @@ public:
private: private:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override; 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; eBlockFace m_BlockFace;

View File

@ -16,7 +16,7 @@ class cItemFrame :
public: public:
CLASS_PROTODEF(cItemFrame); CLASS_PROTODEF(cItemFrame)
cItemFrame(eBlockFace a_BlockFace, double a_X, double a_Y, double a_Z); 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 const cItem & GetItem(void) { return m_Item; } // tolua_export
/** Set the item in the frame */ /** 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 */ /** Returns the rotation from the item in the frame */
Byte GetRotation(void) const { return m_Rotation; } // tolua_export Byte GetRotation(void) const { return m_Rotation; } // tolua_export

View File

@ -21,7 +21,7 @@ class cMinecart :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cMinecart); CLASS_PROTODEF(cMinecart)
/** Minecart payload, values correspond to packet subtype */ /** Minecart payload, values correspond to packet subtype */
enum ePayload enum ePayload
@ -89,7 +89,7 @@ class cRideableMinecart :
typedef cMinecart super; typedef cMinecart super;
public: public:
CLASS_PROTODEF(cRideableMinecart); CLASS_PROTODEF(cRideableMinecart)
cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height); 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; typedef cMinecart super;
public: public:
CLASS_PROTODEF(cMinecartWithChest); CLASS_PROTODEF(cMinecartWithChest)
/// Number of item slots in the chest /// Number of item slots in the chest
static const int NumSlots = 9 * 3; static const int NumSlots = 9 * 3;
@ -144,7 +144,7 @@ class cMinecartWithFurnace :
typedef cMinecart super; typedef cMinecart super;
public: public:
CLASS_PROTODEF(cMinecartWithFurnace); CLASS_PROTODEF(cMinecartWithFurnace)
cMinecartWithFurnace(double a_X, double a_Y, double a_Z); cMinecartWithFurnace(double a_X, double a_Y, double a_Z);
@ -176,7 +176,7 @@ class cMinecartWithTNT :
typedef cMinecart super; typedef cMinecart super;
public: public:
CLASS_PROTODEF(cMinecartWithTNT); CLASS_PROTODEF(cMinecartWithTNT)
cMinecartWithTNT(double a_X, double a_Y, double a_Z); cMinecartWithTNT(double a_X, double a_Y, double a_Z);
} ; } ;
@ -191,7 +191,7 @@ class cMinecartWithHopper :
typedef cMinecart super; typedef cMinecart super;
public: public:
CLASS_PROTODEF(cMinecartWithHopper); CLASS_PROTODEF(cMinecartWithHopper)
cMinecartWithHopper(double a_X, double a_Y, double a_Z); cMinecartWithHopper(double a_X, double a_Y, double a_Z);
} ; } ;

View File

@ -15,7 +15,7 @@ class cPainting :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cPainting); CLASS_PROTODEF(cPainting)
cPainting(const AString & a_Name, int a_Direction, double a_X, double a_Y, double a_Z); 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 const AString & GetName(void) const { return m_Name; } // tolua_export

View File

@ -16,7 +16,7 @@ class cPawn :
typedef cEntity super; typedef cEntity super;
public: public:
CLASS_PROTODEF(cPawn); CLASS_PROTODEF(cPawn)
cPawn(eEntityType a_EntityType, double a_Width, double a_Height); cPawn(eEntityType a_EntityType, double a_Width, double a_Height);

View File

@ -23,7 +23,7 @@ class cPickup :
public: public:
// tolua_end // 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); 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);

View File

@ -1933,14 +1933,14 @@ cPlayer::StringList cPlayer::GetResolvedPermissions()
void cPlayer::UseEquippedItem(void) void cPlayer::UseEquippedItem(int a_Amount)
{ {
if (IsGameModeCreative()) // No damage in creative if (IsGameModeCreative()) // No damage in creative
{ {
return; return;
} }
if (GetInventory().DamageEquippedItem()) if (GetInventory().DamageEquippedItem(a_Amount))
{ {
m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64)); m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
} }

View File

@ -48,7 +48,7 @@ public:
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; 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 */ /** Returns the curently equipped weapon; empty item if none */
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); } virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
@ -356,7 +356,7 @@ public:
const AString & GetLoadedWorldName() { return m_LoadedWorldName; } const AString & GetLoadedWorldName() { return m_LoadedWorldName; }
void UseEquippedItem(void); void UseEquippedItem(int a_Amount = 1);
void SendHealth(void); void SendHealth(void);

View File

@ -22,6 +22,7 @@
#include "FireworkEntity.h" #include "FireworkEntity.h"
#include "GhastFireballEntity.h" #include "GhastFireballEntity.h"
#include "WitherSkullEntity.h" #include "WitherSkullEntity.h"
#include "SplashPotionEntity.h"
#include "Player.h" #include "Player.h"
@ -263,6 +264,7 @@ cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator,
case pkGhastFireball: return new cGhastFireballEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkGhastFireball: return new cGhastFireballEntity (a_Creator, a_X, a_Y, a_Z, Speed);
case pkFireCharge: return new cFireChargeEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkFireCharge: return new cFireChargeEntity (a_Creator, a_X, a_Y, a_Z, Speed);
case pkExpBottle: return new cExpBottleEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkExpBottle: return new cExpBottleEntity (a_Creator, a_X, a_Y, a_Z, Speed);
case pkSplashPotion: return new cSplashPotionEntity (a_Creator, a_X, a_Y, a_Z, Speed, *a_Item);
case pkWitherSkull: return new cWitherSkullEntity (a_Creator, a_X, a_Y, a_Z, Speed); case pkWitherSkull: return new cWitherSkullEntity (a_Creator, a_X, a_Y, a_Z, Speed);
case pkFirework: case pkFirework:
{ {

View File

@ -41,7 +41,7 @@ public:
// tolua_end // 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, 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); cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height);

View File

@ -72,17 +72,18 @@ cSplashPotionEntity::cSplashPotionEntity(
cEntity * a_Creator, cEntity * a_Creator,
double a_X, double a_Y, double a_Z, double a_X, double a_Y, double a_Z,
const Vector3d & a_Speed, const Vector3d & a_Speed,
cEntityEffect::eType a_EntityEffectType, const cItem & a_Item
cEntityEffect a_EntityEffect,
int a_PotionColor
) : ) :
super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), super(pkSplashPotion, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25),
m_EntityEffectType(a_EntityEffectType),
m_EntityEffect(a_EntityEffect),
m_PotionColor(a_PotionColor),
m_DestroyTimer(-1) m_DestroyTimer(-1)
{ {
SetSpeed(a_Speed); SetSpeed(a_Speed);
m_EntityEffectType = cEntityEffect::GetPotionEffectType(a_Item.m_ItemDamage);
m_EntityEffect = cEntityEffect(
cEntityEffect::GetPotionEffectDuration(a_Item.m_ItemDamage),
cEntityEffect::GetPotionEffectIntensity(a_Item.m_ItemDamage)
);
m_PotionColor = cEntityEffect::GetPotionColor(a_Item.m_ItemDamage);
} }

View File

@ -23,15 +23,13 @@ public:
// tolua_end // tolua_end
CLASS_PROTODEF(cSplashPotionEntity); CLASS_PROTODEF(cSplashPotionEntity)
cSplashPotionEntity( cSplashPotionEntity(
cEntity * a_Creator, cEntity * a_Creator,
double a_X, double a_Y, double a_Z, double a_X, double a_Y, double a_Z,
const Vector3d & a_Speed, const Vector3d & a_Speed,
cEntityEffect::eType a_EntityEffectType, const cItem & a_Item
cEntityEffect a_EntityEffect,
int a_PotionColor
); );
cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; } cEntityEffect::eType GetEntityEffectType(void) const { return m_EntityEffectType; }

View File

@ -14,7 +14,7 @@ class cTNTEntity :
public: public:
// tolua_end // tolua_end
CLASS_PROTODEF(cTNTEntity); CLASS_PROTODEF(cTNTEntity)
cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80); cTNTEntity(double a_X, double a_Y, double a_Z, int a_FuseTicks = 80);
cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80); cTNTEntity(const Vector3d & a_Pos, int a_FuseTicks = 80);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cThrownEggEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cThrownEnderPearlEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -21,7 +21,7 @@ public:
// tolua_end // 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); cThrownSnowballEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -22,7 +22,7 @@ public:
// tolua_end // 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); cWitherSkullEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d & a_Speed);

View File

@ -44,6 +44,9 @@ public:
/// Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M; a_Salt is additional source of randomness /// Returns a random float in the range [0 .. a_Range]; a_Range must be less than 1M; a_Salt is additional source of randomness
float NextFloat(float a_Range, int a_Salt); float NextFloat(float a_Range, int a_Salt);
/** Returns a random float between 0 and 1. */
float NextFloat(void) { return NextFloat(1); };
/** Returns a random int in the range [a_Begin .. a_End] */ /** Returns a random int in the range [a_Begin .. a_End] */
int GenerateRandomInteger(int a_Begin, int a_End); int GenerateRandomInteger(int a_Begin, int a_End);

View File

@ -44,7 +44,7 @@ public:
{ {
public: public:
cGenerator(cChunkGenerator & a_ChunkGenerator); cGenerator(cChunkGenerator & a_ChunkGenerator);
virtual ~cGenerator() {} ; // Force a virtual destructor virtual ~cGenerator() {} // Force a virtual destructor
/// Called to initialize the generator on server startup. /// Called to initialize the generator on server startup.
virtual void Initialize(cIniFile & a_IniFile); virtual void Initialize(cIniFile & a_IniFile);

View File

@ -628,7 +628,22 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc)
for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++)
{ {
a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK);
a_ChunkDesc.SetBlockType(x, a_ChunkDesc.GetHeight(x, z), z, E_BLOCK_BEDROCK);
int Height = a_ChunkDesc.GetHeight(x, z);
a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_BEDROCK);
NOISE_DATATYPE CeilingDisguise = (m_Noise1.CubicNoise2D((float)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x) / 10, (float)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z) / 10));
if (CeilingDisguise < 0)
{
CeilingDisguise = -CeilingDisguise;
}
int CeilingDisguiseHeight = Height - 2 - CeilingDisguise * 3;
for (int y = Height - 1; y > CeilingDisguiseHeight; y--)
{
a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_NETHERRACK);
}
} }
} }

View File

@ -675,6 +675,8 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
case biForestHills: case biForestHills:
case biTaigaHills: case biTaigaHills:
case biExtremeHillsEdge: case biExtremeHillsEdge:
case biExtremeHillsPlus:
case biExtremeHills:
case biJungle: case biJungle:
case biJungleHills: case biJungleHills:
case biJungleEdge: case biJungleEdge:
@ -750,18 +752,6 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
return; 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 biExtremeHillsPlusM:
case biExtremeHillsM: 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 NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + a_RelX)) / FrequencyX;
NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ; NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + a_RelZ)) / FrequencyZ;
NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY); 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); FillColumnPattern(a_ChunkDesc, a_RelX, a_RelZ, Pattern);
return; return;
} }
@ -819,7 +809,7 @@ void cDistortedHeightmap::FillColumnPattern(cChunkDesc & a_ChunkDesc, int a_RelX
} }
// Select the ocean-floor pattern to use: // Select the ocean-floor pattern to use:
a_Pattern = ChooseOceanFloorPattern(a_RelX, a_RelZ); a_Pattern = a_ChunkDesc.GetBiome(a_RelX, a_RelZ) == biDeepOcean ? patGravel.Get() : ChooseOceanFloorPattern(a_RelX, a_RelZ);
HasHadWater = true; HasHadWater = true;
} // for y } // for y
a_ChunkDesc.SetBlockType(a_RelX, 0, a_RelZ, E_BLOCK_BEDROCK); a_ChunkDesc.SetBlockType(a_RelX, 0, a_RelZ, E_BLOCK_BEDROCK);

View File

@ -45,42 +45,14 @@ static inline bool IsWater(BLOCKTYPE a_BlockType)
void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc) 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. int ChunkX = a_ChunkDesc.GetChunkX();
double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1; int ChunkZ = a_ChunkDesc.GetChunkZ();
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));
if (Val1 < 0) int Val1 = m_Noise.IntNoise2DInt(ChunkX ^ ChunkZ, ChunkZ + ChunkX);
{ int Val2 = m_Noise.IntNoise2DInt(ChunkZ ^ ChunkX, ChunkZ - ChunkX);
Val1 = -Val1;
}
if (Val2 < 0)
{
Val2 = -Val2;
}
int PosX, PosZ; int PosX = Val1 % 16;
// Calculate PosX int PosZ = Val2 % 16;
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);
}
for (int y = 1; y < cChunkDef::Height; y++) for (int y = 1; y < cChunkDef::Height; y++)
{ {
@ -88,12 +60,14 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
{ {
continue; continue;
} }
if (!cBlockInfo::IsSolid(a_ChunkDesc.GetBlockType(PosX, y - 1, PosZ))) // Only place on solid blocks if (!cBlockInfo::IsSolid(a_ChunkDesc.GetBlockType(PosX, y - 1, PosZ))) // Only place on solid blocks
{ {
continue; 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) if (BlockType < -0.7)
{ {
TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM); TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM);
@ -117,13 +91,49 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
{ {
bool IsFireBlock = a_Block == E_BLOCK_FIRE; bool IsFireBlock = a_Block == E_BLOCK_FIRE;
for (int x = a_RelX - 4; x < a_RelX + 4; x++) int MinX = a_RelX - 4;
if (MinX < 0) // Check if the coordinate is outside the chunk. If it it then adjust it.
{ {
float xx = (float) a_ChunkDesc.GetChunkX() * cChunkDef::Width + x; MinX = 0;
for (int z = a_RelZ - 4; z < a_RelZ + 4; z++) }
int MaxX = a_RelX + 4;
if (MaxX > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it.
{
MaxX = cChunkDef::Width;
}
int MinZ = a_RelZ - 4;
if (MinZ < 0) // Check if the coordinate is outside the chunk. If it it then adjust it.
{
MinZ = 0;
}
int MaxZ = a_RelZ + 4;
if (MaxZ > cChunkDef::Width) // Check if the coordinate is outside the chunk. If it it then adjust it.
{
MaxZ = cChunkDef::Width;
}
int MinY = a_RelY - 2;
if (MinY < 0) // Check if the coordinate is outside the chunk. If it it then adjust it.
{
MinY = 0;
}
int MaxY = a_RelY + 2;
if (MaxY > cChunkDef::Height) // Check if the coordinate is outside the chunk. If it it then adjust it.
{
MaxY = cChunkDef::Height;
}
for (int x = MinX; x < MaxX; x++)
{
int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
for (int z = MinZ; z < MaxZ; 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++) for (int y = MinY; y < MaxY; y++)
{ {
if ( if (
((x < 0) || (x >= cChunkDef::Width)) || ((x < 0) || (x >= cChunkDef::Width)) ||
@ -140,7 +150,7 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
} }
BLOCKTYPE BlockBelow = a_ChunkDesc.GetBlockType(x, y - 1, z); BLOCKTYPE BlockBelow = a_ChunkDesc.GetBlockType(x, y - 1, z);
if (!cBlockInfo::IsSolid(BlockBelow)) // Only place on solid blocks if (!cBlockInfo::FullyOccupiesVoxel(BlockBelow)) // Only place on solid blocks
{ {
continue; continue;
} }
@ -153,9 +163,8 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
} }
} }
NOISE_DATATYPE Val = m_Noise.IntNoise2D(xx, zz);
NOISE_DATATYPE Val = m_Noise.CubicNoise2D(xx, zz); if (Val < -0.5)
if (Val < -0.70)
{ {
a_ChunkDesc.SetBlockType(x, y, z, a_Block); a_ChunkDesc.SetBlockType(x, y, z, a_Block);
} }

View File

@ -94,6 +94,17 @@ protected:
{ {
return 70; return 70;
} }
case biExtremeHillsEdge:
case biExtremeHillsPlus:
case biExtremeHills:
case biExtremeHillsPlusM:
case biExtremeHillsM:
case biIceMountains:
{
return 3;
}
default: default:
{ {
return 20; return 20;

View File

@ -1410,6 +1410,383 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
////////////////////////////////////////////////////////////////////////////////
// BridgeDoubleStairs:
// The data has been exported from the gallery Nether, area index 115, ID 810, created by STR_Warrior
{
// Size:
15, 16, 16, // SizeX = 15, SizeY = 16, SizeZ = 16
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
14, 15, 15, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
"a:112: 0\n" /* netherbrick */
"b:114: 7\n" /* netherbrickstairs */
"c:114: 6\n" /* netherbrickstairs */
"d:114: 4\n" /* netherbrickstairs */
"e:114: 5\n" /* netherbrickstairs */
"f:114: 2\n" /* netherbrickstairs */
"g:114: 3\n" /* netherbrickstairs */
"h:114: 1\n" /* netherbrickstairs */
"i: 44:14\n" /* step */
"m: 19: 0\n" /* sponge */,
// Block data:
// Level 0
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmaaam"
/* 1 */ "aammmmmmmmmaaaa"
/* 2 */ "aammmmmmmmmmmma"
/* 3 */ "aammmmmmmmmmmma"
/* 4 */ "mmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmm"
/* 12 */ "aammmmmmmmmmmma"
/* 13 */ "aammmmmmmmmmmma"
/* 14 */ "aammmmmmmmmaaaa"
/* 15 */ "mmmmmmmmmmmaaam"
// Level 1
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmaaam"
/* 1 */ "aammmmmmmmmaaaa"
/* 2 */ "aammmmmmmmmmmma"
/* 3 */ "aammmmmmmmmmmma"
/* 4 */ "mmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmm"
/* 12 */ "aammmmmmmmmmmma"
/* 13 */ "aammmmmmmmmmmma"
/* 14 */ "aammmmmmmmmaaaa"
/* 15 */ "mmmmmmmmmmmaaam"
// Level 2
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmaaam"
/* 1 */ "aammmmmmmmmaaaa"
/* 2 */ "aammmmmmmmmmmma"
/* 3 */ "aammmmmmmmmmmma"
/* 4 */ "mmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmm"
/* 12 */ "aammmmmmmmmmmma"
/* 13 */ "aammmmmmmmmmmma"
/* 14 */ "aammmmmmmmmaaaa"
/* 15 */ "mmmmmmmmmmmaaam"
// Level 3
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmaaam"
/* 1 */ "aammmmmmmmmaaaa"
/* 2 */ "aammmmmmmmmbbba"
/* 3 */ "aammmmmmmmmmmma"
/* 4 */ "mmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmm"
/* 12 */ "aammmmmmmmmmmma"
/* 13 */ "aammmmmmmmmccca"
/* 14 */ "aammmmmmmmmaaaa"
/* 15 */ "mmmmmmmmmmmaaam"
// Level 4
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmaaam"
/* 1 */ "aammmmmmmmmaaaa"
/* 2 */ "aammmmmmmmmaaaa"
/* 3 */ "aammmmmmmmmbbba"
/* 4 */ "mmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmm"
/* 12 */ "aammmmmmmmmccca"
/* 13 */ "aammmmmmmmmaaaa"
/* 14 */ "aammmmmmmmmaaaa"
/* 15 */ "mmmmmmmmmmmaaam"
// Level 5
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmdaaae"
/* 1 */ "aammmmmmmmdaaaa"
/* 2 */ "aammmmmmmmdaaaa"
/* 3 */ "aammmmmmmmdaaaa"
/* 4 */ "mmmmmmmmmmdaaae"
/* 5 */ "mmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmdaaae"
/* 12 */ "aammmmmmmmdaaaa"
/* 13 */ "aammmmmmmmdaaaa"
/* 14 */ "aammmmmmmmdaaaa"
/* 15 */ "mmmmmmmmmmdaaae"
// Level 6
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmaaaaa"
/* 1 */ "aammmmmmmmaaaaa"
/* 2 */ "aammmmmmmmaaaaa"
/* 3 */ "aammmmmmmmaaaaa"
/* 4 */ "mmmmmmmmmmaaaaa"
/* 5 */ "mmmmmmmmmmdaaae"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmdaaae"
/* 11 */ "mmmmmmmmmmaaaaa"
/* 12 */ "aammmmmmmmaaaaa"
/* 13 */ "aammmmmmmmaaaaa"
/* 14 */ "aammmmmmmmaaaaa"
/* 15 */ "mmmmmmmmmmaaaaa"
// Level 7
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmma...a"
/* 1 */ "aammmmmmmma...a"
/* 2 */ "aammmmmmmma...a"
/* 3 */ "aammmmmmmma...a"
/* 4 */ "mmmmmmmmmmafffa"
/* 5 */ "mmmmmmmmmaaaaaa"
/* 6 */ "mmmmmmmmmaaaaae"
/* 7 */ "mmmmmmmmmaaaaae"
/* 8 */ "mmmmmmmmmaaaaae"
/* 9 */ "mmmmmmmmmaaaaae"
/* 10 */ "mmmmmmmmmaaaaaa"
/* 11 */ "mmmmmmmmmmaggga"
/* 12 */ "aammmmmmmma...a"
/* 13 */ "aammmmmmmma...a"
/* 14 */ "aammmmmmmma...a"
/* 15 */ "mmmmmmmmmma...a"
// Level 8
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmm...m"
/* 1 */ "aammmmmmmma...a"
/* 2 */ "aammmmmmmma...a"
/* 3 */ "aammmmmmmma...a"
/* 4 */ "mmmmmmmmmma...a"
/* 5 */ "mmmmmmmmmaafffa"
/* 6 */ "mmmmmmmmaaaaaaa"
/* 7 */ "mmmmmmmmaaaaaaa"
/* 8 */ "mmmmmmmmaaaaaaa"
/* 9 */ "mmmmmmmmaaaaaaa"
/* 10 */ "mmmmmmmmmaaggga"
/* 11 */ "mmmmmmmmmma...a"
/* 12 */ "aammmmmmmma...a"
/* 13 */ "aammmmmmmma...a"
/* 14 */ "aammmmmmmma...a"
/* 15 */ "mmmmmmmmmmm...m"
// Level 9
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmm...m"
/* 1 */ "aaemmmmmmma...a"
/* 2 */ "aaemmmmmmma...a"
/* 3 */ "aaemmmmmmma...a"
/* 4 */ "mmmmmmmmmma...a"
/* 5 */ "mmmmmmmmmaa...a"
/* 6 */ "mmmmaaaaah....a"
/* 7 */ "mmmmaaaaah....a"
/* 8 */ "mmmmaaaaah....a"
/* 9 */ "mmmmaaaaah....a"
/* 10 */ "mmmmmmmmmaa...a"
/* 11 */ "mmmmmmmmmma...a"
/* 12 */ "aaemmmmmmma...a"
/* 13 */ "aaemmmmmmma...a"
/* 14 */ "aaemmmmmmma...a"
/* 15 */ "mmmmmmmmmmm...m"
// Level 10
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmmmmm"
/* 1 */ "aaaeimmmmmammma"
/* 2 */ "aaaeimmmmmammma"
/* 3 */ "aaaeimmmmma...a"
/* 4 */ "mmmmmmmmmmm...m"
/* 5 */ "mmmmaaaaaam...m"
/* 6 */ "mmmmaaaah.....m"
/* 7 */ "mmmmaaaah.....m"
/* 8 */ "mmmmaaaah.....m"
/* 9 */ "mmmmaaaah.....m"
/* 10 */ "mmmmaaaaaam...m"
/* 11 */ "mmmmmmmmmmm...m"
/* 12 */ "aaaeimmmmma...a"
/* 13 */ "aaaeimmmmmammma"
/* 14 */ "aaaeimmmmmammma"
/* 15 */ "mmmmmmmmmmmmmmm"
// Level 11
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "ccccccccccccccc"
/* 1 */ "aaaaaaaaaaaaaaa"
/* 2 */ "aaaaaaaaaaaaaaa"
/* 3 */ "aaaaaaaaaaaaaaa"
/* 4 */ "bbbbaaaaabbbbbb"
/* 5 */ "mmmmagggamm...m"
/* 6 */ "mmmma.........m"
/* 7 */ "mmmma.........m"
/* 8 */ "mmmma.........m"
/* 9 */ "mmmma.........m"
/* 10 */ "mmmmafffamm...m"
/* 11 */ "ccccaaaahcccccc"
/* 12 */ "aaaaaaaaaaaaaaa"
/* 13 */ "aaaaaaaaaaaaaaa"
/* 14 */ "aaaaaaaaaaaaaaa"
/* 15 */ "bbbbbbbbbbbbbbb"
// Level 12
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "aaaaaaaaaaaaaaa"
/* 1 */ "aaaaaaaaaaaaaaa"
/* 2 */ "aaaaaaaaaaaaaaa"
/* 3 */ "aaaaaaaaaaaaaaa"
/* 4 */ "aaaaagggaaaaaaa"
/* 5 */ "mmmma...ammmmmm"
/* 6 */ "mmmma.........m"
/* 7 */ "mmmmm.........m"
/* 8 */ "mmmmm.........m"
/* 9 */ "mmmma.........m"
/* 10 */ "mmmma...ammmmmm"
/* 11 */ "aaaaafffaaaaaaa"
/* 12 */ "aaaaaaaaaaaaaaa"
/* 13 */ "aaaaaaaaaaaaaaa"
/* 14 */ "aaaaaaaaaaaaaaa"
/* 15 */ "aaaaaaaaaaaaaaa"
// Level 13
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "aaaaaaaaaaaaaaa"
/* 1 */ "..............."
/* 2 */ "..............."
/* 3 */ "..............."
/* 4 */ "aaaaa...aaaaaaa"
/* 5 */ "mmmma...ammmmmm"
/* 6 */ "mmmmm.....mmmmm"
/* 7 */ "mmmmm.....mmmmm"
/* 8 */ "mmmmm.....mmmmm"
/* 9 */ "mmmmm.....mmmmm"
/* 10 */ "mmmma...ammmmmm"
/* 11 */ "aaaaa...aaaaaaa"
/* 12 */ "..............."
/* 13 */ "..............."
/* 14 */ "..............."
/* 15 */ "aaaaaaaaaaaaaaa"
// Level 14
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmmmmm"
/* 1 */ "..............."
/* 2 */ "..............."
/* 3 */ "..............."
/* 4 */ "mmmmm...mmmmmmm"
/* 5 */ "mmmmm...mmmmmmm"
/* 6 */ "mmmmm...mmmmmmm"
/* 7 */ "mmmmm...mmmmmmm"
/* 8 */ "mmmmm...mmmmmmm"
/* 9 */ "mmmmm...mmmmmmm"
/* 10 */ "mmmmm...mmmmmmm"
/* 11 */ "mmmmm...mmmmmmm"
/* 12 */ "..............."
/* 13 */ "..............."
/* 14 */ "..............."
/* 15 */ "mmmmmmmmmmmmmmm"
// Level 15
/* z\x* 11111 */
/* * 012345678901234 */
/* 0 */ "mmmmmmmmmmmmmmm"
/* 1 */ "..............."
/* 2 */ "..............."
/* 3 */ "..............."
/* 4 */ "mmmmm...mmmmmmm"
/* 5 */ "mmmmm...mmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmm"
/* 10 */ "mmmmm...mmmmmmm"
/* 11 */ "mmmmm...mmmmmmm"
/* 12 */ "..............."
/* 13 */ "..............."
/* 14 */ "..............."
/* 15 */ "mmmmmmmmmmmmmmm",
// Connectors:
"0: 0, 13, 13: 4\n" /* Type 0, direction X- */
"0: 14, 13, 13: 5\n" /* Type 0, direction X+ */
"0: 0, 13, 2: 4\n" /* Type 0, direction X- */
"0: 14, 13, 2: 5\n" /* Type 0, direction X+ */
"0: 12, 7, 15: 3\n" /* Type 0, direction Z+ */
"0: 12, 7, 0: 2\n" /* Type 0, direction Z- */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
// Merge strategy:
cBlockArea::msSpongePrint,
// ShouldExtendFloor:
true,
// DefaultWeight:
20,
// DepthWeight:
"",
// AddWeightIfSame:
0,
// MoveToGround:
false,
}, // BridgeDoubleStairs
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BridgeFunnelDown: // BridgeFunnelDown:
// The data has been exported from the gallery Nether, area index 0, ID 2, created by Aloe_vera // The data has been exported from the gallery Nether, area index 0, ID 2, created by Aloe_vera
@ -2606,12 +2983,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "aaaaaaaaaaa" /* 2 */ "aaaaaaaaaaa"
/* 3 */ "aaaaaaaaaaa" /* 3 */ "aaaaaaaaaaa"
/* 4 */ "aaaaaaaaaaa" /* 4 */ "aaaaaaaaaaa"
/* 5 */ "aaaaa......" /* 5 */ "aaaaammmmmm"
/* 6 */ "aaaaa......" /* 6 */ "aaaaammmmmm"
/* 7 */ "aaaaa......" /* 7 */ "aaaaammmmmm"
/* 8 */ "aaaaa......" /* 8 */ "aaaaammmmmm"
/* 9 */ "aaaaa......" /* 9 */ "aaaaammmmmm"
/* 10 */ "aaaaa......" /* 10 */ "aaaaammmmmm"
// Level 1 // Level 1
/* z\x* 1 */ /* z\x* 1 */
@ -2621,12 +2998,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "a.........." /* 2 */ "a.........."
/* 3 */ "a.........." /* 3 */ "a.........."
/* 4 */ "a...aaaaaaa" /* 4 */ "a...aaaaaaa"
/* 5 */ "a...a......" /* 5 */ "a...ammmmmm"
/* 6 */ "a...a......" /* 6 */ "a...ammmmmm"
/* 7 */ "a...a......" /* 7 */ "a...ammmmmm"
/* 8 */ "a...a......" /* 8 */ "a...ammmmmm"
/* 9 */ "a...a......" /* 9 */ "a...ammmmmm"
/* 10 */ "a...a......" /* 10 */ "a...ammmmmm"
// Level 2 // Level 2
/* z\x* 1 */ /* z\x* 1 */
@ -2636,12 +3013,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "a.........." /* 2 */ "a.........."
/* 3 */ "b.........." /* 3 */ "b.........."
/* 4 */ "a...abababa" /* 4 */ "a...abababa"
/* 5 */ "b...b......" /* 5 */ "b...bmmmmmm"
/* 6 */ "a...a......" /* 6 */ "a...ammmmmm"
/* 7 */ "b...b......" /* 7 */ "b...bmmmmmm"
/* 8 */ "a...a......" /* 8 */ "a...ammmmmm"
/* 9 */ "b...b......" /* 9 */ "b...bmmmmmm"
/* 10 */ "a...a......" /* 10 */ "a...ammmmmm"
// Level 3 // Level 3
/* z\x* 1 */ /* z\x* 1 */
@ -2651,12 +3028,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "a.........." /* 2 */ "a.........."
/* 3 */ "b.........." /* 3 */ "b.........."
/* 4 */ "a...abababa" /* 4 */ "a...abababa"
/* 5 */ "b...b......" /* 5 */ "b...bmmmmmm"
/* 6 */ "a...a......" /* 6 */ "a...ammmmmm"
/* 7 */ "b...b......" /* 7 */ "b...bmmmmmm"
/* 8 */ "a...a......" /* 8 */ "a...ammmmmm"
/* 9 */ "b...b......" /* 9 */ "b...bmmmmmm"
/* 10 */ "a...a......" /* 10 */ "a...ammmmmm"
// Level 4 // Level 4
/* z\x* 1 */ /* z\x* 1 */
@ -2666,12 +3043,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "a.........." /* 2 */ "a.........."
/* 3 */ "b.........." /* 3 */ "b.........."
/* 4 */ "a...abababa" /* 4 */ "a...abababa"
/* 5 */ "b...b......" /* 5 */ "b...bmmmmmm"
/* 6 */ "a...a......" /* 6 */ "a...ammmmmm"
/* 7 */ "b...b......" /* 7 */ "b...bmmmmmm"
/* 8 */ "a...a......" /* 8 */ "a...ammmmmm"
/* 9 */ "b...b......" /* 9 */ "b...bmmmmmm"
/* 10 */ "a...a......" /* 10 */ "a...ammmmmm"
// Level 5 // Level 5
/* z\x* 1 */ /* z\x* 1 */
@ -2681,12 +3058,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 2 */ "daaaaaaaaaa" /* 2 */ "daaaaaaaaaa"
/* 3 */ "daaaaaaaaaa" /* 3 */ "daaaaaaaaaa"
/* 4 */ "daaaeeeeeee" /* 4 */ "daaaeeeeeee"
/* 5 */ "daaaf......" /* 5 */ "daaafmmmmmm"
/* 6 */ "daaaf......" /* 6 */ "daaafmmmmmm"
/* 7 */ "daaaf......" /* 7 */ "daaafmmmmmm"
/* 8 */ "daaaf......" /* 8 */ "daaafmmmmmm"
/* 9 */ "daaaf......" /* 9 */ "daaafmmmmmm"
/* 10 */ "daaaf......", /* 10 */ "daaafmmmmmm",
// Connectors: // Connectors:
"1: 2, 1, 10: 3\n" /* Type 1, direction Z+ */ "1: 2, 1, 10: 3\n" /* Type 1, direction Z+ */
@ -4097,7 +4474,12 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
/* 14 */ "abbaabbaabbaabba", /* 14 */ "abbaabbaabbaabba",
// Connectors: // Connectors:
"", "1: 0, 6, 7: 4\n" /* Type 1, direction X- */
"-1: 0, 6, 7: 4\n" /* Type -1, direction X- */
"1: 9, 1, 0: 2\n" /* Type 1, direction Z- */
"-1: 9, 1, 0: 2\n" /* Type -1, direction Z- */
"1: 9, 1, 14: 3\n" /* Type 1, direction Z+ */
"-1: 9, 1, 14: 3\n" /* Type -1, direction Z+ */,
// AllowedRotations: // AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */ 7, /* 1, 2, 3 CCW rotation allowed */
@ -4314,6 +4696,339 @@ const cPrefab::sDef g_NetherFortPrefabs[] =
////////////////////////////////////////////////////////////////////////////////
// SlabbedBridgeStairs:
// The data has been exported from the gallery Nether, area index 116, ID 811, created by Aloe_vera
{
// Size:
16, 14, 16, // SizeX = 16, SizeY = 14, SizeZ = 16
// Hitbox (relative to bounding box):
0, 0, 0, // MinX, MinY, MinZ
15, 13, 15, // MaxX, MaxY, MaxZ
// Block definitions:
".: 0: 0\n" /* air */
"a:112: 0\n" /* netherbrick */
"b:114: 5\n" /* netherbrickstairs */
"c:114: 4\n" /* netherbrickstairs */
"d: 44:14\n" /* step */
"e:114: 6\n" /* netherbrickstairs */
"f:114: 7\n" /* netherbrickstairs */
"g: 44: 6\n" /* step */
"m: 19: 0\n" /* sponge */,
// Block data:
// Level 0
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmmmmm"
/* 1 */ "aammmmmmmmmmmmaa"
/* 2 */ "aammmmmmmmmmmmaa"
/* 3 */ "aammmmmmmmmmmmaa"
/* 4 */ "mmmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 1
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmmmmm"
/* 1 */ "aabmmmmmmmmmmcaa"
/* 2 */ "aabmmmmmmmmmmcaa"
/* 3 */ "aabmmmmmmmmmmcaa"
/* 4 */ "mmmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 2
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmmmmm"
/* 1 */ "aaabdmmmmmmdcaaa"
/* 2 */ "aaabdmmmmmmdcaaa"
/* 3 */ "aaabdmmmmmmdcaaa"
/* 4 */ "mmmmmmmmmmmmmmmm"
/* 5 */ "mmmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 3
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "eeeeeeeeeeeeeeee"
/* 1 */ "aaaaaaaaaaaaaaaa"
/* 2 */ "aaaaaaaaaaaaaaaa"
/* 3 */ "aaaaaaaaaaaaaaaa"
/* 4 */ "ffffffffffffffff"
/* 5 */ "mmmmmmmmmmmmmmmm"
/* 6 */ "mmmmmmmmmmmmmmmm"
/* 7 */ "mmmmmmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 4
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "aaaaaaaaaaaaaaaa"
/* 1 */ "aaaaaaaaaaaaaaaa"
/* 2 */ "aaaaaaaaaaaaaaaa"
/* 3 */ "aaaaaaaaaaaaaaaa"
/* 4 */ "aaaaaaaaaaaaaaaa"
/* 5 */ "faaabmmmmmmmmmmm"
/* 6 */ "caaabmmmmmmmmmmm"
/* 7 */ "caaabmmmmmmmmmmm"
/* 8 */ "mmmmmmmmmmmmmmmm"
/* 9 */ "mmmmmmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 5
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "aaaaaaaaaaaaaaaa"
/* 1 */ "................"
/* 2 */ "................"
/* 3 */ "................"
/* 4 */ "a...aaaaaaaaaaaa"
/* 5 */ "agggammmmmmmmmmm"
/* 6 */ "aaaaammmmmmmmmmm"
/* 7 */ "aaaaammmmmmmmmmm"
/* 8 */ "caaabmmmmmmmmmmm"
/* 9 */ "caaabmmmmmmmmmmm"
/* 10 */ "mmmmmmmmmmmmmmmm"
/* 11 */ "mmmmmmmmmmmmmmmm"
/* 12 */ "maaammmmmmmmmmmm"
/* 13 */ "maaammmmmmmmmmmm"
/* 14 */ "maaammmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 6
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmaaam"
/* 1 */ "................"
/* 2 */ "................"
/* 3 */ "................"
/* 4 */ "m...mmmmmmmmaaam"
/* 5 */ "a...ammmmmmmmmmm"
/* 6 */ "a...ammmmmmmmmmm"
/* 7 */ "agggammmmmmmmmmm"
/* 8 */ "aaaaammmmmmmmmmm"
/* 9 */ "aaaaammmmmmmmmmm"
/* 10 */ "caaabmmmmmmmmmmm"
/* 11 */ "caaabmmmmmmmmmmm"
/* 12 */ "maaabmmmmmmmmmmm"
/* 13 */ "maaabmmmmmmmmmmm"
/* 14 */ "maaafmmmmmmmaaam"
/* 15 */ "mmmmmmmmmmmmaaam"
// Level 7
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmaaam"
/* 1 */ "................"
/* 2 */ "................"
/* 3 */ "................"
/* 4 */ "m...mmmmmmmmaaam"
/* 5 */ "m...mmmmmmmmmmmm"
/* 6 */ "m...mmmmmmmmmmmm"
/* 7 */ "a...ammmmmmmmmmm"
/* 8 */ "a...ammmmmmmmmmm"
/* 9 */ "agggammmmmmmmmmm"
/* 10 */ "aaaaammmmmmmmmmm"
/* 11 */ "aaaaaeemmmmmmmmm"
/* 12 */ "caaaaaammmmmmmmm"
/* 13 */ "caaaaaammmmmmmmm"
/* 14 */ "caaaaaammmmmaaam"
/* 15 */ "fffffffmmmmmaaam"
// Level 8
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmmaaam"
/* 1 */ "mmmmmmmmmmmmmmmm"
/* 2 */ "mmmmmmmmmmmmmmmm"
/* 3 */ "mmmmmmmmmmmmmmmm"
/* 4 */ "m...mmmmmmmmaaam"
/* 5 */ "m...mmmmmmmmmmmm"
/* 6 */ "m...mmmmmmmmmmmm"
/* 7 */ "m...mmmmmmmmmmmm"
/* 8 */ "m...mmmmmmmmmmmm"
/* 9 */ "a...ammmmmmmmmmm"
/* 10 */ "a...ammmmmmmmmmm"
/* 11 */ "a...aaaeemmmmmmm"
/* 12 */ "a....gaaammmmmmm"
/* 13 */ "a....gaaammmmmmm"
/* 14 */ "a....gaaammmaaam"
/* 15 */ "aaaaaaaffmmmaaam"
// Level 9
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmcaaab"
/* 1 */ "mmmmmmmmmmmcaaab"
/* 2 */ "mmmmmmmmmmmcaaab"
/* 3 */ "mmmmmmmmmmmcaaab"
/* 4 */ "mmmmmmmmmmmcaaab"
/* 5 */ "mmmmmmmmmmmcaaab"
/* 6 */ "m...mmmmmmmcaaab"
/* 7 */ "m...mmmmmmmcaaab"
/* 8 */ "m...mmmmmmmcaaab"
/* 9 */ "m...mmmmmmmcaaab"
/* 10 */ "m...mmmmmmmcaaab"
/* 11 */ "m...maaaaeecaaab"
/* 12 */ "m......gaaaaaaab"
/* 13 */ "m......gaaaaaaab"
/* 14 */ "m......gaaaaaaab"
/* 15 */ "mmmmmaaaafffaaab"
// Level 10
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmaaaaa"
/* 1 */ "mmmmmmmmmmmaaaaa"
/* 2 */ "mmmmmmmmmmmaaaaa"
/* 3 */ "mmmmmmmmmmmaaaaa"
/* 4 */ "mmmmmmmmmmmaaaaa"
/* 5 */ "mmmmmmmmmmmaaaaa"
/* 6 */ "mmmmmmmmmmmaaaaa"
/* 7 */ "mmmmmmmmmmmaaaaa"
/* 8 */ "m...mmmmmmmaaaaa"
/* 9 */ "m...mmmmmmmaaaaa"
/* 10 */ "m...mmmmmmmaaaaa"
/* 11 */ "m...mmmaaaaaaaaa"
/* 12 */ "m........gaaaaaa"
/* 13 */ "m........gaaaaaa"
/* 14 */ "m........gaaaaaa"
/* 15 */ "mmmmmmmaaaaaaaaa"
// Level 11
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmma...a"
/* 1 */ "mmmmmmmmmmma...a"
/* 2 */ "mmmmmmmmmmma...a"
/* 3 */ "mmmmmmmmmmma...a"
/* 4 */ "mmmmmmmmmmma...a"
/* 5 */ "mmmmmmmmmmma...a"
/* 6 */ "mmmmmmmmmmma...a"
/* 7 */ "mmmmmmmmmmma...a"
/* 8 */ "mmmmmmmmmmma...a"
/* 9 */ "mmmmmmmmmmma...a"
/* 10 */ "mmmmmmmmmmma...a"
/* 11 */ "mmmmmmmmmaaa...a"
/* 12 */ "mmmm...........a"
/* 13 */ "mmmm...........a"
/* 14 */ "mmmm...........a"
/* 15 */ "mmmmmmmmmaaa...a"
// Level 12
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmm...m"
/* 1 */ "mmmmmmmmmmmm...m"
/* 2 */ "mmmmmmmmmmmm...m"
/* 3 */ "mmmmmmmmmmmm...m"
/* 4 */ "mmmmmmmmmmmm...m"
/* 5 */ "mmmmmmmmmmmm...m"
/* 6 */ "mmmmmmmmmmmm...m"
/* 7 */ "mmmmmmmmmmmm...m"
/* 8 */ "mmmmmmmmmmmm...m"
/* 9 */ "mmmmmmmmmmmm...m"
/* 10 */ "mmmmmmmmmmmm...m"
/* 11 */ "mmmmmmmmmmmm...m"
/* 12 */ "mmmmmm.........m"
/* 13 */ "mmmmmm.........m"
/* 14 */ "mmmmmm.........m"
/* 15 */ "mmmmmmmmmmmm...m"
// Level 13
/* z\x* 111111 */
/* * 0123456789012345 */
/* 0 */ "mmmmmmmmmmmm...m"
/* 1 */ "mmmmmmmmmmmm...m"
/* 2 */ "mmmmmmmmmmmm...m"
/* 3 */ "mmmmmmmmmmmm...m"
/* 4 */ "mmmmmmmmmmmm...m"
/* 5 */ "mmmmmmmmmmmm...m"
/* 6 */ "mmmmmmmmmmmm...m"
/* 7 */ "mmmmmmmmmmmm...m"
/* 8 */ "mmmmmmmmmmmm...m"
/* 9 */ "mmmmmmmmmmmm...m"
/* 10 */ "mmmmmmmmmmmm...m"
/* 11 */ "mmmmmmmmmmmm...m"
/* 12 */ "mmmmmmmm.......m"
/* 13 */ "mmmmmmmm.......m"
/* 14 */ "mmmmmmmm.......m"
/* 15 */ "mmmmmmmmmmmm...m",
// Connectors:
"0: 13, 11, 0: 2\n" /* Type 0, direction Z- */
"0: 13, 11, 15: 3\n" /* Type 0, direction Z+ */
"0: 0, 5, 2: 4\n" /* Type 0, direction X- */
"0: 15, 5, 2: 5\n" /* Type 0, direction X+ */,
// AllowedRotations:
7, /* 1, 2, 3 CCW rotation allowed */
// Merge strategy:
cBlockArea::msSpongePrint,
// ShouldExtendFloor:
true,
// DefaultWeight:
20,
// DepthWeight:
"",
// AddWeightIfSame:
0,
// MoveToGround:
false,
}, // SlabbedBridgeStairs
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// StairsToOpen1: // StairsToOpen1:
// The data has been exported from the gallery Nether, area index 27, ID 277, created by Aloe_vera // The data has been exported from the gallery Nether, area index 27, ID 277, created by Aloe_vera

View File

@ -33,7 +33,7 @@ public:
cHTTPMessage(eKind a_Kind); cHTTPMessage(eKind a_Kind);
// Force a virtual destructor in all descendants // 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 */ /** 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); void AddHeader(const AString & a_Key, const AString & a_Value);

View File

@ -102,13 +102,17 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
{ {
cItem ToAdd(a_Item); cItem ToAdd(a_Item);
int res = 0; int res = 0;
// When the item is a armor, try to set it directly to the armor slot.
if (ItemCategory::IsArmor(a_Item.m_ItemType)) if (ItemCategory::IsArmor(a_Item.m_ItemType))
{ {
res = m_ArmorSlots.AddItem(ToAdd, a_AllowNewStacks); for (size_t i = 0; i < (size_t)m_ArmorSlots.GetNumSlots(); i++)
ToAdd.m_ItemCount -= res;
if (ToAdd.m_ItemCount == 0)
{ {
return res; if (m_ArmorSlots.GetSlot(i).IsEmpty() && cSlotAreaArmor::CanPlaceArmorInSlot(i, a_Item))
{
m_ArmorSlots.SetSlot(i, a_Item);
return a_Item.m_ItemCount;
}
} }
} }
@ -222,12 +226,6 @@ void cInventory::SetSlot(int a_SlotNum, const cItem & a_Item)
return; return;
} }
Grid->SetSlot(GridSlotNum, a_Item); Grid->SetSlot(GridSlotNum, a_Item);
// Broadcast the Equipped Item, if the Slot is changed.
if ((Grid == &m_HotbarSlots) && (m_EquippedSlotNum == (a_SlotNum - invHotbarOffset)))
{
m_Owner.GetWorld()->BroadcastEntityEquipment(m_Owner, 0, a_Item, m_Owner.GetClientHandle());
}
} }
@ -393,6 +391,10 @@ bool cInventory::DamageItem(int a_SlotNum, short a_Amount)
LOGWARNING("%s: requesting an invalid slot index: %d out of %d", __FUNCTION__, a_SlotNum, invNumSlots - 1); LOGWARNING("%s: requesting an invalid slot index: %d out of %d", __FUNCTION__, a_SlotNum, invNumSlots - 1);
return false; return false;
} }
if (a_Amount <= 0)
{
return false;
}
int GridSlotNum = 0; int GridSlotNum = 0;
cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum);
@ -713,6 +715,12 @@ void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
m_ArmorSlots.GetSlot(a_SlotNum), m_Owner.GetClientHandle() m_ArmorSlots.GetSlot(a_SlotNum), m_Owner.GetClientHandle()
); );
} }
// Broadcast the Equipped Item, if the Slot is changed.
if ((a_ItemGrid == &m_HotbarSlots) && (m_EquippedSlotNum == a_SlotNum))
{
m_Owner.GetWorld()->BroadcastEntityEquipment(m_Owner, 0, GetEquippedItem(), m_Owner.GetClientHandle());
}
// Convert the grid-local a_SlotNum to our global SlotNum: // Convert the grid-local a_SlotNum to our global SlotNum:
int Base = 0; int Base = 0;

View File

@ -41,33 +41,33 @@ short cItem::GetMaxDamage(void) const
switch (m_ItemType) switch (m_ItemType)
{ {
case E_ITEM_BOW: return 384; case E_ITEM_BOW: return 384;
case E_ITEM_DIAMOND_AXE: return 1563; case E_ITEM_DIAMOND_AXE: return 1561;
case E_ITEM_DIAMOND_HOE: return 1563; case E_ITEM_DIAMOND_HOE: return 1561;
case E_ITEM_DIAMOND_PICKAXE: return 1563; case E_ITEM_DIAMOND_PICKAXE: return 1561;
case E_ITEM_DIAMOND_SHOVEL: return 1563; case E_ITEM_DIAMOND_SHOVEL: return 1561;
case E_ITEM_DIAMOND_SWORD: return 1563; case E_ITEM_DIAMOND_SWORD: return 1561;
case E_ITEM_FLINT_AND_STEEL: return 65; case E_ITEM_FLINT_AND_STEEL: return 64;
case E_ITEM_GOLD_AXE: return 32; case E_ITEM_GOLD_AXE: return 32;
case E_ITEM_GOLD_HOE: return 32; case E_ITEM_GOLD_HOE: return 32;
case E_ITEM_GOLD_PICKAXE: return 32; case E_ITEM_GOLD_PICKAXE: return 32;
case E_ITEM_GOLD_SHOVEL: return 32; case E_ITEM_GOLD_SHOVEL: return 32;
case E_ITEM_GOLD_SWORD: return 32; case E_ITEM_GOLD_SWORD: return 32;
case E_ITEM_IRON_AXE: return 251; case E_ITEM_IRON_AXE: return 250;
case E_ITEM_IRON_HOE: return 251; case E_ITEM_IRON_HOE: return 250;
case E_ITEM_IRON_PICKAXE: return 251; case E_ITEM_IRON_PICKAXE: return 250;
case E_ITEM_IRON_SHOVEL: return 251; case E_ITEM_IRON_SHOVEL: return 250;
case E_ITEM_IRON_SWORD: return 251; case E_ITEM_IRON_SWORD: return 250;
case E_ITEM_SHEARS: return 251; case E_ITEM_SHEARS: return 250;
case E_ITEM_STONE_AXE: return 132; case E_ITEM_STONE_AXE: return 131;
case E_ITEM_STONE_HOE: return 132; case E_ITEM_STONE_HOE: return 131;
case E_ITEM_STONE_PICKAXE: return 132; case E_ITEM_STONE_PICKAXE: return 131;
case E_ITEM_STONE_SHOVEL: return 132; case E_ITEM_STONE_SHOVEL: return 131;
case E_ITEM_STONE_SWORD: return 132; case E_ITEM_STONE_SWORD: return 131;
case E_ITEM_WOODEN_AXE: return 60; case E_ITEM_WOODEN_AXE: return 59;
case E_ITEM_WOODEN_HOE: return 60; case E_ITEM_WOODEN_HOE: return 59;
case E_ITEM_WOODEN_PICKAXE: return 60; case E_ITEM_WOODEN_PICKAXE: return 59;
case E_ITEM_WOODEN_SHOVEL: return 60; case E_ITEM_WOODEN_SHOVEL: return 59;
case E_ITEM_WOODEN_SWORD: return 60; case E_ITEM_WOODEN_SWORD: return 59;
} }
return 0; return 0;
} }
@ -86,7 +86,7 @@ bool cItem::DamageItem(short a_Amount)
} }
m_ItemDamage += a_Amount; m_ItemDamage += a_Amount;
return (m_ItemDamage >= MaxDamage); return (m_ItemDamage > MaxDamage);
} }

View File

@ -269,7 +269,7 @@ int cItemGrid::AddItemToSlot(const cItem & a_ItemStack, int a_Slot, int a_Num, i
int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_PrioritarySlot) int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_PrioritarySlot)
{ {
int NumLeft = a_ItemStack.m_ItemCount; int NumLeft = a_ItemStack.m_ItemCount;
int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); int MaxStack = a_ItemStack.GetMaxStackSize();
// Try prioritarySlot first: // Try prioritarySlot first:
if ( if (
@ -284,7 +284,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit
} }
// Scan existing stacks: // Scan existing stacks:
for (int i = m_NumSlots - 1; i >= 0; i--) for (int i = 0; i < m_NumSlots; i++)
{ {
if (m_Slots[i].IsEqual(a_ItemStack)) if (m_Slots[i].IsEqual(a_ItemStack))
{ {
@ -302,7 +302,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit
return (a_ItemStack.m_ItemCount - NumLeft); return (a_ItemStack.m_ItemCount - NumLeft);
} }
for (int i = m_NumSlots - 1; i >= 0; i--) for (int i = 0; i < m_NumSlots; i++)
{ {
if (m_Slots[i].IsEmpty()) if (m_Slots[i].IsEmpty())
{ {

View File

@ -328,15 +328,25 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
if (a_Player->IsGameModeSurvival()) if (a_Player->IsGameModeSurvival())
{ {
if (!BlockRequiresSpecialTool(Block) || CanHarvestBlock(Block)) cChunkInterface ChunkInterface(a_World->GetChunkMap());
{ cBlockInServerPluginInterface PluginInterface(*a_World);
cChunkInterface ChunkInterface(a_World->GetChunkMap()); 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);
cBlockInServerPluginInterface PluginInterface(*a_World);
Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
}
} }
a_Player->UseEquippedItem(); if (!cBlockInfo::IsOneHitDig(Block))
{
a_Player->UseEquippedItem(GetDurabilityLossByAction(dlaBreakBlock));
}
}
void cItemHandler::OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity)
{
UNUSED(a_AttackedEntity);
a_Attacker->UseEquippedItem(GetDurabilityLossByAction(dlaAttackEntity));
} }
@ -354,6 +364,20 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I
short cItemHandler::GetDurabilityLossByAction(eDurabilityLostAction a_Action)
{
switch ((int)a_Action)
{
case dlaAttackEntity: return 2;
case dlaBreakBlock: return 1;
}
return 0;
}
char cItemHandler::GetMaxStackSize(void) char cItemHandler::GetMaxStackSize(void)
{ {
if (m_ItemType < 256) if (m_ItemType < 256)
@ -505,6 +529,7 @@ bool cItemHandler::IsPlaceable(void)
bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType) bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
{ {
UNUSED(a_ItemType);
return false; return false;
} }
@ -514,9 +539,50 @@ bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType) bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
{ {
UNUSED(a_BlockType); switch (a_BlockType)
{
return false; 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;
}
} }

View File

@ -19,6 +19,13 @@ class cPlayer;
class cItemHandler class cItemHandler
{ {
public: public:
enum eDurabilityLostAction
{
dlaBreakBlock,
dlaAttackEntity,
};
cItemHandler(int a_ItemType); cItemHandler(int a_ItemType);
/** Force virtual destructor */ /** Force virtual destructor */
@ -48,11 +55,17 @@ public:
virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace); virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_HeldItem, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace);
/** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */ /** Called when the player destroys a block using this item. This also calls the drop function for the destroyed block */
virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_X, int a_Y, int a_Z); virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ);
/** Called when a player attacks a other entity. */
virtual void OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity);
/** Called after the player has eaten this item. */ /** Called after the player has eaten this item. */
virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item); virtual void OnFoodEaten(cWorld *a_World, cPlayer *a_Player, cItem *a_Item);
/** Get the durability lost which the item will get, when a specified action was performed. */
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action);
/** Returns the maximum stack size for a given item */ /** Returns the maximum stack size for a given item */
virtual char GetMaxStackSize(void); virtual char GetMaxStackSize(void);

View File

@ -16,7 +16,6 @@ public:
cItemHoeHandler(int a_ItemType) cItemHoeHandler(int a_ItemType)
: cItemHandler(a_ItemType) : cItemHandler(a_ItemType)
{ {
} }
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override
@ -26,13 +25,18 @@ public:
if ((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS)) if ((Block == E_BLOCK_DIRT) || (Block == E_BLOCK_GRASS))
{ {
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0); a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FARMLAND, 0);
a_Player->UseEquippedItem(); a_Player->UseEquippedItem();
return true; return true;
} }
return false; return false;
} }
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
{
return 0;
}
} ; } ;

View File

@ -8,6 +8,7 @@
class cItemPickaxeHandler : class cItemPickaxeHandler :
public cItemHandler public cItemHandler
{ {
typedef cItemHandler super;
public: public:
cItemPickaxeHandler(int a_ItemType) cItemPickaxeHandler(int a_ItemType)
: cItemHandler(a_ItemType) : cItemHandler(a_ItemType)
@ -84,7 +85,7 @@ public:
return PickaxeLevel() >= 1; return PickaxeLevel() >= 1;
} }
} }
return false; return super::CanHarvestBlock(a_BlockType);
} }
virtual bool CanRepairWithRawMaterial(short a_ItemType) override virtual bool CanRepairWithRawMaterial(short a_ItemType) override

View File

@ -17,126 +17,12 @@ public:
} }
/** Returns the potion color (used by the client for visuals), based on the potion's damage value */
static int GetPotionColor(short a_ItemDamage)
{
// Lowest six bits
return (a_ItemDamage & 0x3f);
}
/** Translates the potion's damage value into the entity effect that the potion gives */
static cEntityEffect::eType GetEntityEffectType(short a_ItemDamage)
{
// Lowest four bits
// Potion effect bits are different from entity effect values
// For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits
switch (a_ItemDamage & 0x0f)
{
case 0x01: return cEntityEffect::effRegeneration;
case 0x02: return cEntityEffect::effSpeed;
case 0x03: return cEntityEffect::effFireResistance;
case 0x04: return cEntityEffect::effPoison;
case 0x05: return cEntityEffect::effInstantHealth;
case 0x06: return cEntityEffect::effNightVision;
case 0x08: return cEntityEffect::effWeakness;
case 0x09: return cEntityEffect::effStrength;
case 0x0a: return cEntityEffect::effSlowness;
case 0x0c: return cEntityEffect::effInstantDamage;
case 0x0d: return cEntityEffect::effWaterBreathing;
case 0x0e: return cEntityEffect::effInvisibility;
// No effect potions
case 0x00:
case 0x07:
case 0x0b: // Will be potion of leaping in 1.8
case 0x0f:
{
break;
}
}
return cEntityEffect::effNoEffect;
}
/** Retrieves the intensity level from the potion's damage value.
Returns 0 for level I potions, 1 for level II potions. */
static short GetEntityEffectIntensity(short a_ItemDamage)
{
// Level II potion if the fifth lowest bit is set
return ((a_ItemDamage & 0x20) != 0) ? 1 : 0;
}
/** Returns the effect duration, in ticks, based on the potion's damage value */
static int GetEntityEffectDuration(short a_ItemDamage)
{
// Base duration in ticks
int base = 0;
double TierCoeff = 1, ExtCoeff = 1, SplashCoeff = 1;
switch (GetEntityEffectType(a_ItemDamage))
{
case cEntityEffect::effRegeneration:
case cEntityEffect::effPoison:
{
base = 900;
break;
}
case cEntityEffect::effSpeed:
case cEntityEffect::effFireResistance:
case cEntityEffect::effNightVision:
case cEntityEffect::effStrength:
case cEntityEffect::effWaterBreathing:
case cEntityEffect::effInvisibility:
{
base = 3600;
break;
}
case cEntityEffect::effWeakness:
case cEntityEffect::effSlowness:
{
base = 1800;
break;
}
}
// If potion is level II, half the duration. If not, stays the same
TierCoeff = (GetEntityEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1;
// If potion is extended, multiply duration by 8/3. If not, stays the same
// Extended potion if sixth lowest bit is set
ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1;
// If potion is splash potion, multiply duration by 3/4. If not, stays the same
SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75;
// Ref.:
// http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit
// http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit
return (int)(base * TierCoeff * ExtCoeff * SplashCoeff);
}
/** Returns true if the potion with the given damage is drinkable */
static bool IsPotionDrinkable(short a_ItemDamage)
{
// Drinkable potion if 13th lowest bit is set
// Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table
return ((a_ItemDamage & 0x2000) != 0);
}
// cItemHandler overrides: // cItemHandler overrides:
virtual bool IsDrinkable(short a_ItemDamage) override virtual bool IsDrinkable(short a_ItemDamage) override
{ {
// Drinkable potion if 13th lowest bit is set // Drinkable potion if 13th lowest bit is set
// Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table
return IsPotionDrinkable(a_ItemDamage); return cEntityEffect::IsPotionDrinkable(a_ItemDamage);
} }
@ -145,7 +31,7 @@ public:
short PotionDamage = a_Item.m_ItemDamage; short PotionDamage = a_Item.m_ItemDamage;
// Do not throw non-splash potions: // Do not throw non-splash potions:
if (IsPotionDrinkable(PotionDamage)) if (cEntityEffect::IsPotionDrinkable(PotionDamage))
{ {
return false; return false;
} }
@ -153,20 +39,10 @@ public:
Vector3d Pos = a_Player->GetThrowStartPos(); Vector3d Pos = a_Player->GetThrowStartPos();
Vector3d Speed = a_Player->GetLookVector() * 7; Vector3d Speed = a_Player->GetLookVector() * 7;
cSplashPotionEntity * Projectile = new cSplashPotionEntity( if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, cProjectileEntity::pkSplashPotion, a_Player, &a_Player->GetEquippedItem(), &Speed) < 0)
a_Player, Pos.x, Pos.y, Pos.z, Speed,
GetEntityEffectType(PotionDamage), cEntityEffect(GetEntityEffectDuration(PotionDamage),
GetEntityEffectIntensity(PotionDamage)), GetPotionColor(PotionDamage)
);
if (Projectile == NULL)
{ {
return false; return false;
} }
if (!Projectile->Initialize(*a_World))
{
delete Projectile;
return false;
}
if (!a_Player->IsGameModeCreative()) if (!a_Player->IsGameModeCreative())
{ {
@ -182,12 +58,16 @@ public:
short PotionDamage = a_Item->m_ItemDamage; short PotionDamage = a_Item->m_ItemDamage;
// Do not drink undrinkable potions: // Do not drink undrinkable potions:
if (!IsDrinkable(a_Item->m_ItemDamage)) if (!cEntityEffect::IsPotionDrinkable(a_Item->m_ItemDamage))
{ {
return false; return false;
} }
a_Player->AddEntityEffect(GetEntityEffectType(PotionDamage), GetEntityEffectDuration(PotionDamage), GetEntityEffectIntensity(PotionDamage)); a_Player->AddEntityEffect(
cEntityEffect::GetPotionEffectType(PotionDamage),
cEntityEffect::GetPotionEffectDuration(PotionDamage),
cEntityEffect::GetPotionEffectIntensity(PotionDamage)
);
a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().RemoveOneEquippedItem();
a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE); a_Player->GetInventory().AddItem(E_ITEM_GLASS_BOTTLE);
return true; return true;

View File

@ -12,6 +12,7 @@
class cItemShearsHandler : class cItemShearsHandler :
public cItemHandler public cItemHandler
{ {
typedef cItemHandler super;
public: public:
cItemShearsHandler(int a_ItemType) : cItemShearsHandler(int a_ItemType) :
cItemHandler(a_ItemType) cItemHandler(a_ItemType)
@ -30,8 +31,12 @@ public:
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES)) if ((Block == E_BLOCK_LEAVES) || (Block == E_BLOCK_NEW_LEAVES))
{ {
NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
cBlockHandler * Handler = cBlockInfo::GetHandler(Block);
cItems Drops; cItems Drops;
Drops.push_back(cItem(Block, 1, a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) & 0x03)); Handler->ConvertToPickups(Drops, Meta);
Drops.push_back(cItem(Block, 1, Meta & 3));
a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ); a_World->SpawnItemPickups(Drops, a_BlockX, a_BlockY, a_BlockZ);
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
@ -54,7 +59,25 @@ public:
return true; return true;
} }
} // switch (a_BlockType) } // switch (a_BlockType)
return false; return super::CanHarvestBlock(a_BlockType);
}
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
{
return 0;
}
virtual void OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
super::OnBlockDestroyed(a_World, a_Player, a_Item, a_BlockX, a_BlockY, a_BlockZ);
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
if ((Block == E_BLOCK_TRIPWIRE) || (Block == E_BLOCK_VINES))
{
a_Player->UseEquippedItem();
}
} }
} ; } ;

View File

@ -14,6 +14,7 @@
class cItemShovelHandler : public cItemHandler class cItemShovelHandler : public cItemHandler
{ {
typedef cItemHandler super;
public: public:
cItemShovelHandler(int a_ItemType) cItemShovelHandler(int a_ItemType)
: cItemHandler(a_ItemType) : cItemHandler(a_ItemType)
@ -39,7 +40,11 @@ public:
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override 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 virtual bool CanRepairWithRawMaterial(short a_ItemType) override

View File

@ -12,18 +12,24 @@
class cItemSwordHandler : class cItemSwordHandler :
public cItemHandler public cItemHandler
{ {
typedef cItemHandler super;
public: public:
cItemSwordHandler(int a_ItemType) cItemSwordHandler(int a_ItemType)
: cItemHandler(a_ItemType) : cItemHandler(a_ItemType)
{ {
} }
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override 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);
} }
virtual bool CanRepairWithRawMaterial(short a_ItemType) override virtual bool CanRepairWithRawMaterial(short a_ItemType) override
{ {
switch (m_ItemType) switch (m_ItemType)
@ -36,6 +42,17 @@ public:
} }
return false; return false;
} }
virtual short GetDurabilityLossByAction(eDurabilityLostAction a_Action) override
{
switch ((int)a_Action)
{
case dlaAttackEntity: return 1;
case dlaBreakBlock: return 2;
}
return 0;
}
} ; } ;

View File

@ -15,7 +15,7 @@ class cBat :
public: public:
cBat(void); cBat(void);
CLASS_PROTODEF(cBat); CLASS_PROTODEF(cBat)
bool IsHanging(void) const {return false; } bool IsHanging(void) const {return false; }
} ; } ;

View File

@ -15,7 +15,7 @@ class cBlaze :
public: public:
cBlaze(void); cBlaze(void);
CLASS_PROTODEF(cBlaze); CLASS_PROTODEF(cBlaze)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void Attack(float a_Dt) override; virtual void Attack(float a_Dt) override;

View File

@ -14,7 +14,7 @@ class cCaveSpider :
public: public:
cCaveSpider(void); cCaveSpider(void);
CLASS_PROTODEF(cCaveSpider); CLASS_PROTODEF(cCaveSpider)
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual void Attack(float a_Dt) override; virtual void Attack(float a_Dt) override;

View File

@ -14,7 +14,7 @@ class cChicken :
public: public:
cChicken(void); cChicken(void);
CLASS_PROTODEF(cChicken); CLASS_PROTODEF(cChicken)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override;

View File

@ -15,7 +15,7 @@ class cCow :
public: public:
cCow(); cCow();
CLASS_PROTODEF(cCow); CLASS_PROTODEF(cCow)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override; virtual void OnRightClicked(cPlayer & a_Player) override;

View File

@ -15,7 +15,7 @@ class cCreeper :
public: public:
cCreeper(void); cCreeper(void);
CLASS_PROTODEF(cCreeper); CLASS_PROTODEF(cCreeper)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override; virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;

View File

@ -15,7 +15,7 @@ class cEnderDragon :
public: public:
cEnderDragon(void); cEnderDragon(void);
CLASS_PROTODEF(cEnderDragon); CLASS_PROTODEF(cEnderDragon)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ; } ;

View File

@ -15,7 +15,7 @@ class cEnderman :
public: public:
cEnderman(void); cEnderman(void);
CLASS_PROTODEF(cEnderman); CLASS_PROTODEF(cEnderman)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;

View File

@ -15,7 +15,7 @@ class cGhast :
public: public:
cGhast(void); cGhast(void);
CLASS_PROTODEF(cGhast); CLASS_PROTODEF(cGhast)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void Attack(float a_Dt) override; virtual void Attack(float a_Dt) override;

View File

@ -15,7 +15,7 @@ class cGiant :
public: public:
cGiant(void); cGiant(void);
CLASS_PROTODEF(cGiant); CLASS_PROTODEF(cGiant)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ; } ;

View File

@ -15,7 +15,7 @@ class cHorse :
public: public:
cHorse(int Type, int Color, int Style, int TameTimes); 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 GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override;

View File

@ -15,7 +15,7 @@ class cIronGolem :
public: public:
cIronGolem(void); cIronGolem(void);
CLASS_PROTODEF(cIronGolem); CLASS_PROTODEF(cIronGolem)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;

View File

@ -15,7 +15,7 @@ public:
/// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest /// Creates a MagmaCube of the specified size; size is 1 .. 3, with 1 being the smallest
cMagmaCube(int a_Size); cMagmaCube(int a_Size);
CLASS_PROTODEF(cMagmaCube); CLASS_PROTODEF(cMagmaCube)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
int GetSize(void) const { return m_Size; } int GetSize(void) const { return m_Size; }

View File

@ -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); 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; virtual void SpawnOn(cClientHandle & a_ClientHandle) override;

View File

@ -15,7 +15,7 @@ class cMooshroom :
public: public:
cMooshroom(void); cMooshroom(void);
CLASS_PROTODEF(cMooshroom); CLASS_PROTODEF(cMooshroom)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override; virtual void OnRightClicked(cPlayer & a_Player) override;

View File

@ -18,7 +18,7 @@ public:
{ {
} }
CLASS_PROTODEF(cOcelot); CLASS_PROTODEF(cOcelot)
} ; } ;

View File

@ -15,7 +15,7 @@ class cPig :
public: public:
cPig(void); cPig(void);
CLASS_PROTODEF(cPig); CLASS_PROTODEF(cPig)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override; virtual void OnRightClicked(cPlayer & a_Player) override;

View File

@ -52,11 +52,7 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
{ {
m_IsSheared = true; m_IsSheared = true;
m_World->BroadcastEntityMetadata(*this); m_World->BroadcastEntityMetadata(*this);
a_Player.UseEquippedItem();
if (!a_Player.IsGameModeCreative())
{
a_Player.UseEquippedItem();
}
cItems Drops; cItems Drops;
int NumDrops = m_World->GetTickRandomNumber(2) + 1; int NumDrops = m_World->GetTickRandomNumber(2) + 1;

View File

@ -20,7 +20,7 @@ public:
with the GenerateNaturalRandomColor() function. */ with the GenerateNaturalRandomColor() function. */
cSheep(int a_Color = -1); cSheep(int a_Color = -1);
CLASS_PROTODEF(cSheep); CLASS_PROTODEF(cSheep)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void OnRightClicked(cPlayer & a_Player) override; virtual void OnRightClicked(cPlayer & a_Player) override;

View File

@ -18,7 +18,7 @@ public:
{ {
} }
CLASS_PROTODEF(cSilverfish); CLASS_PROTODEF(cSilverfish)
} ; } ;

View File

@ -15,7 +15,7 @@ class cSkeleton :
public: public:
cSkeleton(bool IsWither); cSkeleton(bool IsWither);
CLASS_PROTODEF(cSkeleton); CLASS_PROTODEF(cSkeleton)
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void MoveToPosition(const Vector3d & a_Position) override; virtual void MoveToPosition(const Vector3d & a_Position) override;
@ -24,7 +24,7 @@ public:
virtual bool IsUndead(void) override { return true; } virtual bool IsUndead(void) override { return true; }
bool IsWither(void) const { return m_bIsWither; }; bool IsWither(void) const { return m_bIsWither; }
private: private:

View File

@ -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. */ /** 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); cSlime(int a_Size);
CLASS_PROTODEF(cSlime); CLASS_PROTODEF(cSlime)
// cAggressiveMonster overrides: // cAggressiveMonster overrides:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;

Some files were not shown because too many files have changed in this diff Show More