1
0
Fork 0
Commit Graph

45 Commits

Author SHA1 Message Date
x12xx12x 3ff57559e3
ItemHandler initialisation is a constant expression (#5344)
* 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-12-01 23:31:10 +00:00
Tiger Wang 090d8305e4 Warnings improvements
* 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-12-18 21:03:40 +00:00
KingCol13 8947147c25
Enchanting table shows detail on hover. Enchanting is deterministic. (#4937)
* 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-10-01 22:33:32 +01:00
KingCol13 8eca58a1c9
Fortune Drops (#4932)
+ 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-09-28 13:41:49 +01:00
Tobias Wilken 36eab1b323
Introduce recipe book functionality (#4493)
* 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-07-14 17:56:42 +01:00
Mattes D 01b8ed5295
Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)
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
2020-04-03 08:57:01 +02:00
Mattes D 221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Alexander Harkness b4aa19f329
Item durability loss now depends on the item used. (#4123)
Armour durability also no longer changes when it
is used to break blocks or attack mobs.

Fixes #4119
2018-01-05 11:28:06 +00:00
peterbell10 96ce841417 Add TOLUA_EXPOSITION for readability 2017-08-28 14:36:23 +01:00
peterbell10 b8dda388e0 Represent cItem::m_Lore as an AStringVector (#3882)
* Replace cItem::m_Lore with AStringVector

* Reword deprecation warning

* Fix lua bindings
2017-08-18 11:29:54 +01:00
Lane Kolbly 790e15f2e6 Added anvil enchantment handling. (#3857)
+ Added anvil enchantment handling.
2017-07-28 18:00:20 +01:00
Mattes D 2622a8622a APIDump: Reformatted the docs to include type information.
Also fixed a bit of documentation in the CPP source.
2016-09-12 23:21:15 +02:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Gargaj 853e6e6882 change from single followable item to multiple 2015-11-23 22:20:31 +01:00
Samuel Barney 561296f269 Leather Armor can now be dyed.
* Created new color class to handle dye-related coloring
2015-07-15 14:05:36 -06:00
Howaner c19b2befa8 Changed the IsEnchantable() comment again. 2014-09-02 20:17:31 +02:00
Howaner 3ee3a59e75 Changed the IsEnchantable() comment. 2014-08-30 15:06:43 +02:00
Hownaer 4ff34b9f10 APIDump: Added missing cItem things. 2014-08-28 18:18:21 +02:00
Hownaer f1470fcf9f Fixed bad values in the IsEnchantable() method. 2014-08-28 15:21:38 +02:00
madmaxoft 993fd14ddf Fixed basic whitespace problems.
Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
2014-07-17 16:33:09 +02:00
andrew aea866f5b1 Movement Statistics 2014-05-12 21:38:52 +03:00
Howaner df71cc931b Missing comma 2014-05-07 21:32:52 +02:00
Howaner fbb6404cc8 Change m_RepairCost to int. 2014-05-07 20:43:37 +02:00
Howaner e86bf64867 Where is the problem with clang? 2014-05-07 12:45:20 +02:00
Howaner d6cb6e0423 Add repair cost to cItem, add custom name to NBTChunkSerializer and fix anvil bugs. 2014-05-07 12:30:30 +02:00
madmaxoft b0056cdcf8 Removed the explicit copy constructor for cItem.
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-05-01 22:02:25 +02:00
madmaxoft f2b5790776 Fixed a warning when an empty item is being created. 2014-04-30 17:36:51 +02:00
daniel0916 0086fcfef1 Fixed some Errors (not all) 2014-04-17 19:31:43 +02:00
daniel0916 f9343a8490 Modified many things 2014-04-17 13:15:35 +02:00
daniel0916 e6e702e7fd Added complete Enchanting System
http://minecraft.gamepedia.com/Enchantment_mechanics
2014-04-12 14:58:46 +02:00
daniel0916 2e9754ac1c Merge remote-tracking branch 'upstream/master' into Enchanting 2014-04-07 20:12:17 +02:00
madmaxoft a5c0600e6c Fixed a few clang warnings. 2014-03-30 20:02:30 +02:00
Tiger Wang baf2d88921 Implemented ballistic missiles (fireworks)
+ Added fireworks
2014-02-26 23:33:52 +00:00
madmaxoft 7e80b04114 Fixed gcc warnings in Item.h. 2014-02-11 11:30:11 +01:00
Alexander Harkness b9aa0420a3 Merge pull request #646 from worktycho/warningfixes
Fixed most of the reordering warnings
2014-02-05 18:24:08 +00:00
Tycho 8ba6f73169 Fixed most of the reordering warnings 2014-02-05 09:43:49 -08:00
madmaxoft 5cdbb6683f Fixed a warning in cItem in gcc.
Constructor member order...
2014-02-04 22:18:59 +01:00
tonibm19 c2e7dd34d9 Exporded World:FindClosestPlayer, Item:IsEnchantable and Monster:MoveToPosition to Lua API 2014-02-03 20:52:11 +01:00
daniel0916 36120db400 Some updates for enchanting (2) 2014-01-31 19:46:51 +01:00
Tiger Wang 952c53eb4e Removed CustomCopy() 2014-01-16 21:41:55 +00:00
Tiger Wang 74645fdfaa Removed obsoleted functions 2014-01-16 19:00:49 +00:00
Tiger Wang 5d03e49c13 Possibly did what xoft wanted 2014-01-16 18:44:11 +00:00
Tiger Wang fcafd5a2e0 Implemented custom names and lore
+ Added custom names and lore
+ Added saving and loading
+ Added writing and parsing of NBT
2014-01-15 22:38:03 +00:00
madmaxoft 9c8af58b75 Fixed a few MSVC warnings. 2014-01-06 22:22:33 +01:00
Alexander Harkness 675b4aa878 Moved source to src 2013-11-24 14:19:41 +00:00