1
0
Fork 0
Commit Graph

147 Commits

Author SHA1 Message Date
Tiger Wang a999c5d845 More cProtocol cleanup
* Alpha sort functions
* Simplify hand handling
* Fix left handed mode client-side display
2021-04-12 22:35:07 +01:00
Tiger Wang 1394fc8eb5 Streamline player abilities handling
* Update player list gamemode on world change
* Fix invisibility for spectators, use entity metadata
* Populate m_World for cPlayers on load
- Remove SendPlayerMaxSpeed, a duplicate of SendEntityProperties
2021-04-12 22:35:07 +01:00
Tiger Wang 4cd49d7eca Fix sending incorrect date values on world change
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-04-12 22:35:07 +01:00
Damián Imrich 071b7be3d4
Basic elytra flight (#5124)
* Basic elytra flight

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-04-03 18:45:20 +01:00
Tiger Wang 90369deb5a
Change TimeOfDay to WorldDate (#5160)
* Change TimeOfDay to WorldDate

* Do not wrap at 20 minutes, continue incrementing
* Fixes #4737
* Fixes #5159
2021-03-20 20:58:19 +00:00
Tiger Wang 3e3c30496d Add heraldry names to banner pattern API docs 2021-03-15 11:07:54 +00:00
12xx12 8405b8969f
Adding Boss bar (#5025)
+ Add boss bar

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-03-05 15:08:30 +00:00
12xx12 4d6235c807
Add Mushrooms to Generator and fixed up the roofed forest (#5134)
* added generator for mushrooms and aded them to the biomes

* removed unused variable

* added nEwlY uDocUmEnTeD aPi sYmbOls...
2021-03-05 14:04:48 +01:00
dImrich 925f960ea2 Adds playerlist header and footer broadcasting (1.8-1.13) 2021-02-06 14:14:40 +00:00
Tiger Wang eeb63b8901
zlib -> libdeflate (#5085)
+ Use libdeflate
+ Use std::byte
* Fix passing temporary to string_view
+ Emulate make_unique_for_overwrite
2021-01-11 16:39:43 +00:00
Aiden Neill 3d044d2dde
Added magma block contact damage (#5055)
* Added magma block contact damage
* Fireproof entities do not take damage from magma
* Fire resistance prevents magma damage
* No magma damage when hovering over magma block
2020-11-25 17:56:55 +00:00
12xx12 e35519ec8a
Adding new monster types to enum and saving/loading for easier future implementation (#4941)
* added new monster types to enum
added string <-> enum conversion in namespace serializer
added loading functions
added to saving

* renamed zombie pigman to zombified piglins in enum

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-22 23:41:13 +00:00
12xx12 36a67df105
Ender Crytal Fix and report proper cmake file for luabindingscheck fail (#5017)
* fixed network
fixed explosion
fixed ticking

added network broadcast to Setter method

added nullptr protection

using macros in 1.10 Protocol_1_10.cpp

revealed functions to LUA API

small fixups, typos, less functions used

fixed more doc

readded info that saving is done only if the beam is displayed

made the constructor transfer all needed members

fixed wrong commit

removed default parameters on SpawnEnderCrystal

fixed wrong metadata

moved call to destroy in the right place

fixed some typos

Fixed Ender Crystal

* fixed documentation

* fixed doc and added proper error message

* Parameters, arrows

* Parameters

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-06 15:00:59 +00:00
12xx12 961d5eb420
Add beam target, configurable base visibility to Ender Crystals (#5010)
* Fixes #4990

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-29 20:47:20 +00:00
Lukas Pioch aee4778bf7
Added missing return types and fixed param types (#4996) 2020-10-13 20:59:11 +00:00
12xx12 c080f819d2
Adding Silverfish Spawning Blocks (#4946)
* added breaking, spawning, animation

* checkstyle

* added undocumented API symbols

* added changes suggested by @peterbell10

* added natural ore like generation

* fixed spawning two silverfishes

* fixed clang

* fixed clang try 2

* updated comment
unified offset

* final clang fix

* added spawning for more silverfishes if one was damaged

* fixed spawning on one hit kill

* fixed spawning on one hit kill
fixed spawning by potion damage

* fixed clang

* fixed broken build

* fixed broken build

* I should read the error message properly
fixed build now?

* added small changes suggested by @peterbell10

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-11 15:27:41 +00:00
[IPSA] Chris de Claverie be841b4769
Add SetBlockMeta warning in documentation (#4943)
+ Add SetBlockMeta warning in documentation

Co-authored-by: pwnOrbitals <c.de-claverie@pm.me>
2020-10-01 11:38:10 +01:00
12xx12 ba5312c198
Fixed snow golems and added documentation to damage type and added damage type for damage from environment to mobs (#4877)
* made snow golems not crashing the server anymore

* changed damage type to environment

* updated damage in API dopcumentation and changed enderman damage type

* removed incidental d in the code

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-09-17 18:06:41 +00:00
Tiger Wang 6617d43983 Minor typo fixes
* Also DeMorgan'd Emerald ore condition
2020-08-21 00:50:09 +01:00
12xx12 47f7727b7f
Add enhanced Gold generation in Mesa-Type Biomes (#4821)
* added enhanced gold generation in mesa-type-biomes

* fixed typo in comment

* added enhanced gold generation in mesa biomes - fixed small checkstyle errors

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-08-12 07:20:38 +00:00
12xx12 ec3de19c4e small issues addressed in #4817 fixed because was merged to fast 2020-08-09 22:05:13 +00:00
12xx12 fed03048ad
Adding Emeralds to generation (#4817)
* Adding Emeralds to generation

* fixed crash

* fixed documentation and changed function name to match others

* forgot to change the name in the doc

* removed debug output - sorry build servers

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-08-09 20:49:40 +00: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
DrButcher 258318ab98
Buttons can now be triggered by arrows. (#4670)
* Buttons can now be triggered by arrows.
2020-05-03 21:05:32 +01:00
Alexander Harkness 994036a3b8
Add cEntity::GetBoundingBox, and use where appropriate. (#4711)
* Add cEntity::GetBoundingBox, and use where appropriate.
2020-05-03 21:04:33 +01:00
Tiger Wang 63adc6d7dc Add API documentation for repeater metadata constants 2020-04-18 16:51:29 +01:00
Mattes D a55f61548e
Extended Vector3 (#4666) 2020-04-18 11:44:35 +02:00
Mattes D 2cb85a1bcb API docs: Fixed eMonsterType relocation. 2020-04-10 08:19:43 +02:00
Bond-009 8438def87e
Add Zombie Villagers 2020-04-10 00:50:45 +01:00
Mat 60bcc06f43
Implement wither skeletons (#4563) 2020-04-04 13:44:17 +02:00
Alexander Harkness cdc452916e
Replace buckets to the selected hotbar slot, rather than the first available. (#4580)
* Replace buckets to the selected hotbar slot, rather than the first available.

Replicates vanilla behaviour, as well as being more logical.

* Refactor cInventory::AddItem. Behaviour is now documented

* Add new cInventory::ReplaceOneEquippedItem and ::SetEquippedItem methods

* Return empty potion to the same slot after drinking

* Replace buckets correctly in other situations, not simply water and lava

Uses the new ReplaceOneEquippedItem method

* Correct collecting water from source block with bottle

* Add cPlayer::ReplaceOneEquippedItemTossRest method

* Handle stacked filled buckets (in theory)

Use new cPlayer::ReplaceOneEquippedItemTossRest method
2020-04-02 12:42:15 +00:00
Alexander Harkness 9210501af5
Prevent player from being destroyed by plugins (#4584)
* Prevent player from being destroyed by plugins

Add manual binding, bails out with error message if attempted
entity to destroy is player.

* Improve warnings and documentation, remove automatic binding

* Remove old and unnecessary deprecated function
2020-03-31 11:39:23 +00:00
Mat 5eb1ba3bcc
Lua API for spectating entities (#4518) 2020-03-30 21:35:37 +02:00
Mat 782619e3f8
Send respawn packet by default (#4540) 2020-03-24 14:54:12 +00:00
Mat 7d4934534e
Stabilise MoveToWorld (#4004)
* Stabilise MoveToWorld

* Fix comments and deprecate ScheduleMoveToWorld

* Enhanced thread safety for m_WorldChangeInfo

* Return unique_ptr from cAtomicUniquePtr::exchange

* cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld.

Allows broadcasting entities added to the world from the world's tick thread.
This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize.

As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible.
This isn't used anywhere in Cuberite so it's now deprecated.

* Update entity position after removing it from the world.
Fixes broadcasts being sent to the wrong chunk.

* Fix style

* cEntity: Update LastSentPosition when sending spawn packet

* Add Wno-deprecated-declarations to the lua bindings

* Kill uses of ScheduleMoveToWorld
2020-03-05 12:52:34 +02:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D 221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes D 8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
Zach DeCook 31a8d017d9 * Sponge: Add water absorbtion (#4333)
Closes #1411
2019-06-11 00:28:02 +01:00
Zach DeCook 24a8456f79 Create Ender Portal with Eyes of Ender (#4126)
The algorithm was designed so All portals must be facing the center, no matter which block had the eye inserted in last.

Note: Still need to create a block entity so that portals don't become invisible when you relog.

Addresses part of #3445
Fixes #3695
2019-05-11 20:43:26 +01:00
Muhammad Kaisar Arkhan 73689024f0 Add BurnsInDaylight to Lua API and Monsters.ini (#4295)
* Monster.h: Export SetBurnsInDaylight

This commit also adds BurnsInDaylight to check if the Monster burns in daylight
or not.

Closes https://github.com/cuberite/cuberite/issues/4294

* MonsterConfig.cpp: Add BurnsInDaylight

Closes https://github.com/cuberite/cuberite/issues/4294
2018-09-24 21:32:47 +01:00
changyong guo 01e72ddb65 Rewrite explosion knock back (#4251)
1. Base knockback on an entity's bounding box intersection with the explosion 
2. Armor blast protection reduces knockback
3. Don't apply knockback to players flying in creative mode

Fixes #4139
2018-07-23 10:24:00 +01:00
changyong guo 2d3013d1d3 Support swap item between main hand and offhand by press key "F" (#4241)
Hi,

I found cuberite don't support to press key "F" to swap items on main hand and offhand, so I implemented this feature.

Best regards
Changyong
2018-06-24 10:24:10 +01:00
peterbell10 cf75d7b2c5 cBlockInfo: Deprecate direct access to variables. (#4184) 2018-02-20 10:43:28 +00:00
peterbell10 ab350d1e43
cItemGrid: Allocate storage lazily (#4083)
* cItemGrid: Allocate storage lazily
* cItemGrid: Fix spelling, Prioritary -> Priority
2018-01-21 18:45:13 +00:00
Alexander Harkness ad22922393 Rename cEntity swim states (#3996)
* Replace cEntity:m_IsSubmerged with m_IsHeadInWater
* Replace cEntity:m_IsSwimming with m_IsInWater
* Add API documentation for new symbols
* Apply SetSwimState to all entities, not just mobs and players
* Pickups now use IsOnFire to check if they are on fire before destruction

Fixes #3987
2018-01-14 18:44:45 +00:00
Alexander Harkness 6309c6a97f
improve rain simulation (#4017)
* Uses vanilla logic to decide which blocks rain falls through.
 * Rain falls infinitely above the world, and stops at y=0.
 * Entities will now be extinguished if they are under rain-blocking
blocks, and fire will now be extinguished by rain similarly.
 * Create IsWeatherWetAtXYZ to identify wetness at a particular location. 
 * Use new code for enderman rain detection.
 * Fixes issue #916
 * Disable warnings for global constructors in the fire simulator.
2017-12-26 21:25:57 +00:00
peterbell10 0bacda3269 Implement horse inventory (#4053)
* Implement horse inventory

* Fix sign conversions

* Add API doc for ItemCategory::IsHorseArmor

* Improve HandleOpenHorseInventory comment and style fixes.
2017-10-21 17:56:09 +01:00
Lane Kolbly 30c8470a52 Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)
* Made BroadcastSoundEffect take vector parameters.

* Added docs for new vectored methods

* Removed old code

* Fixed lua warnings

* Made old BroadcastSoundEffect not an override.

* m_Block to m_BlockPos, used Vector3d constructor where prettier.

* a_Block to a_BlockPos

* Changed thunderbolt a_Block to a_BlockPos
2017-09-19 15:12:54 +01: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