summaryrefslogtreecommitdiffstats
path: root/src/Item.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-12-02ItemHandler initialisation is a constant expression (#5344)x12xx12x1-1/+1
* Transition to non-pointer item handler * That is my destructor - I decide when I leave this world * I declare your destruction private and you final
2020-12-18Warnings improvementsTiger Wang1-2/+2
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality * Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already * Reduced GetStackValue verbosity + Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness + Give SettingsRepositoryInterface a move constructor to simplify main.cpp code - Remove do {} while (false) construction in redstone handler
2020-10-01Enchanting table shows detail on hover. Enchanting is deterministic. (#4937)KingCol131-2/+3
* Use lapis for enchanting, subtract correct number of levels, ClientHandle now selects from pregenerated list. Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28Fortune Drops (#4932)KingCol131-1/+3
+ Implemented and standardized all clamped discrete random drops. + Changed cItems Add from push_back to emplace_back. Implement fortune for crops. + Enabled hoes to be enchanted with efficiency, silk touch and fortune. Made leaves, gravel and crops affected by fortune. Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-07-14Introduce recipe book functionality (#4493)Tobias Wilken1-0/+25
* Introduce recipe book functionality The recipe book helps especially new players. Missing it gives the impression that cuberite is not as advanced as it is. The handling of the recipe book uses the following functions: - Unlock Recipes (https://wiki.vg/index.php?title=Protocol&oldid=14204#Unlock_Recipes) to make recipes available and show the notification for new recipes. Initialization is done on player login for known ones, the update is done when new items are discovered. - Craft Recipe Request (https://wiki.vg/index.php?title=Protocol&oldid=14204#Craft_Recipe_Request) when the user selects a recipe from the recipe book to fill the slots. Known recipes are initialized on player login via `Unlock Recipes` with `Action` 0. As soon as a new recipe is discovered this is added via `Unlock Recipes` with `Action` 1. To be able to know and recognize new recipes the player class is extended with `KnownItems` and `KnownRecipes`. As soon as a player touches an item this is compared to the list of `KnownItems`, if the item is unknown the recipes are checked for this item and the other ingredients are checked with the list of `KnownItems`. If a full match is discovered the recipe is unlocked with the client and stored in the `KnownRecipes`. To unlock recipes the recipe ID is sent to the client. A mapping file (for protocol 1.12.2) translated the minecraft recipe names to ids. The crafting.txt is extended with and minecraft recipe names is possible. Limitations: Only a single recipe is added to the crafting area. Multiple clicks or shift click does not increase the number of builds. Co-authored-by: peterbell10 <peterbell10@live.co.uk> * Address first issues mentioned by @peterbell10 - Some linting - Extract loading of recipe specific protocol mapping into a function - Build `RecipeNameMap` only once - Use `std::optional` - Extract `LoadRecipe` from `Window` * Start to implement new suggestions * Update with suggestions from @peterbell10 * Some minor cleanup * Update protocol packet IDs * Remove unused include * Include header in cmake * Change a vector to integer counter * Change dromedaryCase method names to PascalCase * Address suggestions from @madmaxoft * Read Protocol subdirectories to load recipe books To load all recipebooks iterate over the `Protocol` subdirectories to find mapping files. Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-04-03Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)Mattes D1-55/+8
The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change) The BlockInfo.h file was removed from Globals.h (main change) The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics) The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor) Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header. That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified. eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
2019-10-16Refactored block-to-pickup conversion. (#4417)Mattes D1-0/+13
2018-01-05Item durability loss now depends on the item used. (#4123)Alexander Harkness1-4/+0
Armour durability also no longer changes when it is used to break blocks or attack mobs. Fixes #4119
2017-08-28Add TOLUA_EXPOSITION for readabilitypeterbell101-12/+2
2017-08-18Represent cItem::m_Lore as an AStringVector (#3882)peterbell101-8/+12
* Replace cItem::m_Lore with AStringVector * Reword deprecation warning * Fix lua bindings
2017-07-28Added anvil enchantment handling. (#3857)Lane Kolbly1-2/+15
+ Added anvil enchantment handling.
2016-09-12APIDump: Reformatted the docs to include type information.Mattes D1-2/+2
Also fixed a bit of documentation in the CPP source.
2016-02-05Bulk clearing of whitespaceLogicParrot1-28/+28
2015-11-23change from single followable item to multipleGargaj1-0/+2
2015-07-15Leather Armor can now be dyed.Samuel Barney1-2/+9
* Created new color class to handle dye-related coloring
2014-09-02Changed the IsEnchantable() comment again.Howaner1-1/+2
2014-08-30Changed the IsEnchantable() comment.Howaner1-1/+2
2014-08-28APIDump: Added missing cItem things.Hownaer1-1/+1
2014-08-28Fixed bad values in the IsEnchantable() method.Hownaer1-1/+1
2014-07-17Fixed basic whitespace problems.madmaxoft1-4/+4
Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
2014-05-12Movement Statisticsandrew1-1/+1
2014-05-07Missing commaHowaner1-2/+2
2014-05-07Change m_RepairCost to int.Howaner1-2/+2
2014-05-07Where is the problem with clang?Howaner1-1/+1
2014-05-07Add repair cost to cItem, add custom name to NBTChunkSerializer and fix anvil bugs.Howaner1-9/+15
2014-05-01Removed the explicit copy constructor for cItem.madmaxoft1-0/+6
The compiler generates an implicit one with the same contents and warns about it. The function left in for ToLua to generate the binding for it.
2014-04-30Fixed a warning when an empty item is being created.madmaxoft1-1/+1
2014-04-17Fixed some Errors (not all)daniel09161-1/+1
2014-04-17Modified many thingsdaniel09161-0/+7
2014-04-12Added complete Enchanting Systemdaniel09161-3/+0
http://minecraft.gamepedia.com/Enchantment_mechanics
2014-03-30Fixed a few clang warnings.madmaxoft1-1/+1
2014-02-27Implemented ballistic missiles (fireworks)Tiger Wang1-4/+12
+ Added fireworks
2014-02-11Fixed gcc warnings in Item.h.madmaxoft1-21/+21
2014-02-05Fixed most of the reordering warningsTycho1-4/+4
2014-02-04Fixed a warning in cItem in gcc.madmaxoft1-1/+1
Constructor member order...
2014-02-03Exporded World:FindClosestPlayer, Item:IsEnchantable and Monster:MoveToPosition to Lua APItonibm191-1/+1
2014-01-31Some updates for enchanting (2)daniel09161-0/+3
2014-01-16Removed CustomCopy()Tiger Wang1-5/+1
2014-01-16Removed obsoleted functionsTiger Wang1-5/+0
2014-01-16Possibly did what xoft wantedTiger Wang1-0/+3
2014-01-15Implemented custom names and loreTiger Wang1-8/+35
+ Added custom names and lore + Added saving and loading + Added writing and parsing of NBT
2014-01-06Fixed a few MSVC warnings.madmaxoft1-2/+2
2013-11-24Moved source to srcAlexander Harkness1-0/+0
2013-11-10Added cItem::GetMaxStackSize()madmaxoft1-0/+3
2013-08-04cItem: Removed a warning emitted when creating an item from airmadmaxoft1-1/+4
2013-06-16cItem: Added useful utility functionsmadmaxoft@gmail.com1-3/+21
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1599 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-04Added cItem copy-constructor to Lua API, made cItem::IsEqual() and IsStackable() enchantment-awaremadmaxoft@gmail.com1-1/+15
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1546 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-02Enchantments: API and sending to clientmadmaxoft@gmail.com1-9/+26
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1539 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-01cItem constructor changed to create single-piece items when not given countmadmaxoft@gmail.com1-5/+20
http://forum.mc-server.org/showthread.php?tid=1150 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1536 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-24Refactored cInventory to use cItemGrid for the actual Storagemadmaxoft@gmail.com1-1/+1
This makes the API more orthogonal and is easier to use in the plugins. Also changes in the inventory are now propagated to the needed places (armor updates to BroadcastEntityEquipment etc.) even when the inventory is changed by a plugin. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1503 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-19Inventory code cleanup, players can now see each other's armormadmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1493 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-12cItems: Added runtime bounds-checking to avoid server crashes with badly written plugins.madmaxoft@gmail.com1-8/+7
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1472 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-09Tiny formatting fix of rev 1463madmaxoft@gmail.com1-0/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1467 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-09function SpawnItemPickups is now exported to Lua. Lua is able to create a Items object.nielsbreu@gmail.com1-0/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1463 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-11Fixed a bit of coding style and function names in cItemmadmaxoft@gmail.com1-49/+6
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1384 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-10Dispensers rewritten to use ItemGridmadmaxoft@gmail.com1-2/+11
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1383 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-10Added cItemGrid to represent an XY grid of items; converted chests to use cItemGrid.madmaxoft@gmail.com1-0/+3
http://forum.mc-server.org/showthread.php?tid=831 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1380 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-06Mineshafts: Added random loot to generated chests and fixed chest directionmadmaxoft@gmail.com1-0/+14
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1365 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-27cItems: Fixed parameter names according to conventionsmadmaxoft@gmail.com1-4/+4
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1179 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-27Added cItems to Lua API.madmaxoft@gmail.com1-1/+28
Now HOOK_BLOCK_TO_PICKUPS is fully functional, as demonstrated by HookNotify. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1178 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-12Merged branch "branches/hooks" into "trunk".madmaxoft@gmail.com1-31/+20
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1139 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-11-11Cleanup: Removed deprecated functions from Lua APImadmaxoft@gmail.com1-8/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1033 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-24Source files cleanup: The rest of the files renamed.madmaxoft@gmail.com1-0/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@887 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-19Another handful of packets rewritten.madmaxoft@gmail.com1-7/+10
Also changed cItem::m_ItemID into m_ItemType of type short. Easier handling. m_ItemID kept for compatibility reasons (Lua-interface etc.) git-svn-id: http://mc-server.googlecode.com/svn/trunk@756 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-18Packet refactoring, phase two, partial. Rewritten a few packet handling functions not to use cPacket-descendant objects.madmaxoft@gmail.com1-7/+34
This breaks plugin API! Plugins need to modify their hook functions to match those used in the Core plugin git-svn-id: http://mc-server.googlecode.com/svn/trunk@750 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-03Fixed a few gcc pedantic warnings; made BLOCKTYPE an unsigned char type.madmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@711 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-19Removed json-related methods from Lua APImadmaxoft@gmail.com1-0/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@634 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-14Attempt to bring sanity to newlines across systems.cedeel@gmail.com1-114/+114
git-svn-id: http://mc-server.googlecode.com/svn/trunk@606 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-12Updated the crafting recipes architecture to better support crafting hooks. Removed the old recipe file and implementation altogether.madmaxoft@gmail.com1-27/+34
git-svn-id: http://mc-server.googlecode.com/svn/trunk@597 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-06Item-dropping code rewritten and centralized - now there's only one place to modify if we want to split or merge same-item drops: cWorld:SpawnItemPickups(). Also, mined blocks can now drop more items, and they recognize if they're being mined by the correct tool.madmaxoft@gmail.com1-1/+11
git-svn-id: http://mc-server.googlecode.com/svn/trunk@561 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-05-28Chests and Furnaces are now saved properly into Anvil scheme.madmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@516 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-13Rewritten most of the code for multithreading; still not 100%, but getting there. If this commit proves to be too problematic, we can always undo it.madmaxoft@gmail.com1-2/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@251 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-28- implemented the fire simulation in native c++ (cFireSimulator)lapayo94@gmail.com1-0/+53
- Changed the Durationsystem for Items. cPlayer::UseEquippedItem calls cItem::DamageItem this function damages the item if it has a duration. (needed the duration also in another place so this saves code ;)) - added some other burning blocks - the mobtypes for the settings.ini which i must have forgotten in the last commit git-svn-id: http://mc-server.googlecode.com/svn/trunk@150 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-21- Crafting fixed in 1.0.0lapayo94@gmail.com1-1/+3
- Server compatible with the weapons and equip again. (Some Packets were incompatible) - fixed bucket bugs (not all) - Fixed clients getting crashed by wrong Pickups - fixed nearly all mob drops. (Check wheather they are burning is missing Big Grin) - maybe some other things I canĀ“t recall atm Big Grin git-svn-id: http://mc-server.googlecode.com/svn/trunk@94 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-31Player data is saved and loaded as human readable JSON now.faketruth1-0/+9
cFileFormatUpdate will loop through old files and convert them to new files (should replace legacy old format loading code) cItem has two new functions to load from Json and output Json, this will keep the items in Json standard ChestEntity and FurnaceEntity use the new functions in cItem git-svn-id: http://mc-server.googlecode.com/svn/trunk@35 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-03MCServer c++ source filesfaketruth1-0/+33
git-svn-id: http://mc-server.googlecode.com/svn/trunk@3 0a769ca7-a7f5-676a-18bf-c427514a06d6