1
0
Fork 0
Commit Graph

480 Commits

Author SHA1 Message Date
Tiger Wang d49ce751ba
Miscellaneous fixes (#5320)
* Protocol: update Abilities flags

+ Add Spectator handling

* BioGen: move <iostream> include

* ClientHandle: rename Respawn packet dimension check flag

* Make it clearer what it's doing.

* ClientHandle: move ProcessProtocolIn calls to World

* Player: remove some redundant initialisation

* Player: UpdateCapabilities enables flight for spectators

* Produce growth: improve comments

* ClientHandle: run unload checks using delta time

* Fix forgotten initialisation of time member
2021-11-11 21:02:29 +00:00
Tiger Wang 1e4850a6c5
World: change spawnpoint type to int (#5313)
* World: change spawnpoint type to int

As Vanilla does.
2021-10-03 17:43:22 +01:00
Tiger Wang c6de5e9bc5 Remove one level of indent in statistics serialiser 2021-07-31 12:11:29 +01:00
Tiger Wang de329dc5ad It is time to remove the statistics upgrade map 2021-07-31 12:11:29 +01:00
Tiger Wang 34bf5c0d9d Rename files to match code 2021-05-04 16:11:56 +01:00
nshah25 8be1dd54bb
Add player statistics to API (#5193)
* Fixed issue #5166

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-05-03 21:07:09 +01:00
Tiger Wang 9b97d63f8f
Chest, weather, crash, and miscellaneous fixes (#5215)
* Alpha-sort cChestEntity

* Chests: use SendUpdateBlockEntity

* Pathfinder: fix out of range Y

* 1.13: correct weather packet ID

* Chests: fix neighbour scanner

+ Add OnAddToWorld and overload to scan neighbours there, instead of in the constructor/OnUse. This fixes hoppers accessing newly loaded double chests and seeing a null m_Neighbour, thus thinking its a single chest.
* Fix typo in cross coords computation.
* Simplify hopper logic.

* Block entities: ASSERT that type is correct

If you match the block type first before calling DoWithBlockEntity, the corresponding block entity must either be empty or correspond to the block type.

* Chunk: fix some forgotten PendingSendBE cleanup

+ Add cleanup in SetAllData, WriteBlockArea
- Remove RemoveBlockEntity (used once), HasBlockEntity (not used)

* Replace MakeIndex with MakeIndexNoCheck

* Remove extraneous MarkDirty in hopper & chests
2021-04-30 13:23:46 +00:00
Tiger Wang 9aa85e38a8 Fix incorrect name in deserialiser for zombie pigmen 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
Tiger Wang 5123850db0
Fix Windows XP to 7 compatibility (#5167)
* Partially reverts 01a4e696b
* Unify thread names
- Remove use of GetThreadId API
2021-03-28 13:34:57 +01:00
12xx12 243083e01a
Adding basic Banner functionality (#4806)
+ Added item and block for banners

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-03-15 02:47:55 +00:00
Tiger Wang d9a2b8611c
Mitigate MSVC crash (#5146)
Reference: http://ci.appveyor.com/project/Cuberite/cuberite/builds/38087390/job/p857ibg3x87naw36/messages
2021-03-06 12:59:39 +00:00
Tiger Wang 868cd94ee9
Prepare ChunkData for BlockState storage (#5105)
* Rename ChunkData Creatable test

* Add missing Y-check in RedstoneWireHandler

* Remove ChunkDef.h dependency in Scoreboard

* Prepare ChunkData for BlockState storage

+ Split chunk block, meta, block & sky light storage
+ Load the height map from disk
- Reduce duplicated code in ChunkData
- Remove saving MCSBiomes, there aren't any
- Remove the allocation pool, ref #4315, #3864

* fixed build

* fixed test

* fixed the debug compile

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-03-05 14:03:55 +01:00
Tiger Wang 81e299f00c Mark UNREACHABLE with intrinsics 2021-02-20 17:46:02 +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 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 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
mBornand 58def8f7df
Fix flower and foliage generation (#4723)
* fix flower generation
- remove wrong mushroom and flower generation
+ add "tiny" mushrooms in Mushrooms biomes
+ add "tiny" mushrooms in Mega Taiga and variants
+ add tulip generation for plains biomes
* Turn numbers into constants
- Remove duplication of grass generation
- Remove fern in inappropriate biomes
* added roofed forest flowers to ini file
* fixed crash with biMesaPlateuM
+ Use empty()
+ Emplace directly
+ Avoid a string copy in BiomeName
+ Alias BiomeIndex to avoid multiple casts

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-14 12:24:31 +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
Alexander Harkness c8c061edf7
Update comments and code for Load/SaveOneChunk so they match (#4992)
Fixes #4991
2020-10-11 16:14:43 +00:00
12xx12 c0711407e9
Adding more customize options to mob spawners and improving the way to look for surrounding entities (#4955)
* added nearly any customize option

* fixed unnecessary diff
added comments

* removed unnecessary const qualifier

* fixed build

* changed to ForEachEntityInBox

* added docs

* updated lua api description

* checkstyle

* added changes suggested by @peterbell10
And now the player may break the server by setting ridiculous ranges

* updated docs
changed cast to static cast

* fixed clang

* fixed clang on WSSAnvil.cpp

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-10 19:31:44 +00:00
peterbell10 a9031b6bae
Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)
* Fix cmake not adding Werror on clang, and _lots_ of warnings

* WIP: Build fixes

* Cannot make intermediate blockhandler instance

* Tiger's changes

* Fix BitIndex check

* Handle invalid NextState values in cMultiVersionProtocol

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-05 10:27:14 +00:00
12xx12 410d6c0045
Fixing Mob spawner behaviour (#4930)
* fixed mob spawner failure (whoopsie in the BlockEntity.GetChunkZ())
Style

* fixed spawning behaviour

* fixed saving entity type saving

* checkstyle

* removed debug log

* removed short saving

* Style

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-27 20:02:16 +03:00
KingCol13 a78fd671b2
Deleted BiomeDef.h and ChunkDef.h from Globals.h (#4885)
* Removed BiomeDef.h

* Removed ChunkDef.h from Globals.h

* Added to CONTRIBUTORS.

* Re-added empty last line to Globals.h

* Included stddef and StringUtils in BiomeDef.h

* Fixed build tools compiling. It compiles, but at what cost?

* Added include to src/Generating/Trees.h

* Include added in ChunkGeneratorThread.h

* Moved rearranged includes in LineBlockTracer.cpp

* Re-arrange headers in ChunkInterface.cpp

* Included ChunkDef.h in Path.h

* Included ChunkDef.h in NBTChunkSerializer.h

* Rearranged included and added required includes to headers.

* Removed unnecessary included in StringUtils.h.
2020-09-25 09:13:59 +00:00
12xx12 f8de67aace Added end portal and enchanting table block entities 2020-09-20 01:40:20 +01:00
Tiger Wang 93adbdce9a
Use tracing for explosions (#4845)
* TNT: Implement tracing algorithm

+ Add intensity tracing
* Fix iterating over all players to SendExplosion, even those not in range

* Implemented TNT entity interaction

* Fixed misaligned destruction tracing

* Finalise TNT algorithm

- Remove BlockArea and just use chunks

Using SetBlock makes it so that we can update everything properly, and does appear to be faster.

* BlockInfo learns about explosion attentuation

* Rename Explodinator parameters

* TNT: pull block destruction into common function

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-12 18:57:44 +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
Tiger Wang c1ffed60ec FastNBTWriter: AddString now uses string_view
* Avoids an allocation for all those string literals we pass in
2020-08-28 21:42:18 +01:00
Tiger Wang be121f9e80 Save enderchest block entities to storage
+ Add EnderChest saving, as Vanilla does
- Remove CreateBlockEntities. Storage should save & load everything so looping over chunk data is not needed
2020-08-28 21:40:40 +01:00
Tiger Wang da9158937d WorldStorage: Removed unused callback parameters 2020-08-28 21:36:46 +01:00
Tiger Wang 8620f6a13e StatSerializer: use std::move 2020-08-21 18:15:34 +01:00
Tiger Wang e23dcffaff Make StatSerializer a namespace 2020-08-21 00:53:10 +01:00
Tiger Wang 6617d43983 Minor typo fixes
* Also DeMorgan'd Emerald ore condition
2020-08-21 00:50:09 +01:00
Tiger Wang 963ec77575 Add statistics upgrade mapping 2020-08-19 20:45:27 +01:00
12xx12 7d0813ce8c Add Statistics and Achievements for newer Network standards 2020-08-19 20:45:27 +01:00
Tiger Wang 5ed4222dee Delete redundant std::move in World loader 2020-08-05 08:35:36 +01:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang 99f8c44342 1.14 connection support 2020-07-26 18:55:16 +01:00
KrystilizeNevaDies d0f38f52cb Remove Schematic Chunk height limitation 2020-07-06 20:56: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
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
Mat c710f6a4ea
Remove old Android leftovers (#4722) 2020-05-07 22:14:00 +03:00
Tiger Wang 9b68fab8ed Fix incorrect formatter invocation 2020-05-04 12:19:12 +01:00
Mattes D dfe7a0adee
NBT: Dynamic list-max-count protection. (#4697) 2020-04-30 08:44:49 +02:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Alexander Harkness a780b3a4f5
Oops, remember to save your files! 2020-04-10 00:53:04 +01:00