1
0
Fork 0
Commit Graph

322 Commits

Author SHA1 Message Date
nshah25 8be1dd54bb
Add player statistics to API (#5193)
* Fixed issue #5166

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-05-03 21:07:09 +01:00
Tiger Wang 9b97d63f8f
Chest, weather, crash, and miscellaneous fixes (#5215)
* Alpha-sort cChestEntity

* Chests: use SendUpdateBlockEntity

* Pathfinder: fix out of range Y

* 1.13: correct weather packet ID

* Chests: fix neighbour scanner

+ Add OnAddToWorld and overload to scan neighbours there, instead of in the constructor/OnUse. This fixes hoppers accessing newly loaded double chests and seeing a null m_Neighbour, thus thinking its a single chest.
* Fix typo in cross coords computation.
* Simplify hopper logic.

* Block entities: ASSERT that type is correct

If you match the block type first before calling DoWithBlockEntity, the corresponding block entity must either be empty or correspond to the block type.

* Chunk: fix some forgotten PendingSendBE cleanup

+ Add cleanup in SetAllData, WriteBlockArea
- Remove RemoveBlockEntity (used once), HasBlockEntity (not used)

* Replace MakeIndex with MakeIndexNoCheck

* Remove extraneous MarkDirty in hopper & chests
2021-04-30 13:23:46 +00:00
npresley0506 d117a6c5db
Repaired Hoppers Treating Chests as two entities (#5202)
* Repaired Hoppers Treating Chests as two entities

* Style changes

* style fixes

* Fixed style issues, also condensed logic in MoveItemsFromChest

* Used m_Neighbour, fixed styling

* GetNeighbour not ReturnNeighbour

Co-authored-by: npresley <npresley@umich.edu>
2021-04-23 12:51:59 +00:00
Tiger Wang 4cd49d7eca Fix sending incorrect date values on world change
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-04-12 22:35:07 +01:00
Mattes D 0137e71f6b Added override specifiers to overridden functions.
Needed for clang-11 compatibility.
2021-04-12 14:09:52 +01:00
Tiger Wang 748b121703
Unify DoWithBlockEntity (#5168)
+ DoWith calls now broadcast the block entity and mark the chunk dirty
+ Add block entity change queue to synchronise BE updates with block updates
* Fixed a few incorrect assertions about BE type
- Remove manual overloads
2021-03-28 14:40:57 +01:00
Tiger Wang edf9e39ed7 Mob heads, banners cannot be used
* Fixed UsedBy returning true, blocking block placement
2021-03-17 23:44:59 +00:00
12xx12 243083e01a
Adding basic Banner functionality (#4806)
+ Added item and block for banners

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-03-15 02:47:55 +00:00
Tiger Wang 45591cbe7b
Properly deprecate more XYZ parameter'd functions (#5147)
* Fixes #5144
2021-03-15 02:28:18 +00:00
Tiger Wang 81e299f00c Mark UNREACHABLE with intrinsics 2021-02-20 17:46:02 +00:00
Tiger Wang 813176fbd1
cChunk: don't inherit from cChunkDef (#5106) 2021-01-18 16:09:10 +00:00
Tiger Wang 16aeb84cd3
Fix potential destruction crashes (#5095)
* Fix potential destruction crashes

* Fix destructors accessing destroyted objects
* Fix cPlayer not destroying windows (Destroyed never called)
* Tentatively fixes #4608, fixes #3236, fixes #3262
- Remove cEntity::Destroyed() and replace with cEntity::OnRemoveFromWorld()

* Add missing call to OnRemoveFromWorld
2021-01-02 13:50:34 +00:00
Tiger Wang 90ce4ed2b8 Command Blocks: fix a crash
* Don't store a temporary
2020-12-30 12:15:19 +00:00
Tiger Wang d9cd2f741d Comment and code style fix
+ Add static keyword
- Don't capture everything in lambda
2020-12-21 13:52:06 +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
Tiger Wang 6d85435f60 Remove BLOCKENTITY_PROTODEF 2020-10-24 18:49:38 +01:00
12xx12 c0711407e9
Adding more customize options to mob spawners and improving the way to look for surrounding entities (#4955)
* added nearly any customize option

* fixed unnecessary diff
added comments

* removed unnecessary const qualifier

* fixed build

* changed to ForEachEntityInBox

* added docs

* updated lua api description

* checkstyle

* added changes suggested by @peterbell10
And now the player may break the server by setting ridiculous ranges

* updated docs
changed cast to static cast

* fixed clang

* fixed clang on WSSAnvil.cpp

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-10 19:31:44 +00:00
12xx12 d3255b3014
Beacon now checks for players in surrounding square (#4972)
* Beacon now check for players in surrounding square not every player

* added proper BoundingBox

Co-authored-by: Alexander Harkness <me@bearbin.net>

* one symbol to change everything
one symbol to break the whole build

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-10-09 19:19:22 +00:00
Tiger Wang 21068011c6 Remove SetProperty(...cPlayer)
Enchantment table, anvil windows are already opened one per-player.
2020-10-03 16:54:14 +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 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
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 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 71b96ab921 Limit fortune level, style fixes 2020-09-23 14:34:15 +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
12xx12 f8de67aace Added end portal and enchanting table block entities 2020-09-20 01:40:20 +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 1bc12ba2b3 Streamline startup sequence
* Clean up cRoot & main
* Move some OS-specifics into OSSupport
2020-09-05 13:16:52 +01:00
Tiger Wang d2e92440eb Remove redundant DoWithChunkAt in chests 2020-08-28 21:43:12 +01:00
Tiger Wang 2d28d681c7 Remove unused variables in ChestEntity/BlockEntityWithItems 2020-08-21 00:53:10 +01:00
12xx12 7d0813ce8c Add Statistics and Achievements for newer Network standards 2020-08-19 20:45:27 +01: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 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
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +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 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 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
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
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Lukas Pioch 9680408c16
Block entity for beacon was not created (#4618) 2020-04-04 19:34:00 +00: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
Bond-009 ea386eaab1
Lock hopper when powered by redstone (#4347)
* Lock hopper when powered by redstone

* Add to manual bindings

* Add hopper API documentation

Co-authored-by: Mat <mail@mathias.is>
2020-03-27 12:03:28 +00:00
Mat 4fde622e2d
Play sound when brewing is complete 2020-03-23 16:12:54 +02:00