1
0
Fork 0
Commit Graph

6053 Commits

Author SHA1 Message Date
Alexander Harkness 281beba50e
Fix the build. Merge conflict between two PRs (#4936) 2020-09-25 10:59:08 +00: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
Tiger Wang 5bd12814db Put phonograph on right part of visual spectrum 2020-09-25 09:07:34 +00:00
Tiger Wang 7574f68a48 BlockEntity: clarify ConvertToPickups behaviour 2020-09-25 09:07:01 +00: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 1a60164848 Small cleanup in Jukeboxes
* Fixed creative players not tracking stats, and the code trying to "place" a record when they used one
2020-09-25 09:07:01 +00:00
Tiger Wang a2ecbf6a2e Fix cItems::AddItemGrid adding empty items 2020-09-25 09:07:01 +00:00
12xx12 b5410c718e
Fix ice behaviour in world (#4927)
+ Added proper ice melting under light influence

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-24 13:53:49 +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
12xx12 a0dd311d02
Added dtEnvitonment to player damage text (#4925)
+ Added dtEnvironment to string conversion
+ Added dtEnvironment to player damage strings
2020-09-22 12:38:55 +01:00
12xx12 51e026a3ae added dtEnvironment to string conversion 2020-09-21 22:58:38 +01:00
Tiger Wang 6183b28f93
Implement redstone quasi-connectivity (#4889) 2020-09-21 20:39:58 +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
theophriene 0a1bf06c6f
Trapdoor crash fix (#4890)
* [WIP] Trapdoor crash fix

* Fixed code style

* Updated commentary in the code

* Updated commentary in the code again

* Fix copy-past error

* Fix another copy-past error!

* Fixed orientation & clipping

* Remove redundant clause

* Some code cleanup

* Fixed compilation error

* Moved logic into helper function, slightly reorganised the caller

* Fixed comments

* Fixed comments, what an idiot

* Added to CONTRIBUTORS

* Fixed bitwise error

* Use cYawRotator

* Reduce indent

Co-authored-by: Elias Thomson <fiv.pids@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-21 14:41:31 +00:00
Alexander Harkness 8de71fc9d6
Synchronously save chunks on server shutdown (#4900)
+ Synchronously save chunks on server shutdown. Fixes #4884
2020-09-21 13:12:09 +01:00
KingCol13 b6b7fb1a65
Implement fortune for ores, glowstone and sea lanterns (#4897)
* Implemented fortune for ores, glowstone and sea lanterns (but nothing organic or flint).

* Cleanup printf

* Stopped playing golf, gave the Camels a FirstHump and moved the FortuneDropMult comment. Thanks for the review :).

* Got rid of FortuneDropMult and replaced with Peter's massive optimization/simplification.

* Fixed default lapis max droprate (8 -> 9).

* Clamp max drops for non-redstone ores to 10.

* Comment justifying the clamp.
2020-09-20 18:06:28 +00:00
Tiger Wang 5a16620322
Cauldron: backport "use" behaviour to 1.12 (#4902)
* Cauldron: backport "use" behaviour to 1.12
2020-09-20 15:39:17 +01: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 6a0669fb98
Added armor and shulker box cleaning (#4875)
+ Added armor and shulker box cleaning
2020-09-20 02:24:58 +01:00
12xx12 f8de67aace Added end portal and enchanting table block entities 2020-09-20 01:40:20 +01:00
12xx12 a2935efaff
Fixed missing case: in entity damaging crashin the server (#4899)
* 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

* added dtEnvironment to ArmorCoversAgainst

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-19 17:31:36 +00:00
12xx12 1a211b6c46
Changing jungle trees a bit (#4823)
* switch range on jungle tree generation and renamed a confusing variable

* changed two numbers to match vanilla behaviour

* made jungle trees closer to vanilla behaviour

- matched variable names to new checkstyle
- made branch generation independent from noise at block position

* replaced random provider with Noise

* implemented changes suggested by peterbell10

* changed the way to determine the size of the leaves on branches

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

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-19 16:51:26 +00:00
KingCol13 272a8029e0
Fix silk-touching glowing redstone (#4893)
* Add src/BlocksRedstoneOre.h to CMakeLists.txt

* Fixed silk touch pickaxe not dropping redstone ore (and dropping null item instead)
2020-09-19 06:59:21 +00:00
Tiger Wang e2e78abdb7 Style, no need to tag struct with s 2020-09-18 16:41:06 +01:00
Tiger Wang 608e7a9950 Remove unused ServerPort argument 2020-09-18 16:41:06 +01:00
Tiger Wang 7f372b12cb Add State enum to protocol 2020-09-18 16:41:06 +01:00
Tiger Wang bf253caab5 Remove unused ServerPort member 2020-09-18 16:41:06 +01:00
Tiger Wang acc399ffb3 Cleanup Protocol classes
* Visibility, static, ordering changes
2020-09-18 16:41:06 +01: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
Elias Thomson f7091e1b19
Fixed leaves and wheat not breakable with piston (#4882)
* Fixed leaves and wheat not breakable with piston

* Fixed alpha-sort

* Add beetroots

Co-authored-by: Elias Thomson <fiv.pids@gmail.com>
2020-09-17 21:03:02 +00: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 c3d2956ba5
BlockHandler: no dynamic allocation (#4862)
* BlockHandler: no dynamic allocation
2020-09-17 14:51:42 +01:00
12xx12 53549a1a4c
Add some const qualifiers to functions (#4874)
* add some const qualifiers to functions

* added changes suggested by @tigerw

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-09-16 22:01:20 +00:00
Elias Thomson a90dedffeb
Fixed doors not breakable by piston (#4869)
Co-authored-by: Elias Thomson <dev@eliasthomson.com>
2020-09-15 19:47:23 +00:00
Tiger Wang d9d71e1de6
Rail: avoid invalid game states (#4864)
+ Check CanBeAt
Ref: #4859

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-13 13:44:20 +00:00
Tiger Wang 33f3c18bc1
Beds: derestrict clicking block face (#4863)
Ref: https://github.com/cuberite/cuberite/issues/4860#issuecomment-691545904
2020-09-13 10:58:39 +00:00
Tiger Wang 198407807f
Reverse order of ChunkSender priorities (#4858)
* Reduces confusion when using overloaded operator< and priority_queue

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-09-12 19:43:18 +00: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
SatoKaito 834d61dacc
fixed missing include for FreeBSD. (#4852) 2020-09-10 00:17:06 +01:00
12xx12 c2f8ceb554
Add more statistic tracking (#4837)
+ Added possible 1.8 stats
+ Added stat tracking for 1.8.2
+ Added stat tracking for 1.9
+ Added the breed cow achievement

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-09-05 16:13:44 +01: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 040380321c WriteConsoleInput can return FALSE when running as servic 2020-09-05 14:23:54 +01:00
Tiger Wang 29808c61c9 Reformat messages in NonCtrlHandler 2020-09-05 13:41:42 +01:00
Tiger Wang 1bc12ba2b3 Streamline startup sequence
* Clean up cRoot & main
* Move some OS-specifics into OSSupport
2020-09-05 13:16:52 +01:00
Tiger Wang 5e670a050b Rename AddEntityIfNotPresent to AddPlayer
+ Always make a chunk for the player to go into
* Fixes #4847
2020-09-03 22:25:35 +01:00
Tiger Wang f84e805453 Entities can fail to add into a chunk
- MoveEntityToNewChunk, AddEntity can fail. Ensure we handle these cases correctly
2020-08-29 21:34:21 +01:00
Tiger Wang 07ffd9f6f3 Unused/duplicate function cleanup
* FaceIntToBlockFace in 1.8/1.9 protocol merged
- Removed undefined permissions stuff in Player header
2020-08-29 16:47:40 +01:00
Tiger Wang d2e92440eb Remove redundant DoWithChunkAt in chests 2020-08-28 21:43:12 +01:00
Tiger Wang 5d736b653f Minor style fixes 2020-08-28 21:42:37 +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 8fa8ee96fc Broadcaster: don't loop over all entities to broadcast one's position
* Use ForClientsWithEntity
2020-08-28 21:41: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 071aee6c79 Clean up pickup collection to use ForEachEntityInBox 2020-08-28 21:35:38 +01:00
Tiger Wang 167247328a Chunk: Make StayCount/AlwaysTicked unsigned 2020-08-28 21:34:23 +01:00
Tiger Wang 7023548de0 Simplify MoveEntityToNewChunk
- No longer try getting from the chunkmap if GetNeighborChunk fails, since nothing else does this and entities (in future) will not tick close to an unloaded chunk edge
* GetRelNeighborChunk uses FindChunk
2020-08-28 21:32:46 +01:00
Tiger Wang 08bd77e547 Clean up GenerateChunk/TouchChunk
- Remove TouchChunk
- Remove unused bool return value in GenerateChunk
- Remove ShouldGenerateIfLoadFailed
2020-08-28 21:26:04 +01:00
Tiger Wang 72ae5ecb5a ChunkMap: do not wantonly make empty chunks
- Removed calls that constructed an empty chunk, found it was invalid, and did nothing with said chunk

Partially addresses #2324
2020-08-28 21:22:44 +01:00
Tiger Wang b084f1f13f Remove unneeded MarkDirty, SendToClients parameters of SetMeta
Partially reverts #3129, whose addition of these parameters was superseded by #3149 that fixed generated leaves' metas.

References:
https://github.com/cuberite/cuberite/pull/4417#discussion_r334950513
e0bcd754009f16480437b2c1fa5e7fbedab31496
2020-08-28 21:08:06 +01:00
Tiger Wang ecd8f0c0de 1.13+: Send length-prefixed server Brand string
Ref: 5176c22656
2020-08-28 21:08:06 +01:00
Mattes D 3d7acb6d10 Removed const 2020-08-27 17:32:48 +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 0e3039d44c Added a "reloadweb" command for reloading web admin config. 2020-08-27 17:32:32 +01:00
Peter Bell fa917259a5 Fix doors and trapdoors closing on server restart 2020-08-25 21:38:49 +01:00
Tiger Wang a473e8ba52 ChunkDataSerializer: don't repeatedly mallocate
+ Store an instance of the class, the way it seems it is meant to be used.
2020-08-21 18:22:04 +01:00
Tiger Wang 440523b022 CompressPacket: reserve CompressedSize, not the uncompressed size
+ Assign the length data to a_CompressedData to overwrite it, mirroring the behaviour of cByteBuffer::ReadAll
2020-08-21 18:17:45 +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 8cca3db61b Consolidate various Chunk serialisers under one roof
* Merge most into WriteSectionDataSeamless
2020-08-21 00:53:10 +01:00
Tiger Wang 2d28d681c7 Remove unused variables in ChestEntity/BlockEntityWithItems 2020-08-21 00:53:10 +01:00
Tiger Wang 82d251b71b Made cProtocol::Version, EntityMetadata enums less verbose 2020-08-21 00:53:09 +01:00
Tiger Wang 9a9079d3da Remove complex templated SendBlockChange
If we're sending enough blocks to have virtual calls be an issue, we should resend the chunk instead.
2020-08-21 00:53:09 +01:00
Tiger Wang d8c8d0124d Replace PowerData struct with PowerLevel
* We no longer need to track the powering block with the removal of SolidBlockHandler. PowerLevel is now just an unsigned char
2020-08-21 00:50:09 +01:00
Tiger Wang 03557e978e cChunk's deleted copy constructor needs const 2020-08-21 00:50:09 +01:00
Tiger Wang d1b0d0f5b5 Remove level of indirection in cChunk storage
- No more unique_ptr storage
2020-08-21 00:50:09 +01:00
Tiger Wang 3143d6ce67 Remove std::make_unique from redstone handler creation 2020-08-21 00:50:09 +01:00
Tiger Wang 6617d43983 Minor typo fixes
* Also DeMorgan'd Emerald ore condition
2020-08-21 00:50:09 +01:00
12xx12 70ab8d2f96
Adding block entity transmission to 1.13 (#4829)
+ Adding block entity transmission to 1.13
+ Added HandlePacketSetBeaconEffect

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-08-19 20:46:03 +01:00
Tiger Wang 963ec77575 Add statistics upgrade mapping 2020-08-19 20:45:27 +01:00
Tiger Wang f23402dacd Add FileStream wrapper 2020-08-19 20:45:27 +01:00
Tiger Wang dbc81c3548 Add statistics palette for 1.15 & 1.16 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
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 a3594f22c2 Update FinishGen.cpp 2020-08-09 22:05:13 +00:00
12xx12 ec3de19c4e small issues addressed in #4817 fixed because was merged to fast 2020-08-09 22:05:13 +00:00
ion232 1b17ec4ca9 Fix enderchest placement rotation 2020-08-09 21:08:48 +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
ion232 f65679d1d4 Fix arrows preventing block placement 2020-08-09 10:19:01 +00:00
Tiger Wang 40eba5244d Remove the redstone solid block handler
- Remove cSolidBlockHandler
* Functionality now integrated into simulator dispatcher
* Fix door double open/close issues, arisen due to the top/bottom halves getting different power
+ Small migration to block states for redstone wire
2020-08-08 18:22:16 +01:00
Tiger Wang 2f79ab2e26 const-ify some Chunk functions 2020-08-08 12:09:40 +01:00
Alexander Harkness b45d8bfc1e
Revert "Hotpatch optional for macOSX builds on buildserver"
This reverts commit 5e3f51f5ff.
2020-08-06 12:36:41 +01:00
Mat cb1f0a5af2
Update bed behavior (#4545) 2020-08-05 19:38:29 +00:00
12xx12 5176c22656
imprementing plugin message to send server brand (#4786)
* fixed issue #4773


Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-08-05 18:55:19 +00:00
Alexander Harkness d6c5ac40a6
Fix big tree ring radius calculations. Ring radius now stays within range. 2020-08-05 18:41:19 +01:00
mBornand 4c0e7e0ab4
edit comment 2020-08-05 18:41:19 +01:00
mBornand 295d8e1a6c
update comment 2020-08-05 18:41:18 +01:00
mBornand eaae8be44b
correct error 2020-08-05 18:41:18 +01:00
mBornand ad05e9e3f4
correct error 2020-08-05 18:41:18 +01:00
mBornand e9bf6edbeb
large conifers sapplings grow 2020-08-05 18:41:17 +01:00
mBornand e7b37b7965
error in comment end 2020-08-05 18:41:17 +01:00
mBornand 987f6ddeaa
add Large conifers 2020-08-05 18:41:16 +01:00
Tiger Wang d2156aab7c WakeUpSimulators correct Y computation
+ Add Y validity check to SimulatorManager
2020-08-05 08:35:37 +01:00
Tiger Wang c0d1cffe0b Delete unreferenced variable 2020-08-05 08:35:37 +01:00
Tiger Wang 25906a3b87 Adjust incorrect palette inclusions 2020-08-05 08:35:37 +01:00
Tiger Wang 5ed4222dee Delete redundant std::move in World loader 2020-08-05 08:35:36 +01:00
Alexander Harkness 5e3f51f5ff
Hotpatch optional for macOSX builds on buildserver 2020-08-04 23:01:39 +01:00
12xx12 781d648571
Code cleanup in cChunk.PlaceBlock() for checking if BlockEntity should be spawned (#4812)
* Changed switch for call in cChunk for call to function cBlockEntity to remove unnecessary confusions while implementing new BlockEntities
2020-08-04 19:01:36 +01:00
Tiger Wang 5bb6512435 Simply Y-check in door handler 2020-08-04 18:26:25 +01:00
Tiger Wang 766a950d20 Continue with placement when using iron doors 2020-08-04 18:18:37 +01:00
Tiger Wang 71ba18d6c6 Door drops respect player gamemode
* Rely on caller to handle converting to pickups, all OnBroken needs to do is to maintain the unity of the door
* Fixes #4797
* Fixes #4796
2020-08-04 18:15:18 +01:00
Tiger Wang c3d6afe47e Corrected wakeup sequences
* Pistons/Ice no longer need to FastSetBlock first (#4600), and the former don't drop items when broken in creative
- Begin migration away from stationary fluids
* Tick the chunk after applying a client's changed
* Broadcast pending blocks at the end of a tick
2020-08-04 18:15:18 +01:00
Tiger Wang 6bdd130aab OnBroken/OnPlaced are for entity actions
* Call OnPlaced/OnBroken in PlaceBlock/DigBlock
- Remove unused Placing/Breaking handlers
* Have the blockhandler's Check handle neighbour updating, instead of QueueTickBlockNeighbors
2020-08-04 18:15:18 +01:00
Tiger Wang adb86a75da Do not GetBlock individually in simulators
* Have the simulator manager get the block and pass it on
+ Add new overload for WakeUp, called when the manager wakes face positions
2020-08-04 18:15:18 +01:00
Tiger Wang b205d233bd Use std::queue for the block tick queue 2020-08-02 15:52:06 +01:00
Tiger Wang 71ffa76847 Remove unused block tick related cChunk functions 2020-08-02 15:52:06 +01:00
Tiger Wang 225c2fa9f6 Always use relative coordinates in AddBlock
+ Pass block, use relatives
* Fixes everything immediately converting abs back to rel and getting block, when these data were already available
2020-08-02 15:52:06 +01:00
Tiger Wang 99856df686 Add WakeUp/AddBlock distinction
* WakeUp is for singular changes (block breaking for example). The simulator should check blocks around the position and discover other affected blocks as it sees fit
* AddBlock is for when you know a whole area is to be updated; chunk loading, or area wakeups for example
+ Prepares for correct handling of destroyed blocks after removal of SolidBlockHandler in the redstone simulator
2020-08-02 15:52:06 +01:00
Tiger Wang 6d7b83a69d Do not impose redstone wakup penalty for all blocks 2020-08-02 15:52:06 +01:00
Tiger Wang fd5191854d Delegate simulator wakeup to cChunk 2020-08-02 15:52:06 +01:00
Tiger Wang 6c47f46c31 Ensure updating relatives calls the correct base case
* Fixed recursive base unintentionally scheduling the origin position for an update because it called the wrong function
2020-08-02 15:52:06 +01:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
12xx12 54e499c065
Added HandleCraftItem call to ShiftClickedResult to make sure achievements are awarded (#4791) 2020-08-01 20:23:01 +02:00
Tiger Wang fb3d3dac1e Correct Serialise393/477 version annotations 2020-07-28 00:08:57 +01:00
Tiger Wang 99f8c44342 1.14 connection support 2020-07-26 18:55:16 +01:00
Tiger Wang 1673c84978 Remove redundant ErasePowerData call
* Also fix a return that should've been continue
2020-07-26 16:08:20 +01:00
Tiger Wang 860eedd3d7 Toggleables: update simulators when changed 2020-07-26 16:07:37 +01:00
Tiger Wang 7d93742498 Clang Tidy fix 2020-07-26 16:06:57 +01:00
Tiger Wang 2e18e4f51c Comparators: use <= in comparison mode 2020-07-26 14:16:46 +01:00
Tiger Wang 4e5ab02a58 Use SimulateChunk in redstone simulator
+ Improved performance, reduces bottleneck in chunkmap lookup
* Stop allocating and throwing away lots of small vectors in Update/GetValidSourcePositions return values
- Remove unused GetPowerLevel virtual
2020-07-26 14:16:46 +01:00
Tiger Wang de06ae7add Fix incorrect big flower translation
* Upgrade palette had incorrect values for upper half of large flowers
2020-07-26 01:23:01 +01:00
Tiger Wang b30d70f09d Call BlockEntityWithItems from ChestEntity slot changed handler
* Small degree of unification for what to do with the current entity
* Make sure to do necessary actions for both sides of a double chest
2020-07-26 00:02:07 +01:00
Tiger Wang 6d650d5f3c Reduce unnecessary wakeups
- cSimulator no longer wakes up positions already woken by cChunk::SetBlock
2020-07-25 20:59:12 +01:00
Tiger Wang e4c09ca87d Use relative vectors in cChunk::DoWith 2020-07-25 20:31:48 +01:00
Tiger Wang b6e4a986b6 Correct placement for tripwire hooks
487f9a2aa9 (r40900869)
2020-07-25 20:29:55 +01:00
Tiger Wang bc01cd5e75 Redstone: check validity of GetBlock 2020-07-24 09:11:40 +01:00
Tiger Wang 4f217c450b zh-cn translation in resource file
+ Add resource description
+ Add more descriptive flags
2020-07-23 21:17:50 +01:00
Tiger Wang 330626ab22 Update submodules 2020-07-23 00:32:47 +01:00
Tiger Wang 07f3f7ec30 Remove some unused inclusions 2020-07-20 09:28:02 +01:00
Tiger Wang 2f30e98dae Remove GetProtocolVersion unneeded comments 2020-07-19 23:11:02 +01:00
Tiger Wang 3dae696b41 Remove ProtocolPalettes 2020-07-19 21:20:27 +01:00
Tiger Wang 5dd51e87e5 Inherit constructors, remove duplication 2020-07-19 20:49:29 +01:00
Tiger Wang e2f15776c7 Remove Waterlogged value from registry
(apparently they're going to remove it, we don't want such a large breaking change)

* Also alpha sort ids, parameters
2020-07-19 20:27:26 +01:00
Tiger Wang 3f712ca9cf Precompile unordered_map/set
+ Add inclusions to Globals.h
* Sort Globals.h
- Remove sys/stat.h from Globals.h
2020-07-19 19:58:53 +01:00
Tiger Wang f4fe137ab5 Use 1.13.1 block palette 2020-07-19 17:02:14 +01:00
Tiger Wang 00f8c3a225 Implement "caching" in ChunkDataSerializer
+ When sending a chunk to multiple clients, group them by protocol version and send the same data
2020-07-19 16:29:49 +01:00
Tiger Wang bedddfffbc Reduce duplication in CompressPacket
- Remove line 1742 that wrote data which was then immediately cleared
* Store the compress/no compress threshold in a constant
- Remove adding a noncompressed header in SendPacket, CompressPacket handles everything now
2020-07-19 16:21:05 +01:00
Tiger Wang c99ddbc376 1.13.1, 1.13.2 connection support 2020-07-19 00:43:33 +01:00
Tiger Wang 1b9b587734 Add 1.13.1 to 1.15.2 mappings 2020-07-19 00:43:33 +01:00
Tiger Wang 9c6b5a3ec9 Delete unused member 2020-07-18 19:23:10 +01:00
Tiger Wang bc1b70dcde Use cMultiVersionProtocol's buffer 2020-07-18 19:23:10 +01:00
Tiger Wang 5141d05ba6 Delete duplicated status request handlers
Here we go again...
2020-07-18 19:23:10 +01:00
Tiger Wang 7425305154 1.13 items support
+ Add 1.16 block and item definitions
2020-07-18 19:23:10 +01:00
Tiger Wang 951a0212d8 Move IsValidSocket out of global namespace 2020-07-18 14:20:31 +01:00
Mat eb0f640fa0
Initial work on 1.13 entity metadata (#4539)
* Initial work on 1.13 entity metadata

* Largely complete metadata

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-07-17 19:33:02 +01:00
Tiger Wang ff2c246de2
cProtocolRecognizer goes on a diet (#4770)
- Removed inheritance from cProtocol
2020-07-17 18:46:50 +01:00
Tiger Wang d8406c7c58 SimplePlaceableItemHandler style 2020-07-14 18:28:06 +01:00
Tiger Wang 9d277f1d10
cWorld * -> cWorld (#4771)
* cWorld * -> cWorld
2020-07-14 17:57:30 +01: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
Tiger Wang 1c714312eb Remove unnecessary includes 2020-07-12 23:41:54 +01:00
KrystilizeNevaDies d0f38f52cb Remove Schematic Chunk height limitation 2020-07-06 20:56:47 +01:00
Tiger Wang 3f33b0736e Comment capitalisation 2020-07-06 20:56:05 +01:00
Tiger Wang a24dd3a2ab Use enum to represent light states 2020-07-06 20:56:05 +01:00
Tiger Wang f49f90906c Reduced packet spam when entities idle
* Try not to send look packets when nothing's changed.
2020-07-06 20:56:05 +01:00
Tiger Wang e205d4109b Made grass spreader prettier 2020-07-06 20:56:05 +01:00
Peter Bell 829f8d46f0 Update fmtlib to 7.0.0 2020-07-06 20:53:04 +01:00
MaxwellScroggs 5cdaf073be
cWindow: Convert XYZ to Vector3 (#4764) 2020-07-04 23:49:17 +02:00
Franklin Kong 868e28b44f
Merged trivial item handlers into cSimplePlaceableItemHandler (#4766)
- Remove unused files

Co-authored-by: aiugai <aiugai@umich.edu>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-06-26 21:34:22 +01:00
morsmordere 60c10ef248
Cactus cannot be placed on a forbidden blocks (#4767)
Co-authored-by: Franklin T Kong <ftk@umich.edu>
Co-authored-by: aiugai <aiugai@umich.edu>

Fixes #4641

Overrode GetPlacementBlockTypeMeta for CactusBlock, which gets called before a player places the cactus block, so it returns true if the placement is allowed or false if not, in which case the cactus does not drop as a block but stays in the player's hand which is the expected behavior. Tested in Minecraft client 1.12.2.
2020-06-26 01:23:47 +01:00
Mat e0a361de2a
Send entities in cChunkSender (#4532)
Confer issue #3696
2020-06-24 12:48:50 +01:00
peterbell10 6036971c77
libevent: Enable IOCP backend on windows (#4745) 2020-06-08 21:03:29 +01:00
peterbell10 99d96337da
Fire sim: Handle fuel block being destroyed (#4751) 2020-05-31 20:27:08 +01:00
Peter Bell ce1d6a7ebd Protocol: Avoid crashing on invalid sign text 2020-05-29 13:46:11 +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 104961b889 sizeof(char) 2020-05-16 09:39:05 +01:00
Peter Bell c1e9d9d0e0 Use thread safe localtime_r on linux 2020-05-16 09:39:05 +01:00
Peter Bell 89c9a7f563 Enable debug logging in test builds 2020-05-16 09:39:05 +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
Mat e053f72db8
Android build cleanup (#4734)
* Android build cleanup

* Remove unnecessary workaround

* Remove more unnecessities

* Bump cmake version
2020-05-10 16:18:28 +00:00
peterbell10 84289a2ba9
Cleanup some workarounds and warnings (#4735)
* Cleanup thread_local usage in FastRandom

* Use constexpr to avoid clang warning

* Fix more Wglobal-constructor warnings

* Make MSVC happy?
2020-05-10 16:16:49 +00:00
peterbell10 154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
Peter Bell 1123c95cf2 Enable C++17 in build 2020-05-09 20:37:16 +01: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 bd54cb71e5
Fix clang-tidy errors (#4730) 2020-05-09 01:38:17 +00:00
Tiger Wang a9e06d33c5 Add some comments about terracing 2020-05-08 10:52:35 +01:00
Tiger Wang 6ac11925f1 Update RedstoneWireHandler style 2020-05-08 10:52:35 +01:00
mBornand 1565d9b3ce
Use Vector3 for cLineBlockTracer and cBlockTracer (#4715)
* cLineBlockTracer uses Vector
2020-05-08 10:04:07 +01:00
peterbell10 c4ca11b372
Fix SetBlockMeta call in observer handler (#4728) 2020-05-08 09:46:03 +01:00
Mat c710f6a4ea
Remove old Android leftovers (#4722) 2020-05-07 22:14:00 +03:00
mBornand b9f441294d
Add tree generation for ExtemeHills and other biomes (#4713) 2020-05-06 17:31:52 +02:00
Mattes D bdb8830b9c Fixed various MSVC warnings. 2020-05-06 12:53:37 +01:00
peterbell10 57952505e5
Update fmt to 6.2.0 (#4718)
* Update fmt to 6.2.0
2020-05-05 22:52:14 +01:00
Mat f4b5c4c341
Remove cRankManager migration code (#4714)
* Remove cRankManager migration code

* Restore mistakenly removed code

* Display log message when creating ranks
2020-05-05 21:20:07 +03:00
Alexander Harkness 4e4ef9052e
Refactor minecart collision detection code. (#4712)
* Refactor minecart collision detection code.

 - Use new GetBoundingBox function.
 - Handle descending and ascending rails.
 - Snap to descending rails.

* Add message for UNREACHABLE
2020-05-04 21:04:21 +00:00
Tiger Wang 24833f7386 Add two missing include guards 2020-05-04 13:58:43 +01:00
Tiger Wang eb3ca16921 Fix one definition rule violations 2020-05-04 13:29:56 +01:00
Tiger Wang 9b68fab8ed Fix incorrect formatter invocation 2020-05-04 12:19:12 +01:00
Lukas Pioch e3de0aef64
Added check if player is in spectator mode (#4709) 2020-05-04 08:14:59 +00:00
Alexander Harkness 8240894d07
Add comment for boat position broadcast 2020-05-04 09:13:55 +01:00
Tiger Wang 07ca095740
Improve entity position updates (#4701)
* Make puking pickups fly nicer

* Improve entity position updates

* Move determination of whether a delta is too big for a packet into the protocol handlers
+ Less jittery movement
+ Generalise CollectEntity to take any entity
2020-05-04 08:10:47 +00: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
mBornand 5b92e6654f Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03 11:51:11 +01:00
mBornand 1c579f58aa Update src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-05-03 11:51:11 +01:00
Marc_Bornand 83193f132c Made some style update and add comments 2020-05-03 11:51:11 +01:00
Marc_Bornand 055c9ef90e Fix the connexion to the side of the repeater 2020-05-03 11:51:11 +01:00
Alexander Harkness 942403de2b Modify pickup collection behaviour to correspond to vanilla.
As documented here: https://www.spigotmc.org/threads/item-pickup-radius.337271/#post-3141146
2020-05-03 11:49:07 +01:00
Mat f5ce03d10d Assert if world is incorrect 2020-05-03 11:49:00 +01:00
mathiascode 5f2c572f9a Set entity world early 2020-05-03 11:49:00 +01:00
Tiger Wang 0b9b7bc1a8 Unify entity spawn packet sending 2020-04-30 23:04:56 +01:00
Mattes D dfe7a0adee
NBT: Dynamic list-max-count protection. (#4697) 2020-04-30 08:44:49 +02:00
Lukas Pioch 38080c7cac Update DispenserEntity.cpp
Removed unneeded cast
2020-04-25 12:27:39 +01:00
Lukas Pioch 91ab938166 Fixed spawning of mobs from dispenser 2020-04-25 12:27:39 +01:00
Mat 9432b57ba8
Get biome at world coords on mob spawn (#4692) 2020-04-25 00:00:27 +02:00
peterbell10 c0e7708aa7
Fix incorrect relative coords usage in farmland handler (#4690) 2020-04-24 17:29:12 +00:00
mathiascode e6cc792cef Prevent bookshelf pickup crash
If no tool was involved in the creation of a bookshelf pickup (e.g. explosion), the server would crash due to a missing nullptr check. Removed the IsTool check completely, since we don't use it elsewhere, and vanilla doesn't do such checks either.
2020-04-24 19:39:22 +03:00
Tiger Wang afd377a941 Unify 1.8 and 1.9
- Deleted ridiculous amount of duplicated code
2020-04-22 17:26:31 +01: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
Tiger Wang 246acb19f9 Delet SpawnObject params
* Fix #4679

awkward...
2020-04-19 23:29:52 +01:00
Tiger Wang 61aff2af12 Correct world access in NetherPortalScanner 2020-04-19 21:43:14 +01:00
Tiger Wang 9d124e6b0a More arrow patches
* Further reduce instances of appearing black
* Fix packet send and get arrows to more reliably lodge in blocks clientside
* Fix hit detection failing at chunk boundaries
+ Use delegating constructors
2020-04-19 20:08:24 +01:00
Lukas Pioch cb64e99377
Added check for item damage (#4681)
* Added check for item damage

Co-authored-by: Mattes D <github@xoft.cz>
2020-04-19 16:36:31 +00:00
Tiger Wang 2976cec4c0 Reduce arrows going black on hit 2020-04-18 20:06:35 +00:00
Tiger Wang 50893667db MoveToWorld must always be provided a world 2020-04-18 19:51:30 +01:00
Tiger Wang e98f93a079 Only store IDs across ticks 2020-04-18 19:51:30 +01:00
Tiger Wang c1ea5f982d Re-implement repeater locking 2020-04-18 16:51:29 +01:00
Mattes D a55f61548e
Extended Vector3 (#4666) 2020-04-18 11:44:35 +02:00
DrButcher 3591be50b2
Fixing washing away of redstone mechanisms (#4665) 2020-04-17 21:01:21 +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
Peter Bell 96bd4637d7 Implement glowing redstone ore 2020-04-16 23:49:33 +01:00
Tiger Wang ede56a5750
ಠ_ಠ (#4660)
+ Provisional handling for observers
2020-04-16 22:27:04 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Mat f931590bf0 Prevent crash when breeding 2020-04-16 18:03:51 +00:00
Bond_009 dc4df66548 Trapdoor can be placed anywhere since 1.9 2020-04-15 21:58:27 +00:00
Mattes D 42cc736bfd
ServerHandle: Fix closing failed servers. (#4653)
If the cServerHandle failed to listen, closing it would then crash Cuberite.
2020-04-15 14:13:40 +02: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
DrButcher 35299b8509
Pressure plate sounds and delay (#4643)
+ Added sounds on depress and release
+ Added correct delay times
2020-04-13 23:23:43 +01:00
Peter Bell 43525c5df8 Acquire chunk map CS when accessing player entities 2020-04-13 17:13:38 +02:00
Mattes D fb05ea7cf7 Fixed entity teleport for just-spawned entities.
Includes a test code in the Debuggers plugin - throwing a cake-as-fallingblock.
2020-04-12 13:34:24 +02:00
Mattes D ef2d5027d3
Removed extended ASCII, and added a check against it. (#4642) 2020-04-12 09:24:30 +02:00
Alexander Harkness 8914355895 Fix rotation metas on blocks 2020-04-11 19:00:05 +00:00
GefaketHD 0712fd2d90 fixing rotation - rel. #4625 2020-04-11 19:00:05 +00:00
Alexander Harkness 0d72270186 Replace all single-digit hex constants with two-digit version 2020-04-10 13:07:16 +00:00
Alexander Harkness db118af6ae Remove silly empty cBlockGlazedTerracotta class 2020-04-10 13:07:16 +00:00
Alexander Harkness 49f301d5a4 Reduce line length on templates 2020-04-10 13:07:16 +00:00
Alexander Harkness e5cc698ee7 Add additional spacing between template/function definitions 2020-04-10 13:07:16 +00:00
Alexander Harkness 9bb001f17b Add doxy-comments to new functions 2020-04-10 13:07:16 +00:00