1
0
Commit Graph

178 Commits

Author SHA1 Message Date
Tiger Wang
a62b2b1be2
Move item placement into item handlers (#5184)
* Move item placement into item handlers

+ Add appropriate CanBeAt checks in cPlayer::PlaceBlocks, into which all placement handlers call.
* Partly addresses #5157
* Fixes #4878
* Fixes #2919
* Fixes #4629
* Fixes #4239
* Fixes #4849

Co-authored-by: changyong guo <guo1487@163.com>
Co-authored-by: Xotheus <shady3300@outlook.com>
Co-authored-by: Krist Pregracke <krist@tiger-scm.com>

* Review fixes

* Update APIDesc.lua

* Rename

Co-authored-by: changyong guo <guo1487@163.com>
Co-authored-by: Xotheus <shady3300@outlook.com>
Co-authored-by: Krist Pregracke <krist@tiger-scm.com>
2021-05-05 13:25:10 +00:00
Tiger Wang
34bf5c0d9d Rename files to match code 2021-05-04 16:11:56 +01:00
Tiger Wang
6e80f7544d Update entity sizes 2021-04-12 22:35:07 +01:00
Tiger Wang
04cb4996e2 Update the minimodules 2021-04-12 14:09:18 +01:00
Damián Imrich
befe132861
cPieceModifier interface and cPieceModifierRandomizeBlocks class (#5122) 2021-04-08 12:24:59 +02:00
12xx12
d78bcac150
Obsidian pillars, end fountain, not Ender dragon spawning (#4993)
* added generator for obsidian pillars and central fountain which then is used for the exit portal

* checkstyle

* checkstyle the second

* fixed clang
removed magic number
added Clamp

* make the pillars configurable

* fixed clang
added warning if there was a unknown value if the tower should have a cage or not

* forgot to cancel on unkwon value

* fixed clang this time maybe

* added new generator to generator test

* fixed test

* added prefab generation for end fountain

* fixed checkstyle and updated the prefab

* added ender dragon spawning
made the fountain positioning dynamic
removed fountain placement functions

* added enderdragon stuff to testing

* pls compile

* added changes suggested by @peterbell10

* fixed clang

* added debug for further research on the ARM build

* ok - it wasn't my tower placement

* checking in setup

* readded the fountain schematic

* removed finisher

* readded generator

* removed generator trigger - kept ini file access

* using cChunkDef function to calculate abs pos of endercrystal

* yes, I know it's unused...

* commented everything in the ComposableGenerator.cpp
 - so only the new class in compiled in but not called at all

* don't compile in the new generator at all
(removed from CMakeLists.txt)

* readded the new generator

* readded the new generator

* removed debug output

* made the towers generate acrocc chunk borders

* fixed bad merge

* fixed clang

* fixed clang

* generate the dragon 20 blocks above terrain

* trying to fixed weird undefined reference

* maybe this fixes the weird behaviour

* takes chunk width as parameter now

* added new comments with info to generated structures
removed ender dragon spawning
removed chunkwidth from parameter

* fixed linker

* maybe fixed linking. tried with gc and clang

* fixed ender crystal

* fixed test

* updated output strings

* fixed build

* fixed up test

* fixed test compile

* fixed test - cant get the tests to show up

* removed the semicolon

* maybe this is the fix?

* at this point i have no idea - in MVSC it works

* removed the ender dragon

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2021-04-08 12:18:18 +02:00
Tiger Wang
125df19477
Do not fake a tool when converting to pickups (#5170)
* When the cause of destruction was world-induced (CanBeAt check failed) there is no tool. Pass the nullptr directly to ConvertToPickups and let it handle it.
* Fixes #4795
- Remove unused a_Digger parameter to ConvertToPickups.
2021-03-28 14:41:34 +01:00
Tiger Wang
de76503d5c Remove DoesDropOnUnsuitable
This is only overridden false in Vines and Snow. It is called when a CanBeAt check fails, to determine whether DropBlockAsPickups is called. However, Vines and Snow already drop nothing without the right tool, so this function is superfluous.
2021-03-15 02:44: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
12xx12
2481190d9c CompositeChat: use variants 2021-02-08 12:41:30 +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
12xx12
14a00d0051
changing cComposite Chat to newer c++ standart (#5028)
* upgraded to new C++ for loops and fixed errors

* readded delete instruction

* now using unique ptr

* added test for text only (that was causing an error for me)

* using unique ptr constructor

* added move constructor and deleted copy constructor

* fixed deconstuctor
http prefixes are constexpr and std::string_view

* fixed whitespace

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-11-11 22:38:51 +01: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
Tiger Wang
a145980795
Fix Android builds (#4998)
Construct paths relative to the Cuberite sources with PROJECT_SOURCE_DIR, instead of wherever the first CMakeLists.txt file happened to be with CMAKE_SOURCE_DIR.

In Android's case, the latter was in a folder called android/ but that's not the root of the source tree, so any file path built off that root was wrong. This caused file-specific warnings exclusions to fail to apply.
2020-10-15 09:35:44 +00:00
Tiger Wang
c158569af3 Remove unused Temporary namespace 2020-09-25 14:51:57 +01:00
Tiger Wang
c53a0ba5f6 Unify block entity pickup conversion
- Removed normal BlockHandler knowledge of block entities during conversion
+ Added cBlockEntity::ConvertToPickups that handles it
2020-09-25 09:07:01 +00:00
Tiger Wang
68cced73af
BlockHandler initialisation is a constant expression (#4891)
* BlockHandler initialisation is a constant expression

If we can't make it all namespaces, this is the next best I guess.

+ Tag handlers constexpr, const as needed
+ Inherit constructors
* Privatise handler functions

* More constexpr

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-20 13:50:52 +00:00
12xx12
c18fe8aa45
Adding Generator For Single Piece Structures (#4830)
* the beginning of a magnificent work - added basic files and classes without functionality

* fixed checkstyle

* added imports

* moved imports

* - Adding SinglePieceStructureGen
- Adding a cPrefabChestStructure to generate Chests with contents
- Added the options and calls to the ComposableGenerator

* moved Globals to .h file

* removed the chest thingy from the code (for now)

* Update SinglePieceStructureGen.cpp

* readded whitespace

* renamed to SinglePieceStructuresGen for consistency
added new classes to test

* fixed small things (mostly style and cleanup)
removed loottables

* added small changes suggested by madmaxoft

* small change to documentation

* added check for allowed biomes

* check only the biome of the origin position

* fixed error on IsBiomeAllowed

* added new cubesets

* updated structures for with sponging

* updated biome names

* updated metadata to prevent crashing
removed debug output

* updated structures with sponging

* added sponging to deserterWell to make it disappear in sand

* small change in meta

* rename DesertTemple -> DesertPyramid

* minor style changes

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-17 22:20:50 +00:00
Tiger Wang
c3d2956ba5
BlockHandler: no dynamic allocation (#4862)
* BlockHandler: no dynamic allocation
2020-09-17 14:51:42 +01:00
Tiger Wang
501702065b Fixup test block handler stubs 2020-08-04 18:39:47 +01:00
Mattes D
46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
Tiger Wang
6317176d7e More CMake cleanup 2020-07-12 22:00:07 +01:00
Peter Bell
ad935ef40f Update libevent to 2.1.12-stable 2020-07-06 20:53:04 +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
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
peterbell10
8e2dfce84b
Require semi-colon at end of function-like macros (#4719) 2020-05-05 20:39:59 +00:00
Mattes D
487f9a2aa9
Vector3 in Handlers (#4680)
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-21 22:19:22 +02: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
peterbell10
aac592f985
Manage block entity lifetime with unique_ptr (#4080) 2020-04-03 23:23:38 +02: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
a0d2e934eb BlockTypePalette: Improved loading speed in MSVC Debug builds. 2020-02-24 09:37:40 +01:00
Mattes D
2d6f6a574d BlockTypePalette: Load from TSV or original reports' JSON. 2019-12-28 22:43:35 +01:00
Mattes D
7453a9fbe1 Moved ProtocolBlockTypePalette functionality into BlockTypePalette. 2019-12-28 22:43:35 +01:00
Mattes D
2de6b7537d BlockTypePalette: Refactored for usage in both directions.
Improves index() lookup speeds and allows BlockTypePalette to be used in place of ProtocolBlockTypePalette.
2019-12-28 22:43:35 +01: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
E14
d1c95742dd Add ProtocolBlockTypePalette (#4391) 2019-09-22 22:57:54 +02:00
peterbell10
7678d5e6ed Fix race condition in UrlClientTest 2019-09-10 14:18:10 +02:00
Mattes D
ad24702b4e ChunkGenerator: Changed to use cChunkCoords. 2019-09-08 20:21:49 +02:00
Mattes D
343bc2729e Generator: Added repeatability test. 2019-09-07 13:38:07 +02:00
Mattes D
d8d1e6e1d2 Added a BasicGeneratorTest. 2019-09-06 16:12:33 +02: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
Mattes D
f021e2fe22 Updated LibEvent to release 2.1.11-stable. (#4383)
This finally restores my ability to compile on Windows and Linux from the same source folder (on a network drive).

LibEvent broke this long ago by writing a config file into the source folder, rather than build folder. Now it's finally fixed.
2019-09-04 22:34:54 +01:00
Mattes D
2504538a3a
Added a basic PalettedBlockArea implementation (#4377) 2019-08-28 08:29:02 +02:00
Mattes D
74579fbadf
Improved testing framework. (#4376) 2019-08-26 21:38:34 +02:00
Mattes D
02fbf16865 Added BlockState implementation for 1.13 support. 2019-08-24 12:03:38 +02:00
Mattes D
f48ac9f0c3 BlockTypeRegistry: Added hint manipulation 2019-08-05 21:42:54 +02:00