1
0
Fork 0
Commit Graph

528 Commits

Author SHA1 Message Date
Mattes D bdedab15c9
Falling blocks can now be spawned at any position. (#4620)
* Falling blocks can now be spawned at any position.

* Added a /cake command to Debuggers that throws a cake in a nice slow arc.

* Fixed regular falling blocks.
2020-04-09 20:25:20 +00:00
Mat 6a21bf979c
Initial resource pack support (#4622) 2020-04-07 21:23:54 +00:00
Mat 60bcc06f43
Implement wither skeletons (#4563) 2020-04-04 13:44:17 +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
peterbell10 59e38d1a46
Fix explosion knockback issues and tweak knockback strength (#4590) 2020-04-02 09:29:42 +02:00
peterbell10 6116f899de
Fix client disconnect assert (#4579) 2020-03-29 22:58:19 +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 195bebb480
Disable bonemealable settings for now (#4551) 2020-03-26 17:06:15 +00:00
Mat b7e88e2c9f
Fix nether mob spawning (#4546)
* Fix nether mob spawning

* Remove zombie from nether mobs
2020-03-25 10:49:36 +00:00
Mat 7700116330
Pickup spawn improvements (#4525)
Pickups are now thrown around when spawned, like in vanilla. Pickups also bail out of the collision detection checks while being created, to prevent them from blasting too far off in e.g. cobblestone generators.
2020-03-23 00:05:47 +00:00
Mat c968f1f7da
TNT position fixes (#4519)
* 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-22 17:33:36 +02:00
Mat 61a6a18b79
Improve explosion visuals (#4511) 2020-03-20 23:42:16 +00:00
Mat 7d4934534e
Stabilise MoveToWorld (#4004)
* Stabilise MoveToWorld

* Fix comments and deprecate ScheduleMoveToWorld

* Enhanced thread safety for m_WorldChangeInfo

* Return unique_ptr from cAtomicUniquePtr::exchange

* cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld.

Allows broadcasting entities added to the world from the world's tick thread.
This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize.

As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible.
This isn't used anywhere in Cuberite so it's now deprecated.

* Update entity position after removing it from the world.
Fixes broadcasts being sent to the wrong chunk.

* Fix style

* cEntity: Update LastSentPosition when sending spawn packet

* Add Wno-deprecated-declarations to the lua bindings

* Kill uses of ScheduleMoveToWorld
2020-03-05 12:52:34 +02:00
NiLSPACE dc787e1d96 Improved large jungle and acacia tree generation (#4413) 2019-12-22 23:38:11 +01:00
Mattes D 61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D 221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes D 365cbc6e1c
Refactored more of Entities and BlockEntities to use Vector3. (#4403) 2019-09-29 14:59:24 +02:00
Mattes D 180a43d097 Fixed MSVC warnings (#4400) 2019-09-27 16:51:44 +01:00
Mattes D 66e73a2d68 NBTChunkSerializer: Cleaned up interface.
Removed dependency on cChunkDataCallback.
Moved all the serializing code into a worker class.
Changed the serialization into a single-call action.
2019-09-24 17:38:59 +02:00
Mattes D 878393a03d Moved the generator defaults to ComposableGenerator. 2019-09-06 16:12:33 +02:00
Mattes D a2ffa432b3 Separated chunk generator from world / plugin interfaces.
The generator now only takes care of servicing synchronous "GetChunk(X, Y)" and "GetBiomes(X, Y)" requests.
2019-09-06 16:12:33 +02:00
peterbell10 4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
changyong guo 57690b81a2 Experience orb (#4259)
* Replace cWorld::FindClosesPlayer with cWorld::DoWithClosestPlayer
* Implement experience reward splitting into the orb sizes used in vanilla
* Modified speed calculation in cExpOrb::Tick to make the orbs fly towards the player

Fixes #4216
2018-08-02 15:59:10 +01:00
peterbell10 cdd8e42587
cWorld: Manually bind deprecated broadcast functions (#4265)
Ref: https://github.com/cuberite/cuberite/pull/4264#discussion_r204769193
2018-07-27 00:12:41 +01: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 c94d7184eb Broadcast refactor (#4264)
* 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-24 22:30:49 +01:00
changyong guo 01e72ddb65 Rewrite explosion knock back (#4251)
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
2018-07-23 10:24:00 +01:00
Bond-009 98d807187b Removed duplicate code (#4198)
Should also fix dogs not despawning
2018-04-11 12:17:30 +01:00
peterbell10 d3c1c626f5
Deal with covered switches consistently (#4161)
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.

* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.

* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()
2018-02-04 23:07:12 +00:00
Bond-009 d11335e4f6 Add world name in logs from cWorld (#4148) 2018-01-16 22:04:39 +00:00
Alexander Harkness 6309c6a97f
improve rain simulation (#4017)
* Uses vanilla logic to decide which blocks rain falls through.
 * Rain falls infinitely above the world, and stops at y=0.
 * Entities will now be extinguished if they are under rain-blocking
blocks, and fire will now be extinguished by rain similarly.
 * Create IsWeatherWetAtXYZ to identify wetness at a particular location. 
 * Use new code for enderman rain detection.
 * Fixes issue #916
 * Disable warnings for global constructors in the fire simulator.
2017-12-26 21:25:57 +00:00
peterbell10 c54bf40ef9 cWorld Threads: Seperate initialization and thread start.
Prevents nullptr dereferences before Start has been called.
2017-10-21 19:33:22 +02:00
peterbell10 1537ebed6f cWorld: Move Initialization from Start to the constructor.
Start now does nothing more than launch the world's threads.
2017-10-21 19:33:22 +02:00
Bond-009 10c5c1227e BroadcastBlockBreakAnimation and BroadcastBlockEntity use vectors (#4038) 2017-09-25 18:17:45 +02:00
Lane Kolbly 30c8470a52 Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959)
* 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-19 15:12:54 +01:00
Lukas Pioch c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
peterbell10 e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
Lane Kolbly b12f4ef7d5 Made world data paths adjustable, and added API to temporarily disable saving chunks to disk. (#3912) 2017-09-07 13:41:16 +01:00
Bond-009 104f9e127b Changed some int parameters to vector parameters (#3937) 2017-09-07 10:25:34 +02:00
peterbell10 ef1f371dab Add cWorld::RemoveEntity and use in cEntity (#4003)
* Add cWorld::RemoveEntity and use in cEntity

* cEntity: Remove uneeded asserts from Destroy and DoMoveToWorld
2017-09-05 15:11:35 +01:00
LogicParrot 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
peterbell10 1779db1201 cWorld: Add entities without holding of m_CSEntitiesToAdd
* Fixes deadlock when cWorld::AddEntity is called while holding chunk map CS.
2017-08-29 15:46:36 +02:00
peterbell10 f4f2fc7c3d Add cUUID class (#3871) 2017-08-25 13:43:18 +01:00
Pablo Beltrán b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
Tiger Wang 72d7027861 Merge pull request #3489 from cuberite/EntityOwnership
* Changed entity ownership model to use smart pointers
2017-08-18 11:17:56 +01:00
Lane Kolbly 7bdbfad1bb Changed int parameters to vector parameters in cCuboid and simulators (#3874) 2017-08-17 15:48:38 +02:00
Tiger Wang 4ef47aed62 Changed entity ownership model to use smart pointers 2017-08-07 19:24:16 +01:00
peterbell10 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
Lukas Pioch 4691bc5a29 Removed double includes (#3885) 2017-08-02 19:57:20 +01:00
peterbell10 8eb5672920 cWorld::SendBlockTo take player by ref 2017-08-01 08:21:20 +02:00
peterbell10 a56cfd1f42 Remove smart pointer macros 2017-07-21 14:41:51 +01:00
Mattes D 167c4bf2e6 Simulators: Added area-based wakeup. 2017-07-16 10:01:19 +02:00
Lane Kolbly 793acd267f Changing pickup lifetime and combining semantics, making these adjustable in the lua api. (#3843) 2017-07-12 12:13:27 +02:00
Lukas Pioch 885d828712 Added bed entity (#3823)
* 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-07-07 09:31:45 +02:00
Bond-009 3d56ad01aa Let water vaporise in the Nether by default 2017-06-20 09:28:00 +02:00
peterbell10 f4de38af80 Remove sign conversion 2017-06-16 07:07:02 +02:00
peterbell10 360d8eade0 FastRandom rewrite (#3754) 2017-06-13 21:35:30 +02:00
Lukas Pioch 73a3c4e3be Exported boat
- NBT: Added saving / loading of material
- Added the material in the item handler of the boat
- Drop the correct boat if destroyed
- APIDoc: Added desc and functions
2017-05-24 19:02:18 +02:00
Pablo Beltrán 2359611c57 Don't destroy monster when last target type is a player (#3721)
In current Cuberite version if you are pursued by monsters you just have to disconnect and connect again to get rid of them. If no other player is in your chunk monsters will get destroyed.
2017-05-21 10:29:06 +02:00
Mattes D 2c3c1f1527 Tracer replacement (#3704)
* Replaced cTracer usage with cLineBlockTracer.

* Exported new cLineBlockTracer utility functions to Lua API.
2017-05-11 13:34:36 +01:00
Lukas Pioch 5580d558a5 Added missing checks for Initialize function and updated APIDoc 2017-05-08 06:31:45 +02:00
Bond-009 ca3aa4ca06 Changed world_end to world_the_end #3531 (#3538) 2017-02-24 10:02:16 +01:00
mathiascode dae2adde65 Updated sounds and effect IDs (#3422) 2017-02-15 06:05:24 +01:00
mathiascode 4311f4a658 Added some blocks and items (#3503) 2017-02-14 11:13:55 +01:00
Lawton Mizell 043aa4e574 Made survival the default gamemode (#3563) 2017-02-07 16:00:30 +01:00
Mattes D 97980d1103 World: Remember the age persistently. (#3556) 2017-01-19 22:45:23 +01:00
Mattes D dfa8f278ea World: Removed LineBlockTracer test code. (#3555)
The test for LineBlockTracer is already in the Debuggers plugin (/spidey and testtracer commands).
2017-01-19 21:06:42 +01:00
Mattes D a4955dfda3 Removed asserts about chunk queued.
The assumption is not needed and was invalid under a stress-test.
2017-01-19 16:25:07 +01:00
Mattes D 7cc3fb098d DeadlockDetect now lists some tracked CS's stats. 2017-01-18 09:03:05 +01:00
Fabian Stein 90fcf9814f World: Add check for unknown RedstoneSimulator (#3496) 2016-12-29 00:41:20 +01:00
Mattes D 0e3b3be766 Initial support for the 1.11 protocol. 2016-12-16 00:07:22 +01:00
Tiger Wang 8c6d0b51c7 Use CMake's Android generators to crosscompile 2016-12-12 14:32:32 +00:00
Mattes D 0bffa29358 Removed ClientHandle.h dependencies from common headers. 2016-11-18 20:00:04 +01:00
bibo38 cb640ffea4 Spectators added (#2852) 2016-10-12 14:38:45 +02:00
LogicParrot 7e9e7f7911 Configurable dirty unused chunk cap to avoid RAM overuse (#3359)
Configurable dirty unused chunk cap to avoid RAM overuse
2016-09-03 18:38:29 +03:00
ElNounch e9d1a942d1 Delay EntityChangedWorld players' callback until Entity fully linked to world (#3330)
Otherwise, some API calls just don't seem to happen
.gitignore tweak for test executables
2016-08-22 19:43:43 +02:00
ElNounch 343531bafa Added cWorld:SetSpawn() API and Lua binding (#3316) 2016-08-15 10:41:32 +02:00
Alexander Harkness 320d1c6151 Fix tab list sometimes not updating after a player leaves. (#3280)
When a player leaves the game, their client handle has its state
changed to csDestroyed.

This should fix issue #3138
2016-07-31 12:02:21 +01:00
Mattes D f8e1df2476 Updated API documentation. 2016-07-18 22:11:40 +02:00
QUSpilPrgm f1192c6860 Makes tall grass and large flowers bonemealable
Adds the bonemeal particle effect to some more places
2016-06-03 15:45:49 +02:00
QUSpilPrgm 706257f8fb Update Dispensers and let them act more like in Vanilla
- 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-06-03 15:45:49 +02:00
Pokechu22 a4f327118b 1.9 / 1.9.2 / 1.9.3 / 1.9.4 protocol support (#3135)
* 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-14 20:12:42 +01:00
LogicParrot 36754f20f8 Fix Crash on stopping the server (#3176) 2016-05-02 00:18:21 +03:00
benf516 3b64719f55 Disable Enderman Spawn (Issue #3108) (#3170)
Temporarily disabled enderman spawning until the glitches can be fixed
2016-04-30 07:57:10 +03:00
LogicParrot 7f5757eccf Reduced unnecessary block updates 2016-04-23 00:30:00 +03:00
LogicParrot 9b60ee6e43 Auto clean bad world linkages 2016-04-19 12:06:52 +03:00
LogicParrot 373d9f92a4 Updated cChunk::SetMeta, fixed grass growth, reduced markDirty/setMeta usage 2016-04-16 19:04:45 +03:00
LogicParrot c9e80cdeae Revert "Move mob tick code to cChunk" 2016-04-06 12:16:14 +03:00
LogicParrot 5bbf033a65 Move mob tick code to cChunk 2016-04-06 09:33:43 +03:00
LogicParrot 13195cd207 Fix adding players to world 2016-03-31 20:40:58 +03:00
LogicParrot 630ceed2c0 Entities are never lost 2016-03-30 14:56:47 +03:00
LogicParrot ebd80805ca Rewrite mob tick code 2016-03-23 10:32:09 +02:00
Marvin Kopf f9506f6405 Add check if entity is in chunk before changing tick status 2016-02-21 00:07:58 +01:00
LogicParrot 83459d0d89 Proper entity destruction in non-ticking chunks 2016-02-19 07:05:22 +02:00
LogicParrot f3e0a5f656 Add forum link to linkage error message 2016-02-09 09:30:22 +02:00
LogicParrot 91fd275c0b Improve world linkage error message 2016-02-09 00:40:26 +02:00
LogicParrot ed97946bb9 Merge pull request #2961 from LogicParrot/enforce
[PhantomWorlds - 4] Prevent server from starting if there's bad world linkage
2016-02-08 11:57:57 +02:00
LogicParrot 96f9afa278 Proper world linkages and dimension types for newly created world.ini's 2016-02-06 10:18:13 +02:00
Marvin Kopf 0b826b0e52 Tab completion for player names now case insensitive. 2016-02-05 21:27:31 +01:00