1
0
Fork 0
Commit Graph

682 Commits

Author SHA1 Message Date
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
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 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
Mattes D bdb8830b9c Fixed various MSVC warnings. 2020-05-06 12:53:37 +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
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
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 c1ea5f982d Re-implement repeater locking 2020-04-18 16:51:29 +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
Bond_009 dc4df66548 Trapdoor can be placed anywhere since 1.9 2020-04-15 21:58:27 +00: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
Alexander Harkness 2b77b67197 Fix comment text 2020-04-10 13:07:16 +00:00
Alexander Harkness f40aba941e Add mixins for blocks that rotate based on player yaw at placement
Also add observer block handler.
2020-04-10 13:07:16 +00:00
Alexander Harkness 458d7f95c2 Brewing stands do not have rotation 2020-04-10 13:07:16 +00:00
Alexander Harkness 48ccd93426 Add Terracotta handlers 2020-04-10 13:07:16 +00:00
Alexander Harkness cb21a4611d Correct Black Glazed Terracotta block handler 2020-04-10 13:07:16 +00:00
Alexander Harkness ba048e2101
New hotfix to prevent calling OnBroken (#4600)
* Fix stack overflow in breaking ice.

Stupid fix, but it does work and is used in other places too...

* Replace hotfix for pistons with better one

* Fix comments in BlockBed handler
2020-04-03 20:24:49 +00: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