1
0
Commit Graph

711 Commits

Author SHA1 Message Date
cflep
7fbe4a0126
Added dimension check to nether portal (#5068)
+ Added dimension check to nether portal
2020-12-18 21:10:14 +00:00
Derek Qu
280f7a81f4
Note Block Left Click Fix V2 (#5052)
+ Add function to play note block on left click
2020-11-26 00:58:35 +00:00
0ddlyoko
672bb04570
Add correct implementation of crops (#4802)
* [FIX] Add correct implementation of seed drops.

> Official percentage of drops has been implemented

* Fix C++ conventions

* Change "Vals" variable to "m_Vals"

* [FIX] Add correct implementation of Carrots, Potatoes, Wheat & Beetroots seed

* Add Fortune support with crops

Add fortune support with Wheat, Carrots, Potatoes & Beetroots seeds

* [FIX] Right-clicking on a grown Beetroot in survival consume 2 bone meals

Fix #4805

* Add documentation for "cWorld::IsFullGrownPlantAt" method

* Fix dispenser that full grown a plant

> Change methods cItemDyeHandler::FertilizePlant & cItemDyeHandler::growPlantsAround to static

* Display particle even if tree doesn't grow

* When right-clicking on a full grown melon / pumpkin seed, no longer produce a melon / pumpkin

Before this commit, when you right-click on a melon or a pumpkin seed, a melon / pumpkin block spawned.
With this commit, it no longer spawns

* [FIX] Do not create melon / pumpkin block when right-clicking with a bone meal

This fix will prevent the creation of a melon / pumpkin block when you right-click with a bone meal on a melon / pumpkin plant
- It just detect if the plant is full grown. if yes, the method "Grow" is not called

- Remove IsFullGrownPlant

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-06 16:54:01 +00:00
12xx12
c080f819d2
Adding Silverfish Spawning Blocks (#4946)
* added breaking, spawning, animation

* checkstyle

* added undocumented API symbols

* added changes suggested by @peterbell10

* added natural ore like generation

* fixed spawning two silverfishes

* fixed clang

* fixed clang try 2

* updated comment
unified offset

* final clang fix

* added spawning for more silverfishes if one was damaged

* fixed spawning on one hit kill

* fixed spawning on one hit kill
fixed spawning by potion damage

* fixed clang

* fixed broken build

* fixed broken build

* I should read the error message properly
fixed build now?

* added small changes suggested by @peterbell10

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-11 15:27:41 +00:00
12xx12
6fd35be67a
added check if the digger is a nullptr (#4981)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-09 20:12:19 +00:00
12xx12
3381c0f6d6
Merged OnBreak with OnPlayerBreak (#4967)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-08 20:13:44 +01: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
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
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
Tiger Wang
c158569af3 Remove unused Temporary namespace 2020-09-25 14:51:57 +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
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
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
71b96ab921 Limit fortune level, style fixes 2020-09-23 14:34:15 +01: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
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
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
c3d2956ba5
BlockHandler: no dynamic allocation (#4862)
* BlockHandler: no dynamic allocation
2020-09-17 14:51:42 +01: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
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
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
Mattes D
c98a2d9acf Changed tree-growing functions in cWorld to use Vector3i coords. 2020-08-27 17:32:48 +01:00
ion232
1b17ec4ca9 Fix enderchest placement rotation 2020-08-09 21:08:48 +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
Mat
cb1f0a5af2
Update bed behavior (#4545) 2020-08-05 19:38:29 +00: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
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
fd5191854d Delegate simulator wakeup to cChunk 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
Tiger Wang
860eedd3d7 Toggleables: update simulators when changed 2020-07-26 16:07:37 +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
b6e4a986b6 Correct placement for tripwire hooks
487f9a2aa9 (r40900869)
2020-07-25 20:29:55 +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
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
e205d4109b Made grass spreader prettier 2020-07-06 20:56:05 +01:00
MaxwellScroggs
5cdaf073be
cWindow: Convert XYZ to Vector3 (#4764) 2020-07-04 23:49:17 +02: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
Tiger Wang
9e8598fb1c
Upgrade to C++17 [CMake] (#4717)
* Make our CMake slightly less insane
2020-05-16 20:59:10 +01:00