1
0
Commit Graph

673 Commits

Author SHA1 Message Date
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
45591cbe7b
Properly deprecate more XYZ parameter'd functions (#5147)
* Fixes #5144
2021-03-15 02:28:18 +00:00
12xx12
3daf253b7f
Some emplace_back replacements (#5149)
* replace push_back with emplace_back when a new object was created in the function call
2021-03-07 16:31:43 +00:00
Tiger Wang
50a94f972d
Fix debug macro situation (#5114)
Use the standard NDEBUG.
2021-01-26 09:41:55 +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
Tiger Wang
742e27ad2f Remove unused Temporary namespace
- Remove unused temporary mapping generation at startup
2020-12-21 00:11:34 +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
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
Tiger Wang
64442b05f8
cBlockInfo: further cleanup (#5001)
* cBlockInfo: further cleanup

+ Use switch statements instead of lookup in dynamically initialised arrays
- Remove some deprecated bindings

* Update Stubs removing references to BlockInfoArray
2020-10-18 15:37:07 +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
Tiger Wang
f9ac6543ab C++17 stuff 2020-09-30 22:05:17 +01:00
[IPSA] Chris de Claverie
9a548b3b3e
Plugin reload <plugin_name> feature (#4942)
+ Add `reload <pluginname>`
* Fixes #365

Co-authored-by: Alexander Harkness <me@bearbin.net>
Co-authored-by: pwnOrbitals <c.de-claverie@pm.me>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-27 23:15:03 +01:00
Tiger Wang
3edcafdf8b TABS OUT OF BED! TABS IN THE CORRIDORS! 2020-09-23 14:34:15 +01:00
Tiger Wang
71b96ab921 Limit fortune level, style fixes 2020-09-23 14:34:15 +01:00
KrystilizeNevaDies
23bca00831
Implement Dropspenser Hook (#4903)
* Implement Dropspenser Hook

Implemented a hook for dropspensing.
HOOK_DROPSPENSE

When plugin callback returns true then dropspense is cancelled

* Update src/Bindings/PluginManager.h

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

* Create OnDropSpense.lua

* Fix indent

* Forgot include

Forgot to include the plugin manager. Although now im confused why it was working on my end without including the plugin manager

* Update plugins.lua with dropspense

* fix typos

* haha notepad++ go brr

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-09-21 15:31:45 +00:00
12xx12
2d197e147e
Use pitch lookup in noteblock block entity (#4826)
- Removed the calculation in the noteblock block entity

I did the calculation in python if anyone is interested where the numbers are from

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-09-05 16:07:01 +01:00
Mattes D
c98a2d9acf Changed tree-growing functions in cWorld to use Vector3i coords. 2020-08-27 17:32:48 +01:00
Mattes D
46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang
330626ab22 Update submodules 2020-07-23 00:32:47 +01:00
Tiger Wang
9e8598fb1c
Upgrade to C++17 [CMake] (#4717)
* Make our CMake slightly less insane
2020-05-16 20:59:10 +01:00
Peter Bell
6dee68cb63 Avoid a copy when logging lua strings 2020-05-16 09:39:05 +01:00
Peter Bell
3189a3cbee Update logging code to reduce unnecessary string copying:
* Write into a single fmt::memory_buffer
* Use string_view instead of AString for listener callbacks
* Also collapsed vFLOG and vLOG functions into one per formatting type
2020-05-16 09:39:05 +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
peterbell10
154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
peterbell10
e6634ed26c
Update submodules (#4727)
Closes #4708

This updates jsoncpp, mbedtls, TCLAP and SQLiteCpp to their latest stable release. A few additional changes were needed:

* jsoncpp deprecated Reader, FastWriter and StyledWriter which I've replaced
  with some helper functions in JsonUtils.cpp

* SQLiteCpp changed how it builds with external sqlite libraries, now expecting
  them to be installed. The simplest path was to remove sqlite from cuberite's
  submodule and just use SQLiteCpp's internal version.
2020-05-09 15:51:15 +01:00
mBornand
1565d9b3ce
Use Vector3 for cLineBlockTracer and cBlockTracer (#4715)
* cLineBlockTracer uses Vector
2020-05-08 10:04:07 +01:00
Mat
c710f6a4ea
Remove old Android leftovers (#4722) 2020-05-07 22:14:00 +03:00
peterbell10
57952505e5
Update fmt to 6.2.0 (#4718)
* Update fmt to 6.2.0
2020-05-05 22:52:14 +01:00
Tiger Wang
9b68fab8ed Fix incorrect formatter invocation 2020-05-04 12:19:12 +01:00
Mattes D
26ac146f41
More Vector3 in cBlockHandler (#4644)
* cBlockHandler.OnUpdate uses Vector3 params.

Also slightly changed how block ticking works.
2020-04-17 10:36:37 +01:00
Mattes D
9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Mattes D
f84bab3bc2
Fixed Lua Vector unification. (#4652) 2020-04-15 00:23:24 +01:00
Mattes D
c9a9b3c9d0
Bindings: Allow coercion between Vector3 subtypes. (#4646)
In manually bound functions, allows one to use any Vector3<T> value, as well as a {x, y, z} table, in Lua as any Vector3<T> parameter.
Has example in Debuggers' /vector command.
Unfortunately doesn't work in auto-bindings.
2020-04-14 16:43:21 +02:00
Mattes D
a765e71325
Removed the obsolete cTracer class. (#4594) 2020-04-03 12:50:08 +00: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
Alexander Harkness
41d4ea6948
Fix off-by-one error and clean error messages in manual bindings for BlockArea (#4549)
* Correct off-by-one error in manual bindings for FillRelCuboid

Fixes #4454

* Fix inconsistent error messages in manual bindings for BlockArea

* Generate error if invalid coords passed to FillRelCuboid
2020-04-01 12:43:26 +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
7d8da81b92
Updated plugin list format (#4557) 2020-03-27 13:47:04 +01:00
Bond-009
ea386eaab1
Lock hopper when powered by redstone (#4347)
* Lock hopper when powered by redstone

* Add to manual bindings

* Add hopper API documentation

Co-authored-by: Mat <mail@mathias.is>
2020-03-27 12:03:28 +00:00
Alexander Harkness
0a68994f48 Manual merge of #4498.
Credit to @MeMuXin

Closes #4498
2020-03-23 12:18:12 +00:00
Max Luchterhand
4f60eaabca
Wrong overload of function push() got called when pushing a cEntity*. (#4512)
* Now having two funcs, Push(cEntity* ..) and Push(const cEntity* ...).
For now, the const function just casts away the const qualifier and
passes to the other.

Co-authored-by: mluchterhand <mluchterhand@max.de>
2020-03-21 16:00:26 +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
221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes D
365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Lukas Pioch
70d0b46b60 Added missing closing } in message output 2019-09-20 14:33:53 +01:00
Mattes D
a2ffa432b3 Separated chunk generator from world / plugin interfaces.
The generator now only takes care of servicing synchronous "GetChunk(X, Y)" and "GetBiomes(X, Y)" requests.
2019-09-06 16:12:33 +02:00
Lukas Pioch
528db6eea7 Added null check for position (#4366) 2019-08-11 00:32:22 +02:00
Mattes D
26d0605121
Improved CMake generator (#4365) 2019-08-10 13:15:51 +02:00
Mattes D
e7016b1525
Removed coord-based API from cCuboid. (#4362) 2019-08-09 03:13:15 +02:00
Mark Asp
c00b365617 Check for nil in cWorld:SpawnSplitExperienceOrbs binding (#4354)
Adds explicit nil check for 'position' parameter to prevent crashes if invalid.

Fixes #4352
2019-07-28 14:09:51 +01:00