1
0
Fork 0
Commit Graph

173 Commits

Author SHA1 Message Date
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
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mattes D 4aef80b47e Added temporary block type mapping for 1.13+ protocols. 2020-01-07 06:53:17 +01:00
Mattes D b63bb2f694 Root: Load the UpgradeBlockTypePalette on startup. 2020-01-07 06:53:17 +01:00
Mattes D 180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01:00
Mattes D 8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
Bond-009 b9fdaf8a94 Use clang-tidy to check more code conventions (#4214)
* Create clang-tidy.sh
* Add clang-tidy to circle.yml
* Fixed some naming violations

Fixes #4164
2018-05-06 18:07:34 +01:00
mathiascode a879778968 Broadcast playerlist removal in every world (#4201) 2018-04-02 18:39:54 +01:00
peterbell10 757231cc6e
Add the fmt library (#4065)
* Replaces AppendVPrintf with fmt::sprintf
* fmt::ArgList now used as a type safe alternative to varargs.
* Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu.
* Adds FLOG functions to log with fmt's native formatting style.
2018-01-03 17:41:16 +00:00
bibo38 532731e6f4 Fixed Clang 5.0 compile errors (#4085)
* Fixed Clang 5.0 compile errors

* Fixed wrong comment

* Only disable warnings in Clang 5 or higher

* Added a CMake condition for the Clang 5 no-zero-as-null-pointer-constant warning

* Now using the use_nullptr branch of the Cuberite specific SQLiteCpp fork
2017-12-21 11:36:58 +00:00
peterbell10 1537ebed6f cWorld: Move Initialization from Start to the constructor.
Start now does nothing more than launch the world's threads.
2017-10-21 19:33:22 +02:00
peterbell10 8835bf344d cRoot: Make PollPeriod representation 32 bit (#4030) 2017-09-19 14:14:44 +01:00
Lukas Pioch c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
Alexander Harkness 0968a4d360 Fix error with implicit cast from long long to long (#4026) 2017-09-14 13:11:22 +02:00
peterbell10 3ec9e6ec87 Limit how long cRoot::InputThread may block (#4019)
Limit how long cRoot::InputThread may block
Only calls `std::getline` when there is input available
which removes the need to "notify" the input thread.
Fixes #2494 and fixes #3177
2017-09-12 07:41:39 +01:00
peterbell10 e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
Lane Kolbly b12f4ef7d5 Made world data paths adjustable, and added API to temporarily disable saving chunks to disk. (#3912) 2017-09-07 13:41:16 +01:00
LogicParrot 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
peterbell10 f4f2fc7c3d Add cUUID class (#3871) 2017-08-25 13:43:18 +01:00
worktycho 832298e7aa Add command line argument for disabling the logfile 2017-06-03 21:40:35 +02:00
josh-parris 05c3e8bed8 Prevent infinite loop when logging fails (#3693)
Prevent infinite loop when logging fails
2017-05-05 13:02:54 +01:00
johnsoch f269565e73 Fixed looping when unable to bind port (#3621)
Fixes #3593
2017-03-17 13:44:28 +01:00
Bond-009 ca3aa4ca06 Changed world_end to world_the_end #3531 (#3538) 2017-02-24 10:02:16 +01:00
Gareth Nelson 1c31cb7eec Add support for alternate config file locations (#3578) 2017-02-22 14:10:32 +01:00
Mattes D 7cc3fb098d DeadlockDetect now lists some tracked CS's stats. 2017-01-18 09:03:05 +01:00
sweetgiorni 6522385897 Disconnect sent flag added
Truthiness no longer assumed
2017-01-03 13:14:28 -08:00
sweetgiorni 0718d82e1a Player check
Checks if there are any players connected to the server before running
PlayerCallback and waiting 1 second.
2017-01-03 12:31:07 -08:00
sweetgiorni 78b6d54bf8 Api Documentation
Added API documentation for GetShutdownMessage.
Style fix in Root.cpp
2017-01-03 12:18:53 -08:00
sweetgiorni 25e4f15488 Custom Disconnect Message
Adds a m_ShutdownMessage option to the settings. When the stop command
is issued, players are kicked with said message before the server shuts
down.
2017-01-03 11:15:34 -08:00
Fabian Stein ad476e1cf9 Fix crash after attempting to kill a non-running thread (#3504)
Fixes #3221
2017-01-01 22:43:24 +01:00
LogicParrot d4353f8084 Disabled anticheat (#3511) 2017-01-01 15:47:17 +02:00
Tiger Wang 8c6d0b51c7 Use CMake's Android generators to crosscompile 2016-12-12 14:32:32 +00:00
Mattes D 0bffa29358 Removed ClientHandle.h dependencies from common headers. 2016-11-18 20:00:04 +01:00
mohe2015 32b38fb264 Anticheat fastbreak (#3411)
Added block hardness checks when breaking blocks.
2016-11-06 19:30:19 +01:00
LogicParrot dd8daaf63e Remove settings.ini world migration code (#3360) 2016-08-29 17:27:38 +03:00
Alexander Harkness fb2e231f5e Fix the error in #3270. 2016-07-29 19:51:33 +01:00
Alexander Harkness a2a9341c24 Tab completion across worlds (#3270)
Fixes #2563.
2016-07-21 13:00:30 +02:00
Mattes D 36eefbf0f2 SelfTests: Removed the unneeded cSelfTests class. 2016-06-18 13:12:10 +02:00
LogicParrot 9b60ee6e43 Auto clean bad world linkages 2016-04-19 12:06:52 +03:00
LogicParrot 3fb32a5535 Write to console when autofixing linkages 2016-02-09 10:02:36 +02:00
LogicParrot bcbfd3348d Merge pull request #2990 from LogicParrot/defaultWorld
Add DefaultWorld to newly generated INI
2016-02-08 12:49:20 +02:00
LogicParrot dd34243521 Add DefaultWorld to newly generated INI 2016-02-08 12:26:21 +02:00
LogicParrot 3efdfca61d remove cWorld::createAndInitializeWorld 2016-02-08 12:17:10 +02:00
LogicParrot ed97946bb9 Merge pull request #2961 from LogicParrot/enforce
[PhantomWorlds - 4] Prevent server from starting if there's bad world linkage
2016-02-08 11:57:57 +02:00
LogicParrot 96f9afa278 Proper world linkages and dimension types for newly created world.ini's 2016-02-06 10:18:13 +02:00
LogicParrot d8861da599 Prevent server from starting if there's bad world linkage 2016-02-05 15:34:16 +02:00
LogicParrot 8f7d929140 Fix unexpected world creation introduced by #2821 2016-02-04 10:06:07 +02:00
Mathias 152c7c064a Front-end update 2016-01-28 20:01:42 +02:00
Anthony Birkett d75168ca03 Fix running as a service.
Two problems identified, both traced to commit 4315a11

(main.cpp) ParseArguments() was no longer being called before checking cRoot::m_RunAsService.
This led to m_RunAsService never being set (we use -d on the command line to instigate a service start).

(Root.cpp) Terminate events were being ignored when running as a service.
We only need to ignore the cin.good() call, not terminate events as a whole.
2016-01-21 16:38:13 +00:00