1
0
Commit Graph

11149 Commits

Author SHA1 Message Date
Tiger Wang
19302eeb87 Redstone: inline -> static 2021-01-22 22:04:47 +00:00
Damián Imrich
4f3b699b27
End crystal placement (#5112)
* End crystal placement

* End crystal placement - fixed error and added some comments

* Removed unused includes

* Update src/Items/ItemEndCrystal.h

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

* End Crystal placement, early-return pattern enforcement

* End crystal Item finish?

* Small changes

Fixed a crashbug in ender crystal destruction.
According to vanilla 1.16 testing, end crystals don't place if any entity intersects the box, not just other end crystals.
Check return value of SpawnEnderCrystal.
Add header in SeeMake.
Cafe Stile Redux.

* The stylechecker relies on CMakeLists

* There is another

Co-authored-by: Alexander Harkness <me@bearbin.net>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-01-22 17:06:26 +00:00
Damián Imrich
59e906ec6c
Implementation of totem of undying behaviour (#5111)
* notchian totem of undying

* ...

* ....

* Update src/Entities/Pawn.cpp

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

* DeductTotem func

* fixed build errors

* Added myself to CONTRIBUTORS

* Small changes

Co-authored-by: Peter <peter@cassoviacode.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-01-22 09:05:18 +00:00
Tiger Wang
49ef21d650 MultiVersionProtocol: fix two crashes
First one: add missing exception handler in ProcessProtocolIn

Second: remove faulty logic dealing with incomplete packets.

`a_Data = a_Data.substr(m_Buffer.GetUsedSpace() - m_Buffer.GetReadableSpace());`

was incorrect; it attempted to apply a length derived from m_Buffer to an unrelated a_Data. Its purpose was to give cProtocol the data the client sent, minus initial handshake bytes. However, we can use the knowledge that during initial handshake, there is no encryption and every byte can be written unchanged into m_Buffer, to just call cProtocol with a data length of zero. This will cause it to parse from m_Buffer - wherein we have already written everything the client sent - with no a_Data manipulation needed.

Additionally, removed UnsupportedButPingableProtocolException (use of exception as control flow) and encode this state as m_Protocol == nullptr, id est "no protocol for this unsupported version", which is then handled by cMultiVersionProtocol itself.
2021-01-19 09:54:58 +00:00
Tiger Wang
813176fbd1
cChunk: don't inherit from cChunkDef (#5106) 2021-01-18 16:09:10 +00:00
wereii
bdb45998c9
Fixed horse UI desync when taking saddle out (#5108)
due to overlooked fallthrough
2021-01-16 18:27:50 +00:00
Tiger Wang
054a89dd9e Clarify cClientHandle, cPlayer ownership semantics
+ 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-12 12:34:34 +00:00
Tiger Wang
9328afe65c Convert most calls to blocking GetHeight/GetBiomeAt to direct chunk accesses
* Hopefully fixes #5094
2021-01-11 16:39:56 +00:00
Tiger Wang
eeb63b8901
zlib -> libdeflate (#5085)
+ Use libdeflate
+ Use std::byte
* Fix passing temporary to string_view
+ Emulate make_unique_for_overwrite
2021-01-11 16:39:43 +00:00
Varga Szabolcs
00c0a23ace
Fixed switch-ups regarding some slab and stair recipes (#5099) 2021-01-05 02:14:53 +00:00
Tiger Wang
16aeb84cd3
Fix potential destruction crashes (#5095)
* Fix potential destruction crashes

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

* Add missing call to OnRemoveFromWorld
2021-01-02 13:50:34 +00:00
Nir
4656f7486d
Fix version typo in CMakeLists.txt (#5098) 2021-01-02 11:35:40 +00:00
Tiger Wang
959b263093
Fix AppVeyor IA32 builds (#5096)
* Fix AppVeyor IA32 builds

> The default target platform name (architecture) is that of the host and is provided in the CMAKE_VS_PLATFORM_NAME_DEFAULT variable.

AppVeyor uses AMD64. Oops.

* del cmakecache

* -

* +
2020-12-31 19:43:02 +00:00
Tiger Wang
90ce4ed2b8 Command Blocks: fix a crash
* Don't store a temporary
2020-12-30 12:15:19 +00:00
Tiger Wang
abc96bb4ce Avoid an std::list in StreamNextChunk 2020-12-26 17:55:45 +00:00
Tiger Wang
bb37e5c152 Streamline ClientHandle chunk send a little
- Removed RemoveFromAllChunks. On destruction cWorld::RemovePlayer calls RemoveClientFromChunks already, and there's no need to manually clear the chunk lists.
2020-12-26 17:55:45 +00:00
Tiger Wang
c91335bfbb Don't prematurely exit "downloading terrain" screen on join
- Remove leftover SendPlayerMoveLook from #1500
2020-12-26 17:55:45 +00:00
Tiger Wang
60bc040a9c Make SetAllData's MarkDirty() the chunk's responsibility 2020-12-26 17:55:45 +00:00
Tiger Wang
9fcd2d4210 Avoid a gratuitous dirty when loading chunks with entities
Loaded entities are directly moved into the chunk data, instead of having to go through cWorld, as if they were just spawned. This avoid dirtying the chunk.
2020-12-26 17:55:45 +00:00
Tiger Wang
7f894b2f73 Silverfish: correct search cube 2020-12-26 16:58:53 +00:00
Tiger Wang
14ada52f3a Daylight Sensor: remove redundant delay
Daylight Sensors are already always ticked.
2020-12-26 16:58:53 +00:00
Tiger Wang
d9a7c51d4d ViewDistance: unsigned -> signed 2020-12-26 16:58:53 +00:00
Tiger Wang
53ae358d8c Replace custom ChunkCoordinate with cChunkCoords 2020-12-21 23:21:01 +00:00
Tiger Wang
f3ec768dfb unique_ptr<cChunkMap> to plain member 2020-12-21 23:21:01 +00:00
Tiger Wang
9518a27357
Prepare for 1.15+ (#4856)
+ Add type-safe container for states
* Split registry Blocks into BlockTypes, BlockStates so the block types enumeration can be #included without too much penalty
* Ensure Registry uses type-safe container
2020-12-21 13:54:04 +00:00
Tiger Wang
5b6bed6b00 Improve Enderman targeting
* Fix look angle checks
* Do LOS trace from eye-height
2020-12-21 13:52:23 +00:00
Tiger Wang
47c0b48bfd Monsters: improve targeting
* Replace DoWithNearestPlayer with bounding box search (avoid iterating through all players in world).
* Do line-of-sight checks from eye-to-eye.
+ Added LOS and LOS lost timer to target lost checks, in addition to distance.
2020-12-21 13:52:23 +00:00
Tiger Wang
491238f799 Chunk: use FAST_FLOOR_DIV 2020-12-21 13:52:15 +00:00
Tiger Wang
e7331fe820 Improve Silverfish search
* Start from the inside out, don't always look at the entire search space by bailing out randomly
2020-12-21 13:52:06 +00:00
Tiger Wang
d9cd2f741d Comment and code style fix
+ Add static keyword
- Don't capture everything in lambda
2020-12-21 13:52:06 +00:00
Tiger Wang
742e27ad2f Remove unused Temporary namespace
- Remove unused temporary mapping generation at startup
2020-12-21 00:11:34 +00:00
the1robert
73ae985a4b Enable LOS checks for Hostile Mobs. 2020-12-20 02:00:44 +00:00
KingCol13
616c1dafbf Trace to surface of cube. 2020-12-19 13:28:02 +00:00
Aiden Neill
a7e9f88ff3
New pull request for daylight sensor (#5066)
* Fixes #4918

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-12-19 01:42:34 +00:00
cflep
7fbe4a0126
Added dimension check to nether portal (#5068)
+ Added dimension check to nether portal
2020-12-18 21:10:14 +00:00
bwats97
28b8febce4
Added the ability for white beds to be dyed (#5077)
+ Added Ability for white beds to be dyed
2020-12-18 21:09:55 +00:00
mathiascode
2103308618 Ignore CanFly flag sent by the client 2020-12-18 21:03:50 +00:00
Tiger Wang
090d8305e4 Warnings improvements
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality
* Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already
* Reduced GetStackValue verbosity
+ Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness
+ Give SettingsRepositoryInterface a move constructor to simplify main.cpp code
- Remove do {} while (false) construction in redstone handler
2020-12-18 21:03:40 +00:00
Tiger Wang
83e18f6d31 Horsies: don't always broadcast metadata 2020-12-18 20:44:06 +00:00
Azurethi
1c5af8c00d Fixes incorrect var name in RsaPrivateKey.cpp
Fixed an incorrect variable name in src/mbedTLS++/RsaPrivateKey.cpp : cRsaPrivateKey::Decrypt.
2020-12-05 00:12:48 +00:00
cflep
5aad42a4d0
Light the nether portal when switching dimensions (#5062)
* Fixes #5007
2020-12-01 01:02:19 +00:00
Tiger Wang
98cf4025ce BlockInfo: float-equal for Clang only 2020-11-28 20:49:33 +00:00
Tiger Wang
815f2aed82 Lilypads: add missing boundary check 2020-11-28 20:48:53 +00:00
Derek Qu
7027b2279f
Fix lilypad displacing block above (#5056)
* Fix lilypad displacing block above

Side fixes:
* Fix lilypad displacing half slabs
* Fix lilypad being placed on flowing water and non-water blocks in
general

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-28 01:01:47 +00:00
Derek Qu
280f7a81f4
Note Block Left Click Fix V2 (#5052)
+ Add function to play note block on left click
2020-11-26 00:58:35 +00:00
Aiden Neill
3d044d2dde
Added magma block contact damage (#5055)
* Added magma block contact damage
* Fireproof entities do not take damage from magma
* Fire resistance prevents magma damage
* No magma damage when hovering over magma block
2020-11-25 17:56:55 +00:00
12xx12
e35519ec8a
Adding new monster types to enum and saving/loading for easier future implementation (#4941)
* added new monster types to enum
added string <-> enum conversion in namespace serializer
added loading functions
added to saving

* renamed zombie pigman to zombified piglins in enum

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-22 23:41:13 +00:00
Derek Qu
a0afd13233
Add coloured glass pane recipes (#5032)
+ Add coloured glass pane recipes using uncolored glass panes
2020-11-15 16:45:02 +00:00
Tiger Wang
0c69b648ae HTTPServerConnection: more robust error handling
* Fix passing a nullptr to downstream code when the request was malformed
+ Reset the connection on errors
* Fixes #5029
2020-11-14 12:24:42 +00:00
mBornand
58def8f7df
Fix flower and foliage generation (#4723)
* fix flower generation
- remove wrong mushroom and flower generation
+ add "tiny" mushrooms in Mushrooms biomes
+ add "tiny" mushrooms in Mega Taiga and variants
+ add tulip generation for plains biomes
* Turn numbers into constants
- Remove duplication of grass generation
- Remove fern in inappropriate biomes
* added roofed forest flowers to ini file
* fixed crash with biMesaPlateuM
+ Use empty()
+ Emplace directly
+ Avoid a string copy in BiomeName
+ Alias BiomeIndex to avoid multiple casts

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-14 12:24:31 +00:00