1
0
Fork 0
Commit Graph

83 Commits

Author SHA1 Message Date
Tiger Wang 3dae696b41 Remove ProtocolPalettes 2020-07-19 21:20:27 +01:00
Tiger Wang 9d277f1d10
cWorld * -> cWorld (#4771)
* cWorld * -> cWorld
2020-07-14 17:57:30 +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 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 8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
mathiascode a879778968 Broadcast playerlist removal in every world (#4201) 2018-04-02 18:39:54 +01: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 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
peterbell10 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
Lukas Pioch 0397535fa7 Removed unused forward declarations (#3888) 2017-08-03 15:10:29 +02: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
Alexander Harkness a2a9341c24 Tab completion across worlds (#3270)
Fixes #2563.
2016-07-21 13:00:30 +02:00
Mattes D fea556ca1b Renamed HTTPServer folder to HTTP.
It contains client code as well.
2016-03-01 16:19:56 +01:00
LogicParrot 3efdfca61d remove cWorld::createAndInitializeWorld 2016-02-08 12:17:10 +02:00
LogicParrot d8861da599 Prevent server from starting if there's bad world linkage 2016-02-05 15:34:16 +02:00
Safwat Halaby 74912a2aaf Fix pre - #2815 default world linkage configs 2015-12-25 14:59:54 +02:00
Safwat Halaby b4649248d1 Nether and End in settings.ini by default, and created at startup 2015-12-25 13:49:13 +02:00
Lukas Pioch 9749c3aac9 Implemented brewing 2015-11-03 18:00:55 +01:00
Tiger Wang 4315a11393 Fixed and improved restarting
Restarts are now an actual, close-as-possible to application
exit+reopen.
2015-08-20 16:15:23 +01:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Lane Kolbly 9d620a20a0 Work on NetherPortalScanner. Setup portal scanner to reset PortalCooldown. Changed where player is spawned. Added a_InitSpawn flag to CreateAndInitializeWorld. 2015-06-13 16:09:43 -05:00
Mattes D d390214929 SelfTests are registered and executed after logging framework init.
Fixes #2228.
2015-06-11 22:20:04 +02:00
b33duck 022348645e Fix for the way connecting clients receive player lists and broadcast chat 2015-05-28 19:43:16 -07:00
Lukas Pioch c3b872ad93 Added method to get the uptime of the server in seconds. Implements #1650. 2015-05-26 05:36:46 +02:00
tycho b9efa02c80 Initial implementation of IniFile overloading 2015-05-16 10:46:51 +01:00
Mattes D 846d16315a CheckBasicStyle: checks spaces around * and &. 2015-05-09 12:58:55 +02:00
Mattes D 31953b19b8 Fixed crash on exit introduced with Windows Service capability.
Ref.: #1845
2015-04-05 17:07:29 +02:00
Anthony Birkett 51891b766c Working as a Windows service. Starts and stops correctly.
Added "/service" switch, to prompt the binary to attempt starting as a service.
Added service* methods, to control service startup.
Split up main() into universalMain(), which contains the startup code for both service and normal start.
Added cRoot::m_RunningAsService bool,
Added cRoot::SetStopping(bool) to allow a stop request to be sent by the service controller.
Added cBlockIDMap::init() to avoid loading items.ini before the working directory has been set.
2015-04-01 00:03:37 +01:00
Tiger Wang 0d6672bf5d Fixed crash on restart 2014-12-21 14:31:20 +00:00
Mattes D 32bce44f1f Merge pull request #1623 from p-mcgowan/issue_1253
Prevent multiple logins with same username, unless allowed in settings
2014-12-10 11:17:11 +01:00
Vincent 12c012fa01 Changed CheckMultiLogin() to not have main body wrapped in an if statement.
Added in indent to cPlayerListCallBack in cCallback class inside CheckMultiLogin().
Added doxy-comment for DoWithPlayer().
Changed comments on IsPlayerInQueue() and IsAllowMultiLogin() to doxy-comments.
2014-12-08 14:33:59 -08:00
Vincent 6de07d4a39 Fixed compile errors 2014-12-08 00:45:29 -08:00
Vincent d8d3b9aec5 Moved the check into a new function and just calls that function and a blank FindAndDoWithPlayer added. 2014-12-08 00:12:48 -08:00
Mattes D c014f5624c Merged branch 'origin/master' into c++11. 2014-12-04 22:04:16 +01:00
Mattes D a9e77fe7da cRoot: Fixed a memory leak with cRankManager. 2014-11-26 11:00:46 +01:00
Tiger Wang 79e5b82354 Merge remote-tracking branch 'origin/master' into c++11
Conflicts:
	src/Noise/Noise.h
	src/World.h
2014-11-23 17:12:34 +00:00
Mattes D c9a3cb4d3f Fixed trailing whitespace. 2014-11-12 21:59:42 +01:00
Lukas Pioch 13b20d6fe2 renamed FindAndDoWithUUID to DoWithPlayerByUUID, fixed style and comments, added description to APIDump 2014-11-05 21:57:38 +01:00
Lukas Pioch 269d76a208 Simplified FindAndDoWithUUID, formatted line 2014-11-02 21:38:17 +01:00
Lukas Pioch 9f71a4e7ae Added FindAndDoWithUUID 2014-11-02 21:01:23 +01:00
Tiger Wang 51fa6b4090 Suggestions 2014-10-23 23:58:01 +01:00
Tiger Wang aa19a3afb0 Migrated random generators to std::random 2014-10-19 14:10:18 +01:00
Tiger Wang cc600de51f Merge branch 'master' of https://github.com/mc-server/MCServer 2014-10-19 12:34:05 +01:00