1
0
Fork 0
Commit Graph

5916 Commits

Author SHA1 Message Date
Tiger Wang 21068011c6 Remove SetProperty(...cPlayer)
Enchantment table, anvil windows are already opened one per-player.
2020-10-03 16:54:14 +01:00
KingCol13 cd1b507745
Fix instant mining of blocks not being recognised, tweak anti-cheat (#4938)
* Tried to fix a small issue...

Ended up rewriting a bunch of god awful, opaque code with no source
and no sense. Who names a function GetPlayerRelativeBlockHardness???
It's gone now. We're safe again.

* Testing anti-cheat.

* Tidy up debug logging.

* Remove empty member declaration.

* Rewrite GetDigSpeed slightly for better readability.

* GetMiningProgressPerTick now returns 1 when instantly mined. Fixed hasily written typo.

* Comment style and typo fixes.
2020-10-02 20:57:17 +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
Tiger Wang 429117c1f6 Doors: check power & toggle correctly
* Fixed upper half ignoring its updates
* Fixes #4945
* Fixed doors playing sound effects when they didn't actually toggle
2020-09-28 23:40:19 +01:00
Tiger Wang c9fbb43ac7
HandleEnchantItem: use a lambda (#4944) 2020-09-28 22:38:10 +00:00
KingCol13 8eca58a1c9
Fortune Drops (#4932)
+ Implemented and standardized all clamped discrete random drops.
+ Changed cItems Add from push_back to emplace_back. Implement fortune for crops.
+ Enabled hoes to be enchanted with efficiency, silk touch and fortune. Made leaves, gravel and crops affected by fortune.

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28 13:41:49 +01:00
KingCol13 32af227fa7
Enchanting consumes lapis, removes correct number of levels (#4934)
* Use lapis for enchanting, subtract correct number of levels.
* Enforced distancing regulation better than our government.

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28 00:51:23 +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
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
Tiger Wang c158569af3 Remove unused Temporary namespace 2020-09-25 14:51:57 +01:00
Tiger Wang 4519469547 Do not call into things we don't own in destructors
- Remove improper accesses in cChunk destructor
* Fixes #4894
2020-09-25 14:51:16 +01:00
Tiger Wang 10bd15a11e Grass spread: check chunk & light validity correctly 2020-09-25 14:51:16 +01:00
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