1
0

Merge branch 'master' into Effects

This commit is contained in:
Howaner 2014-09-12 19:13:46 +02:00
commit 1223a24d3c
133 changed files with 2159 additions and 1377 deletions

1
.gitignore vendored
View File

@ -56,6 +56,7 @@ Makefile
*.a *.a
*.d *.d
*.so *.so
BuildInfo.h
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles
Makefile Makefile

View File

@ -2,6 +2,10 @@
set -e set -e
export MCSERVER_BUILD_SERIES_NAME="Travis $CC $TRAVIS_MCSERVER_BUILD_TYPE"
export MCSERVER_BUILD_ID=$TRAVIS_JOB_NUMBER
export MCSERVER_BUILD_DATETIME=`date`
cmake . -DBUILD_TOOLS=1 -DSELF_TEST=1; cmake . -DBUILD_TOOLS=1 -DSELF_TEST=1;
make -j 2; make -j 2;
make -j 2 test; make -j 2 test;

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.2) cmake_minimum_required (VERSION 2.8.7)
# Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html ) # Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html )
enable_language(CXX C) enable_language(CXX C)
@ -18,6 +18,25 @@ if(DEFINED ENV{TRAVIS_BUILD_WITH_COVERAGE})
set(BUILD_WITH_COVERAGE $ENV{TRAVIS_BUILD_WITH_COVERAGE}) set(BUILD_WITH_COVERAGE $ENV{TRAVIS_BUILD_WITH_COVERAGE})
endif() endif()
if(DEFINED ENV{MCSERVER_BUILD_ID})
set(BUILD_ID $ENV{MCSERVER_BUILD_ID})
set(BUILD_SERIES_NAME $ENV{MCSERVER_BUILD_SERIES_NAME})
set(BUILD_DATETIME $ENV{MCSERVER_BUILD_DATETIME})
if(DEFINED ENV{MCSERVER_BUILD_COMMIT_ID})
set(BUILD_COMMIT_ID $ENV{MCSERVER_BUILD_COMMIT_ID})
else()
message("Commit id not set, attempting to determine id from git")
execute_process(
COMMAND git rev-parse HEAD
RESULT_VARIABLE GIT_EXECUTED
OUTPUT_VARIABLE BUILD_COMMIT_ID)
string(STRIP ${BUILD_COMMIT_ID} BUILD_COMMIT_ID)
if (NOT (GIT_EXECUTED EQUAL 0))
message(FATAL_ERROR "Could not identifiy git commit id")
endif()
endif()
endif()
# This has to be done before any flags have been set up. # This has to be done before any flags have been set up.
if(${BUILD_TOOLS}) if(${BUILD_TOOLS})
add_subdirectory(Tools/MCADefrag/) add_subdirectory(Tools/MCADefrag/)

View File

@ -6,10 +6,7 @@
..\MCServer\furnace.txt ..\MCServer\furnace.txt
..\MCServer\items.ini ..\MCServer\items.ini
..\MCServer\monsters.ini ..\MCServer\monsters.ini
..\MCServer\buildinfo.txt
MCServer*debug.cmd MCServer*debug.cmd
*.example.ini *.example.ini
Lua-LICENSE.txt ThirdPartyLicenses
LuaExpat-license.html
LuaSQLite3-LICENSE.txt
SQLiteCpp-LICENSE.txt
MersenneTwister-LICENSE.txt

View File

@ -1,2 +1,3 @@
MCServer\*.pdb MCServer\*.pdb
src\Bindings\Bindings.* MCServer\buildinfo.txt
src\Bindings\Bindings.*

View File

@ -524,6 +524,7 @@ end
Functions = Functions =
{ {
GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." },
GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." },
GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." },
GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" },
GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." }, GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." },
@ -1188,7 +1189,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
constructor = constructor =
{ {
{ Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" }, { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" },
{ Params = "ItemType, Count, Damage, EnchantmentString", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default) and enchantments (non-enchanted by default)" }, { Params = "ItemType, Count, Damage, EnchantmentString, CustomName, Lore", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" },
{ Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" }, { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" },
} , } ,
AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." }, AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." },
@ -1201,12 +1202,14 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" }, IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" },
IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" }, IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" },
IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage, lore, name and enchantments)" }, IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage, lore, name and enchantments)" },
IsEnchantable = { Params = "", Return = "bool", Notes = "Returns true if the item is enchantable" },
IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" }, IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" },
IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" }, IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" },
IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." }, IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." },
IsCustomNameEmpty = { Params = "", Return = "bool", Notes = "Returns if the custom name of the cItem is empty." }, IsCustomNameEmpty = { Params = "", Return = "bool", Notes = "Returns if the custom name of the cItem is empty." },
IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." },
GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" },
EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." },
IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." },
}, },
Variables = Variables =
{ {
@ -1214,8 +1217,10 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
m_ItemCount = { Type = "number", Notes = "Number of items in this stack" }, m_ItemCount = { Type = "number", Notes = "Number of items in this stack" },
m_ItemDamage = { Type = "number", Notes = "The damage of the item. Zero means no damage. Maximum damage can be queried with GetMaxDamage()" }, m_ItemDamage = { Type = "number", Notes = "The damage of the item. Zero means no damage. Maximum damage can be queried with GetMaxDamage()" },
m_ItemType = { Type = "number", Notes = "The item type. One of E_ITEM_ or E_BLOCK_ constants" }, m_ItemType = { Type = "number", Notes = "The item type. One of E_ITEM_ or E_BLOCK_ constants" },
m_CustomName = { Type = "string", Notes = "The custom name for an item." }, m_CustomName = { Type = "string", Notes = "The custom name for an item." },
m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." }, m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." },
m_RepairCost = { Type = "number", Notes = "The repair cost of the item. The anvil need this value" },
m_Enchantments = { Type = "{{cEnchantments|cEnchantments}}}", Notes = "The enchantments of the item." },
}, },
AdditionalInfo = AdditionalInfo =
{ {
@ -2342,6 +2347,7 @@ end
ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." }, ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." },
ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." }, ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cChestEntity|ChestEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next chest, or true to abort the enumeration." },
ForEachEntity = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachEntity = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}})</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cEntity|Entity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next entity, or true to abort the enumeration." },
ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." }, ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])</pre> The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." },
ForEachPlayer = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}}, [CallbackData])</pre> The callback should return false or no value to continue with the next player, or true to abort the enumeration." }, ForEachPlayer = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}}, [CallbackData])</pre> The callback should return false or no value to continue with the next player, or true to abort the enumeration." },

View File

@ -202,7 +202,7 @@ function Explode(Split, Player)
if (#Split ~= 2) then if (#Split ~= 2) then
-- There was more or less than one argument (excluding the "/explode" bit) -- There was more or less than one argument (excluding the "/explode" bit)
-- Send the proper usage to the player and exit -- Send the proper usage to the player and exit
SendMessage(Player, "Usage: /explode [playername]") Player:SendMessage("Usage: /explode [playername]")
return true return true
end end
@ -213,7 +213,7 @@ function Explode(Split, Player)
if (Explodee:GetName() == Split[2]) then if (Explodee:GetName() == Split[2]) then
-- Create an explosion at the same position as they are; see <a href="cWorld.html">API docs</a> for further details of this function -- Create an explosion at the same position as they are; see <a href="cWorld.html">API docs</a> for further details of this function
Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin) Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin)
SendMessageSuccess(Player, Split[2] .. " was successfully exploded") Player:SendMessageSuccess(Split[2] .. " was successfully exploded")
HasExploded = true; HasExploded = true;
return true -- Signalize to MCS that we do not need to call this callback for any more players return true -- Signalize to MCS that we do not need to call this callback for any more players
end end
@ -224,7 +224,7 @@ function Explode(Split, Player)
if not(HasExploded) then if not(HasExploded) then
-- We have not broken out so far, therefore, the player must not exist, send failure -- We have not broken out so far, therefore, the player must not exist, send failure
SendMessageFailure(Player, Split[2] .. " was not found") Player:SendMessageFailure(Split[2] .. " was not found")
end end
return true return true

View File

@ -65,6 +65,8 @@ function Initialize(Plugin)
PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one"); PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one");
PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z"); PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z");
PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory."); PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory.");
PM:BindCommand("/pickups", "debuggers", HandlePickups, "- Spawns random pickups around you");
PM:BindCommand("/poof", "debuggers", HandlePoof, "- Nudges pickups close to you away from you");
Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers)
Plugin:AddWebTab("StressTest", HandleRequest_StressTest) Plugin:AddWebTab("StressTest", HandleRequest_StressTest)
@ -1558,3 +1560,57 @@ end
local PossibleItems =
{
cItem(E_ITEM_DIAMOND),
cItem(E_ITEM_GOLD),
cItem(E_ITEM_IRON),
cItem(E_ITEM_DYE, 1, E_META_DYE_BLUE), -- Lapis lazuli
cItem(E_ITEM_COAL),
}
function HandlePickups(a_Split, a_Player)
local PlayerX = a_Player:GetPosX()
local PlayerY = a_Player:GetPosY()
local PlayerZ = a_Player:GetPosZ()
local World = a_Player:GetWorld()
local Range = 12
for x = 0, Range do for z = 0, Range do
local px = PlayerX + x - Range / 2
local pz = PlayerZ + z - Range / 2
local Items = cItems()
Items:Add(PossibleItems[math.random(#PossibleItems)])
World:SpawnItemPickups(Items, px, PlayerY, pz, 0)
end end -- for z, for x
return true
end
function HandlePoof(a_Split, a_Player)
local PlayerPos = Vector3d(a_Player:GetPosition()) -- Create a copy of the position
PlayerPos.y = PlayerPos.y - 1
local Box = cBoundingBox(PlayerPos, 4, 2)
local NumEntities = 0
a_Player:GetWorld():ForEachEntityInBox(Box,
function (a_Entity)
if not(a_Entity:IsPlayer()) then
local AddSpeed = a_Entity:GetPosition() - PlayerPos -- Speed away from the player
a_Entity:AddSpeed(AddSpeed * 32 / (AddSpeed:SqrLength() + 1)) -- The further away, the less speed to add
NumEntities = NumEntities + 1
end
end
)
a_Player:SendMessage("Poof! (" .. NumEntities .. " entities)")
return true
end

View File

@ -40,8 +40,8 @@
# Need to list each of the four log types, otherwise all logs would get converted into apple planks (^0) # Need to list each of the four log types, otherwise all logs would get converted into apple planks (^0)
ApplePlanks, 4 = AppleLog, * OakPlanks, 4 = OakLog, *
ConiferPlanks, 4 = ConiferLog, * SprucePlanks, 4 = SpruceLog, *
BirchPlanks, 4 = BirchLog, * BirchPlanks, 4 = BirchLog, *
JunglePlanks, 4 = JungleLog, * JunglePlanks, 4 = JungleLog, *
AcaciaPlanks, 4 = AcaciaLog, * AcaciaPlanks, 4 = AcaciaLog, *
@ -67,6 +67,7 @@ DiamondBlock = Diamond, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3
LapisBlock = LapisLazuli, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 LapisBlock = LapisLazuli, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
EmeraldBlock = Emerald, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 EmeraldBlock = Emerald, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
RedstoneBlock = RedstoneDust, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 RedstoneBlock = RedstoneDust, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
CoalBlock = Coal, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
QuartzBlock = NetherQuartz, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3 QuartzBlock = NetherQuartz, 1:1, 1:2, 1:3, 2:1, 2:2, 2:3, 3:1, 3:2, 3:3
NetherBrick = netherbrickitem, 1:1, 1:2, 2:1, 2:2 NetherBrick = netherbrickitem, 1:1, 1:2, 2:1, 2:2
Glowstone = GlowstoneDust, 1:1, 1:2, 2:1, 2:2 Glowstone = GlowstoneDust, 1:1, 1:2, 2:1, 2:2
@ -147,9 +148,6 @@ StoneBrickStairs, 4 = StoneBrick, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
RedSandstoneStairs, 4 = RedSandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3 RedSandstoneStairs, 4 = RedSandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
RedSandstoneStairs, 4 = RedSandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3 RedSandstoneStairs, 4 = RedSandstone, 3:1, 2:2, 3:2, 1:3, 2:3, 3:3
# Other
Carpet = Wool, 1:3, 2:3
#******************************************************# #******************************************************#
@ -353,7 +351,7 @@ Clay, 4 = ClayBlock, *
Painting = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Wool, 2:2 Painting = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Wool, 2:2
ItemFrame = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Leather, 2:2 ItemFrame = Stick, 1:1, 1:2, 1:3, 2:1, 2:3, 3:1, 3:2, 3:3 | Leather, 2:2
Sign = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 | Stick, 2:3 Sign, 3 = Planks, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 | Stick, 2:3
Ladder, 3 = Stick, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 3:3 Ladder, 3 = Stick, 1:1, 3:1, 1:2, 2:2, 3:2, 1:3, 3:3
GlassPane, 16 = Glass, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 GlassPane, 16 = Glass, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
IronBars, 16 = IronIngot, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2 IronBars, 16 = IronIngot, 1:1, 2:1, 3:1, 1:2, 2:2, 3:2
@ -451,13 +449,30 @@ PinkWool = Wool, * | PinkDye, *
GrayWool = Wool, * | GrayDye, * GrayWool = Wool, * | GrayDye, *
LightGrayWool = Wool, * | LightGrayDye, * LightGrayWool = Wool, * | LightGrayDye, *
CyanWool = Wool, * | CyanDye, * CyanWool = Wool, * | CyanDye, *
VioletWool = Wool, * | VioletDye, * PurpleWool = Wool, * | PurpleDye, *
BlueWool = Wool, * | BlueDye, * BlueWool = Wool, * | BlueDye, *
BrownWool = Wool, * | BrownDye, * BrownWool = Wool, * | BrownDye, *
GreenWool = Wool, * | GreenDye, * GreenWool = Wool, * | GreenDye, *
RedWool = Wool, * | RedDye, * RedWool = Wool, * | RedDye, *
BlackWool = Wool, * | BlackDye, * BlackWool = Wool, * | BlackDye, *
WhiteCarpet, 3 = WhiteWool, 1:1, 2:1
OrangeCarpet, 3 = OrangeWool, 1:1, 2:1
MagentaCarpet, 3 = MagentaWool, 1:1, 2:1
LightBlueCarpet, 3 = LightBlueWool, 1:1, 2:1
YellowCarpet, 3 = YellowWool, 1:1, 2:1
LimeCarpet, 3 = LimeWool, 1:1, 2:1
PinkCarpet, 3 = PinkWool, 1:1, 2:1
GrayCarpet, 3 = GrayWool, 1:1, 2:1
LightGrayCarpet, 3 = LightGrayWool, 1:1, 2:1
CyanCarpet, 3 = CyanWool, 1:1, 2:1
PurpleCarpet, 3 = PurpleWool, 1:1, 2:1
BlueCarpet, 3 = BlueWool, 1:1, 2:1
BrownCarpet, 3 = BrownWool, 1:1, 2:1
GreenCarpet, 3 = GreenWool, 1:1, 2:1
RedCarpet, 3 = RedWool, 1:1, 2:2
BlackCarpet, 3 = BlackWool, 1:1, 2:1
#******************************************************# #******************************************************#
# Stained Glass: # Stained Glass:
# #

View File

@ -15,11 +15,11 @@ podzol=3:2
cobblestone=4 cobblestone=4
cobble=4 cobble=4
planks=5 planks=5
appleplanks=5:0
oakplanks=5:0 oakplanks=5:0
appleplanks=5:0
spruceplanks=5:1
coniferplanks=5:1 coniferplanks=5:1
pineplanks=5:1 pineplanks=5:1
spruceplanks=5:1
darkplanks=5:1 darkplanks=5:1
birchplanks=5:2 birchplanks=5:2
lightplanks=5:2 lightplanks=5:2
@ -29,53 +29,59 @@ acaciaplanks=5:4
darkoakplanks=5:5 darkoakplanks=5:5
bigoakplanks=5:5 bigoakplanks=5:5
roofedoakplanks=5:5 roofedoakplanks=5:5
; Obsolete: do not use "wood", as its meaning is not clear - wiki uses log as wood, we use planks as wood.
wood=5
sapling=6 sapling=6
applesapling=6:0
oaksapling=6:0 oaksapling=6:0
applesapling=6:0
sprucesapling=6:1
conifersapling=6:1 conifersapling=6:1
pinesapling=6:1 pinesapling=6:1
sprucesapling=6:1 darkplanks=6:1
birchsapling=6:2 birchsapling=6:2
whitesapling=6:2
junglesapling=6:3 junglesapling=6:3
adminium=7 redsapling=6:3
acaciasapling=6:4
darkoaksapling=6:5
bigoaksapling=6:5
roofedoaksapling=6:5
bedrock=7 bedrock=7
adminium=7
water=8 water=8
flowingwater=8
stationarywater=9
stillwater=9 stillwater=9
swater=9 swater=9
stationarywater=9
lava=10 lava=10
flowinglava=10
stationarylava=11
stilllava=11 stilllava=11
slava=11 slava=11
stationarylava=11
sand=12 sand=12
redsand=12:1 redsand=12:1
gravel=13 gravel=13
goldore=14 goldore=14
ironore=15 ironore=15
coalore=16 coalore=16
tree=17
log=17 log=17
applelog=17:0 tree=17
oaklog=17:0 oaklog=17:0
applelog=17:0
sprucelog=17:1
coniferlog=17:1 coniferlog=17:1
pinelog=17:1 pinelog=17:1
sprucelog=17:1
darklog=17:1 darklog=17:1
birchlog=17:2 birchlog=17:2
whitelog=17:2 whitelog=17:2
junglelog=17:3 junglelog=17:3
leaves=18 leaves=18
appleleaves=18:0
oakleaves=18:0 oakleaves=18:0
appleleaves=18:0
spruceleaves=18:1
coniferleaves=18:1 coniferleaves=18:1
pineleaves=18:1 pineleaves=18:1
spruceleaves=18:1 darkleaves=18:1
birchleaves=18:2 birchleaves=18:2
whiteleaves=18:2
jungleleaves=18:3 jungleleaves=18:3
sponge=19 sponge=19
wetsponge=19:1 wetsponge=19:1
@ -85,8 +91,9 @@ lapisblock=22
dispenser=23 dispenser=23
sandstone=24 sandstone=24
normalsandstone=24:0 normalsandstone=24:0
ornamentsandstone=24:1 chiseledsandstone=24:1
decorativesandstone=24:1 decorativesandstone=24:1
ornamentsandstone=24:1
smoothsandstone=24:2 smoothsandstone=24:2
noteblock=25 noteblock=25
bedblock=26 bedblock=26
@ -101,14 +108,16 @@ deadbush=32
piston=33 piston=33
pistonextension=34 pistonextension=34
pistonhead=34 pistonhead=34
cloth=35
wool=35 wool=35
cloth=35
whitewool=35:0 whitewool=35:0
orangewool=35:1 orangewool=35:1
magentawool=35:2 magentawool=35:2
lightbluewool=35:3 lightbluewool=35:3
ltbluewool=35:3
yellowwool=35:4 yellowwool=35:4
limewool=35:5 limewool=35:5
ltbluewool=35:3
lightgreenwool=35:5 lightgreenwool=35:5
ltgreenwool=35:5 ltgreenwool=35:5
pinkwool=35:6 pinkwool=35:6
@ -122,11 +131,13 @@ lightgraywool=35:8
lightgreywool=35:8 lightgreywool=35:8
ltgraywool=35:8 ltgraywool=35:8
ltgreywool=35:8 ltgreywool=35:8
silverwool=35:8
cyanwool=35:9 cyanwool=35:9
purplewool=35:10 purplewool=35:10
violetwool=35:10 violetwool=35:10
bluewool=35:11 bluewool=35:11
darkbluewool=35:11 darkbluewool=35:11
dkbluewool=35:11
brownwool=35:12 brownwool=35:12
greenwool=35:13 greenwool=35:13
darkgreenwool=35:13 darkgreenwool=35:13
@ -134,14 +145,12 @@ dkgreenwool=35:13
redwool=35:14 redwool=35:14
blackwool=35:15 blackwool=35:15
dandelion=37 dandelion=37
; Renamed in 1.7, use "poppy" instead; kept for compatibility reasons, will be removed later on.
rose=38
flower=38
poppy=38 poppy=38
rose=38
flower=38
blueorchid=38:1 blueorchid=38:1
allium=38:2 allium=38:2
azurebluet=38:3
redtulip=38:4 redtulip=38:4
orangetulip=38:5 orangetulip=38:5
whitetulip=38:6 whitetulip=38:6
@ -149,11 +158,12 @@ pinktulip=38:7
oxeyedaisy=38:8 oxeyedaisy=38:8
brownmushroom=39 brownmushroom=39
redmushroom=40 redmushroom=40
gold=41
goldblock=41 goldblock=41
iron=42 gold=41
ironblock=42 ironblock=42
iron=42
doubleslab=43 doubleslab=43
doublestep=43
stonedoubleslab=43:0 stonedoubleslab=43:0
sandstonedoubleslab=43:1 sandstonedoubleslab=43:1
wooddoubleslab=43:2 wooddoubleslab=43:2
@ -183,19 +193,19 @@ obsidian=49
torch=50 torch=50
fire=51 fire=51
mobspawner=52 mobspawner=52
woodstairs=53
oakwoodstairs=53 oakwoodstairs=53
woodstairs=53
chest=54 chest=54
redstonedust=55
redstonewire=55 redstonewire=55
redstonedust=55
diamondore=56 diamondore=56
diamondblock=57 diamondblock=57
workbench=58 workbench=58
crop=59 crop=59
crops=59 crops=59
soil=60
farmland=60 farmland=60
tilleddirt=60 tilleddirt=60
soil=60
furnace=61 furnace=61
litfurnace=62 litfurnace=62
signblock=63 signblock=63
@ -207,11 +217,11 @@ track=66
tracks=66 tracks=66
cobblestonestairs=67 cobblestonestairs=67
stairs=67 stairs=67
signblocktop=68
wallsign=68 wallsign=68
signblocktop=68
lever=69 lever=69
rockplate=70
stoneplate=70 stoneplate=70
rockplate=70
irondoorblock=71 irondoorblock=71
woodplate=72 woodplate=72
redstoneore=73 redstoneore=73
@ -228,13 +238,13 @@ reedblock=83
jukebox=84 jukebox=84
fence=85 fence=85
pumpkin=86 pumpkin=86
netherstone=87
netherrack=87 netherrack=87
hellrock=87 hellrock=87
slowsand=88 netherstone=87
soulsand=88 soulsand=88
lightstone=89 slowsand=88
glowstone=89 glowstone=89
lightstone=89
portal=90 portal=90
jackolantern=91 jackolantern=91
jacko=91 jacko=91
@ -243,22 +253,39 @@ whitestainedglass=95
orangestainedglass=95:1 orangestainedglass=95:1
magentastainedglass=95:2 magentastainedglass=95:2
lightbluestainedglass=95:3 lightbluestainedglass=95:3
ltbluestainedglass=95:3
yellowstainedglass=95:4 yellowstainedglass=95:4
limestainedglass=95:5 limestainedglass=95:5
lightgreenstainedglass=95:5
ltgreenstainedglass=95:5
pinkstainedglass=95:6 pinkstainedglass=95:6
graystainedglass=95:7 graystainedglass=95:7
greystainedglass=95:7
darkgraystainedglass=95:7
darkgreystainedglass=95:7
dkgraystainedglass=95:7
dkgreystainedglass=95:7
lightgraystainedglass=95:8 lightgraystainedglass=95:8
lightgreystainedglass=95:8
ltgraystainedglass=95:8
ltgreystainedglass=95:8
silverstainedglass=95:8
cyanstainedglass=95:9 cyanstainedglass=95:9
purplestainedglass=95:10
violetstainedglass=95:10 violetstainedglass=95:10
bluestainedglass=95:11 bluestainedglass=95:11
darkbluestainedglass=95:11
dkbluestainedglass=95:11
brownstainedglass=95:12 brownstainedglass=95:12
greenstainedglass=95:13 greenstainedglass=95:13
darkgreenstainedglass=95:13
dkgreenstainedglass=95:13
redstainedglass=95:14 redstainedglass=95:14
blackstainedglass=95:15 blackstainedglass=95:15
trapdoor=96 trapdoor=96
silverfishblock=97 silverfishblock=97
stonebricks=98
stonebrick=98 stonebrick=98
stonebricks=98
mossystonebrick=98:1 mossystonebrick=98:1
crackedstonebrick=98:2 crackedstonebrick=98:2
chiseledstonebrick=98:3 chiseledstonebrick=98:3
@ -288,35 +315,36 @@ endstone=121
dragonegg=122 dragonegg=122
redstonelamp=123 redstonelamp=123
redstonelampoff=123 redstonelampoff=123
litredstonelamp=124
redstonelampon=124 redstonelampon=124
woodendoubleslab=125 woodendoubleslab=125
appledoublewoodslab=125:0
oakwooddoubleslab=125:0 oakwooddoubleslab=125:0
appledoublewoodslab=125:0
sprucewooddoubleslab=125:1
coniferwooddoubleslab=125:1 coniferwooddoubleslab=125:1
pinewooddoubleslab=125:1 pinewooddoubleslab=125:1
sprucewooddoubleslab=125:1
darkwooddoubleslab=125:1 darkwooddoubleslab=125:1
birchwooddoubleslab=125:2 birchwooddoubleslab=125:2
whitewooddoubleslab=125:2 whitewooddoubleslab=125:2
junglewooddoubleslab=125:3 junglewooddoubleslab=125:3
acaciawooddoubleslab=125:4 acaciawooddoubleslab=125:4
bigoakwooddoubleslab=125:5
darkoakwooddoubleslab=125:5 darkoakwooddoubleslab=125:5
bigoakwooddoubleslab=125:5
roofedwooddoubleslab=125:5 roofedwooddoubleslab=125:5
woodenslab=126 woodenslab=126
applewoodslab=126:0
oakwoodslab=126:0 oakwoodslab=126:0
applewoodslab=126:0
sprucewoodslab=126:1
coniferwoodslab=126:1 coniferwoodslab=126:1
pinewoodslab=126:1 pinewoodslab=126:1
sprucewoodslab=126:1
darkwoodslab=126:1 darkwoodslab=126:1
birchwoodslab=126:2 birchwoodslab=126:2
whitewoodslab=126:2 whitewoodslab=126:2
junglewoodslab=126:3 junglewoodslab=126:3
acaciawoodslab=126:4 acaciawoodslab=126:4
bigoakwoodslab=126:5
darkoakwoodslab=126:5 darkoakwoodslab=126:5
roofedwoodslab=126:5 roofedwoodslab=126:5
bigoakwoodslab=126:5
cocoabeans=127 cocoabeans=127
sandstonestairs=128 sandstonestairs=128
emeraldore=129 emeraldore=129
@ -324,9 +352,9 @@ enderchest=130
tripwirehook=131 tripwirehook=131
tripwire=132 tripwire=132
emeraldblock=133 emeraldblock=133
sprucewoodstairs=134
coniferwoodstairs=134 coniferwoodstairs=134
pinewoodstairs=134 pinewoodstairs=134
sprucewoodstairs=134
darkwoodstairs=134 darkwoodstairs=134
birchwoodstairs=135 birchwoodstairs=135
whitewoodstairs=135 whitewoodstairs=135
@ -342,6 +370,7 @@ woodenbutton=143
skeletonhead=144 skeletonhead=144
witherhead=144:1 witherhead=144:1
zombiehead=144:2 zombiehead=144:2
playerhead=144:3
humanhead=144:3 humanhead=144:3
stevehead=144:3 stevehead=144:3
creeperhead=144:4 creeperhead=144:4
@ -365,45 +394,81 @@ whitestainedclay=159
orangestainedclay=159:1 orangestainedclay=159:1
magentastainedclay=159:2 magentastainedclay=159:2
lightbluestainedclay=159:3 lightbluestainedclay=159:3
ltbluestainedclay=159:3
yellowstainedclay=159:4 yellowstainedclay=159:4
limestainedclay=159:5 limestainedclay=159:5
lightgreenstainedclay=159:5
ltgreenstainedclay=159:5
pinkstainedclay=159:6 pinkstainedclay=159:6
graystainedclay=159:7 graystainedclay=159:7
greystainedclay=159:7
darkgraystainedclay=159:7
darkgreystainedclay=159:7
dkgraystainedclay=159:7
dkgreystainedclay=159:7
lightgraystainedclay=159:8 lightgraystainedclay=159:8
lightgreystainedclay=159:8
ltgraystainedclay=159:8
ltgreystainedclay=159:8
silvertsainedclay=159:8
cyanstainedclay=159:9 cyanstainedclay=159:9
purplestainedclay=159:10
violetstainedclay=159:10 violetstainedclay=159:10
bluestainedclay=159:11 bluestainedclay=159:11
darkbluestainedclay=159:11
dkbluestainedclay=159:11
brownstainedclay=159:12 brownstainedclay=159:12
greenstainedclay=159:13 greenstainedclay=159:13
darkgreenstainedclay=159:13
dkgreenstainedclay=159:13
redstainedclay=159:14 redstainedclay=159:14
blackstainedclay=159:15 blackstainedclay=159:15
whitestainedglasspane=160 whitestainedglasspane=160
orangestainedglasspane=160:1 orangestainedglasspane=160:1
magentastainedglasspane=160:2 magentastainedglasspane=160:2
lightbluestainedglasspane=160:3 lightbluestainedglasspane=160:3
ltbluestainedglasspane=160:3
yellowstainedglasspane=160:4 yellowstainedglasspane=160:4
limestainedglasspane=160:5 limestainedglasspane=160:5
lightgreenstainedglasspane=160:5
ltgreenstainedglasspane=160:5
pinkstainedglasspane=160:6 pinkstainedglasspane=160:6
graystainedglasspane=160:7 graystainedglasspane=160:7
greystainedglasspane=160:7
darkgraystainedglasspane=160:7
darkgreystainedglasspane=160:7
dkgraystainedglasspane=160:7
dkgreystainedglasspane=160:7
lightgraystainedglasspane=160:8 lightgraystainedglasspane=160:8
lightgreystainedglasspane=160:8
ltgraystainedglasspane=160:8
ltgreystainedglasspane=160:8
silverstainedglasspane=160:8
cyanstainedglasspane=160:9 cyanstainedglasspane=160:9
purplestainedglasspane=160:10
violetstainedglasspane=160:10 violetstainedglasspane=160:10
bluestainedglasspane=160:11 bluestainedglasspane=160:11
darkbluestainedglasspane=160:11
dkbluestainedglasspane=160:11
brownstainedglasspane=160:12 brownstainedglasspane=160:12
greenstainedglasspane=160:13 greenstainedglasspane=160:13
darkgreenstainedglasspane=160:13
dkgreenstainedglasspane=160:13
redstainedglasspane=160:14 redstainedglasspane=160:14
blackstainedglasspane=160:15 blackstainedglasspane=160:15
acacialeaves=161 newleaves=161
bigoakleaves=161:1 acacialeaves=161:0
darkoakleaves=161:1 darkoakleaves=161:1
bigoakleaves=161:1
roofedoakleaves=161:1 roofedoakleaves=161:1
acacialog=162 newlog=162
bigoaklog=162:1 acacialog=162:0
darkoaklog=162:1 darkoaklog=162:1
bigoaklog=162:1
roofedoaklog=162:1 roofedoaklog=162:1
acaciawoodstairs=163 acaciawoodstairs=163
bigoakwoodstiars=164
darkoakwoodstairs=164 darkoakwoodstairs=164
bigoakwoodstiars=164
roofedoakwoodstairs=164 roofedoakwoodstairs=164
slimeblock=165 slimeblock=165
irontrapdoor=167 irontrapdoor=167
@ -413,15 +478,57 @@ darkprismarine=168:2
sealantern=169 sealantern=169
haybale=170 haybale=170
carpet=171 carpet=171
whitecarpet=171:0
orangecarpet=171:1
magentacarpet=171:2
lightbluecarpet=171:3
ltbluecarpet=171:3
yellowcarpet=171:4
limecarpet=171:5
lightgreencarpet=171:5
ltgreencarpet=171:5
pinkcarpet=171:6
graycarpet=171:7
greycarpet=171:7
darkgraycarpet=171:7
darkgreycarpet=171:7
dkgraycarpet=171:7
dkgreycarpet=171:7
lightgraycarpet=171:8
lightgreycarpet=171:8
ltgraycarpet=171:8
ltgreycarpet=171:8
silvercarpet=171:8
cyancarpet=171:9
purplecarpet=171:10
violetcarpet=171:10
bluecarpet=171:11
darkbluecarpet=171:11
dkbluecarpet=171:11
browncarpet=171:12
greencarpet=171:13
darkgreencarpet=171:13
dkgreencarpet=171:13
redcarpet=171:14
blackcarpet=171:15
hardenedclay=172 hardenedclay=172
coalblock=173
packedice=174
doubleplant=175
sunflower=175:0
lilac=175:1
doubletallgrass=175:2
doubletallfern=175:3
rosebush=175:4
peony=175:5
redsandstone=179 redsandstone=179
chiseledredsandstone=179:1 chiseledredsandstone=179:1
smoothredsandstone=179:2 smoothredsandstone=179:2
redsandstonestairs=180 redsandstonestairs=180
redsandstoneslab=182 redsandstoneslab=182
sprucefencegate=183
coniferfencegate=183 coniferfencegate=183
pinefencegate=183 pinefencegate=183
sprucefencegate=183
darkfencegate=183 darkfencegate=183
birchfencegate=184 birchfencegate=184
whitefencegate=184 whitefencegate=184
@ -430,9 +537,9 @@ darkoakfencegate=186
bigoakfencegate=186 bigoakfencegate=186
roofedoakfencegate=186 roofedoakfencegate=186
acaciafencegate=187 acaciafencegate=187
sprucefence=188
coniferfence=188 coniferfence=188
pinefence=188 pinefence=188
sprucefence=188
darkfence=188 darkfence=188
birchfence=189 birchfence=189
whitefence=189 whitefence=189
@ -453,7 +560,6 @@ redapple=260
bow=261 bow=261
arrow=262 arrow=262
coal=263 coal=263
coalblock=173
charcoal=263:1 charcoal=263:1
diamond=264 diamond=264
ironingot=265 ironingot=265
@ -466,9 +572,9 @@ ironsword=267
woodensword=268 woodensword=268
woodsword=268 woodsword=268
woodenshovel=269 woodenshovel=269
woodspade=269
woodshovel=269 woodshovel=269
woodenspade=269 woodenspade=269
woodspade=269
woodenpickaxe=270 woodenpickaxe=270
woodpickaxe=270 woodpickaxe=270
woodenpick=270 woodenpick=270
@ -496,8 +602,8 @@ soup=282
goldensword=283 goldensword=283
goldsword=283 goldsword=283
goldenshovel=284 goldenshovel=284
goldshovel=284
goldenspade=284 goldenspade=284
goldshovel=284
goldspade=284 goldspade=284
goldenpickaxe=285 goldenpickaxe=285
goldpickaxe=285 goldpickaxe=285
@ -508,13 +614,13 @@ goldaxe=286
string=287 string=287
feather=288 feather=288
gunpowder=289 gunpowder=289
woodhoe=290
woodenhoe=290 woodenhoe=290
woodhoe=290
stonehoe=291 stonehoe=291
ironhoe=292 ironhoe=292
diamondhoe=293 diamondhoe=293
goldhoe=294
goldenhoe=294 goldenhoe=294
goldhoe=294
seeds=295 seeds=295
wheat=296 wheat=296
bread=297 bread=297
@ -543,19 +649,24 @@ goldpants=316
goldenboots=317 goldenboots=317
goldboots=317 goldboots=317
flint=318 flint=318
porkchop=319
meat=319 meat=319
pork=319 pork=319
cookedporkchop=320
cookedmeat=320 cookedmeat=320
cookedpork=320 cookedpork=320
painting=321 painting=321
paintings=321 paintings=321
goldenapple=322 goldenapple=322
goldapple=322 goldapple=322
notchapple=322:1
enchantedgoldenapple=322:1 enchantedgoldenapple=322:1
enchantedgoldapple=322:1 enchantedgoldapple=322:1
sign=323 sign=323
wooddoor=324 oakdoor=324
appledoor=324
woodendoor=324 woodendoor=324
wooddoor=324
bucket=325 bucket=325
waterbucket=326 waterbucket=326
lavabucket=327 lavabucket=327
@ -569,32 +680,34 @@ leather=334
milkbucket=335 milkbucket=335
brick=336 brick=336
clay=337 clay=337
reed=338
sugarcane=338 sugarcane=338
reed=338
paper=339 paper=339
book=340 book=340
slimeorb=341
slimeball=341 slimeball=341
slimeorb=341
storageminecart=342 storageminecart=342
poweredminecart=343 poweredminecart=343
egg=344 egg=344
compass=345 compass=345
fishingrod=346 fishingrod=346
watch=347 watch=347
glowstonedust=348
lightstonedust=348 lightstonedust=348
lightdust=348 lightdust=348
glowstonedust=348
glowdust=348 glowdust=348
rawfish=349
fish=349 fish=349
rawfish=349
cookedfish=350 cookedfish=350
dye=351 dye=351
inksac=351:0 inksac=351:0
blackdye=351:0 blackdye=351:0
reddye=351:1
rosered=351:1 rosered=351:1
greendye=351:2 reddye=351:1
cactusgreen=351:2 cactusgreen=351:2
greendye=351:2
darkgreendye=351:2
dkgreendye=351:2
cocoabeans=351:3 cocoabeans=351:3
browndye=351:3 browndye=351:3
lapislazuli=351:4 lapislazuli=351:4
@ -604,12 +717,13 @@ dkbluedye=351:4
purpledye=351:5 purpledye=351:5
violetdye=351:5 violetdye=351:5
cyandye=351:6 cyandye=351:6
lightgreydye=351:7
lightgraydye=351:7 lightgraydye=351:7
ltgreydye=351:7 lightgreydye=351:7
ltgraydye=351:7 ltgraydye=351:7
greydye=351:8 ltgreydye=351:7
silverdye=351:7
graydye=351:8 graydye=351:8
greydye=351:8
darkgreydye=351:8 darkgreydye=351:8
darkgraydye=351:8 darkgraydye=351:8
dkgreydye=351:8 dkgreydye=351:8
@ -675,6 +789,7 @@ goldencarrot=396
skeletonhead=397 skeletonhead=397
witherhead=397:1 witherhead=397:1
zombiehead=397:2 zombiehead=397:2
playerhead=397:3
stevehead=397:3 stevehead=397:3
creeperhead=397:4 creeperhead=397:4
carrotonastick=398 carrotonastick=398
@ -709,30 +824,46 @@ banner=425
blackbanner=415:0 blackbanner=415:0
redbanner=415:1 redbanner=415:1
greenbanner=415:2 greenbanner=415:2
darkgreenbanner=415:2
dkgreenbanner=415:2
brownbanner=415:3 brownbanner=415:3
bluebanner=415:4 bluebanner=415:4
darkbluebanner=415:4
dkbluebanner=415:4
purplebanner=415:5 purplebanner=415:5
violetbanner=415:5
cyanbanner=415:6 cyanbanner=415:6
silverbanner=415:7
lightgraybanner=415:7 lightgraybanner=415:7
lightgreybanner=415:7
ltgraybanner=415:7
ltgreybanner=415:7
silverbanner=415:7
graybanner=415:8 graybanner=415:8
greybanner=415:8
darkgraybanner=415:8
darkgreybanner=415:8
dkgraybanner=415:8
dkgreybanner=415:8
pinkbanner=415:9 pinkbanner=415:9
limebanner=415:10 limebanner=415:10
lightgreenbanner=415:10
ltgreenbanner=415:10
yellowbanner=415:11 yellowbanner=415:11
lightbluebanner=415:12 lightbluebanner=415:12
ltbluebanner=415:12
magentabanner=415:13 magentabanner=415:13
orangebanner=415:14 orangebanner=415:14
whitebanner=415:15 whitebanner=415:15
sprucedoor=427
coniferdoor=427 coniferdoor=427
pinedoor=427 pinedoor=427
sprucedoor=427
darkdoor=427 darkdoor=427
birchdoor=428 birchdoor=428
whitedoor=428 whitedoor=428
jungledoor=429 jungledoor=429
acaciadoor=430 acaciadoor=430
bigoakdoor=431
darkoakdoor=431 darkoakdoor=431
bigoakdoor=431
roofedoakdoor=431 roofedoakdoor=431
goldrecord=2256 goldrecord=2256
greenrecord=2257 greenrecord=2257
@ -748,4 +879,3 @@ wardrecord=2265

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,326 @@
/* reset CSS */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remove textarea resize at Safari */
textarea {
resize: none;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}
/*
Origional from http://www.perspectived.com/
Modified by Ben Phelps
Made for FakeTruth - MCServer
*/
/* Basic ---------------------------------------- */
.clear { clear: both; }
body {
background: white;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #646464;
text-align: center;
}
#wrapper {
text-align: left;
width: 930px;
margin: 0 auto;
}
/* Logo ---------------------------------------- */
h1 {
margin: 15px 0 10px 5px;
width: 180px;
height: 36px;
background: url(logo.png) no-repeat left top;
}
h1 a {
display: block;
width: 225px;
height: 28px;
}
h1 span { display: none; }
a {
color: #646464;
}
/* Container ---------------------------------------- */
#containerHolder {
background: #eee;
padding: 5px;
}
#container {
background: #fff url(background.gif) repeat-y left top;
border: 1px solid #ddd;
width: 918px;
}
#connectHolder {
background: #eee;
padding: 5px;
margin-bottom:8px;
}
#connect {
border: 1px solid #ddd;
background-color: #fff;
padding:5px;
width: 908px;
}
.pics {
height: 375px;
width: 600px;
}
.pics img {
padding: 5px;
border: 1px solid #ddd;
background-color: #eee;
width: 600px;
height: 375px;
margin-left: 15px;
}
/* Login -------------------------------------- */
#loginLogo {
margin: 0 auto;
margin-top:100px;
width: 180px;
height: 36px;
background-image: url(logo.png);
}
#loginHolder {
background: #eee;
padding: 5px;
width: 310px;
margin: 0 auto;
height: 90px;
margin-top:20px;
}
#login {
padding:10px;
width: 288px;
height: 68px;
border: 1px solid #ddd;
background:#fff;
text-align: left;
}
/* Sidebar ---------------------------------------- */
#sidebar {
width: 179px;
float: left;
}
#sidebar .sideNav { width: 179px; }
#sidebar .sideNav li { border-bottom: 1px solid #ddd; width: 179px; }
#sidebar .sideNav li a {
display: block;
color: #646464;
background: #f6f6f6;
text-decoration: none;
height: 29px;
line-height: 29px;
padding: 0 19px;
width: 141px;
}
#sidebar .sideNav li a:hover { background: #fdfcf6; }
#sidebar .sideNav li a.active, #sidebar .sideNav li a.active:hover {
background: #f0f7fa;
color: #c66653;
}
/* Breadcrumb ---------------------------------------- */
h2 {
width: 718px;
float: right;
color: #646464;
font-size: 16px;
line-height: 16px;
font-weight: bold;
margin: 20px 0 0 0;
padding: 0 0 10px 0;
border-bottom: 1px solid #ddd;
}
h2 a {
color: #646464;
text-decoration: none;
}
h2 a.active { color: #c66653; }
h2 a:hover { text-decoration: underline; }
/* Content ---------------------------------------- */
#main {
width: 700px;
float: right;
padding: 0 19px 0 0;
}
#main p {
padding: 10px;
}
h3 {
font-size: 14px;
line-height: 14px;
font-weight: bold;
color: #5494af;
padding: 0 0 0 10px;
margin: 20px 0 10px;
}
h4 {
padding: 0 0 0 10px;
margin: 20px 0 10px;
}
#main ul {
padding: 0 0 0 10px;
list-style-type: circle;
list-style-position: inside;
}
#main table {
border-top: 1px solid #ddd;
width: 700px;
}
#main table tr th {
text-align: left;
background: #f6f6f6;
padding: 0px 20px;
height: 20px;
line-height: 20px;
border-bottom: 1px solid #ddd;
}
#main table tr td {
background: #f6f6f6;
padding: 0px 20px;
height: 29px;
line-height: 29px;
border-bottom: 1px solid #ddd;
}
#main table tr.odd td {
background: #fbfbfb;
}
#main table tr:hover td { background: #fdfcf6; }
#main table .action {
text-align: right;
padding: 0 20px 0 10px;
}
#main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; }
#main table tr:hover .action .edit { color: #c5a059; }
#main table tr:hover .action .delete { color: #a02b2b; }
#main table tr:hover .action .view { color: #55a34a; }
#main table tr:hover .action a:hover { text-decoration: underline; }
fieldset {
border: 1px solid #ddd;
padding: 19px;
margin: 0 0 20px 0;
background: #fbfbfb;
}
form p { margin: 0 0 14px 0; float: left; width: 100%; }
label {
display: block;
width: 100%;
margin: 0 0 7px 0;
line-height: 12px;
}
/* Footer ---------------------------------------- */
#footer {
margin: 10px 0 30px 0;
font-size: 11px;
line-height: 11px;
color: #9B9B9B;
padding: 0 0 0 5px;
}
#footer a { color: #9B9B9B; }
#footer a:hover { text-decoration: none; }

View File

@ -0,0 +1,25 @@
<html>
<head>
<title>MCServer WebAdmin - Login</title>
<meta charset="UTF-8">
<link rel="icon" href="favicon.ico">
<style type="text/css">
header {
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
</style>
</head>
<body>
<header>
<img src="mc-logo.png" alt="MCServer Logo" class="logo">
<h1>MCServer - WebAdmin</h1>
<form method="get" action="webadmin/">
<input type="submit" value="Log in">
</form>
</header>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -205,6 +205,15 @@ macro(enable_profile)
endif() endif()
endmacro() endmacro()
#this is a hack because we can't use cmake 2.8.10 because of travis
macro(get_clang_version)
execute_process(
COMMAND "${CMAKE_CXX_COMPILER}" "--version"
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT)
string(REGEX MATCH "version ([0-9]\\.[0-9])" x ${CLANG_VERSION_OUTPUT})
set(CLANG_VERSION ${CMAKE_MATCH_1})
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
@ -223,17 +232,28 @@ macro(set_exe_flags)
add_flags_cxx("-ffast-math") add_flags_cxx("-ffast-math")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
get_clang_version()
if ("${CLANG_VERSION}" VERSION_LESS 3.0)
message(FATAL_ERROR "MCServer requires clang version 3.0 or higher, version is ${CLANG_VERSION}")
endif()
# 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-error=switch-enum -Wno-documentation -Wno-exit-time-destructors") add_flags_cxx("-Wno-exit-time-destructors -Wno-padded")
add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-padded") add_flags_cxx("-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=deprecated")
add_flags_cxx("-Wno-error=deprecated -Wno-error=weak-vtables -Wno-error=float-equal") add_flags_cxx("-Wno-error=missing-prototypes")
add_flags_cxx("-Wno-error=missing-prototypes -Wno-error=non-virtual-dtor") add_flags_cxx("-Wno-error=shadow -Wno-error=old-style-cast -Wno-error=global-constructors")
add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=shadow -Wno-error=old-style-cast") add_flags_cxx("-Wno-error=float-equal")
add_flags_cxx("-Wno-error=exit-time-destructors -Wno-error=missing-variable-declarations") add_flags_cxx("-Wno-weak-vtables -Wno-switch-enum")
add_flags_cxx("-Wno-error=global-constructors -Wno-implicit-fallthrough") if ("${CLANG_VERSION}" VERSION_GREATER 3.0)
add_flags_cxx("-Wno-error=extra-semi -Wno-weak-vtables -Wno-switch-enum") # flags that are not present in 3.0
add_flags_cxx("-Wno-error=covered-switch-default -Wno-error=missing-variable-declarations")
add_flags_cxx("-Wno-implicit-fallthrough -Wno-error=extra-semi")
endif()
if ("${CLANG_VERSION}" VERSION_GREATER 3.1)
# flags introduced in 3.2
add_flags_cxx("-Wno-documentation")
endif()
endif() endif()
endif() endif()

@ -1 +1 @@
Subproject commit 27b9d111818af3b05bcf4153bb6e380fe1dd6816 Subproject commit 203c2fb68bbf871eaf4ca98756a113d74d620dea

View File

@ -668,6 +668,24 @@ void cIniFile::Clear(void)
bool cIniFile::HasValue(const AString & a_KeyName, const AString & a_ValueName)
{
// Find the key:
int keyID = FindKey(a_KeyName);
if (keyID == noID)
{
return false;
}
// Find the value:
int valueID = FindValue(keyID, a_ValueName);
return (valueID != noID);
}
void cIniFile::AddHeaderComment(const AString & comment) void cIniFile::AddHeaderComment(const AString & comment)
{ {
comments.push_back(comment); comments.push_back(comment);

View File

@ -53,7 +53,9 @@ private:
/// Removes the UTF-8 BOMs (Byte order makers), if present. /// Removes the UTF-8 BOMs (Byte order makers), if present.
void RemoveBom(AString & a_line) const; void RemoveBom(AString & a_line) const;
public: public:
enum errors enum errors
{ {
noID = -1, noID = -1,
@ -79,6 +81,9 @@ public:
/// Deletes all stored ini data (but doesn't touch the file) /// Deletes all stored ini data (but doesn't touch the file)
void Clear(void); void Clear(void);
/** Returns true iff the specified value exists. */
bool HasValue(const AString & a_KeyName, const AString & a_ValueName);
/// Returns index of specified key, or noID if not found /// Returns index of specified key, or noID if not found
int FindKey(const AString & keyname) const; int FindKey(const AString & keyname) const;

View File

@ -36,7 +36,9 @@ extern "C" {
#define TEMPLATE_BIND(p) #define TEMPLATE_BIND(p)
#endif #endif
#define TOLUA_TEMPLATE_BIND(p) #ifndef TOLUA_TEMPLATE_BIND
#define TOLUA_TEMPLATE_BIND(p)
#endif
#define TOLUA_PROTECTED_DESTRUCTOR #define TOLUA_PROTECTED_DESTRUCTOR
#define TOLUA_PROPERTY_TYPE(p) #define TOLUA_PROPERTY_TYPE(p)

View File

@ -107,7 +107,7 @@ void cLuaChunkStay::AddChunkCoord(cLuaState & L, int a_Index)
} }
} // for itr - m_Chunks[] } // for itr - m_Chunks[]
m_Chunks.push_back(cChunkCoords(ChunkX, ZERO_CHUNK_Y, ChunkZ)); m_Chunks.push_back(cChunkCoords(ChunkX, ChunkZ));
} }

View File

@ -859,6 +859,32 @@ void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
{
tolua_Error err;
if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err))
{
a_ReturnedVal = *((cBoundingBox **)lua_touserdata(m_LuaState, a_StackPos));
}
}
void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal)
{
tolua_Error err;
if (tolua_isusertype(m_LuaState, a_StackPos, "cWorld", false, &err))
{
a_ReturnedVal = *((cWorld **)lua_touserdata(m_LuaState, a_StackPos));
}
}
bool cLuaState::CallFunction(int a_NumResults) bool cLuaState::CallFunction(int a_NumResults)
{ {
ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first

View File

@ -59,6 +59,10 @@ class cTNTEntity;
class cCreeper; class cCreeper;
class cHopperEntity; class cHopperEntity;
class cBlockEntity; class cBlockEntity;
class cBoundingBox;
typedef cBoundingBox * pBoundingBox;
typedef cWorld * pWorld;
@ -230,6 +234,12 @@ public:
/** Retrieve value at a_StackPos, if it is a valid number, converting and clamping it to eWeather. /** Retrieve value at a_StackPos, if it is a valid number, converting and clamping it to eWeather.
If not, a_Value is unchanged. */ If not, a_Value is unchanged. */
void GetStackValue(int a_StackPos, eWeather & a_Value); void GetStackValue(int a_StackPos, eWeather & a_Value);
/** Retrieve value at a_StackPos, if it is a valid cBoundingBox class. If not, a_Value is unchanged */
void GetStackValue(int a_StackPos, pBoundingBox & a_Value);
/** Retrieve value at a_StackPos, if it is a valid cWorld class. If not, a_Value is unchanged */
void GetStackValue(int a_StackPos, pWorld & a_Value);
// Include the cLuaState::Call() overload implementation that is generated by the gen_LuaState_Call.lua script: // Include the cLuaState::Call() overload implementation that is generated by the gen_LuaState_Call.lua script:
@ -328,6 +338,14 @@ protected:
*/ */
bool PushFunction(int a_FnRef); bool PushFunction(int a_FnRef);
/** Pushes a function that has been saved as a reference.
Returns true if successful. Logs a warning on failure
*/
bool PushFunction(const cRef & a_FnRef)
{
return PushFunction((int)a_FnRef);
}
/** Pushes a function that is stored in a referenced table by name /** Pushes a function that is stored in a referenced table by name
Returns true if successful. Logs a warning on failure Returns true if successful. Logs a warning on failure
*/ */

View File

@ -676,6 +676,75 @@ static int tolua_ForEachInChunk(lua_State * tolua_S)
template <
class Ty1,
class Ty2,
bool (Ty1::*Func1)(const cBoundingBox &, cItemCallback<Ty2> &)
>
static int tolua_ForEachInBox(lua_State * tolua_S)
{
// Check params:
cLuaState L(tolua_S);
if (
!L.CheckParamUserType(1, "cWorld") ||
!L.CheckParamUserType(2, "cBoundingBox") ||
!L.CheckParamFunction(3) ||
!L.CheckParamEnd(4)
)
{
return 0;
}
// Get the params:
Ty1 * Self = NULL;
cBoundingBox * Box = NULL;
L.GetStackValues(1, Self, Box);
ASSERT(Self != NULL); // We have verified the type at the top, so we should get valid objects here
ASSERT(Box != NULL);
// Create a reference for the function:
cLuaState::cRef FnRef(L, 3);
// Callback wrapper for the Lua function:
class cLuaCallback : public cItemCallback<Ty2>
{
public:
cLuaCallback(cLuaState & a_LuaState, cLuaState::cRef & a_FuncRef) :
m_LuaState(a_LuaState),
m_FnRef(a_FuncRef)
{}
private:
// cItemCallback<Ty2> overrides:
virtual bool Item(Ty2 * a_Item) override
{
bool res = false;
if (!m_LuaState.Call(m_FnRef, a_Item, cLuaState::Return, res))
{
LOGWARNING("Failed to call Lua callback");
m_LuaState.LogStackTrace();
return true; // Abort enumeration
}
return res;
}
cLuaState & m_LuaState;
cLuaState::cRef & m_FnRef;
} Callback(L, FnRef);
bool bRetVal = (Self->*Func1)(*Box, Callback);
FnRef.UnRef();
/* Push return value on stack */
tolua_pushboolean(tolua_S, bRetVal);
return 1;
}
template < template <
class Ty1, class Ty1,
class Ty2, class Ty2,
@ -3327,6 +3396,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "ForEachBlockEntityInChunk", tolua_ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>); tolua_function(tolua_S, "ForEachBlockEntityInChunk", tolua_ForEachInChunk<cWorld, cBlockEntity, &cWorld::ForEachBlockEntityInChunk>);
tolua_function(tolua_S, "ForEachChestInChunk", tolua_ForEachInChunk<cWorld, cChestEntity, &cWorld::ForEachChestInChunk>); tolua_function(tolua_S, "ForEachChestInChunk", tolua_ForEachInChunk<cWorld, cChestEntity, &cWorld::ForEachChestInChunk>);
tolua_function(tolua_S, "ForEachEntity", tolua_ForEach< cWorld, cEntity, &cWorld::ForEachEntity>); tolua_function(tolua_S, "ForEachEntity", tolua_ForEach< cWorld, cEntity, &cWorld::ForEachEntity>);
tolua_function(tolua_S, "ForEachEntityInBox", tolua_ForEachInBox< cWorld, cEntity, &cWorld::ForEachEntityInBox>);
tolua_function(tolua_S, "ForEachEntityInChunk", tolua_ForEachInChunk<cWorld, cEntity, &cWorld::ForEachEntityInChunk>); tolua_function(tolua_S, "ForEachEntityInChunk", tolua_ForEachInChunk<cWorld, cEntity, &cWorld::ForEachEntityInChunk>);
tolua_function(tolua_S, "ForEachFurnaceInChunk", tolua_ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>); tolua_function(tolua_S, "ForEachFurnaceInChunk", tolua_ForEachInChunk<cWorld, cFurnaceEntity, &cWorld::ForEachFurnaceInChunk>);
tolua_function(tolua_S, "ForEachPlayer", tolua_ForEach< cWorld, cPlayer, &cWorld::ForEachPlayer>); tolua_function(tolua_S, "ForEachPlayer", tolua_ForEach< cWorld, cPlayer, &cWorld::ForEachPlayer>);

View File

@ -109,7 +109,7 @@ local function WriteOverload(f, a_NumParams, a_NumReturns)
-- Write the function signature: -- Write the function signature:
f:write("bool Call(") f:write("bool Call(")
f:write("FnT a_Function") f:write("const FnT & a_Function")
for i = 1, a_NumParams do for i = 1, a_NumParams do
f:write(", ParamT", i, " a_Param", i) f:write(", ParamT", i, " a_Param", i)
end end

View File

@ -15,6 +15,7 @@
cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World) : cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World) :
super(a_BlockType, a_X, a_Y, a_Z, a_World) super(a_BlockType, a_X, a_Y, a_Z, a_World)
{ {
ASSERT((a_Y >= 0) && (a_Y < cChunkDef::Height));
} }

View File

@ -362,6 +362,8 @@ enum ENUM_ITEM_ID
E_ITEM_LEAD = 420, E_ITEM_LEAD = 420,
E_ITEM_NAME_TAG = 421, E_ITEM_NAME_TAG = 421,
E_ITEM_MINECART_WITH_COMMAND_BLOCK = 422, E_ITEM_MINECART_WITH_COMMAND_BLOCK = 422,
E_ITEM_RAW_MUTTON = 423,
E_ITEM_MUTTON = 424,
// Keep these two as the last values of the consecutive list, without a number - they will get their correct number assigned automagically by C++ // Keep these two as the last values of the consecutive list, without a number - they will get their correct number assigned automagically by C++
// IsValidItem() depends on this! // IsValidItem() depends on this!

View File

@ -18,6 +18,7 @@ cBlockInfo::cBlockInfo()
, m_IsSolid(true) , m_IsSolid(true)
, m_FullyOccupiesVoxel(false) , m_FullyOccupiesVoxel(false)
, m_CanBeTerraformed(false) , m_CanBeTerraformed(false)
, m_PlaceSound("")
, m_Handler(NULL) , m_Handler(NULL)
{} {}
@ -571,6 +572,172 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info)
a_Info[E_BLOCK_SOULSAND ].m_CanBeTerraformed = true; a_Info[E_BLOCK_SOULSAND ].m_CanBeTerraformed = true;
a_Info[E_BLOCK_STAINED_CLAY ].m_CanBeTerraformed = true; a_Info[E_BLOCK_STAINED_CLAY ].m_CanBeTerraformed = true;
a_Info[E_BLOCK_STONE ].m_CanBeTerraformed = true; a_Info[E_BLOCK_STONE ].m_CanBeTerraformed = true;
// Block place sounds:
a_Info[E_BLOCK_STONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_GRASS ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_DIRT ].m_PlaceSound = "dig.gravel";
a_Info[E_BLOCK_COBBLESTONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_PLANKS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_SAPLING ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_BEDROCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SAND ].m_PlaceSound = "dig.sand";
a_Info[E_BLOCK_GRAVEL ].m_PlaceSound = "dig.gravel";
a_Info[E_BLOCK_GOLD_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_IRON_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_COAL_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_LOG ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_LEAVES ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_SPONGE ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_GLASS ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_LAPIS_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_LAPIS_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_DISPENSER ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SANDSTONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_NOTE_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_POWERED_RAIL ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_DETECTOR_RAIL ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_STICKY_PISTON ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_COBWEB ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_TALL_GRASS ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_DEAD_BUSH ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_PISTON ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_PISTON_EXTENSION ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_WOOL ].m_PlaceSound = "dig.cloth";
a_Info[E_BLOCK_PISTON_MOVED_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_DANDELION ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_FLOWER ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_BROWN_MUSHROOM ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_RED_MUSHROOM ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_GOLD_BLOCK ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_IRON_BLOCK ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_DOUBLE_STONE_SLAB ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_STONE_SLAB ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_BRICK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_TNT ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_BOOKCASE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_MOSSY_COBBLESTONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_OBSIDIAN ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_TORCH ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_FIRE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_MOB_SPAWNER ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_WOODEN_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_CHEST ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_REDSTONE_WIRE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_DIAMOND_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_DIAMOND_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_CRAFTING_TABLE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_FARMLAND ].m_PlaceSound = "dig.gravel";
a_Info[E_BLOCK_FURNACE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_LIT_FURNACE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SIGN_POST ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_WOODEN_DOOR ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_LADDER ].m_PlaceSound = "dig.ladder";
a_Info[E_BLOCK_RAIL ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_COBBLESTONE_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_WALLSIGN ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_LEVER ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_STONE_PRESSURE_PLATE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_IRON_DOOR ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_WOODEN_PRESSURE_PLATE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_REDSTONE_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_REDSTONE_ORE_GLOWING ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_REDSTONE_TORCH_OFF ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_REDSTONE_TORCH_ON ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_STONE_BUTTON ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SNOW ].m_PlaceSound = "dig.snow";
a_Info[E_BLOCK_ICE ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_SNOW_BLOCK ].m_PlaceSound = "dig.snow";
a_Info[E_BLOCK_CACTUS ].m_PlaceSound = "dig.cloth";
a_Info[E_BLOCK_CLAY ].m_PlaceSound = "dig.gravel";
a_Info[E_BLOCK_SUGARCANE ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_JUKEBOX ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_FENCE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_PUMPKIN ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_NETHERRACK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SOULSAND ].m_PlaceSound = "dig.sand";
a_Info[E_BLOCK_GLOWSTONE ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_NETHER_PORTAL ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_JACK_O_LANTERN ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_CAKE ].m_PlaceSound = "dig.snow";
a_Info[E_BLOCK_REDSTONE_REPEATER_OFF ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_REDSTONE_REPEATER_ON ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_STAINED_GLASS ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_TRAPDOOR ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_SILVERFISH_EGG ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_STONE_BRICKS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_HUGE_BROWN_MUSHROOM ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_HUGE_RED_MUSHROOM ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_IRON_BARS ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_GLASS_PANE ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_MELON ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_PUMPKIN_STEM ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_MELON_STEM ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_VINES ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_FENCE_GATE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_BRICK_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_STONE_BRICK_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_MYCELIUM ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_LILY_PAD ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_NETHER_BRICK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_NETHER_BRICK_FENCE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_NETHER_BRICK_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_NETHER_WART ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_ENCHANTMENT_TABLE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_BREWING_STAND ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_CAULDRON ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_END_PORTAL ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_END_PORTAL_FRAME ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_END_STONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_DRAGON_EGG ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_REDSTONE_LAMP_OFF ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_REDSTONE_LAMP_ON ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_DOUBLE_WOODEN_SLAB ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_WOODEN_SLAB ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_COCOA_POD ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_SANDSTONE_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_EMERALD_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_ENDER_CHEST ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_TRIPWIRE_HOOK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_TRIPWIRE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_EMERALD_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_SPRUCE_WOOD_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_BIRCH_WOOD_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_JUNGLE_WOOD_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_COMMAND_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_BEACON ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_COBBLESTONE_WALL ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_FLOWER_POT ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_CARROTS ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_POTATOES ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_HEAD ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_ANVIL ].m_PlaceSound = "dig.anvil";
a_Info[E_BLOCK_TRAPPED_CHEST ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_ACTIVE_COMPARATOR ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_DAYLIGHT_SENSOR ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_BLOCK_OF_REDSTONE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_NETHER_QUARTZ_ORE ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_HOPPER ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_QUARTZ_BLOCK ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_QUARTZ_STAIRS ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_ACTIVATOR_RAIL ].m_PlaceSound = "dig.metal";
a_Info[E_BLOCK_DROPPER ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_STAINED_CLAY ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_STAINED_GLASS_PANE ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_NEW_LEAVES ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_NEW_LOG ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_ACACIA_WOOD_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_DARK_OAK_WOOD_STAIRS ].m_PlaceSound = "dig.wood";
a_Info[E_BLOCK_HAY_BALE ].m_PlaceSound = "dig.grass";
a_Info[E_BLOCK_CARPET ].m_PlaceSound = "dig.cloth";
a_Info[E_BLOCK_HARDENED_CLAY ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_BLOCK_OF_COAL ].m_PlaceSound = "dig.stone";
a_Info[E_BLOCK_PACKED_ICE ].m_PlaceSound = "dig.glass";
a_Info[E_BLOCK_BIG_FLOWER ].m_PlaceSound = "dig.grass";
} }

View File

@ -48,6 +48,9 @@ public:
/** Can a finisher change it? */ /** Can a finisher change it? */
bool m_CanBeTerraformed; bool m_CanBeTerraformed;
/** Sound when placing this block */
AString m_PlaceSound;
// tolua_end // tolua_end
/** Associated block handler. */ /** Associated block handler. */
@ -64,6 +67,7 @@ public:
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; }
inline static bool CanBeTerraformed (BLOCKTYPE a_Type) { return Get(a_Type).m_CanBeTerraformed; } inline static bool CanBeTerraformed (BLOCKTYPE a_Type) { return Get(a_Type).m_CanBeTerraformed; }
inline static AString GetPlaceSound (BLOCKTYPE a_Type) { return Get(a_Type).m_PlaceSound; }
// tolua_end // tolua_end

View File

@ -118,12 +118,6 @@ public:
} }
} }
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -57,12 +57,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
return m_BlockType == E_BLOCK_WOODEN_BUTTON ? "step.wood" : "step.stone";
}
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace) inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
{ {
switch (a_BlockFace) switch (a_BlockFace)

View File

@ -69,12 +69,6 @@ public:
{ {
a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); a_Chunk.GetWorld()->GrowCactus(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
} }
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
} ; } ;

View File

@ -43,11 +43,6 @@ public:
{ {
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
} ; } ;

View File

@ -22,12 +22,6 @@ public:
cBlockHandler(a_BlockType) cBlockHandler(a_BlockType)
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(

View File

@ -106,12 +106,6 @@ public:
// Single chest, no further processing needed // Single chest, no further processing needed
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;

View File

@ -15,11 +15,6 @@ public:
: cBlockHandler(a_BlockType) : cBlockHandler(a_BlockType)
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
} ; } ;

View File

@ -20,11 +20,6 @@ public:
{ {
a_Pickups.push_back(cItem(E_BLOCK_AIR, 8, 0)); a_Pickups.push_back(cItem(E_BLOCK_AIR, 8, 0));
} }
virtual const char * GetStepSound(void) override
{
return "step.stone";
}
} ; } ;

View File

@ -64,12 +64,6 @@ public:
a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw()); a_BlockMeta = cBlockRedstoneRepeaterHandler::RepeaterRotationToMetaData(a_Player->GetYaw());
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -100,12 +100,6 @@ public:
{ {
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND)); return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -88,12 +88,6 @@ public:
} }
} // for i - repeat twice } // for i - repeat twice
} }
virtual const char * GetStepSound(void) override
{
return "step.gravel";
}
} ; } ;

View File

@ -109,15 +109,6 @@ void cBlockDoorHandler::OnPlacedByPlayer(
const char * cBlockDoorHandler::GetStepSound(void)
{
return (m_BlockType == E_BLOCK_WOODEN_DOOR) ? "step.wood" : "step.stone";
}
NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta) NIBBLETYPE cBlockDoorHandler::MetaRotateCCW(NIBBLETYPE a_Meta)
{ {
if (a_Meta & 0x08) if (a_Meta & 0x08)

View File

@ -19,7 +19,6 @@ public:
virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override; virtual void OnDestroyed(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ) override;
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) override; 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) override;
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override; virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override;
virtual const char * GetStepSound(void) override;
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override; virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) override;
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override; virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) override;

View File

@ -33,11 +33,6 @@ public:
a_BlockMeta = RotationToMetaData(a_Player->GetYaw()); a_BlockMeta = RotationToMetaData(a_Player->GetYaw());
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.stone";
}
static NIBBLETYPE RotationToMetaData(double a_Rotation) static NIBBLETYPE RotationToMetaData(double a_Rotation)
{ {

View File

@ -17,6 +17,12 @@ public:
} }
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
a_Pickups.Add(E_BLOCK_FENCE_GATE, 1, 0); // Reset meta to zero
}
virtual bool GetPlacementBlockTypeMeta( virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,

View File

@ -50,11 +50,6 @@ public:
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
/** Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border /** Traces along YP until it finds an obsidian block, returns Y difference or 0 if no portal, and -1 for border
Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding */ Takes the X, Y, and Z of the base block; with an optional MaxY for portal border finding */
int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0) int FindObsidianCeiling(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, int MaxY = 0)

View File

@ -28,12 +28,6 @@ public:
{ {
return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ)); return (a_RelY > 0) && IsBlockTypeOfDirt(a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ));
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -16,9 +16,15 @@ public:
{ {
} }
virtual const char * GetStepSound(void) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
return "step.gravel"; a_Pickups.Add(E_BLOCK_GRAVEL, 1, 0);
cFastRandom Random;
if (Random.NextInt(30) == 0)
{
a_Pickups.Add(E_ITEM_FLINT, 1, 0);
}
} }
} ; } ;

View File

@ -495,15 +495,6 @@ void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterfac
const char * cBlockHandler::GetStepSound()
{
return "step.stone";
}
bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk) bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk)
{ {
return true; return true;

View File

@ -84,9 +84,6 @@ 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, bool a_CanDrop = true, bool a_DropVerbatim = false); virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop = true, bool a_DropVerbatim = false);
/// Returns step sound name of block
virtual const char * GetStepSound(void);
/// Checks if the block can stay at the specified relative coords in the chunk /// Checks if the block can stay at the specified relative coords in the chunk
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk); virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk);

View File

@ -15,12 +15,6 @@ public:
: cBlockSidewaysHandler(a_BlockType) : cBlockSidewaysHandler(a_BlockType)
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -111,12 +111,6 @@ public:
int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width; int BlockZ = a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width;
return LadderCanBePlacedAt(a_ChunkInterface, BlockX, a_RelY, BlockZ, BlockFace); return LadderCanBePlacedAt(a_ChunkInterface, BlockX, a_RelY, BlockZ, BlockFace);
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -112,12 +112,6 @@ public:
DropBlock(a_ChunkInterface, a_WorldInterface, a_PluginInterface, NULL, BlockX, a_RelY, BlockZ); DropBlock(a_ChunkInterface, a_WorldInterface, a_PluginInterface, NULL, BlockX, a_RelY, BlockZ);
a_ChunkInterface.DigBlock(a_WorldInterface, BlockX, a_RelY, BlockZ); a_ChunkInterface.DigBlock(a_WorldInterface, BlockX, a_RelY, BlockZ);
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -70,12 +70,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta) inline static eBlockFace BlockMetaDataToBlockFace(NIBBLETYPE a_Meta)
{ {
switch (a_Meta & 0x7) switch (a_Meta & 0x7)

View File

@ -22,12 +22,6 @@ public:
cFastRandom Random; cFastRandom Random;
a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + Random.NextInt(5)), 0)); a_Pickups.push_back(cItem(E_ITEM_MELON_SLICE, (char)(3 + Random.NextInt(5)), 0));
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -50,12 +50,6 @@ public:
} }
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -22,11 +22,6 @@ public:
{ {
a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0)); a_Pickups.push_back(cItem(E_BLOCK_DIRT, 1, 0));
} }
virtual const char * GetStepSound(void) override
{
return "step.gravel";
}
} ; } ;

View File

@ -51,7 +51,8 @@ public:
} }
default: default:
{ {
ASSERT(!"Unhandled ore!"); a_Pickups.push_back(cItem(m_BlockType));
break;
} }
} }
} }

View File

@ -27,12 +27,6 @@ public:
a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage); a_BlockMeta = (NIBBLETYPE)(a_Player->GetEquippedItem().m_ItemDamage);
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -63,12 +63,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
inline static NIBBLETYPE RepeaterRotationToMetaData(double a_Rotation) inline static NIBBLETYPE RepeaterRotationToMetaData(double a_Rotation)
{ {
a_Rotation += 90 + 45; // So its not aligned with axis a_Rotation += 90 + 45; // So its not aligned with axis

View File

@ -23,12 +23,6 @@ public:
// Always drop the ON torch, meta 0 // Always drop the ON torch, meta 0
a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_TORCH_ON, 1, 0)); a_Pickups.push_back(cItem(E_BLOCK_REDSTONE_TORCH_ON, 1, 0));
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -15,12 +15,6 @@ public:
: cBlockHandler(a_BlockType) : cBlockHandler(a_BlockType)
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.sand";
}
}; };

View File

@ -46,12 +46,6 @@ public:
a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x08); a_Chunk.SetMeta(a_RelX, a_RelY, a_RelZ, Meta | 0x08);
} }
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -65,12 +65,6 @@ public:
} }
} }
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -27,12 +27,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
{ {
if (a_RelY <= 0) if (a_RelY <= 0)

View File

@ -85,18 +85,6 @@ public:
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
switch (m_BlockType)
{
case E_BLOCK_WOODEN_SLAB: return "step.wood";
case E_BLOCK_STONE_SLAB: return "step.stone";
}
ASSERT(!"Unhandled slab type!");
return "";
}
virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override virtual bool CanDirtGrowGrass(NIBBLETYPE a_Meta) override
@ -174,17 +162,6 @@ public:
ASSERT(!"Unhandled double slab type!"); ASSERT(!"Unhandled double slab type!");
return a_BlockType; return a_BlockType;
} }
virtual const char * GetStepSound(void) override
{
switch (m_BlockType)
{
case E_BLOCK_DOUBLE_STONE_SLAB: return "step.stone";
case E_BLOCK_DOUBLE_WOODEN_SLAB: return "step.wood";
}
ASSERT(!"Unhandled double slab type!");
return "";
}
} ; } ;

View File

@ -87,12 +87,6 @@ public:
{ {
return false; return false;
} }
virtual const char * GetStepSound(void) override
{
return "step.cloth";
}
} ; } ;

View File

@ -55,24 +55,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
if (
(m_BlockType == E_BLOCK_WOODEN_STAIRS) ||
(m_BlockType == E_BLOCK_SPRUCE_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_JUNGLE_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_ACACIA_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_BIRCH_WOOD_STAIRS) ||
(m_BlockType == E_BLOCK_DARK_OAK_WOOD_STAIRS)
)
{
return "step.wood";
}
return "step.stone";
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to zero // Reset meta to zero

View File

@ -47,12 +47,6 @@ public:
{ {
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND)); return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) == E_BLOCK_FARMLAND));
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -78,12 +78,6 @@ public:
{ {
a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1); a_Chunk.GetWorld()->GrowSugarcane(a_RelX + a_Chunk.GetPosX() * cChunkDef::Width, a_RelY, a_RelZ + a_Chunk.GetPosZ() * cChunkDef::Width, 1);
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -16,11 +16,6 @@ public:
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override virtual void OnCancelRightClick(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace) override
{ {
a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player); a_WorldInterface.SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, a_Player);

View File

@ -53,12 +53,6 @@ public:
{ {
return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR)); return ((a_RelY > 0) && (a_Chunk.GetBlock(a_RelX, a_RelY - 1, a_RelZ) != E_BLOCK_AIR));
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
} ; } ;

View File

@ -184,12 +184,6 @@ public:
// Always drop meta = 0 // Always drop meta = 0
a_Pickups.push_back(cItem(m_BlockType, 1, 0)); a_Pickups.push_back(cItem(m_BlockType, 1, 0));
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -16,11 +16,6 @@ public:
{ {
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{ {
// Reset meta to zero // Reset meta to zero

View File

@ -20,11 +20,6 @@ public:
{ {
a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0)); a_Pickups.push_back(cItem(E_ITEM_STRING, 1, 0));
} }
virtual const char * GetStepSound(void) override
{
return "";
}
}; };

View File

@ -70,11 +70,6 @@ public:
return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn)); return ((a_RelY > 0) && cBlockInfo::FullyOccupiesVoxel(BlockIsOn));
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
}; };

View File

@ -159,12 +159,6 @@ public:
{ {
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.grass";
}
virtual bool DoesDropOnUnsuitable(void) override virtual bool DoesDropOnUnsuitable(void) override

View File

@ -27,12 +27,6 @@ public:
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
virtual void OnPlacedByPlayer( virtual void OnPlacedByPlayer(
cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player,
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,

View File

@ -30,12 +30,6 @@ public:
{ {
return true; return true;
} }
virtual const char * GetStepSound(void) override
{
return "step.wood";
}
} ; } ;

View File

@ -17,7 +17,7 @@ class cWorldInterface
public: public:
virtual ~cWorldInterface() {} virtual ~cWorldInterface() {}
virtual Int64 GetTimeOfDay(void) const = 0; virtual int GetTimeOfDay(void) const = 0;
virtual Int64 GetWorldAge(void) const = 0; virtual Int64 GetWorldAge(void) const = 0;
virtual eDimension GetDimension(void) const = 0; virtual eDimension GetDimension(void) const = 0;
@ -44,7 +44,7 @@ public:
/** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */ /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */
virtual bool ForEachPlayer(cItemCallback<cPlayer> & a_Callback) = 0; virtual bool ForEachPlayer(cItemCallback<cPlayer> & a_Callback) = 0;
virtual void SetTimeOfDay(Int64 a_TimeOfDay) = 0; virtual void SetTimeOfDay(int a_TimeOfDay) = 0;
/** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */ /** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */
virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0; virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0;

View File

@ -80,6 +80,17 @@ public:
/// Calculates the intersection of the two bounding boxes; returns true if nonempty /// Calculates the intersection of the two bounding boxes; returns true if nonempty
bool Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection); bool Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection);
double GetMinX(void) const { return m_Min.x; }
double GetMinY(void) const { return m_Min.y; }
double GetMinZ(void) const { return m_Min.z; }
double GetMaxX(void) const { return m_Max.x; }
double GetMaxY(void) const { return m_Max.y; }
double GetMaxZ(void) const { return m_Max.z; }
const Vector3d & GetMin(void) const { return m_Min; }
const Vector3d & GetMax(void) const { return m_Max; }
protected: protected:
Vector3d m_Min; Vector3d m_Min;
Vector3d m_Max; Vector3d m_Max;

15
src/BuildInfo.h.cmake Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#cmakedefine BUILD_ID
#ifdef BUILD_ID
#undef BUILD_ID
#define BUILD_SERIES_NAME "@BUILD_SERIES_NAME@"
#define BUILD_ID "@BUILD_ID@"
#define BUILD_COMMIT_ID "@BUILD_COMMIT_ID@"
#define BUILD_DATETIME "@BUILD_DATETIME@"
#endif

View File

@ -75,6 +75,7 @@ SET (HDRS
BlockInfo.h BlockInfo.h
BlockTracer.h BlockTracer.h
BoundingBox.h BoundingBox.h
BuildInfo.h.cmake
ByteBuffer.h ByteBuffer.h
ChatColor.h ChatColor.h
Chunk.h Chunk.h
@ -140,6 +141,8 @@ include_directories(".")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/sqlite")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/SQLiteCpp/include") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/SQLiteCpp/include")
configure_file("BuildInfo.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.h")
if (NOT MSVC) if (NOT MSVC)
# Bindings need to reference other folders, so they are done here instead # Bindings need to reference other folders, so they are done here instead
# lib dependencies are not included # lib dependencies are not included

View File

@ -37,6 +37,7 @@
#include "MobSpawner.h" #include "MobSpawner.h"
#include "BlockInServerPluginInterface.h" #include "BlockInServerPluginInterface.h"
#include "SetChunkData.h" #include "SetChunkData.h"
#include "BoundingBox.h"
#include "json/json.h" #include "json/json.h"
@ -65,19 +66,18 @@ sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_Bloc
// cChunk: // cChunk:
cChunk::cChunk( cChunk::cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ, int a_ChunkX, int a_ChunkZ,
cChunkMap * a_ChunkMap, cWorld * a_World, cChunkMap * a_ChunkMap, cWorld * a_World,
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP,
cAllocationPool<cChunkData::sChunkSection> & a_Pool cAllocationPool<cChunkData::sChunkSection> & a_Pool
) : ) :
m_IsValid(false), m_Presence(cpInvalid),
m_IsLightValid(false), m_IsLightValid(false),
m_IsDirty(false), m_IsDirty(false),
m_IsSaving(false), m_IsSaving(false),
m_HasLoadFailed(false), m_HasLoadFailed(false),
m_StayCount(0), m_StayCount(0),
m_PosX(a_ChunkX), m_PosX(a_ChunkX),
m_PosY(a_ChunkY),
m_PosZ(a_ChunkZ), m_PosZ(a_ChunkZ),
m_World(a_World), m_World(a_World),
m_ChunkMap(a_ChunkMap), m_ChunkMap(a_ChunkMap),
@ -165,11 +165,22 @@ cChunk::~cChunk()
void cChunk::SetValid(void) void cChunk::SetPresence(cChunk::ePresence a_Presence)
{ {
m_IsValid = true; m_Presence = a_Presence;
if (a_Presence == cpPresent)
m_World->GetChunkMap()->ChunkValidated(); {
m_World->GetChunkMap()->ChunkValidated();
}
}
void cChunk::SetShouldGenerateIfLoadFailed(bool a_ShouldGenerateIfLoadFailed)
{
m_ShouldGenerateIfLoadFailed = a_ShouldGenerateIfLoadFailed;
} }
@ -178,6 +189,9 @@ void cChunk::SetValid(void)
void cChunk::MarkRegenerating(void) void cChunk::MarkRegenerating(void)
{ {
// Set as queued again:
SetPresence(cpQueued);
// Tell all clients attached to this chunk that they want this chunk: // Tell all clients attached to this chunk that they want this chunk:
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
{ {
@ -191,7 +205,11 @@ void cChunk::MarkRegenerating(void)
bool cChunk::CanUnload(void) bool cChunk::CanUnload(void)
{ {
return m_LoadedByClient.empty() && !m_IsDirty && (m_StayCount == 0); return
m_LoadedByClient.empty() && // The chunk is not used by any client
!m_IsDirty && // The chunk has been saved properly or hasn't been touched since the load / gen
(m_StayCount == 0) && // The chunk is not in a ChunkStay
(m_Presence != cpQueued) ; // The chunk is not queued for loading / generating (otherwise multi-load / multi-gen could occur)
} }
@ -223,7 +241,7 @@ void cChunk::MarkSaved(void)
void cChunk::MarkLoaded(void) void cChunk::MarkLoaded(void)
{ {
m_IsDirty = false; m_IsDirty = false;
SetValid(); SetPresence(cpPresent);
} }
@ -232,12 +250,17 @@ void cChunk::MarkLoaded(void)
void cChunk::MarkLoadFailed(void) void cChunk::MarkLoadFailed(void)
{ {
if (m_IsValid) ASSERT(m_Presence == cpQueued);
// If the chunk is marked as needed, generate it:
if (m_ShouldGenerateIfLoadFailed)
{ {
return; m_World->GetGenerator().QueueGenerateChunk(m_PosX, m_PosZ, false);
}
else
{
m_Presence = cpInvalid;
} }
m_HasLoadFailed = true;
} }
@ -246,6 +269,8 @@ void cChunk::MarkLoadFailed(void)
void cChunk::GetAllData(cChunkDataCallback & a_Callback) void cChunk::GetAllData(cChunkDataCallback & a_Callback)
{ {
ASSERT(m_Presence == cpPresent);
a_Callback.HeightMap(&m_HeightMap); a_Callback.HeightMap(&m_HeightMap);
a_Callback.BiomeData(&m_BiomeMap); a_Callback.BiomeData(&m_BiomeMap);
@ -272,6 +297,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
{ {
ASSERT(a_SetChunkData.IsHeightMapValid()); ASSERT(a_SetChunkData.IsHeightMapValid());
ASSERT(a_SetChunkData.AreBiomesValid()); ASSERT(a_SetChunkData.AreBiomesValid());
ASSERT(IsQueued());
memcpy(m_BiomeMap, a_SetChunkData.GetBiomes(), sizeof(m_BiomeMap)); memcpy(m_BiomeMap, a_SetChunkData.GetBiomes(), sizeof(m_BiomeMap));
memcpy(m_HeightMap, a_SetChunkData.GetHeightMap(), sizeof(m_HeightMap)); memcpy(m_HeightMap, a_SetChunkData.GetHeightMap(), sizeof(m_HeightMap));
@ -317,7 +343,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
CreateBlockEntities(); CreateBlockEntities();
// Set the chunk data as valid. This may be needed for some simulators that perform actions upon block adding (Vaporize) // Set the chunk data as valid. This may be needed for some simulators that perform actions upon block adding (Vaporize)
SetValid(); SetPresence(cpPresent);
// Wake up all simulators for their respective blocks: // Wake up all simulators for their respective blocks:
WakeUpSimulators(); WakeUpSimulators();
@ -653,7 +679,7 @@ void cChunk::MoveEntityToNewChunk(cEntity * a_Entity)
cChunk * Neighbor = GetNeighborChunk(a_Entity->GetChunkX() * cChunkDef::Width, a_Entity->GetChunkZ() * cChunkDef::Width); cChunk * Neighbor = GetNeighborChunk(a_Entity->GetChunkX() * cChunkDef::Width, a_Entity->GetChunkZ() * cChunkDef::Width);
if (Neighbor == NULL) if (Neighbor == NULL)
{ {
Neighbor = m_ChunkMap->GetChunkNoLoad(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); Neighbor = m_ChunkMap->GetChunkNoLoad(a_Entity->GetChunkX(), a_Entity->GetChunkZ());
if (Neighbor == NULL) if (Neighbor == NULL)
{ {
// TODO: What to do with this? // TODO: What to do with this?
@ -1319,11 +1345,11 @@ void cChunk::CreateBlockEntities(void)
case E_BLOCK_JUKEBOX: case E_BLOCK_JUKEBOX:
case E_BLOCK_FLOWER_POT: case E_BLOCK_FLOWER_POT:
{ {
if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width)) if (!HasBlockEntityAt(x + m_PosX * Width, y, z + m_PosZ * Width))
{ {
m_BlockEntities.push_back(cBlockEntity::CreateByBlockType( m_BlockEntities.push_back(cBlockEntity::CreateByBlockType(
BlockType, GetMeta(x, y, z), BlockType, GetMeta(x, y, z),
x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World x + m_PosX * Width, y, z + m_PosZ * Width, m_World
)); ));
} }
break; break;
@ -1960,6 +1986,30 @@ bool cChunk::ForEachEntity(cEntityCallback & a_Callback)
bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback)
{
// The entity list is locked by the parent chunkmap's CS
for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2)
{
++itr2;
cBoundingBox EntBox((*itr)->GetPosition(), (*itr)->GetWidth() / 2, (*itr)->GetHeight());
if (!EntBox.DoesIntersect(a_Box))
{
// The entity is not in the specified box
continue;
}
if (a_Callback.Item(*itr))
{
return false;
}
} // for itr - m_Entitites[]
return true;
}
bool cChunk::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult) bool cChunk::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult)
{ {
// The entity list is locked by the parent chunkmap's CS // The entity list is locked by the parent chunkmap's CS
@ -2165,7 +2215,7 @@ bool cChunk::DoWithRedstonePoweredEntityAt(int a_BlockX, int a_BlockY, int a_Blo
} }
} }
if (a_Callback.Item((cRedstonePoweredEntity *)*itr)) if (a_Callback.Item(dynamic_cast<cRedstonePoweredEntity *>(*itr))) // Needs dynamic_cast due to multiple inheritance
{ {
return false; return false;
} }
@ -2603,7 +2653,7 @@ cChunk * cChunk::GetRelNeighborChunk(int a_RelX, int a_RelZ)
int BlockZ = m_PosZ * cChunkDef::Width + a_RelZ; int BlockZ = m_PosZ * cChunkDef::Width + a_RelZ;
int ChunkX, ChunkZ; int ChunkX, ChunkZ;
BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ); BlockToChunk(BlockX, BlockZ, ChunkX, ChunkZ);
return m_ChunkMap->GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); return m_ChunkMap->GetChunkNoLoad(ChunkX, ChunkZ);
} }
// Walk the neighbors: // Walk the neighbors:
@ -3128,7 +3178,7 @@ void cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ, int & a
Vector3i cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ) Vector3i cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ)
{ {
return Vector3i(m_PosX * Width + a_RelX, m_PosY * Height + a_RelY, m_PosZ * Width + a_RelZ); return Vector3i(m_PosX * Width + a_RelX, a_RelY, m_PosZ * Width + a_RelZ);
} }

View File

@ -66,8 +66,16 @@ class cChunk :
public cChunkDef // The inheritance is "misused" here only to inherit the functions and constants defined in cChunkDef public cChunkDef // The inheritance is "misused" here only to inherit the functions and constants defined in cChunkDef
{ {
public: public:
/** Represents the presence state of the chunk */
enum ePresence
{
cpInvalid, /**< The chunk is not present at all and is not queued in the loader / generator */
cpQueued, /**< The chunk is not present, but is queued for loading / generation */
cpPresent, /**< The chunk is present */
};
cChunk( cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ, // Chunk coords int a_ChunkX, int a_ChunkZ, // Chunk coords
cChunkMap * a_ChunkMap, cWorld * a_World, // Parent objects cChunkMap * a_ChunkMap, cWorld * a_World, // Parent objects
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, // Neighbor chunks cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, // Neighbor chunks
cAllocationPool<cChunkData::sChunkSection> & a_Pool cAllocationPool<cChunkData::sChunkSection> & a_Pool
@ -75,11 +83,25 @@ public:
cChunk(cChunk & other); cChunk(cChunk & other);
~cChunk(); ~cChunk();
bool IsValid(void) const {return m_IsValid; } // Returns true if the chunk block data is valid (loaded / generated) /** Returns true iff the chunk block data is valid (loaded / generated) */
void SetValid(void); // Also wakes up any calls to cChunkMap::GetHeight() bool IsValid(void) const {return (m_Presence == cpPresent); }
void MarkRegenerating(void); // Marks all clients attached to this chunk as wanting this chunk
bool IsDirty(void) const {return m_IsDirty; } // Returns true if the chunk has changed since it was last saved /** Returns true iff the chunk is in the queue for loading / generating */
bool HasLoadFailed(void) const {return m_HasLoadFailed; } // Returns true if the chunk failed to load and hasn't been generated since then bool IsQueued(void) const {return (m_Presence == cpQueued); }
/** Sets the chunk's presence.
Wakes up any calls to cChunkMap::GetHeight() when setting to cpPresent. */
void SetPresence(ePresence a_Presence);
/** Called to indicate whether the chunk should be queued in the generator if it fails to load. Set by cChunkMap::GetChunk(). */
void SetShouldGenerateIfLoadFailed(bool a_ShouldGenerateIfLoadFailed);
/** Marks all clients attached to this chunk as wanting this chunk. Also sets presence to cpQueued. */
void MarkRegenerating(void);
/** Returns true iff the chunk has changed since it was last saved. */
bool IsDirty(void) const {return m_IsDirty; }
bool CanUnload(void); bool CanUnload(void);
bool IsLightValid(void) const {return m_IsLightValid; } bool IsLightValid(void) const {return m_IsLightValid; }
@ -94,7 +116,10 @@ public:
void MarkSaving(void); // Marks the chunk as being saved. void MarkSaving(void); // Marks the chunk as being saved.
void MarkSaved(void); // Marks the chunk as saved, if it didn't change from the last call to MarkSaving() void MarkSaved(void); // Marks the chunk as saved, if it didn't change from the last call to MarkSaving()
void MarkLoaded(void); // Marks the chunk as freshly loaded. Fails if the chunk is already valid void MarkLoaded(void); // Marks the chunk as freshly loaded. Fails if the chunk is already valid
void MarkLoadFailed(void); // Marks the chunk as failed to load. Ignored is the chunk is already valid
/** Marks the chunk as failed to load.
If m_ShouldGenerateIfLoadFailed is set, queues the chunk for generating. */
void MarkLoadFailed(void);
/** 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);
@ -135,7 +160,6 @@ public:
void TickBlock(int a_RelX, int a_RelY, int a_RelZ); void TickBlock(int a_RelX, int a_RelY, int a_RelZ);
int GetPosX(void) const { return m_PosX; } int GetPosX(void) const { return m_PosX; }
int GetPosY(void) const { return m_PosY; }
int GetPosZ(void) const { return m_PosZ; } int GetPosZ(void) const { return m_PosZ; }
cWorld * GetWorld(void) const { return m_World; } cWorld * GetWorld(void) const { return m_World; }
@ -216,6 +240,10 @@ public:
/** Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true */ /** Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true */
bool ForEachEntity(cEntityCallback & a_Callback); // Lua-accessible bool ForEachEntity(cEntityCallback & a_Callback); // Lua-accessible
/** Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
Returns true if all entities processed, false if the callback aborted by returning true. */
bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback); // Lua-accessible
/** Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. */ /** Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. */
bool DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult); // Lua-accessible bool DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult); // Lua-accessible
@ -430,7 +458,12 @@ private:
typedef std::vector<sSetBlockQueueItem> sSetBlockQueueVector; typedef std::vector<sSetBlockQueueItem> sSetBlockQueueVector;
bool m_IsValid; // True if the chunk is loaded / generated /** Holds the presence status of the chunk - if it is present, or in the loader / generator queue, or unloaded */
ePresence m_Presence;
/** If the chunk fails to load, should it be queued in the generator or reset back to invalid? */
bool m_ShouldGenerateIfLoadFailed;
bool m_IsLightValid; // True if the blocklight and skylight are calculated bool m_IsLightValid; // True if the blocklight and skylight are calculated
bool m_IsDirty; // True if the chunk has changed since it was last saved bool m_IsDirty; // True if the chunk has changed since it was last saved
bool m_IsSaving; // True if the chunk is being saved bool m_IsSaving; // True if the chunk is being saved
@ -449,7 +482,7 @@ private:
/** Number of times the chunk has been requested to stay (by various cChunkStay objects); if zero, the chunk can be unloaded */ /** Number of times the chunk has been requested to stay (by various cChunkStay objects); if zero, the chunk can be unloaded */
int m_StayCount; int m_StayCount;
int m_PosX, m_PosY, m_PosZ; int m_PosX, m_PosZ;
cWorld * m_World; cWorld * m_World;
cChunkMap * m_ChunkMap; cChunkMap * m_ChunkMap;

View File

@ -16,11 +16,6 @@
/** This is really only a placeholder to be used in places where we need to "make up" a chunk's Y coord.
It will help us when the new chunk format comes out and we need to patch everything up for compatibility.
*/
#define ZERO_CHUNK_Y 0
// Used to smoothly convert to new axis ordering. One will be removed when deemed stable. // Used to smoothly convert to new axis ordering. One will be removed when deemed stable.
#define AXIS_ORDER_YZX 1 // Original (1.1-) #define AXIS_ORDER_YZX 1 // Original (1.1-)
#define AXIS_ORDER_XZY 2 // New (1.2+) #define AXIS_ORDER_XZY 2 // New (1.2+)
@ -377,14 +372,13 @@ class cChunkCoords
{ {
public: public:
int m_ChunkX; int m_ChunkX;
int m_ChunkY;
int m_ChunkZ; int m_ChunkZ;
cChunkCoords(int a_ChunkX, int a_ChunkY, int a_ChunkZ) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ) {} cChunkCoords(int a_ChunkX, int a_ChunkZ) : m_ChunkX(a_ChunkX), m_ChunkZ(a_ChunkZ) {}
bool operator == (const cChunkCoords & a_Other) const bool operator == (const cChunkCoords & a_Other) const
{ {
return ((m_ChunkX == a_Other.m_ChunkX) && (m_ChunkY == a_Other.m_ChunkY) && (m_ChunkZ == a_Other.m_ChunkZ)); return ((m_ChunkX == a_Other.m_ChunkX) && (m_ChunkZ == a_Other.m_ChunkZ));
} }
} ; } ;
@ -395,6 +389,27 @@ typedef std::vector<cChunkCoords> cChunkCoordsVector;
class cChunkCoordsWithBool
{
public:
int m_ChunkX;
int m_ChunkZ;
bool m_ForceGenerate;
cChunkCoordsWithBool(int a_ChunkX, int a_ChunkZ, bool a_ForceGenerate) : m_ChunkX(a_ChunkX), m_ChunkZ(a_ChunkZ), m_ForceGenerate(a_ForceGenerate){}
bool operator == (const cChunkCoordsWithBool & a_Other) const
{
return ((m_ChunkX == a_Other.m_ChunkX) && (m_ChunkZ == a_Other.m_ChunkZ) && (m_ForceGenerate == a_Other.m_ForceGenerate));
}
};
typedef std::list<cChunkCoordsWithBool> cChunkCoordsWithBoolList;
/// Interface class used as a callback for operations that involve chunk coords /// Interface class used as a callback for operations that involve chunk coords
class cChunkCoordCallback class cChunkCoordCallback
{ {

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ class cBlockArea;
class cMobCensus; class cMobCensus;
class cMobSpawner; class cMobSpawner;
class cSetChunkData; class cSetChunkData;
class cBoundingBox;
typedef std::list<cClientHandle *> cClientHandleList; typedef std::list<cClientHandle *> cClientHandleList;
typedef cChunk * cChunkPtr; typedef cChunk * cChunkPtr;
@ -132,6 +133,9 @@ public:
/** Copies the chunk's blocktypes into a_Blocks; returns true if successful */ /** Copies the chunk's blocktypes into a_Blocks; returns true if successful */
bool GetChunkBlockTypes (int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_Blocks); bool GetChunkBlockTypes (int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_Blocks);
/** Returns true iff the chunk is in the loader / generator queue. */
bool IsChunkQueued(int a_ChunkX, int a_ChunkZ);
bool IsChunkValid (int a_ChunkX, int a_ChunkZ); bool IsChunkValid (int a_ChunkX, int a_ChunkZ);
bool HasChunkAnyClients (int a_ChunkX, int a_ChunkZ); bool HasChunkAnyClients (int a_ChunkX, int a_ChunkZ);
int GetHeight (int a_BlockX, int a_BlockZ); // Waits for the chunk to get loaded / generated int GetHeight (int a_BlockX, int a_BlockZ); // Waits for the chunk to get loaded / generated
@ -209,6 +213,11 @@ public:
/** Calls the callback for each entity in the specified chunk; returns true if all entities processed, false if the callback aborted by returning true */ /** Calls the callback for each entity in the specified chunk; returns true if all entities processed, false if the callback aborted by returning true */
bool ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback); // Lua-accessible bool ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback); // Lua-accessible
/** Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
Returns true if all entities processed, false if the callback aborted by returning true.
If any chunk in the box is missing, ignores the entities in that chunk silently. */
bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback); // Lua-accessible
/** Destroys and returns a list of blocks destroyed in the explosion at the specified coordinates */ /** Destroys and returns a list of blocks destroyed in the explosion at the specified coordinates */
void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlockAffected); void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlockAffected);
@ -270,16 +279,10 @@ public:
bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible bool GetSignLines (int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4); // Lua-accessible
/** Touches the chunk, causing it to be loaded or generated */ /** Touches the chunk, causing it to be loaded or generated */
void TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); void TouchChunk(int a_ChunkX, int a_ChunkZ);
/** Loads the chunk, if not already loaded. Doesn't generate. Returns true if chunk valid (even if already loaded before) */
bool LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
/** Loads the chunks specified. Doesn't report failure, other than chunks being !IsValid() */
void LoadChunks(const cChunkCoordsList & a_Chunks);
/** Marks the chunk as failed-to-load */ /** Marks the chunk as failed-to-load */
void ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ); void ChunkLoadFailed(int a_ChunkX, int a_ChunkZ);
/** Sets the sign text. Returns true if sign text changed. */ /** Sets the sign text. Returns true if sign text changed. */
bool SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); bool SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4);
@ -363,7 +366,7 @@ private:
~cChunkLayer(); ~cChunkLayer();
/** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */ /** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */
cChunkPtr GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ); cChunkPtr GetChunk( int a_ChunkX, int a_ChunkZ);
/** Returns the specified chunk, or NULL if not created yet */ /** Returns the specified chunk, or NULL if not created yet */
cChunk * FindChunk(int a_ChunkX, int a_ChunkZ); cChunk * FindChunk(int a_ChunkX, int a_ChunkZ);
@ -456,9 +459,9 @@ private:
std::auto_ptr<cAllocationPool<cChunkData::sChunkSection> > m_Pool; std::auto_ptr<cAllocationPool<cChunkData::sChunkSection> > m_Pool;
cChunkPtr GetChunk (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading / generating if not valid cChunkPtr GetChunk (int a_ChunkX, int a_ChunkZ); // Also queues the chunk for loading / generating if not valid
cChunkPtr GetChunkNoGen (int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Also queues the chunk for loading if not valid; doesn't generate cChunkPtr GetChunkNoGen (int a_ChunkX, int a_ChunkZ); // Also queues the chunk for loading if not valid; doesn't generate
cChunkPtr GetChunkNoLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Doesn't load, doesn't generate cChunkPtr GetChunkNoLoad(int a_ChunkX, int a_ChunkZ); // Doesn't load, doesn't generate
/** Gets a block in any chunk while in the cChunk's Tick() method; returns true if successful, false if chunk not loaded (doesn't queue load) */ /** Gets a block in any chunk while in the cChunk's Tick() method; returns true if successful, false if chunk not loaded (doesn't queue load) */
bool LockedGetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta); bool LockedGetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta);

View File

@ -81,7 +81,7 @@ void cChunkSender::ChunkReady(int a_ChunkX, int a_ChunkZ)
// This is probably never gonna be called twice for the same chunk, and if it is, we don't mind, so we don't check // This is probably never gonna be called twice for the same chunk, and if it is, we don't mind, so we don't check
{ {
cCSLock Lock(m_CS); cCSLock Lock(m_CS);
m_ChunksReady.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)); m_ChunksReady.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
} }
m_evtQueue.Set(); m_evtQueue.Set();
} }
@ -95,12 +95,12 @@ void cChunkSender::QueueSendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle *
ASSERT(a_Client != NULL); ASSERT(a_Client != NULL);
{ {
cCSLock Lock(m_CS); cCSLock Lock(m_CS);
if (std::find(m_SendChunks.begin(), m_SendChunks.end(), sSendChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ, a_Client)) != m_SendChunks.end()) if (std::find(m_SendChunks.begin(), m_SendChunks.end(), sSendChunk(a_ChunkX, a_ChunkZ, a_Client)) != m_SendChunks.end())
{ {
// Already queued, bail out // Already queued, bail out
return; return;
} }
m_SendChunks.push_back(sSendChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ, a_Client)); m_SendChunks.push_back(sSendChunk(a_ChunkX, a_ChunkZ, a_Client));
} }
m_evtQueue.Set(); m_evtQueue.Set();
} }
@ -160,7 +160,7 @@ void cChunkSender::Execute(void)
m_ChunksReady.pop_front(); m_ChunksReady.pop_front();
Lock.Unlock(); Lock.Unlock();
SendChunk(Coords.m_ChunkX, Coords.m_ChunkY, Coords.m_ChunkZ, NULL); SendChunk(Coords.m_ChunkX, Coords.m_ChunkZ, NULL);
} }
else else
{ {
@ -169,7 +169,7 @@ void cChunkSender::Execute(void)
m_SendChunks.pop_front(); m_SendChunks.pop_front();
Lock.Unlock(); Lock.Unlock();
SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkY, Chunk.m_ChunkZ, Chunk.m_Client); SendChunk(Chunk.m_ChunkX, Chunk.m_ChunkZ, Chunk.m_Client);
} }
Lock.Lock(); Lock.Lock();
int RemoveCount = m_RemoveCount; int RemoveCount = m_RemoveCount;
@ -186,14 +186,14 @@ void cChunkSender::Execute(void)
void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client) void cChunkSender::SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client)
{ {
ASSERT(m_World != NULL); ASSERT(m_World != NULL);
// Ask the client if it still wants the chunk: // Ask the client if it still wants the chunk:
if (a_Client != NULL) if (a_Client != NULL)
{ {
if (!a_Client->WantsSendChunk(a_ChunkX, a_ChunkY, a_ChunkZ)) if (!a_Client->WantsSendChunk(a_ChunkX, a_ChunkZ))
{ {
return; return;
} }

View File

@ -95,13 +95,11 @@ protected:
struct sSendChunk struct sSendChunk
{ {
int m_ChunkX; int m_ChunkX;
int m_ChunkY;
int m_ChunkZ; int m_ChunkZ;
cClientHandle * m_Client; cClientHandle * m_Client;
sSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client) : sSendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) :
m_ChunkX(a_ChunkX), m_ChunkX(a_ChunkX),
m_ChunkY(a_ChunkY),
m_ChunkZ(a_ChunkZ), m_ChunkZ(a_ChunkZ),
m_Client(a_Client) m_Client(a_Client)
{ {
@ -111,7 +109,6 @@ protected:
{ {
return ( return (
(a_Other.m_ChunkX == m_ChunkX) && (a_Other.m_ChunkX == m_ChunkX) &&
(a_Other.m_ChunkY == m_ChunkY) &&
(a_Other.m_ChunkZ == m_ChunkZ) && (a_Other.m_ChunkZ == m_ChunkZ) &&
(a_Other.m_Client == m_Client) (a_Other.m_Client == m_Client)
); );
@ -162,7 +159,7 @@ protected:
virtual void BlockEntity (cBlockEntity * a_Entity) override; virtual void BlockEntity (cBlockEntity * a_Entity) override;
/// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == NULL /// Sends the specified chunk to a_Client, or to all chunk clients if a_Client == NULL
void SendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, cClientHandle * a_Client); void SendChunk(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client);
} ; } ;

View File

@ -51,7 +51,7 @@ void cChunkStay::Add(int a_ChunkX, int a_ChunkZ)
return; return;
} }
} // for itr - Chunks[] } // for itr - Chunks[]
m_Chunks.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)); m_Chunks.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
} }

View File

@ -472,13 +472,13 @@ void cClientHandle::StreamChunks(void)
// For each distance touch chunks in a hollow square centered around current position: // For each distance touch chunks in a hollow square centered around current position:
for (int i = -d; i <= d; ++i) for (int i = -d; i <= d; ++i)
{ {
World->TouchChunk(ChunkPosX + d, ZERO_CHUNK_Y, ChunkPosZ + i); World->TouchChunk(ChunkPosX + d, ChunkPosZ + i);
World->TouchChunk(ChunkPosX - d, ZERO_CHUNK_Y, ChunkPosZ + i); World->TouchChunk(ChunkPosX - d, ChunkPosZ + i);
} // for i } // for i
for (int i = -d + 1; i < d; ++i) for (int i = -d + 1; i < d; ++i)
{ {
World->TouchChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ + d); World->TouchChunk(ChunkPosX + i, ChunkPosZ + d);
World->TouchChunk(ChunkPosX + i, ZERO_CHUNK_Y, ChunkPosZ - d); World->TouchChunk(ChunkPosX + i, ChunkPosZ - d);
} // for i } // for i
} // for d } // for d
} }
@ -501,8 +501,8 @@ void cClientHandle::StreamChunk(int a_ChunkX, int a_ChunkZ)
{ {
{ {
cCSLock Lock(m_CSChunkLists); cCSLock Lock(m_CSChunkLists);
m_LoadedChunks.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)); m_LoadedChunks.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)); m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
} }
World->SendChunkTo(a_ChunkX, a_ChunkZ, this); World->SendChunkTo(a_ChunkX, a_ChunkZ, this);
} }
@ -1448,7 +1448,7 @@ void cClientHandle::HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, e
NewBlock->OnPlacedByPlayer(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta); NewBlock->OnPlacedByPlayer(ChunkInterface, *World, m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
// Step sound with 0.8f pitch is used as block placement sound // Step sound with 0.8f pitch is used as block placement sound
World->BroadcastSoundEffect(NewBlock->GetStepSound(), (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.8f); World->BroadcastSoundEffect(cBlockInfo::GetPlaceSound(BlockType), (double)a_BlockX, (double)a_BlockY, (double)a_BlockZ, 1.0f, 0.8f);
cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta); cRoot::Get()->GetPluginManager()->CallHookPlayerPlacedBlock(*m_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, BlockType, BlockMeta);
} }
@ -2734,7 +2734,7 @@ bool cClientHandle::HasPluginChannel(const AString & a_PluginChannel)
bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkZ)
{ {
if (m_State >= csDestroying) if (m_State >= csDestroying)
{ {
@ -2742,7 +2742,7 @@ bool cClientHandle::WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
} }
cCSLock Lock(m_CSChunkLists); cCSLock Lock(m_CSChunkLists);
return (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)) != m_ChunksToSend.end()); return (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) != m_ChunksToSend.end());
} }
@ -2758,9 +2758,9 @@ void cClientHandle::AddWantedChunk(int a_ChunkX, int a_ChunkZ)
LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this); LOGD("Adding chunk [%d, %d] to wanted chunks for client %p", a_ChunkX, a_ChunkZ, this);
cCSLock Lock(m_CSChunkLists); cCSLock Lock(m_CSChunkLists);
if (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)) == m_ChunksToSend.end()) if (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), cChunkCoords(a_ChunkX, a_ChunkZ)) == m_ChunksToSend.end())
{ {
m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ)); m_ChunksToSend.push_back(cChunkCoords(a_ChunkX, a_ChunkZ));
} }
} }
@ -2858,11 +2858,27 @@ void cClientHandle::SocketClosed(void)
void cClientHandle::HandleEnchantItem(Byte & WindowID, Byte & Enchantment) void cClientHandle::HandleEnchantItem(Byte & a_WindowID, Byte & a_Enchantment)
{ {
cEnchantingWindow * Window = (cEnchantingWindow*)m_Player->GetWindow(); if (a_Enchantment > 2)
{
LOGWARNING("%s attempt to crash the server with invalid enchanting selection!", GetUsername().c_str());
Kick("Invalid enchanting!");
return;
}
if (
(m_Player->GetWindow() == NULL) ||
(m_Player->GetWindow()->GetWindowID() != a_WindowID) ||
(m_Player->GetWindow()->GetWindowType() != cWindow::wtEnchantment)
)
{
return;
}
cEnchantingWindow * Window = (cEnchantingWindow*) m_Player->GetWindow();
cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player); cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player);
int BaseEnchantmentLevel = Window->GetPropertyValue(Enchantment); int BaseEnchantmentLevel = Window->GetPropertyValue(a_Enchantment);
if (Item.EnchantByXPLevels(BaseEnchantmentLevel)) if (Item.EnchantByXPLevels(BaseEnchantmentLevel))
{ {

View File

@ -62,7 +62,7 @@ public:
cClientHandle(const cSocket * a_Socket, int a_ViewDistance); cClientHandle(const cSocket * a_Socket, int a_ViewDistance);
virtual ~cClientHandle(); virtual ~cClientHandle();
const AString & GetIPString(void) const { return m_IPString; } const AString & GetIPString(void) const { return m_IPString; } // tolua_export
cPlayer * GetPlayer(void) { return m_Player; } // tolua_export cPlayer * GetPlayer(void) { return m_Player; } // tolua_export
@ -209,7 +209,7 @@ public:
// tolua_end // tolua_end
/** Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend) */ /** Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend) */
bool WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); bool WantsSendChunk(int a_ChunkX, int a_ChunkZ);
/** Adds the chunk specified to the list of chunks wanted for sending (m_ChunksToSend) */ /** Adds the chunk specified to the list of chunks wanted for sending (m_ChunksToSend) */
void AddWantedChunk(int a_ChunkX, int a_ChunkZ); void AddWantedChunk(int a_ChunkX, int a_ChunkZ);
@ -269,7 +269,7 @@ public:
void RemoveFromWorld(void); void RemoveFromWorld(void);
/** Called when the player will enchant a Item */ /** Called when the player will enchant a Item */
void HandleEnchantItem(Byte & WindowID, Byte & Enchantment); void HandleEnchantItem(Byte & a_WindowID, Byte & a_Enchantment);
private: private:

View File

@ -387,7 +387,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
case cMonster::mtGhast: case cMonster::mtGhast:
case cMonster::mtZombiePigman: case cMonster::mtZombiePigman:
case cMonster::mtMagmaCube: case cMonster::mtMagmaCube:
{ {
break; break;
}; };
default: StartBurning(BurnTicks * 20); default: StartBurning(BurnTicks * 20);
@ -417,7 +417,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
} }
if (!Player->IsOnGround()) if (!Player->IsOnGround())
{ {
if ((a_TDI.DamageType == dtAttack) || (a_TDI.DamageType == dtArrowAttack)) if ((a_TDI.DamageType == dtAttack) || (a_TDI.DamageType == dtArrowAttack))
{ {
a_TDI.FinalDamage += 2; a_TDI.FinalDamage += 2;

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