Commit Graph
372 Commits
Author SHA1 Message Date
Mattes DandGitHub 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
Alexander HarknessandGitHub 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
MatandGitHub 076749bd36 Increase speed of splash potion and expbottle (#4513) 2020-03-22 17:44:24 +02:00
MatandGitHub c968f1f7da TNT position fixes (#4519)
* TNT position fixes

* Don't add offset to explosion spawn coords

* Don't make other entities push TNT

* Correct initial TNT speed

* Fix typo

* Improvements

* Revert unwanted change

* Style fixes

* Update format
2020-03-22 17:33:36 +02:00
MatandGitHub 581c1e5034 Fix typo in fish meta 2020-03-22 14:43:12 +02:00
MatandGitHub c0c9bf2b86 Don't enchant an already enchanted book 2020-03-22 13:32:24 +02:00
MatandGitHub 49dd645aa6 Don't remove items twice (#4524)
* Don't remove items twice
2020-03-22 12:17:04 +02:00
MatandGitHub c4fc6a5343 Bonemeal cannot be used on cactus and sugar cane 2020-03-21 19:46:57 +02:00
MatandGitHub d572ad7faf Don't spawn boats in ground 2020-03-05 16:05:30 +02:00
MatandGitHub 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
Matandpeterbell10 dca896dfcc Boats can be spawned on land 2020-03-01 13:27:19 +00:00
MatandGitHub 5074527d2c Disable block placement in adventure mode (#4424) 2019-12-30 01:54:37 +02:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes DandGitHub 221cc4ec5c Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes DandGitHub 365cbc6e1c Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Zach DeCookandpeterbell10 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
Zach DeCookandpeterbell10 b9e7505d7f Buckets: Be able to place fluids through other fluids. (#4331) 2019-05-07 20:15:58 +01:00
peterbell10andAlexander Harkness 4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
peterbell10andGitHub ee84197014 Force all headers other than "Globals.h" to be included with relative paths (#4269)
Closes #4236

CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/".

#include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-08-29 01:51:25 +01:00
peterbell10andGitHub 950aeffff8 CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
changyong guoandpeterbell10 7b0db672d1 Keep players in gmNotSet (#4248)
This allows players game mode to update to the default after portal to another world.
Fixes #4207
2018-07-23 00:35:32 +01:00
Bond-009andpeterbell10 7e9695ecb0 Damage fishing rod when catching the hook on a block, then reeling it in (#4151)
Fixes #4132
2018-02-11 12:40:16 +00:00
peterbell10andGitHub d3c1c626f5 Deal with covered switches consistently (#4161)
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.

* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.

* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()
2018-02-04 23:07:12 +00:00
Bond-009andAlexander Harkness 701fee334c Prioritize hinge on the left side (#4153) 2018-01-17 19:15:42 +00:00
Alexander Harknessandpeterbell10 2529a89835 Golden Apple Fixes (#4130)
* Do not remove food item until player has been fed
* Golden apples now ignore hunger when eating
* Removed EnchantedGoldenApple recipe, as it was removed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
* Adjust golden apple effects, as they were changed in 1.9
    Reference: https://minecraft.gamepedia.com/1.9#Items_2
2018-01-06 00:39:23 +00:00
Bond-009andpeterbell10 d7de2dccf0 Improved fishing rewards (#4120)
* Damage fishing rod after use
* Give xp to the player for catching something
* Fixed junk drops
* Implement Luck of the Sea
2018-01-05 14:32:30 +00:00
Alexander HarknessandGitHub 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
peterbell10andGitHub 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
peterbell10andAlexander Harkness bf5e6874fe cItemHandler: Update max stack size of old doors. (#4072) 2017-11-20 11:04:17 +00:00
Bond-009andMattes D 10c5c1227e BroadcastBlockBreakAnimation and BroadcastBlockEntity use vectors (#4038) 2017-09-25 18:17:45 +02:00
Lane Kolblyandpeterbell10 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
Lukas PiochandMattes D c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
peterbell10andAlexander Harkness 307e7aaff5 Fix switch warnings (#4013)
* Fix switch warnings
  * Fix a variety of -Wswitch and -Wswitch-enum warnings
  * Remove unneeded -Wno-error flags

* Reorganise some eMonsterType switches
  * Alpha sort eMonsterType cases in WriteMobMetadata
    and in cNBTChunkSerializer::AddMonsterEntity
  * List all mob types in protocol 1.12 and NBTChunkSerializer

* cStructGenTrees::GetNumTrees: remove switch default

* cWSSAnvil::LoadOldMinecartFromNBT: Log unhandled minecart type
2017-09-14 09:48:57 +01:00
peterbell10andMattes D e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
Bond-009andMattes D 104f9e127b Changed some int parameters to vector parameters (#3937) 2017-09-07 10:25:34 +02:00
LogicParrotandAlexander Harkness 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10andMattes D 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
mathiascodeandLukas Pioch 02775e52c4 Minor changes (#3909) 2017-08-24 11:19:40 +02:00
peterbell10andLukas Pioch 0854ed01a4 Fix use after move in cItemBowHandler::OnItemShoot 2017-08-24 11:17:51 +02:00
Pablo BeltránandMattes D b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
Tiger WangandGitHub 72d7027861 Merge pull request #3489 from cuberite/EntityOwnership
* Changed entity ownership model to use smart pointers
2017-08-18 11:17:56 +01:00
Lukas PiochandTiger Wang 743a50014a Replaced includes with forward declarations 2017-08-13 12:31:10 +01:00
Tiger Wang 4ef47aed62 Changed entity ownership model to use smart pointers 2017-08-07 19:24:16 +01:00
Lukas Piochandworktycho 07f25253a2 Removed unneeded includes (#3902) 2017-08-06 20:57:44 +01:00
peterbell10andLukas Pioch 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
Lukas PiochandTiger Wang 4691bc5a29 Removed double includes (#3885) 2017-08-02 19:57:20 +01:00
peterbell10andLukas Pioch 0d0323608d cBlockHandler: take player by ref 2017-08-01 08:21:20 +02:00
peterbell10andLukas Pioch 8eb5672920 cWorld::SendBlockTo take player by ref 2017-08-01 08:21:20 +02:00
Lane Kolblyandworktycho 10d42a2452 Consolidated food effects into EatItem, added all fish type FoodInfos. (#3875)
* Consolidated food effects into EatItem, added all fish types.

* Changed type of NumFishInfos to satisfy clang.

* Removed unused call for a_Item in EatItem
2017-07-30 18:53:21 +01:00
peterbell10andLukas Pioch bbf5bec817 BigFlower fixes (#3826)
* BigFlowers fixes

* Correct upper part meta
* Documented parameters to DoesIgnoreBuildCollision
2017-07-07 16:37:53 +02:00