summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-11-03Chunk: Optimise idle tickingTiger Wang1-1/+4
* Instead of chunks ticking player objects, and the player object in turn ticking its client handle, let the world tick the client handles. This means we no longer need to maintain a special-case for chunks that shouldn't be ticking, but still need to process players. Partially reverts to the state before 054a89dd.
2022-04-20Valid Height is now checked by vector.x12xx12x1-1/+1
2021-12-29Improved farmer AI & Fixed entity loading functions (#5351)Persson-dev1-6/+6
* Allow villagers to pickup items * Add farmer villager harvesting * Use of auto keyword * Using for loop to check adjacent crops * Show particules when farmer harvest * Fix area comment * Move constants to header file * Removing unnecessary semicolon * Initialization of CropBlockType variable * Apply 12xx12 suggestion * Fixing area constant size * Refactor bounding box calculation, use vectors. * Add Api documentation * Update lua docs * Rework farmer ai * Fixing lua docs notes * Add missing capitalisation * Add villagers inventory save * Fixing loading entities from disk inconsistencies * Add farmer harvest animation * Fix beetroots grow state Co-authored-by: Alexander Harkness <me@bearbin.net>
2021-05-05Move item placement into item handlers (#5184)Tiger Wang1-1/+5
* Move item placement into item handlers + Add appropriate CanBeAt checks in cPlayer::PlaceBlocks, into which all placement handlers call. * Partly addresses #5157 * Fixes #4878 * Fixes #2919 * Fixes #4629 * Fixes #4239 * Fixes #4849 Co-authored-by: changyong guo <guo1487@163.com> Co-authored-by: Xotheus <shady3300@outlook.com> Co-authored-by: Krist Pregracke <krist@tiger-scm.com> * Review fixes * Update APIDesc.lua * Rename Co-authored-by: changyong guo <guo1487@163.com> Co-authored-by: Xotheus <shady3300@outlook.com> Co-authored-by: Krist Pregracke <krist@tiger-scm.com>
2021-03-28Fix chunk block changes being sent out of order (#5169)Tiger Wang1-0/+8
* Flush out all pending, buffered changes at the end of each tick, after every chunk is ticked. This makes every block update client-side in unison, instead of unlucky ones only being sent 1 tick later. * Re-add buffer for outgoing network data; IOCP async WSASend has higher overhead than expected... Fixes regression introduced in 054a89dd9
2021-03-28Unify DoWithBlockEntity (#5168)Tiger Wang1-369/+7
+ 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-05Prepare ChunkData for BlockState storage (#5105)Tiger Wang1-40/+6
* 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-01-12Clarify cClientHandle, cPlayer ownership semanticsTiger Wang1-11/+6
+ A cPlayer, once created, has a strong pointer to the cClientHandle. The player ticks the clienthandle. If he finds the handle destroyed, he destroys himself in turn. Nothing else can kill the player. * The client handle has a pointer to the player. Once a player is created, the client handle never outlasts the player, nor does it manage the player's lifetime. The pointer is always safe to use after FinishAuthenticate, which is also the point where cProtocol is put into the Game state that allows player manipulation. + Entities are once again never lost by constructing a chunk when they try to move into one that doesn't exist. * Fixed a forgotten Super invocation in cPlayer::OnRemoveFromWorld. * Fix SaveToDisk usage in destructor by only saving things cPlayer owns, instead of accessing cWorld.
2021-01-11Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accessesTiger Wang1-4/+58
* Hopefully fixes #5094
2021-01-11zlib -> libdeflate (#5085)Tiger Wang1-3/+0
+ Use libdeflate + Use std::byte * Fix passing temporary to string_view + Emulate make_unique_for_overwrite
2020-12-26Make SetAllData's MarkDirty() the chunk's responsibilityTiger Wang1-6/+0
2020-12-22Replace custom ChunkCoordinate with cChunkCoordsTiger Wang1-5/+5
2020-12-22unique_ptr<cChunkMap> to plain memberTiger Wang1-11/+23
2020-12-21Chunk: use FAST_FLOOR_DIVTiger Wang1-3/+2
2020-11-02Added new flowers on bonemeal use (#5011)12xx121-1/+1
+ Added new biome-dependent flower placement * Update planter algorithm Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-25Do not call into things we don't own in destructorsTiger Wang1-1/+8
- Remove improper accesses in cChunk destructor * Fixes #4894
2020-09-12Use tracing for explosions (#4845)Tiger Wang1-197/+0
* 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-03Rename AddEntityIfNotPresent to AddPlayerTiger Wang1-13/+4
+ Always make a chunk for the player to go into * Fixes #4847
2020-08-29Entities can fail to add into a chunkTiger Wang1-0/+10
- MoveEntityToNewChunk, AddEntity can fail. Ensure we handle these cases correctly
2020-08-28Clean up pickup collection to use ForEachEntityInBoxTiger Wang1-16/+22
2020-08-28Clean up GenerateChunk/TouchChunkTiger Wang1-78/+2
- Remove TouchChunk - Remove unused bool return value in GenerateChunk - Remove ShouldGenerateIfLoadFailed
2020-08-28ChunkMap: do not wantonly make empty chunksTiger Wang1-198/+127
- Removed calls that constructed an empty chunk, found it was invalid, and did nothing with said chunk Partially addresses #2324
2020-08-28Remove unneeded MarkDirty, SendToClients parameters of SetMetaTiger Wang1-2/+2
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-21Remove level of indirection in cChunk storageTiger Wang1-53/+33
- No more unique_ptr storage
2020-08-04OnBroken/OnPlaced are for entity actionsTiger Wang1-58/+0
* Call OnPlaced/OnBroken in PlaceBlock/DigBlock - Remove unused Placing/Breaking handlers * Have the blockhandler's Check handle neighbour updating, instead of QueueTickBlockNeighbors
2020-08-02Remove unused block tick related cChunk functionsTiger Wang1-17/+0
2020-08-02Always use relative coordinates in AddBlockTiger Wang1-3/+2
+ Pass block, use relatives * Fixes everything immediately converting abs back to rel and getting block, when these data were already available
2020-08-02Add WakeUp/AddBlock distinctionTiger Wang1-1/+1
* WakeUp is for singular changes (block breaking for example). The simulator should check blocks around the position and discover other affected blocks as it sees fit * AddBlock is for when you know a whole area is to be updated; chunk loading, or area wakeups for example + Prepares for correct handling of destroyed blocks after removal of SolidBlockHandler in the redstone simulator
2020-08-01Replaced cpp14::make_unique<> with std::make_unique<>.Mattes D1-3/+3
2020-07-25Use relative vectors in cChunk::DoWithTiger Wang1-15/+15
2020-05-03Add cEntity::GetBoundingBox, and use where appropriate. (#4711)Alexander Harkness1-3/+2
* Add cEntity::GetBoundingBox, and use where appropriate.
2020-04-17More Vector3 in cBlockHandler (#4644)Mattes D1-10/+10
* cBlockHandler.OnUpdate uses Vector3 params. Also slightly changed how block ticking works.
2020-04-03New hotfix to prevent calling OnBroken (#4600)Alexander Harkness1-6/+1
* 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-03Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)Mattes D1-0/+1
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-02Fix explosion knockback issues and tweak knockback strength (#4590)peterbell101-13/+9
2020-03-27 Lock hopper when powered by redstone (#4347)Bond-0091-0/+18
* Lock hopper when powered by redstone * Add to manual bindings * Add hopper API documentation Co-authored-by: Mat <mail@mathias.is>
2020-03-27Merge #4552Alexander Harkness1-1/+8
commit 28654b1f42a98c0f9910e333a9c8074fe30aff24 Author: Alexander Harkness <me@bearbin.net> Date: Fri Mar 27 11:58:34 2020 +0000 Remove whitespace commit f1492e174b51e168bf4fb150c2d7b7096c393057 Author: Odin <SirRobo@users.noreply.github.com> Date: Fri Mar 27 04:30:32 2020 +1100 Add issue comment commit b64166d68a327e8a9bf80720ff6e9c6af93921b5 Author: Odin <SirRobo@users.noreply.github.com> Date: Fri Mar 27 03:42:35 2020 +1100 Don't run OnBroken with pistons Stops piston duplication bug and doesn't break water and lava simulation
2020-03-22TNT position fixes (#4519)Mat1-1/+1
* TNT position fixes * Don't add offset to explosion spawn coords * Don't make other entities push TNT * Correct initial TNT speed * Fix typo * Improvements * Revert unwanted change * Style fixes * Update format
2020-03-22Fix invalid explosion damage (#4529)Mat1-1/+1
2020-03-19Improvements to knockback (#4504)Mat1-1/+1
* Improvements to knockback * SetSpeed for explosions * Improve code consistency
2019-10-28Moved growing from cWorld / cChunk to cBlockHandler descendants.Mattes D1-130/+75
2019-10-16Refactored block-to-pickup conversion. (#4417)Mattes D1-143/+58
2019-09-27Fixed MSVC warnings (#4400)Mattes D1-1/+1
2019-09-24NBTChunkSerializer: Cleaned up interface.Mattes D1-2/+8
Removed dependency on cChunkDataCallback. Moved all the serializing code into a worker class. Changed the serialization into a single-call action.
2019-09-06Separated chunk generator from world / plugin interfaces.Mattes D1-7/+7
The generator now only takes care of servicing synchronous "GetChunk(X, Y)" and "GetBiomes(X, Y)" requests.
2019-02-20Limit the size of cListAllocationPool's free listpeterbell101-1/+1
2018-07-26CheckBasicStyle: Check number of empty lines between functions (#4267)peterbell101-2/+7
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-24Broadcast refactor (#4264)peterbell101-459/+10
* Move Broadcast functions from cChunkMap to cBroadcaster - Remove cBroadcastInterface in favour of cBroadcaster. - cChunk: Remove broadcast functions. * resurect broadcast interface * Absorb cBroadcaster into cWorld. Removes the need for forwarding the function calls. * Improve const-correctness * Use Int8 instead of char + Comment `ForClients` functions * Improve comments * Broadcaster: Rename ForClients functions
2018-07-23Optimise chunk set (#4260)peterbell101-4/+2
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-23Rewrite explosion knock back (#4251)changyong guo1-4/+15
1. Base knockback on an entity's bounding box intersection with the explosion 2. Armor blast protection reduces knockback 3. Don't apply knockback to players flying in creative mode Fixes #4139
2017-09-27Fix explosion interaction with block entities. (#4052)peterbell101-0/+13
* WriteBlockArea: Fix erasing of block entities. * cChunkMap::DoExplosionAt destroys block entities
2017-09-25BroadcastBlockBreakAnimation and BroadcastBlockEntity use vectors (#4038)Bond-0091-11/+8
2017-09-19Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)Lane Kolbly1-10/+10
* Made BroadcastSoundEffect take vector parameters. * Added docs for new vectored methods * Removed old code * Fixed lua warnings * Made old BroadcastSoundEffect not an override. * m_Block to m_BlockPos, used Vector3d constructor where prettier. * a_Block to a_BlockPos * Changed thunderbolt a_Block to a_BlockPos
2017-09-11Replace ItemCallbacks with lambdas (#3993)peterbell101-85/+42
2017-09-07Changed some int parameters to vector parameters (#3937)Bond-0091-1/+1
2017-09-02Revert "Replace ItemCallbacks with lambdas (#3948)"LogicParrot1-43/+86
This reverts commit 496c337cdfa593654018c171f6a74c28272265b5.
2017-09-01Replace ItemCallbacks with lambdas (#3948)peterbell101-86/+43
2017-08-21Fully implemented leashes (#3798)Pablo Beltrán1-0/+29
2017-08-17Changed int parameters to vector parameters in cCuboid and simulators (#3874)Lane Kolbly1-12/+10
2017-08-07Changed entity ownership model to use smart pointersTiger Wang1-11/+12
2017-08-02Removed double includes (#3885)Lukas Pioch1-1/+0
2017-08-01cWorld::SendBlockTo take player by refpeterbell101-2/+2
2017-07-16Simulators: Added area-based wakeup.Mattes D1-47/+4
2017-07-07Added bed entity (#3823)Lukas Pioch1-0/+18
* Added bed entity * Export cBedEntity to lua * Set color of bed through item damage value * Added bed entity to APIDoc * NBT: Added loading and saving * Crafting recipes for the colored beds
2017-06-13FastRandom rewrite (#3754)peterbell101-5/+6
2017-02-05Fixed bindings for cBlockArea:Read and Write. (#3568)Mattes D1-2/+2
The original bindings accepted nil as the World param, causing a crash.
2017-01-18DeadlockDetect now lists some tracked CS's stats.Mattes D1-0/+19
2016-12-16Initial support for the 1.11 protocol.Mattes D1-2/+2
2016-10-12Spectators added (#2852)bibo381-0/+9
2016-10-09cChunk::SetAlwaysTicked implies cChunk::stay (#3361)LogicParrot1-1/+1
2016-09-03Configurable dirty unused chunk cap to avoid RAM overuse (#3359)LogicParrot1-2/+19
Configurable dirty unused chunk cap to avoid RAM overuse
2016-08-03Simplified cChunkMap chunk storage (#2565)Tiger Wang1-584/+224
2016-07-18Updated API documentation.Mattes D1-2/+2
2016-06-03Makes tall grass and large flowers bonemealableQUSpilPrgm1-0/+18
Adds the bonemeal particle effect to some more places
2016-06-03Update Dispensers and let them act more like in VanillaQUSpilPrgm1-6/+9
- Added code to make bonemeal, potions, minecarts, XP bottles and boats work inside dispensers - Dispensers are now able to place TNT if the block is transparent but not air - Added return value that indicates the success of pumpkin, melon, sugarcane and cactus growing functions - Changed return value of "GrowRipePlant" so that it actually indicates if the block was able to grow - Fixed "GrowSugarcane" and "GrowCactus" in "GrowRipePlant" so that it only grows them a single block
2016-05-141.9 / 1.9.2 / 1.9.3 / 1.9.4 protocol support (#3135)Pokechu221-1/+17
* Semistable update to 15w31a I'm going through snapshots in a sequential order since it should make things easier, and since protocol version history is written. * Update to 15w34b protocol Also, fix an issue with the Entity Equipment packet from the past version. Clients are able to connect and do stuff! * Partially update to 15w35e Chunk data doesn't work, but the client joins. I'm waiting to do chunk data because chunk data has an incomplete format until 15w36d. * Add '/blk' debug command This command lets one see what block they are looking at, and makes figuring out what's supposed to be where in a highly broken chunk possible. * Fix CRLF normalization in CheckBasicStyle.lua Normally, this doesn't cause an issue, but when running from cygwin, it detects the CR as whitespace and creates thousands of violations for every single line. Lua, when run on windows, will normalize automatically, but when run via cygwin, it won't. The bug was simply that gsub was returning a replaced version, but not changing the parameter, so the replaced version was ignored. * Update to 15w40b This includes chunk serialization. Fully functional chunk serialization for 1.9. I'm not completely happy with the chunk serialization as-is (correct use of palettes would be great), but cuberite also doesn't skip sending empty chunks so this performance optimization should probably come later. The creation of a full buffer is suboptimal, but it's the easiest way to implement this code. * Write long-by-long rather than creating a buffer This is a bit faster and should be equivalent. However, the code still doesn't look too good. * Update to 15w41a protocol This includes the new set passengers packet, which works off of the ridden entity, not the rider. That means, among other things, that information about the previously ridden vehicle is needed when detaching. So a new method with that info was added. * Update to 15w45a * 15w51b protocol * Update to 1.9.0 protocol Closes #3067. There are still a few things that need to be worked out (picking up items, effects, particles, and most importantly inventory), but in general this should work. I'll make a few more changes tomorrow to get the rest of the protocol set up, along with 1.9.1/1.9.2 (which did make a few changes). Chunks, however, _are_ working, along with most other parts of the game (placing/breaking blocks). * Fix item pickup packet not working That was a silly mistake, but at least it was an easy one. * 1.9.2 protocol support * Fix version info found in server list ping Thus, the client reports that it can connect rather than saying that the server is out of date. This required creating separate classes for 1.9.1 and 1.9.2, unfortunately. * Fix build errors generated by clang These didn't happen in MSVC. * Add protocol19x.cpp and protocol19x.h to CMakeLists * Ignore warnings in protocol19x that are ignored in protocol18x * Document BLOCK_FACE and DIG_STATUS constants * Fix BLOCK_FACE links and add separate section for DIG_STATUS * Fix bat animation and object spawning The causes of both of these are explained in #3135, but the gist is that both were typos. * Implement Use Item packet This means that buckets, bows, fishing rods, and several other similar items now work when not looking at a block. * Handle DIG_STATUS_SWAP_ITEM_IN_HAND * Add support for spawn eggs and potions The items are transformed from the 1.9 version to the 1.8 version when reading and transformed back when sending. * Remove spammy potion debug logging * Fix wolf collar color metadata The wrong type was being used, causing several clientside issues (including the screen going black). * Fix 1.9 chunk sending in the nether The nether and the end don't send skylight. * Fix clang build errors * Fix water bottles becoming mundane potions This happened because the can become splash potion bit got set incorrectly. Water bottles and mundane potions are only differentiated by the fact that water bottles have a metadata of 0, so setting that bit made it a mundane potion. Also add missing break statements to the read item NBT switch, which would otherwise break items with custom names and also cause incorrect "Unimplemented NBT data when parsing!" logging. * Copy Protocol18x as Protocol19x Aditionally, method and class names have been swapped to clean up other diffs. This commit is only added to make the following diffs more readable; it doesn't make any other changes (beyond class names). * Make thrown potions use the correct appearence This was caused by potions now using metadata. * Add missing api doc for cSplashPotionEntity::GetItem * Fix compile error in SplashPotionEntity.cpp * Fix fix of cSplashPotionEntity API doc * Temporarilly disable fall damage particles These were causing issues in 1.9 due to the changed effect ID. * Properly send a kick packet when connecting with an invalid version This means that the client no longer waits on the server screen with no indication whatsoever. However, right now the server list ping isn't implemented for unknown versions, so it'll only load "Old" on the ping. I also added a GetVarIntSize method to cByteBuffer. This helps clean up part of the code here (and I think it could clean up other parts), but it may make sense for it to be moved elsewhere (or declared in a different way). * Handle server list pings from unrecognized versions This isn't the cleanest way of writing it (it feels odd to use ProtocolRecognizer to send packets, and the addition of m_InPingForUnrecognizedVersion feels like the wrong technique), but it works and I can't think of a better way (apart from creating a full separate protocol class to handle only the ping... which would be worse). * Use cPacketizer for the disconnect packet This also should fix clang build errors. * Add 1.9.3 / 1.9.4 support * Fix incorrect indentation in APIDesc
2016-05-01Fix Crash on stopping the server (#3176)LogicParrot1-0/+13
2016-04-24ChunkLayers now stored in std::mapLogicParrot1-59/+58
2016-04-24Revert "ChunkLayers now stored in std::map"LogicParrot1-51/+59
2016-04-23ChunkLayers now stored in std::mapLogicParrot1-59/+51
2016-04-22Reduced unnecessary block updatesLogicParrot1-20/+1
2016-04-16Updated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usageLogicParrot1-2/+2
2016-04-05Improved player freeze codeLogicParrot1-2/+3
2016-03-30Entities are never lostLogicParrot1-10/+4
2016-02-22Fixed removing entities from parent chunksLogicParrot1-1/+1
2016-02-05Bulk clearing of whitespaceLogicParrot1-48/+48
2016-01-31Updated old forum linksMathias1-1/+1
2016-01-06Fixed Clang warnings.Mattes D1-9/+9
2015-12-18Reorganised the redstone simulatorTiger Wang1-115/+8
-> Many thanks to @worktycho for the idea, and @Haxi52 for the implementation plan! * Uses classes and inheritance now * Speed should be improved
2015-12-13allow use failures to propagate from the entity/block to the playerGargaj1-3/+3
2015-11-24Add enum for Sound and Particle EffectsDave Tucker1-1/+1
Fixes #2603 Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2015-11-23Changed static_cast to FloorCJulian Laubstein1-1/+1
2015-11-23Adjusted height validation using cChunkDef::IsValidHeight()Julian Laubstein1-1/+1
2015-11-03Implemented brewingLukas Pioch1-0/+33
2015-10-04Fixed a race condition between chunk loader and generator.Mattes D1-18/+18
When using ChunkWorx to generate multiple chunks, the server would sometimes fail an assert because it would generate a chunk even when it was successfully loaded. This was caused by chunks queued in cWorld's m_SetChunkDataQueue and thus being marked as "InQueue" although they were already loaded. Solved by adding a new parameter to chunk coord callbacks specifying whether the operation succeeded or failed, and using that instead of the chunk presence flag to decide whether to generate or not.
2015-09-25Maked it compileable for clang-3.7Lukas Pioch1-2/+2
2015-09-24Add new "ForEach" function: ForEachLoadedChunk.tycho1-0/+28
2015-08-18Some warning fixesJulian Laubstein1-1/+1
2015-07-31Unified the doxy-comment format.Mattes D1-1/+0
2015-07-29Silenced and fixed many warning messages across multiple files.Samuel Barney1-19/+19
2015-06-10Reinstate "Chunk queue collapsing"Tiger Wang1-16/+0
This reinstates commit f36acb683594daff5af3971dcbe3c3a171628b78 and reverts commit adfbc42c021e1bcfcb355933c0fd784306ce0e18.
2015-06-07Revert "Chunk queue collapsing"worktycho1-0/+16
2015-06-05Moved Chunk Broadcasts over to the regular queuetycho1-16/+0
2015-05-30Made cLightingThread own its callbackstycho1-2/+2
2015-05-09CheckBasicStyle: checks spaces around * and &.Mattes D1-9/+9
2015-05-07Added support for additional data in the ParticleEffect Packettycho1-0/+22
Also started refactoring how broadcasts are handled
2015-04-26Fix explosions trying to write to unread blockareaTiger Wang1-3/+5
2015-04-21Hotfixed some chunk presence issues when generating.Mattes D1-0/+2
2015-03-21Changed cEntity::m_UniqueID to UInt32.Mattes D1-7/+7
2015-02-08Handle client 'leave bed' requestTiger Wang1-4/+1
* Fixes #1728
2015-01-11Initial convertion of a_Dt to std::chronoTycho1-2/+2
also refactored cWorld::m_WorldAge and cWorld::m_TimeOfDay
2014-12-24Refactored all player block placing to go through hooks.Mattes D1-36/+67
Fixes #1618.
2014-12-17NULL -> nullptrTiger Wang1-1/+1
2014-12-10Added a cWorld:PrepareChunk function.Mattes D1-0/+97
It prepares the chunk - loads or generates it and lights it. The spawn prepare process uses this function.
2014-10-31Fixed missing CS lock in cChunkMap::WakeUpSimulatorsInArea().Mattes D1-0/+1
2014-10-23En masse NULL -> nullptr replaceTiger Wang1-139/+139
2014-10-20En masse NULL -> nullptr replaceTiger Wang1-139/+139
2014-10-15Functions in cPluginManager get references instead of pointers.Mattes D1-6/+8
2014-09-27Added barriers correctlyMasy981-0/+1
2014-09-26Removed more unessicary includesTycho1-1/+1
2014-09-12Fixed farmland issues.Howaner1-3/+3
2014-09-111.8: Added ParticleEffect packet.Howaner1-2/+2
2014-09-05WorldStorage no longer queues chunks into generator.Mattes D1-2/+2
2014-09-05Rewritten chunk status to specify whether the chunk is in queue.Mattes D1-51/+24
This fixes #1370.
2014-09-04Fixed compilation after chunk Y removal.madmaxoft1-1/+1
2014-09-03Added cWorld::ForEachEntityInBox()madmaxoft1-0/+32
2014-08-30Fixed style.madmaxoft1-2/+3
2014-08-29Improved explosion damageTiger Wang1-45/+22
2014-08-28remove y-coord from chunksLO1ZB1-129/+129
2014-07-30Exported the beacon.Howaner1-0/+18
2014-07-30Added beacon.Howaner1-0/+1
2014-07-24Added a queue for setting chunk data.madmaxoft1-16/+9
Fixes #1196.
2014-07-21SuggestionsTiger Wang1-1/+0
2014-07-21Style: Normalized to no spaces before closing parenthesis.madmaxoft1-36/+36
2014-07-19Fixed clamping issuesarchshift1-4/+1
2014-07-18Fixed spaces before commas.madmaxoft1-2/+2
2014-07-17Fixed spaces around single-line comments.madmaxoft1-11/+12
There should be at least two spaces in front and one space after //-style comments.
2014-07-17Fixed basic whitespace problems.madmaxoft1-3/+3
Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
2014-07-17Fixed crash with entities in unloaded chunksTiger Wang1-1/+3
* Fixes #1190
2014-07-15Derp.Howaner1-2/+2
2014-07-14Reset meta to zero when the block explode.Howaner1-4/+4
2014-07-13Added parenthasiesworktycho1-1/+1
2014-07-13Fixed MSVC warnings in SoundEffect functions.madmaxoft1-1/+1
2014-07-13Changed BroadcastSoundEffect function to take floating pos.Howaner1-3/+3
2014-07-13Fixed wrong types. (BLOCKTYPE -> NIBBLETYPE)Howaner1-2/+2
2014-07-10Implemented support for forced chunk ticking.madmaxoft1-2/+18
Fixes #1160.
2014-07-07Implemented trapped chests & othersTiger Wang1-1/+20
+ Added trapped chests * Fixed a bunch of bugs in the redstone simulator concerning wires and repeaters * Other potential bugfixes
2014-06-27Added generic entity-collecting.Mattes D1-3/+3
Now any cEntity can be collected, not only cPickups. This should help PR #1098.
2014-06-26Add Null check to SendBlockToworktycho1-1/+1
Fixes CID 43611
2014-06-16Merge branch 'master' of github.com:mc-server/MCServerTycho1-4/+16
2014-06-14Reformated ChunkMap.hTycho1-2/+5
2014-06-14Added generic Allocation Pool InterfaceTycho1-3/+9
2014-06-14fixed spacesTycho1-1/+1
2014-06-14fixed spacesTycho1-1/+1
2014-06-12Portals animate and delay correctlyTiger Wang1-0/+1
2014-06-10Fixed a race condition when adding a player to a world.madmaxoft1-0/+24
2014-05-25Hopefully fixed piston duplication issuesTiger Wang1-2/+2
* Fixes #879 * Fixes #714
2014-05-23Implemented Allocation Pool use by cChunkDataTycho1-4/+7
2014-04-27Fixed player spawning #953.madmaxoft1-1/+4
2014-04-27Redstone simulator now directly accesses cChunkTiger Wang1-2/+0
* Redstone simulator performance improvements * Added return values to some functions * Minor fixes
2014-04-26Implemented Chunk Sparsing with segmentsTycho1-10/+6
2014-04-26Removed unused assignments.archshift1-4/+2
2014-04-18Did some static analysis, fixed some bugs and optimized a lot of codejfhumann1-20/+20
2014-04-12Fixed chunkstays not being removed on auto-delete.madmaxoft1-9/+17
Fixes #837.
2014-03-27Fix merge conflictsHowaner1-7/+0
2014-03-27Add new leaves to all classes.Howaner1-0/+7
2014-03-20ENUMified shrapnel levelTiger Wang1-2/+2
2014-03-18Added levels of shrapnelTiger Wang1-3/+7
2014-03-18Fixed chunkmap tree block replacing.madmaxoft1-8/+2
2014-03-16Fixed double to float conversions.madmaxoft1-45/+46
2014-03-16Add new leaves to all classes.Howaner1-0/+7
2014-03-10Shrapnel now configurableTiger Wang1-1/+1
2014-03-07Add Lua Bindings for FlowerPotEntity.h and add documentation.Howaner1-2/+2
2014-03-07Add Flower PotsHowaner1-0/+18
2014-03-05Added extra awesomeness to TNTTiger Wang1-11/+20
+ TNT now has a chance of flinging FallingBlock entities around * Improved TNT damage * Improved TNT spawning visuals * Possible fix for 'SetSwimState failure' messages in debug
2014-02-24Fixed a possible crash in cWorld::WakeUpSimulatorsInArea().madmaxoft1-0/+4
The Y coords weren't checked.
2014-02-23Rename SkullEntity to MobHeadEntityHowaner1-2/+2
2014-02-23Add Heads completelyHowaner1-0/+18
2014-02-19Rename SkullEntity to MobHeadEntityHowaner1-2/+2
2014-02-18Add Heads completelyHowaner1-0/+18
2014-02-18Added cWorld:SetAreaBiome() API function.madmaxoft1-2/+59
Fixes #675.
2014-02-10Rewritten Lua ChunkStay API into a single function, cWorld:ChunkStay().madmaxoft1-2/+11
This fixes problems with indeterminate class object lifespan (Lua-GC) and forgetting to disable it or keep it until ready.
2014-02-08Initial ChunkStay code.madmaxoft1-113/+72
2014-02-05Fixed explosions bugTiger Wang1-1/+1
* Fixed bug where explosions would sometimes never be sent
2014-02-05Fixed a bunch of MSVS warningsTiger Wang1-1/+1
* Possibly also fixed some bugs with pathfinding and TNT, though unlikely
2014-02-03Greatly improved TNT propulsion chancesTiger Wang1-1/+1
2014-02-03Inversed conditionTiger Wang1-25/+28
2014-02-02Uncommented pickup spawner codeTiger Wang1-3/+7
2014-02-02TNT improvementsTiger Wang1-37/+115
+ Added entity damage + Added entity propulsion * Fixed #67 and fixed #230
2014-02-01Changed pointers to referencesTycho1-3/+3
2014-02-01Changed signitures of Several BLockHandler MethodsTycho1-4/+3
Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check
2014-01-26Refactored cBlockHandler::OnUse and dependentsTycho1-2/+57
2014-01-18Basic command block implementationandrew1-0/+17
2014-01-07More MSVC warning fixes.madmaxoft1-1/+1
2013-12-22Fixed compiler warning.STRWarrior1-1/+1
2013-12-22Implented BroadcastParticleEffectSTRWarrior1-0/+19
2013-12-20Fixed compiler warning when iterating over a fixed array of items (ARRAYCOUNT).madmaxoft1-12/+12
2013-12-15This adds the cWorld::BroadcastEntityEffect and cWorld::BroadcastRemoveEntityEffect functions.STRWarrior1-0/+33
2013-12-14Implemented note block playing and fixed wireTiger Wang1-0/+17
Game of Thrones music in Minecraft, here I come!
2013-12-08Moved bindings-related to a Bindings subfolder.madmaxoft1-1/+1
Ref.: #407
2013-12-07Renamed animation functionTiger Wang1-3/+3
Renamed BroadcastPlayerAnimation to BroadcastEntityAnimation. Not just players can have animations, you know.
2013-12-06Fixed duplication glitch with QueueSetBlockTiger Wang1-2/+2
If a coordinate was queued, and then the block there was broken, it would reappear: double items! Also now just sets meta if previous and current blocktypes matched.
2013-11-30Changed cBlockHandler->OnUpdate() to use cChunk directly.madmaxoft1-1/+18
2013-11-28Fixed a bug with TNT waking simulatorsTiger Wang1-2/+2
2013-11-28Improved TNT pickup randomisationTiger Wang1-1/+1
2013-11-27Made TNT pickups spawning chance 25%Tiger Wang1-2/+2
2013-11-27Fixed VC2008 compilation, normalized include paths.madmaxoft1-1/+1
2013-11-27Fixed the remaining derpsAlexander Harkness1-2/+2
2013-11-24Attempt to fix compilationTiger Wang1-2/+2
2013-11-24Moved source to srcAlexander Harkness1-0/+0
2013-11-20Added cWorld:ForEachBlockEntityInChunk() and cWorld:DoWithBlockEntityAt() functions.madmaxoft1-0/+33
Also exported them to the Lua API.
2013-11-10Bundled fixes [SEE DESC]Tiger Wang1-1/+1
* Fixed compiler warning in Monster.cpp * Future proofed particle effects * Improved pickups, made less jittery
2013-10-24TNT Spawns PickupsTiger Wang1-1/+15
Fixes FS#397.
2013-09-08Adding an Empty shell that would launch mob spawner - not called yetmgueydan1-0/+28
2013-09-07Adding mob census (sorry this is a big commit as work was done before git integration i couldn't split it more)mgueydan1-0/+32
2013-09-07Renamed cWorld::DoExplosiontAt() to cWorld::DoExplosionAt()madmaxoft1-1/+1
2013-08-19Moved entities into the Entities subfolder.madmaxoft1-4/+3
2013-08-18Implemented cWorld:QueueSetBlock(), as requested for delayed blocksetting.madmaxoft1-0/+17
Untested yet, so might not work.
2013-08-18Removed SetServerBlock griefing.madmaxoft1-18/+0
2013-08-18Properly fixed piston non-animationTiger Wang1-0/+18
Fixes #57
2013-08-09Added OnExploding() and OnExploded() hooks.madmaxoft1-18/+21
As requested in FS 413, with extra parameters: World, BlockX, BlockY, BlockZ, Size, CanCauseFire, Source, SourceData OnExploding() can return 3 values: StopHook, CanCauseFire, ExplosionSize
2013-08-03Added cWorld::DoWithChunk() function.madmaxoft1-0/+15
This will be used by the blocktracers to gain direct access to chunk data.
2013-08-03Removed the unused BlockY parameter from cChunkDef::BlockToChunk()madmaxoft1-13/+13
2013-07-07Improved function names for protocol packet sending; alpha-sorted the function listsmadmaxoft@gmail.com1-76/+69
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1659 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-07-01Rewritten entity-on-fire management ("forever on fire" bugs)madmaxoft@gmail.com1-3/+3
Fixes FS #297 and part of FS #403. Added sizes to all entities. Moved all damage-related functions from cPawn to cEntity API change: renamed cPawn:TeleportTo() to cEntity:TeleportToCoords() git-svn-id: http://mc-server.googlecode.com/svn/trunk@1635 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-25Added a warning when spawning an entity in a non-existent chunkmadmaxoft@gmail.com1-0/+3
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1627 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-21Explosions don't produce warnings in cBlockArea; fixed logging in cBlockAreamadmaxoft@gmail.com1-1/+7
Fixes FS #389 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1616 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-21Simulators are woken up after an explosion.madmaxoft@gmail.com1-3/+63
Fixes FS #391 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1615 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-19Improved commentmadmaxoft@gmail.com1-1/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1609 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-18Explosions do not effect the terrain when they are in water.nielsbreu@gmail.com1-0/+11
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1608 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-18More TNT fixes.madmaxoft@gmail.com1-37/+35
Chain-reaction TNTs are spawned in proper coordinates (FS #390) Centralized Primed TNT entity spawning and made available to the plugins. Internal changes for better TNT performance. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1604 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-18TNT fixes.madmaxoft@gmail.com1-6/+39
Other blocks can be placed next to TNT. Explosions activate nearby TNT blocks. TNT doesn't destroy bedrock, obsidian and liquid blocks. Server doesn't crash when a TNT (or other entity) leaves the valid Y range. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1603 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-12Added cWorld::SetSignLines(), re-exported to Lua manually to avoid ghost return valuesmadmaxoft@gmail.com1-4/+4
FS #364 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1582 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-28Chunk / ChunkMap: Added support for unbounded querying blocktype-only or blockmeta-onlymadmaxoft@gmail.com1-0/+46
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1522 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-26Implemented droppersmadmaxoft@gmail.com1-0/+66
Added a common ancestor class "DropSpenser" that has the common code for dropper and dispenser and is Lua-accessible, too. The Debuggers plugin now triggers both droppers and dispensers when rclking them with a redstone torch. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1514 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-19Fixed cWorld:ForEachEntity()madmaxoft@gmail.com1-1/+1
Fix for FS #374. The function was processing only one chunkmap layer object, due to an inverse condition. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1491 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-05-04Explosion: Switched from a cube to a sphere. Implemented using cBlockArea and moved block changing code to ChunkMapkeyboard.osh@gmail.com1-0/+30
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1441 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-27Fixed a few possible crashes upon server stopmadmaxoft@gmail.com1-3/+5
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1418 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-13Proper entity removal functionsmadmaxoft@gmail.com1-34/+14
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1386 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-04-13Rewritten entities so that they are owned by individual chunks and ticked within their chunk's Tick()madmaxoft@gmail.com1-62/+218
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1385 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-03-18Added support for the packet #28 (0x1C): ENTITY_VELOCITYkeyboard.osh@gmail.com1-0/+16
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1283 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-03-14Fix for the Vaporize fluid simulator when loading chunks.madmaxoft@gmail.com1-1/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1271 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-03-03Player can sit in minecarts (but not move them yet)madmaxoft@gmail.com1-0/+15
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1249 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-02-28Simulators now have direct access to the cChunk object in the WakeUp() callmadmaxoft@gmail.com1-4/+21
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1227 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-02-27Fixed a copypasta error from rev 1224madmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1226 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-02-27Made FAST_FLOOR_DIV work correctly, replaced all floorf() divisions with it.madmaxoft@gmail.com1-5/+5
Still not perfect - chunk and region calculations can be made into a single CPU instruction - SAR - but not all compilers are known to support that (">>" operator on signed datatypes needs to perform arithmetic shift, C/C++ standard makes it implementation-specific; MSVC and GCC do what we need, LLVM unknown) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1224 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-02-05Added new hooks: OnChunkAvailable(), OnChunkUnloaded() and OnChunkUnloading(). Modified OnChunkGenerated() signature.madmaxoft@gmail.com1-1/+9
http://forum.mc-server.org/showthread.php?tid=464&pid=6312#pid6312 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1193 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-12-26Dispensers can dispense items and liquids nowluksor111@gmail.com1-0/+33
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1105 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-12-14cChunk now tracks its neighbors as direct pointers; used in UnboundedRelGetBlock et al.madmaxoft@gmail.com1-2/+74
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1073 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-11-11Removed an unused obsolete function chain - cWorld::GetChunkBlockData()madmaxoft@gmail.com1-16/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1036 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-26Fixed a valgrind warning in BlockDirt.madmaxoft@gmail.com1-2/+6
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1011 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-21Added jukeboxes (patch contributed by Luksor)madmaxoft@gmail.com1-0/+19
git-svn-id: http://mc-server.googlecode.com/svn/trunk@994 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-20Made cWorld's block query functions more orthogonal, added GetBlockInfo() returning all info on a block.madmaxoft@gmail.com1-9/+44
git-svn-id: http://mc-server.googlecode.com/svn/trunk@986 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-14Floody fluid simulator now dries up correctly, too.madmaxoft@gmail.com1-30/+49
git-svn-id: http://mc-server.googlecode.com/svn/trunk@964 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-06BlockArea writing support (BlockTypes with BlockMeta only)madmaxoft@gmail.com1-0/+39
git-svn-id: http://mc-server.googlecode.com/svn/trunk@933 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-29Beds can be slept in now (it doesn't change the time though)faketruth1-0/+19
git-svn-id: http://mc-server.googlecode.com/svn/trunk@911 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-25Added the block dig animation packet (patch contributed by l0udPL)madmaxoft@gmail.com1-0/+19
git-svn-id: http://mc-server.googlecode.com/svn/trunk@892 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-24Source files cleanup: The rest of the files renamed.madmaxoft@gmail.com1-7/+7
git-svn-id: http://mc-server.googlecode.com/svn/trunk@887 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-23Source files cleanup: OSSupport-related files in a separate subfolder, renamed.madmaxoft@gmail.com1-1/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@885 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-23Source files cleanup: Generating-related files in a separate subfoldermadmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@881 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-11Merged in a patch for sounds by l0udPLmadmaxoft@gmail.com1-0/+19
http://forum.mc-server.org/showthread.php?tid=434&pid=4564#pid4564 git-svn-id: http://mc-server.googlecode.com/svn/trunk@858 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-31Progress on the 1.3.2 protocol.madmaxoft@gmail.com1-2/+2
Sometimes the client lets the player through, but most of the times the connection breaks for no apparent reason. git-svn-id: http://mc-server.googlecode.com/svn/trunk@812 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-29Gotten completely rid of all cPackets. The cProtocol125 class now does all the parsing and writing by itself.madmaxoft@gmail.com1-4/+4
git-svn-id: http://mc-server.googlecode.com/svn/trunk@802 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-27Cut out all packet handling to a separate cProtocol descendantmadmaxoft@gmail.com1-38/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@796 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-26git-svn-id: http://mc-server.googlecode.com/svn/trunk@795 0a769ca7-a7f5-676a-18bf-c427514a06d6madmaxoft@gmail.com1-0/+16
2012-08-25cWorld doesn't use cPackets.madmaxoft@gmail.com1-0/+18
git-svn-id: http://mc-server.googlecode.com/svn/trunk@789 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-24cPickup doesn't use cPackets.madmaxoft@gmail.com1-0/+16
Also, Lua API change, OnCollectItem -> OnCollectPickup; first param is cPlayer to match other callbacks. git-svn-id: http://mc-server.googlecode.com/svn/trunk@786 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-24Monster classes don't use cPackets. Chat messages are sent / broadcast without cPackets. BlockEntities don't use cPackets.madmaxoft@gmail.com1-0/+50
git-svn-id: http://mc-server.googlecode.com/svn/trunk@783 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-19Window, Chest, Furnace and Pawn are not using cPackets at allmadmaxoft@gmail.com1-0/+33
git-svn-id: http://mc-server.googlecode.com/svn/trunk@762 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-19Almost all packets' handling is now rewritten not to use cPacket descendants elsewhere than in cClientHandle.madmaxoft@gmail.com1-0/+108
git-svn-id: http://mc-server.googlecode.com/svn/trunk@761 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-19Another handful of packets rewritten.madmaxoft@gmail.com1-0/+32
Also changed cItem::m_ItemID into m_ItemType of type short. Easier handling. m_ItemID kept for compatibility reasons (Lua-interface etc.) git-svn-id: http://mc-server.googlecode.com/svn/trunk@756 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-06A bit of cleanup and documentation around the UI window handlingmadmaxoft@gmail.com1-3/+3
git-svn-id: http://mc-server.googlecode.com/svn/trunk@716 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-03Fixed a few gcc pedantic warnings; made BLOCKTYPE an unsigned char type.madmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@711 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-07-02Temporary jungle trees (swamp-like), based on code by STR_Warrior). Also vines don't overwrite leaves anymore.madmaxoft@gmail.com1-0/+8
git-svn-id: http://mc-server.googlecode.com/svn/trunk@646 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-07-02cBlockArea object added (with only minimal testing so far)madmaxoft@gmail.com1-0/+29
git-svn-id: http://mc-server.googlecode.com/svn/trunk@641 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-17Removed the deprecated GetBlockEntity(), added several enumerators to replace it.madmaxoft@gmail.com1-0/+84
git-svn-id: http://mc-server.googlecode.com/svn/trunk@629 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-16Exported cWorld::ForEachEntity and cWorld::ForEachEntityInChunk; no idea if they actually workmadmaxoft@gmail.com1-0/+15
git-svn-id: http://mc-server.googlecode.com/svn/trunk@620 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-14Attempt to bring sanity to newlines across systems.cedeel@gmail.com1-1485/+1485
git-svn-id: http://mc-server.googlecode.com/svn/trunk@606 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-09Cacti grow by themselves and by bonemealmadmaxoft@gmail.com1-0/+17
git-svn-id: http://mc-server.googlecode.com/svn/trunk@583 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-08Sugarcane grows and can be grown using bonemeal.madmaxoft@gmail.com1-0/+17
git-svn-id: http://mc-server.googlecode.com/svn/trunk@578 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-07Bonemeal works on crops, melons, pumpkins, saplings and grass. Plant growing has been refactored into separate functions callable from Lua, too.madmaxoft@gmail.com1-0/+17
git-svn-id: http://mc-server.googlecode.com/svn/trunk@573 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-07Repeaters' delays can be set by rclkmadmaxoft@gmail.com1-0/+17
git-svn-id: http://mc-server.googlecode.com/svn/trunk@570 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-06-06Item-dropping code rewritten and centralized - now there's only one place to modify if we want to split or merge same-item drops: cWorld:SpawnItemPickups(). Also, mined blocks can now drop more items, and they recognize if they're being mined by the correct tool.madmaxoft@gmail.com1-17/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@561 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-05-30Added support for SetNextBlockTick() function callable from Luamadmaxoft@gmail.com1-0/+17
git-svn-id: http://mc-server.googlecode.com/svn/trunk@527 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-05-29Added code for the chunks to manipulate their neighbors while ticking. Also added some basic farming support - melon and pumpkin growing code. Untested and untestable so far, will test and fix later.madmaxoft@gmail.com1-15/+59
git-svn-id: http://mc-server.googlecode.com/svn/trunk@518 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-05-25Merged the composable_generator branch into the trunkmadmaxoft@gmail.com1-28/+190
git-svn-id: http://mc-server.googlecode.com/svn/trunk@504 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-04-10Added the "/regeneratechunk" command that regenerates either current chunk or a chunk specified with x, z parameters. TODO: permissions - we don't want guests erasing our chunks!madmaxoft@gmail.com1-1/+16
git-svn-id: http://mc-server.googlecode.com/svn/trunk@454 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-22Fixed a deadlock by removing clients from all chunks upon their exit, not using the clients chunklists.madmaxoft@gmail.com1-4/+19
git-svn-id: http://mc-server.googlecode.com/svn/trunk@426 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-16That didn't work.. I forgot some cChunk functions were changed. Now it should compile againfaketruth1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@417 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-16Exposed a function to Lua to get a block's sky light valuefaketruth1-1/+19
git-svn-id: http://mc-server.googlecode.com/svn/trunk@416 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-14Unified the chunk data to use the BLOCKDATA datatype.madmaxoft@gmail.com1-4/+4
git-svn-id: http://mc-server.googlecode.com/svn/trunk@413 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-14Split chunk data into separate arrays; decoupled most sources from cChunk.h dependencymadmaxoft@gmail.com1-24/+41
git-svn-id: http://mc-server.googlecode.com/svn/trunk@411 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-09cClientHandles have a unique ID now to distinguish themfaketruth1-2/+3
cAuthenticator uses unique client ID for authentication Changed the kick function used by cAuthenticator to take a client ID instead of name, so the correct user is kicked Using callback reference instead of pointer in GetChunkData and affiliates GetChunkData returns false when failed, and true when succeeded Renamed entity type enums to something prettier Exposed some functions to Lua git-svn-id: http://mc-server.googlecode.com/svn/trunk@388 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-05ChunkSender: Chunks are now compressed and sent to clients from a separate threads, proper passive waiting between threads. Not much tested, just appears to work :)madmaxoft@gmail.com1-24/+27
git-svn-id: http://mc-server.googlecode.com/svn/trunk@365 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-28Linux compilation fix (y u no support const_iterator, gcc?)madmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@338 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-28Chunk now has an indicator of load failure; Chunk generator uses cChunkStaymadmaxoft@gmail.com1-0/+20
git-svn-id: http://mc-server.googlecode.com/svn/trunk@337 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-28Implemented synchronous chunk loading; optimized cChunkStay interface for speed (though still unused ;)madmaxoft@gmail.com1-38/+111
git-svn-id: http://mc-server.googlecode.com/svn/trunk@336 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-28Const-correctness for packet broadcasting (fixes GCC compilation)madmaxoft@gmail.com1-2/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@333 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-27Fix for the perpetual load issuemadmaxoft@gmail.com1-1/+7
git-svn-id: http://mc-server.googlecode.com/svn/trunk@332 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-26Implemented chunk loading without generating on load-failuremadmaxoft@gmail.com1-3/+13
git-svn-id: http://mc-server.googlecode.com/svn/trunk@331 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-26New cChunkStay class for temporarily keeping chunks loaded even when then have no clients. For now unused, will be used by generator and lighting in the future.madmaxoft@gmail.com1-0/+91
git-svn-id: http://mc-server.googlecode.com/svn/trunk@330 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-23Plain pointer cChunkPtr finishing touches; removed cChunk's critical sectionsmadmaxoft@gmail.com1-0/+15
git-svn-id: http://mc-server.googlecode.com/svn/trunk@325 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-23Made cChunkPtr a plain old pointer again, since it's safe nowmadmaxoft@gmail.com1-4/+6
git-svn-id: http://mc-server.googlecode.com/svn/trunk@324 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-22Fixed a potential deadlock in cChunkMap::m_CSLayers vs cWorld::m_CSAllEntitiesmadmaxoft@gmail.com1-6/+8
git-svn-id: http://mc-server.googlecode.com/svn/trunk@313 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-21Removed cChunkPtrs from everywhere but internal cChunkMap usage. Now we should finally be threadsafe :)madmaxoft@gmail.com1-3/+140
Also fixed a threading issue when a player connecting might have gotten stuck in "Downloading world" forever git-svn-id: http://mc-server.googlecode.com/svn/trunk@304 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-21Fixed heightmap optimization from rev 302; removed a few more cChunkPtrsmadmaxoft@gmail.com1-0/+45
git-svn-id: http://mc-server.googlecode.com/svn/trunk@303 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-21Fixed block-getting so that simulators work againmadmaxoft@gmail.com1-0/+37
git-svn-id: http://mc-server.googlecode.com/svn/trunk@301 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-20Removed some more cChunkPtr usagemadmaxoft@gmail.com1-6/+138
git-svn-id: http://mc-server.googlecode.com/svn/trunk@298 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-20Using own ASSERT() that logs to filefaketruth1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@297 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-18Substantial cWorld::FastSetBlock() speed up by queueing all such calls and processing them later chunk-wise (makes growing trees in the generator fast again)madmaxoft@gmail.com1-0/+51
git-svn-id: http://mc-server.googlecode.com/svn/trunk@295 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-18Re-implemented tree-growing. May produce artefacts on old-world / new-world boundaries.madmaxoft@gmail.com1-0/+16
git-svn-id: http://mc-server.googlecode.com/svn/trunk@293 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-18Thread-safe chunk generation, storage and generator are queried for progress while initializing servermadmaxoft@gmail.com1-1/+58
Note that this commit breaks foliage generation - there are no trees in the chunks generated! git-svn-id: http://mc-server.googlecode.com/svn/trunk@292 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-17Chunk coords mostly "upgraded" to include the Y coord for future compatibilitymadmaxoft@gmail.com1-6/+24
git-svn-id: http://mc-server.googlecode.com/svn/trunk@285 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-16cWorldGenerator speedup - doesn't call GetChunk() anymore, not queueing the chunk it's generating to be loaded recursively.madmaxoft@gmail.com1-1/+11
cChunk fix - setting a block to the same value doesn't mark chunk dirty (resulted in un-unloadable chunks) git-svn-id: http://mc-server.googlecode.com/svn/trunk@279 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-16Chunk is now marked as dirty; saving only dirty chunks; rewritten load / save not to use cChunkPtr; set VC2008 project to level4 warnings; block entities are now loaded and saved properlymadmaxoft@gmail.com1-6/+105
git-svn-id: http://mc-server.googlecode.com/svn/trunk@273 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-16Chunks are properly saved before being unloaded nowfaketruth1-0/+3
numchunks server command works again git-svn-id: http://mc-server.googlecode.com/svn/trunk@272 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-15Restored chest and furnace functionality as it was (it's basically working but joined chests show single-chest window)madmaxoft@gmail.com1-0/+38
git-svn-id: http://mc-server.googlecode.com/svn/trunk@263 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-13Rewritten most of the code for multithreading; still not 100%, but getting there. If this commit proves to be too problematic, we can always undo it.madmaxoft@gmail.com1-456/+112
git-svn-id: http://mc-server.googlecode.com/svn/trunk@251 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-08Removed unused codemadmaxoft@gmail.com1-15/+8
git-svn-id: http://mc-server.googlecode.com/svn/trunk@249 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-08MTRand class is not created in each tick, therefore much improving tick-thread time (now uses ~5 % CPU instead of one full core)madmaxoft@gmail.com1-2/+2
git-svn-id: http://mc-server.googlecode.com/svn/trunk@245 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-01AString logging fix 2madmaxoft@gmail.com1-7/+7
git-svn-id: http://mc-server.googlecode.com/svn/trunk@218 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-01sprintf() begone! Replaced with StringUtils' Printf()madmaxoft@gmail.com1-6/+5
git-svn-id: http://mc-server.googlecode.com/svn/trunk@216 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-01Removed a few duplicate includesmadmaxoft@gmail.com1-2/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@215 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-31Linux fixes, but while it compiles, when a user joins it crashes the server with "*** glibc detected *** ./MCServer: double free or corruption (out): 0x00007fb5f5158db0 ***"mtilden@gmail.com1-0/+1
Please look into this. Also, am I the only one compiling/using Linux? git-svn-id: http://mc-server.googlecode.com/svn/trunk@198 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-30Added a WebAdmin interface to view users their groups, and the permissions of groups.faketruth1-1/+1
cChunk::Tick did an assertion in cCSLock, I used a cCSUnlock to fix it, but not sure if this is correct. git-svn-id: http://mc-server.googlecode.com/svn/trunk@194 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-30More cFile cleanup; removed old format writing for block entitiesmadmaxoft@gmail.com1-4/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@193 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-30Initial cFile implementation (using stdio FILE) and test in cChunkMapmadmaxoft@gmail.com1-84/+86
git-svn-id: http://mc-server.googlecode.com/svn/trunk@192 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-29Old code begone! ChunkMap cleanupmadmaxoft@gmail.com1-348/+250
git-svn-id: http://mc-server.googlecode.com/svn/trunk@189 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-29VC2008 / VC2010: Enabled precompiled header through Globals.h; the header included in every module in the project. Compilation optimization.madmaxoft@gmail.com1-6/+9
git-svn-id: http://mc-server.googlecode.com/svn/trunk@188 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-29ChunkGenerator: rewritten thread-locking using the new RAII CSLock classmadmaxoft@gmail.com1-3/+4
git-svn-id: http://mc-server.googlecode.com/svn/trunk@186 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-27MSVC 2008 Express compatibility: Added the projects, modified sources to compile. Tested on MSVC 2008 Express and MSVC 2010 Expressmadmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@179 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-19Terrain generation is synchronous again, async generation has bugs.faketruth1-1/+1
Made some funky smart pointer things for chunks. Fixed a bug where the client would override the player position on the server and back again, resulting in sending too many chunks to the client which it doesn't even need. Fixed some compiler warnings in cPickup.cpp git-svn-id: http://mc-server.googlecode.com/svn/trunk@164 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-01Fixed the numchunks console command.faketruth1-1/+11
Added some form of reference counting to cChunk to make sure it's not referenced when deleting it. Right now it's only needed due to the generation of chunks in a separate thread and adding it to the spread light list in cWorld git-svn-id: http://mc-server.googlecode.com/svn/trunk@161 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-27Users file was pretty messed up with mixed unix and windows line endings. The ini failed to parse correctly under cygwin.faketruth1-1/+1
'Fixed' a 'bug' where MCServer would seemingly endlessly calculate lighting for an entire world (and then crash), when this entire world has 'wrong' lighting. This happens when running a converted map from Vanilla. Fixed this by only allowing a maximum of 50 chunks to recalculate their lighting per tick. Fixed a small coding error in cChunkMap where it would check PakVersion twice, instead of also ChunkVersion. DeNotch converter does not need the VS2010 runtime thingies anymore git-svn-id: http://mc-server.googlecode.com/svn/trunk@138 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-25Chunks are generated in a separate thread allowing players to keep on playing and chatting while chunks are generated. This means, however, that cWorld::GetChunk() does not always return a chunk and is something you need to be aware of. I am not entirely sure if all this is completely stable, but I think so :Ofaketruth1-0/+2
Chunks are now generated before the player is able to see them. This is done because after a chunks is done generating, some blocks might still need to be set (parts of trees from neighboring chunk), causing more bandwidth to be used (each changed block needs to be sent to clients again) and (fps) lagging the clients when changing a lot of blocks. Calculating ahead fixes these issues. Separated the placing of foliage (trees and stuff) when generated chunks into a new function GenerateFoliage() Cleaned up the VS2010 project, now using some VS2010 specific functions like dependencies on projects (no need for setting library dependencies manually). VS2010 project now compiles way faster in Release by using multi threading. git-svn-id: http://mc-server.googlecode.com/svn/trunk@103 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-11-01You can now run multiple worlds by defining them in settings.ini . However there's no way to change worlds on the fly yetfaketruth1-12/+8
Players are now stored in separate folder /players instead of in the world folder (!so move the folder!) Fixed a memory leak/error in cPickup.cpp Multiple worlds are stored in cRoot cClientHandle lists are taken out of cWorld and now stored in cServer Worlds now have names to distinguish them by Some functions in the Core plugin now distinguish between worlds git-svn-id: http://mc-server.googlecode.com/svn/trunk@40 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-11-01Players can now place blocks in creative mode. The blocks players select from the creative mode inventory are not stored in the players' inventory. (I kind of like that)admin@omencraft.com1-0/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@37 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-31denotch map converter works! :Dadmin@omencraft.com1-8/+9
git-svn-id: http://mc-server.googlecode.com/svn/trunk@36 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-31Prepared some parts of the code for multi world support, I created lots of TODO'sfaketruth1-3/+4
git-svn-id: http://mc-server.googlecode.com/svn/trunk@29 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-30Changed cChunkMat.cpp back to normal. Made more changes to the denotch map converter. Testing cNBTData parser.admin@omencraft.com1-5/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@21 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-29Added denotch map converter. Program currently reads the only mcr file in the region dir and writes the uncompressed chunk data in world/X0-Z0.pak. I compile in linux with "g++ cConvert.cpp -lz -o denotch"admin@omencraft.com1-5/+10
git-svn-id: http://mc-server.googlecode.com/svn/trunk@20 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-21Compiles for linuxfaketruth1-0/+3
git-svn-id: http://mc-server.googlecode.com/svn/trunk@6 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-10-03MCServer c++ source filesfaketruth1-0/+714
git-svn-id: http://mc-server.googlecode.com/svn/trunk@3 0a769ca7-a7f5-676a-18bf-c427514a06d6