1
0
Fork 0
Commit Graph

41 Commits

Author SHA1 Message Date
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
Tiger Wang 868cd94ee9
Prepare ChunkData for BlockState storage (#5105)
* Rename ChunkData Creatable test

* Add missing Y-check in RedstoneWireHandler

* Remove ChunkDef.h dependency in Scoreboard

* Prepare ChunkData for BlockState storage

+ Split chunk block, meta, block & sky light storage
+ Load the height map from disk
- Reduce duplicated code in ChunkData
- Remove saving MCSBiomes, there aren't any
- Remove the allocation pool, ref #4315, #3864

* fixed build

* fixed test

* fixed the debug compile

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-03-05 14:03:55 +01: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
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 31a11a6df4
Optimise chunk set (#4260)
Closes #1244

Initially I was just going to add the cChunkData to cSetChunkData but profiling revealed 
that the copying wasn't even the biggest slowdown. Much more time was being spent in 
cChunk::CreateBlockEntities and cChunk::WakeUpSimulators than was in memcpy so I've made 
those significantly faster as well.

Optimisations performed:
 * cSetChunkData now stores blocks in a cChunkData object
 * cChunkData objects can now perform moves even if they are using different pools
 * cChunk::CreateBlockEntities now iterates in the correct order and only over present chunk sections
 * Similarly for cChunk::WakeUpSimulators
 * cSetChunkData::CalculateHeightMap now shortcuts to the highest present chunk section before checking blocks directly
2018-07-23 19:12:51 +01:00
peterbell10 2df14a0496
cChunk and cChunkData: Use vectors for block get and set functions (#4172)
* cChunkData: Change interface to use Vector3i
* cChunk: Add Vector3i overloads for bounded block get and set functions.
2018-02-04 22:15:31 +00:00
peterbell10 447d929da1 Implement anvil chunk sparsing 2017-08-26 20:56:44 +02:00
peterbell10 096cdac80d Implement protocol level chunk sparsing (#3864) 2017-08-21 17:56:53 +01:00
LogicParrot 77bf00a599 Out of world blocks are now always considered air blocks 2016-04-23 09:54:34 +03:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Samuel Barney 804805d35a Silenced and fixed many warning messages across multiple files. 2015-07-29 09:49:30 -06:00
worktycho 45fa2d98db Fixed Bug in cChunkData.
FIxed a bug where if the index was not aligned with the sections empty sections would not be set in the correct location.
2015-03-10 20:32:01 +00:00
Tiger Wang a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Tycho ee50790398 Merge branch 'master' of github.com:mc-server/MCServer 2014-06-16 15:12:50 +01:00
Tiger Wang d5649df326 Further improvements on redstone speed
Based on suggestions of @worktycho
* Repeaters now walk their data structure only when needed
* Fixed a bug with cChunkData returning an incorrect value for whether a
meta had changed
2014-06-07 10:39:36 +01:00
Tiger Wang 8e57f75622 Fixed #1057 2014-06-04 09:21:44 +01:00
Tycho f26ddac619 removed NULL assignment to const value 2014-05-30 14:50:30 +01:00
Tycho d854d3af1c removed unneded addressof 2014-05-30 14:43:33 +01:00
madmaxoft e136f6e0f5 Fixed cChunkData nibble copying. 2014-05-30 11:35:29 +02:00
madmaxoft 5368c5dd79 Fixed sign comparison. 2014-05-30 09:49:57 +02:00
madmaxoft 0e2138736c Fixed wrong copy sizes in cChunkData. 2014-05-30 09:17:17 +02:00
madmaxoft 8c4dd5dcfd Attempt at fixing an unresolved symbol in gcc / clang. 2014-05-29 21:41:44 +02:00
worktycho be10f07db0 Fix bug when a_Idx is not a multiple of SectionBLockCount 2014-05-29 19:44:36 +01:00
worktycho 901e3ec494 Derp 2014-05-29 19:35:47 +01:00
worktycho b50181e361 fix underflow
Wish c++ could specify saturating unsigned underflow.
2014-05-29 19:29:06 +01:00
madmaxoft 59068b77b7 Fixed wrong block sizes for copying / setting. 2014-05-29 20:21:39 +02:00
worktycho 0cfee5d141 Fixed Wrong types in nibble sizeofs 2014-05-29 19:10:35 +01:00
worktycho 80fe19c0e2 Fixed overflow bug 2014-05-29 17:41:07 +01:00
madmaxoft f7777e8c75 Added comments, reformatted code. 2014-05-29 18:25:08 +02:00
madmaxoft 999662503a Fixed forgotten changes. 2014-05-29 09:09:11 +02:00
madmaxoft 81f756cbda cChunkData: Normalized code style. 2014-05-28 22:40:19 +02:00
madmaxoft 7ec44951a0 Fixed cChunkData formatting. 2014-05-28 16:34:25 +02:00
Tycho 19df18c461 Fixed test globals to work with precompiled headers 2014-05-27 12:46:22 +01:00
Tycho 944d29c0ae inject TestGlobals.h correctly 2014-05-24 14:09:51 +01:00
Tycho 7fac63cffb Moved accessors to cpp file 2014-05-24 13:37:25 +01:00
Tycho 8f964886e0 Implemented style changes 2014-05-24 13:33:40 +01:00
Tycho 4b23472097 Fixed if spaces 2014-05-21 21:46:20 +01:00
Tycho 88c61a2e96 Fixed reversed comparisons to null 2014-05-21 21:18:14 +01:00
Tycho 93c0dcb1fe Added space to ChunkData.cpp 2014-05-21 20:26:43 +01:00
Tycho 5929ffbc40 Fixed stylistic issues 2014-05-21 20:08:34 +01:00
Tycho 024027db89 Renamed cChunkBuffer to cChunkData 2014-05-21 19:58:48 +01:00