summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-01-14Fixed Compiler Warningsx12xx12x1-14/+14
2021-12-02ItemHandler initialisation is a constant expression (#5344)x12xx12x1-4/+3
* 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
2021-07-09Item frame maps (#5258)KingCol131-1/+1
+ Send map data when item frame spawns. + Add some casts to placate compiler warnings. * size_t for array access. * Mark chunk dirty when rotation or item in item frame is changed.
2020-07-14Introduce recipe book functionality (#4493)Tobias Wilken1-4/+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>
2018-01-21cItemGrid: Allocate storage lazily (#4083)peterbell101-75/+113
* cItemGrid: Allocate storage lazily * cItemGrid: Fix spelling, Prioritary -> Priority
2017-07-09cItemGrid bounds check (#3837)peterbell101-12/+62
2017-06-16BlockEntities: Support cloning self.Mattes D1-0/+16
2016-02-05Bulk clearing of whitespaceLogicParrot1-13/+13
2015-07-29Silenced and fixed many warning messages across multiple files.Samuel Barney1-3/+3
2015-05-24Made -Weverything an error.tycho1-1/+1
2014-12-21Fixed a possible division by zero.Mattes D1-1/+1
2014-11-18Moved all Noise-related files into a separate folder.Mattes D1-1/+1
2014-10-23En masse NULL -> nullptr replaceTiger Wang1-1/+1
2014-10-20En masse NULL -> nullptr replaceTiger Wang1-1/+1
2014-10-19Fixed minor style issues.Mattes D1-1/+1
2014-10-16Changed i variable to jSTRWarrior1-3/+10
The server wasn't going over all the items before.
2014-10-15Fixed possible crashSTRWarrior1-1/+8
It could crash if MinAmount - MaxAmount was 0 because it would execute (Number % 0)
2014-10-15The code now prevents conflicting enchantments.STRWarrior1-0/+1
2014-10-15Adding enchantments directly instead of first getting the name of it.STRWarrior1-1/+1
2014-10-15Renamed the counter to 'j'STRWarrior1-1/+1
2014-10-15Returned cFastRandom and cEnchantment:GetRandomEnchantmentFromVector to beforeSTRWarrior1-1/+1
Added cEnchantment:GenerateEnchantmentFromVector that allows to get the same enchantments over and over.
2014-10-15Enchanted books generate in MineShafts chestsSTRWarrior1-1/+14
2014-07-18Added RemoveItem() function to the player inventory.Howaner1-0/+33
2014-07-18Items should first added to the first slot, not the latest.Howaner1-3/+3
2014-06-19Nullify deleted pointers.archshift1-0/+1
2014-02-12Changed inheritance a bitTiger Wang1-0/+7
* cBlockEntityWithItems now inherits from cBlockEntityWindowOwner
2014-01-16Removed obsoleted functionsTiger Wang1-4/+4
2013-12-22Fixed signedness warning in cItemGrid.madmaxoft1-3/+3
2013-11-24Moved source to srcAlexander Harkness1-0/+0
2013-08-11Added an AllowEmptyStacks param to cItemGrid::HowManyCanFit().madmaxoft1-2/+5
2013-07-29Changed everyting to Unix line endings.Alexander Harkness1-662/+662
2013-07-26cItemGrid: ChangeSlotCount() now returns -1 if invalid SlotNummadmaxoft@gmail.com1-2/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1684 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-07-03Empty buckets replace fluid buckets on use and vice versa (patch contributed by Mgueydan)madmaxoft1-12/+40
Fixes FS #277. API change: added an optional parameter to cItemGrid:AddItem(), cItemGrid:AddItems(), cInventory:AddItem() and cInventory:AddItems() git-svn-id: http://mc-server.googlecode.com/svn/trunk@1643 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-13Added hopper entity, it can suck items out of chests, dispensers, droppers and other hopppers above it.madmaxoft@gmail.com1-3/+7
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1587 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-13cItemGrid: Added IsSlotEmpty() functionsmadmaxoft@gmail.com1-0/+25
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1585 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-04ItemGrid: fixed changing item count when ToRemove == CurrentCountmadmaxoft@gmail.com1-1/+1
Fixes FS #380 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1545 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-26Fixed cItemGrid API, no more changeable GetSlot().madmaxoft@gmail.com1-25/+0
Also fixed possible water and lava duplication glitches in the dispenser. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1520 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-26ItemGrid: Added the RemoveOneItem() functionmadmaxoft@gmail.com1-0/+47
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1513 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-25cChestEntity and cDispenserEntity now inherit from a common ancestor, cBlockEntityWithItemsmadmaxoft@gmail.com1-0/+41
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1507 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-24Slight cleanup in the cInventory / cItemGrid APImadmaxoft@gmail.com1-0/+18
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1504 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-24Refactored cInventory to use cItemGrid for the actual Storagemadmaxoft@gmail.com1-14/+189
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-04-10ItemGrid: Renamed all Item to Slot - better and consistent namingmadmaxoft@gmail.com1-40/+40
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1381 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/+349
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