1
0
Commit Graph

6080 Commits

Author SHA1 Message Date
Nate
8efe55c62c
Change to Cuboid calculation for splash distance (#5176)
* Change to Cuboid calculation for splash distance

* Use ForEachEntityInBox when splash entities

* Remove TODO comment, calculation verified

* Added self to contributors
2021-04-06 16:16:31 +00:00
Damián Imrich
071b7be3d4
Basic elytra flight (#5124)
* Basic elytra flight

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-04-03 18:45:20 +01:00
Tiger Wang
ce6f8b3557 Fix finisher generating invalid pumpkin
Result was black spot in the ground because the meta exceeded 3 and the client didn't render anything.

Been here since the beginning? fbabf9ee8c/source/FinishGen.cpp (L159)
2021-04-01 00:02:44 +01:00
Tiger Wang
8a30a4a7b8 Player data loading cleanup
* Kick player if data were corrupt to avoid making it worse
2021-03-29 23:36:15 +01:00
Tiger Wang
222d9957a1 cIsThread cleanup
+ Semi-gracefully handle unexpected exceptions
* No-one cared about the return values, remove them
2021-03-29 23:36:15 +01:00
Tiger Wang
8ec5552998
Do an early check for empty network buffers (#5172)
Avoid overhead when nothing to do.
2021-03-29 23:36:00 +01:00
Tiger Wang
abcc14076c Call ProcessProtocolOut at opportune times 2021-03-28 21:20:13 +01:00
Tiger Wang
c24e968f2c Send keep alives slightly less frequently
Ref: http://github.com/cuberite/cuberite/issues/4082#issuecomment-348675321
2021-03-28 15:36:10 +01:00
Tiger Wang
5d11816015 Move some redstone implementations into the source file 2021-03-28 15:36:10 +01:00
Tiger Wang
2687f2df30
Fix chunk block changes being sent out of order (#5169)
* 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-28 14:44:20 +01:00
Tiger Wang
125df19477
Do not fake a tool when converting to pickups (#5170)
* When the cause of destruction was world-induced (CanBeAt check failed) there is no tool. Pass the nullptr directly to ConvertToPickups and let it handle it.
* Fixes #4795
- Remove unused a_Digger parameter to ConvertToPickups.
2021-03-28 14:41:34 +01:00
Tiger Wang
748b121703
Unify DoWithBlockEntity (#5168)
+ DoWith calls now broadcast the block entity and mark the chunk dirty
+ Add block entity change queue to synchronise BE updates with block updates
* Fixed a few incorrect assertions about BE type
- Remove manual overloads
2021-03-28 14:40:57 +01:00
Tiger Wang
5123850db0
Fix Windows XP to 7 compatibility (#5167)
* Partially reverts 01a4e696b
* Unify thread names
- Remove use of GetThreadId API
2021-03-28 13:34:57 +01:00
Tiger Wang
90369deb5a
Change TimeOfDay to WorldDate (#5160)
* Change TimeOfDay to WorldDate

* Do not wrap at 20 minutes, continue incrementing
* Fixes #4737
* Fixes #5159
2021-03-20 20:58:19 +00:00
Tiger Wang
55ba39ca0e Don't send ping updates one packet at a time
* Use the batch update feature of the packet.
* Lengthen interval between time and ping update packets (ref. http://github.com/cuberite/cuberite/issues/4082#issuecomment-348675321).
2021-03-19 11:23:30 +00:00
Tiger Wang
e3fe9e5e93 Deduplicate WriteBlockEntity 2021-03-17 23:44:59 +00:00
Tiger Wang
edf9e39ed7 Mob heads, banners cannot be used
* Fixed UsedBy returning true, blocking block placement
2021-03-17 23:44:59 +00:00
Tiger Wang
5ca3a7c2e7 shared_ptr -> unique_ptr in generators 2021-03-17 23:44:42 +00:00
12xx12
243083e01a
Adding basic Banner functionality (#4806)
+ Added item and block for banners

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-03-15 02:47:55 +00:00
Tiger Wang
ca5608c66c Derive HugeMushroom from the base handler
ConvertToPickups is already overridden.
2021-03-15 02:44:39 +00:00
Tiger Wang
61cc1c0190 Change Cobblestone block handler to default
Cobblestone shouldn't be handled with the Stone handler.
2021-03-15 02:44:39 +00:00
Tiger Wang
de76503d5c Remove DoesDropOnUnsuitable
This is only overridden false in Vines and Snow. It is called when a CanBeAt check fails, to determine whether DropBlockAsPickups is called. However, Vines and Snow already drop nothing without the right tool, so this function is superfluous.
2021-03-15 02:44:39 +00:00
Tiger Wang
45591cbe7b
Properly deprecate more XYZ parameter'd functions (#5147)
* Fixes #5144
2021-03-15 02:28:18 +00:00
NiLSPACE
c729d7abde
Fixed some death messages showing up even when they are disabled. (#5153) 2021-03-11 21:26:35 +00:00
Tiger Wang
01a4e696b3
Do protocol decryption in-place (with CryptoAPI on Windows) (#5145) 2021-03-08 16:37:36 +00:00
12xx12
3daf253b7f
Some emplace_back replacements (#5149)
* replace push_back with emplace_back when a new object was created in the function call
2021-03-07 16:31:43 +00:00
Tiger Wang
d9a2b8611c
Mitigate MSVC crash (#5146)
Reference: http://ci.appveyor.com/project/Cuberite/cuberite/builds/38087390/job/p857ibg3x87naw36/messages
2021-03-06 12:59:39 +00:00
Mat
40b6758905
Add block handler for huge mushroom blocks (#5143) 2021-03-05 19:43:40 +01:00
12xx12
8405b8969f
Adding Boss bar (#5025)
+ Add boss bar

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-03-05 15:08:30 +00:00
12xx12
4d6235c807
Add Mushrooms to Generator and fixed up the roofed forest (#5134)
* added generator for mushrooms and aded them to the biomes

* removed unused variable

* added nEwlY uDocUmEnTeD aPi sYmbOls...
2021-03-05 14:04:48 +01:00
Tiger Wang
868cd94ee9
Prepare ChunkData for BlockState storage (#5105)
* Rename ChunkData Creatable test

* Add missing Y-check in RedstoneWireHandler

* Remove ChunkDef.h dependency in Scoreboard

* Prepare ChunkData for BlockState storage

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

* fixed build

* fixed test

* fixed the debug compile

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
2021-03-05 14:03:55 +01:00
12xx12
5fa45182e8
fixed the crash on generating in the SinglePiceStructuresGen (#5136) 2021-03-05 14:28:36 +02:00
Tiger Wang
81e299f00c Mark UNREACHABLE with intrinsics 2021-02-20 17:46:02 +00:00
Tiger Wang
6aa1d13508 Clang 7? 2021-02-11 01:24:50 +00:00
Tiger Wang
2f1359a0f9 Fix march=native not being enabled
* LINUX doesn't exist apparently, use UNIX instead
+ Add some platform-specific logic to determine whether to use mcpu or march
- Remove duplicated compile option comments
+ Add STATUS level to messages
2021-02-11 01:24:50 +00:00
Tiger Wang
86cfb38211 MSVC warnings 2021-02-10 10:30:32 +00:00
12xx12
2481190d9c CompositeChat: use variants 2021-02-08 12:41:30 +00:00
Tiger Wang
7ad054b087 Explodinator performance optimisations
Thanks @lixfel (#4246)
2021-02-07 22:36:15 +00:00
Tiger Wang
5a8e75e6aa Explodinator: fix divide by zero 2021-02-07 22:36:15 +00:00
Tiger Wang
be2bf999c2 Fix #5118 2021-02-07 22:36:15 +00:00
dImrich
925f960ea2 Adds playerlist header and footer broadcasting (1.8-1.13) 2021-02-06 14:14:40 +00:00
Simerson
b1b7424c43
Creative mode hits immediately disappear boats (#5117)
Instant destroy boat in creative mode

+ boat one-shot in creative mode
+ Add boat instant destroy in creative
+ Instant break boat in creative
2021-01-28 22:39:40 +00:00
Tiger Wang
50a94f972d
Fix debug macro situation (#5114)
Use the standard NDEBUG.
2021-01-26 09:41:55 +00:00
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
Tiger Wang
16aeb84cd3
Fix potential destruction crashes (#5095)
* Fix potential destruction crashes

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

* Add missing call to OnRemoveFromWorld
2021-01-02 13:50:34 +00:00
Tiger Wang
90ce4ed2b8 Command Blocks: fix a crash
* Don't store a temporary
2020-12-30 12:15:19 +00:00
Tiger Wang
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
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
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
12xx12
283b9d706c
Some const and inheritance correctness (#5014)
* Some const and inheritance correctness
* Devirtualise SendBlockTo(Vector3i)

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-13 21:50:46 +00:00
12xx12
14a00d0051
changing cComposite Chat to newer c++ standart (#5028)
* upgraded to new C++ for loops and fixed errors

* readded delete instruction

* now using unique ptr

* added test for text only (that was causing an error for me)

* using unique ptr constructor

* added move constructor and deleted copy constructor

* fixed deconstuctor
http prefixes are constexpr and std::string_view

* fixed whitespace

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-11-11 22:38:51 +01:00
0ddlyoko
672bb04570
Add correct implementation of crops (#4802)
* [FIX] Add correct implementation of seed drops.

> Official percentage of drops has been implemented

* Fix C++ conventions

* Change "Vals" variable to "m_Vals"

* [FIX] Add correct implementation of Carrots, Potatoes, Wheat & Beetroots seed

* Add Fortune support with crops

Add fortune support with Wheat, Carrots, Potatoes & Beetroots seeds

* [FIX] Right-clicking on a grown Beetroot in survival consume 2 bone meals

Fix #4805

* Add documentation for "cWorld::IsFullGrownPlantAt" method

* Fix dispenser that full grown a plant

> Change methods cItemDyeHandler::FertilizePlant & cItemDyeHandler::growPlantsAround to static

* Display particle even if tree doesn't grow

* When right-clicking on a full grown melon / pumpkin seed, no longer produce a melon / pumpkin

Before this commit, when you right-click on a melon or a pumpkin seed, a melon / pumpkin block spawned.
With this commit, it no longer spawns

* [FIX] Do not create melon / pumpkin block when right-clicking with a bone meal

This fix will prevent the creation of a melon / pumpkin block when you right-click with a bone meal on a melon / pumpkin plant
- It just detect if the plant is full grown. if yes, the method "Grow" is not called

- Remove IsFullGrownPlant

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-06 16:54:01 +00:00
12xx12
36a67df105
Ender Crytal Fix and report proper cmake file for luabindingscheck fail (#5017)
* fixed network
fixed explosion
fixed ticking

added network broadcast to Setter method

added nullptr protection

using macros in 1.10 Protocol_1_10.cpp

revealed functions to LUA API

small fixups, typos, less functions used

fixed more doc

readded info that saving is done only if the beam is displayed

made the constructor transfer all needed members

fixed wrong commit

removed default parameters on SpawnEnderCrystal

fixed wrong metadata

moved call to destroy in the right place

fixed some typos

Fixed Ender Crystal

* fixed documentation

* fixed doc and added proper error message

* Parameters, arrows

* Parameters

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-11-06 15:00:59 +00:00
Tiger Wang
645fea4237
Players are no longer kicked when clicking on bedrock (#5023)
* Players are no longer kicked when clicking on bedrock
* Fixes #5022
2020-11-06 14:58:47 +00:00
Tiger Wang
1ed782787a Rein in light spread by correcting falloff value
* Fixes #5018
2020-11-02 15:44:23 +00:00
12xx12
177cf041db
Added new flowers on bonemeal use (#5011)
+ 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-11-02 15:44:02 +00:00
12xx12
961d5eb420
Add beam target, configurable base visibility to Ender Crystals (#5010)
* Fixes #4990

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-29 20:47:20 +00:00
Tiger Wang
6d85435f60 Remove BLOCKENTITY_PROTODEF 2020-10-24 18:49:38 +01:00
KingCol13
c11ca96c3d
TNT Changes (#4970)
+ Make TNT drop pickups, change a few comments.
+ Give each ray random intensity, instead of each explosion.
* Use direction instead of destination, rewrite for pairs of edges.
2020-10-24 18:48:48 +01:00
Tiger Wang
64442b05f8
cBlockInfo: further cleanup (#5001)
* cBlockInfo: further cleanup

+ Use switch statements instead of lookup in dynamically initialised arrays
- Remove some deprecated bindings

* Update Stubs removing references to BlockInfoArray
2020-10-18 15:37:07 +00:00
12xx12
c07ea7b9ab
added const correctness on some functions in cPlayer (#4999)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-15 20:18:32 +02:00
12xx12
9419c78609
Remove debug output on PieceStructuresGen.cpp (#4984)
- Remove debug output on PieceStructuresGen.cpp
- Removed Stopwatch import

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-12 13:35:14 +01:00
Alexander Harkness
c8c061edf7
Update comments and code for Load/SaveOneChunk so they match (#4992)
Fixes #4991
2020-10-11 16:14:43 +00:00
NiLSPACE
bca93b17da
Simple end gen (#4973)
* Fixed current end generator

* Implemented new simplified end generation which includes a void between the main island and other islands

* Fixed basic style

* Hopefully fixed clang errors.
2020-10-11 15:44:57 +00:00
12xx12
c080f819d2
Adding Silverfish Spawning Blocks (#4946)
* added breaking, spawning, animation

* checkstyle

* added undocumented API symbols

* added changes suggested by @peterbell10

* added natural ore like generation

* fixed spawning two silverfishes

* fixed clang

* fixed clang try 2

* updated comment
unified offset

* final clang fix

* added spawning for more silverfishes if one was damaged

* fixed spawning on one hit kill

* fixed spawning on one hit kill
fixed spawning by potion damage

* fixed clang

* fixed broken build

* fixed broken build

* I should read the error message properly
fixed build now?

* added small changes suggested by @peterbell10

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-11 15:27:41 +00:00
12xx12
c0711407e9
Adding more customize options to mob spawners and improving the way to look for surrounding entities (#4955)
* added nearly any customize option

* fixed unnecessary diff
added comments

* removed unnecessary const qualifier

* fixed build

* changed to ForEachEntityInBox

* added docs

* updated lua api description

* checkstyle

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

* updated docs
changed cast to static cast

* fixed clang

* fixed clang on WSSAnvil.cpp

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-10 19:31:44 +00:00
KingCol13
b0b1ccddd1
Anvil fixes (#4976)
* Rewrite to use wiki target/sacrifice terminology.

* Fix negative damages.

* Prevent repairing if output matches target.

* Make target and sacrifice const.

* Pre-PR tidy-up

* Keep m_MaximumCost updated.
2020-10-10 19:23:25 +00:00
12xx12
32ee1708a2
Adding wolf breading and moving breeding functionality to cMonster (#4951)
* added wolf breading

* mpoved breeding to monster

* checkstyle

* fixed my IDE "helping"

* removed magic number
and fixed faster aging

* added flooring to age manipulation

* fixed copiler error

* fixed typo

* moved tps to Defines.h

* removed the TPS constant from the lua API exposure

* added inline constexpr
added explanation

* fixed broken build

* "fixed" build

Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-09 20:49:25 +00:00
12xx12
6fd35be67a
added check if the digger is a nullptr (#4981)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-10-09 20:12:19 +00:00
12xx12
d3255b3014
Beacon now checks for players in surrounding square (#4972)
* Beacon now check for players in surrounding square not every player

* added proper BoundingBox

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

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

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-10-09 19:19:22 +00:00
Lukas Pioch
6ddc03db09 Add default value nullptr for parameter a_Digger and added digger to
cWorld:DigBlock in lua api
2020-10-09 18:39:20 +01:00
Bart Ribbers
2ca2a50b47
Include sys/select.h on non-glibc Linux platforms (#4977)
Otherwise fd_set will be unknown for example on Musl libc systems
2020-10-09 13:38:41 +00:00
12xx12
3381c0f6d6
Merged OnBreak with OnPlayerBreak (#4967)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-08 20:13:44 +01:00
peterbell10
a9031b6bae
Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)
* Fix cmake not adding Werror on clang, and _lots_ of warnings

* WIP: Build fixes

* Cannot make intermediate blockhandler instance

* Tiger's changes

* Fix BitIndex check

* Handle invalid NextState values in cMultiVersionProtocol

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-05 10:27:14 +00:00
NiLSPACE
23021dd828
Fixed current end generator (#4968) 2020-10-04 15:12:36 +00:00
Tiger Wang
21068011c6 Remove SetProperty(...cPlayer)
Enchantment table, anvil windows are already opened one per-player.
2020-10-03 16:54:14 +01:00
KingCol13
cd1b507745
Fix instant mining of blocks not being recognised, tweak anti-cheat (#4938)
* Tried to fix a small issue...

Ended up rewriting a bunch of god awful, opaque code with no source
and no sense. Who names a function GetPlayerRelativeBlockHardness???
It's gone now. We're safe again.

* Testing anti-cheat.

* Tidy up debug logging.

* Remove empty member declaration.

* Rewrite GetDigSpeed slightly for better readability.

* GetMiningProgressPerTick now returns 1 when instantly mined. Fixed hasily written typo.

* Comment style and typo fixes.
2020-10-02 20:57:17 +00:00
KingCol13
8947147c25
Enchanting table shows detail on hover. Enchanting is deterministic. (#4937)
* Use lapis for enchanting, subtract correct number of levels, ClientHandle now selects from pregenerated list.

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-01 22:33:32 +01:00
Tiger Wang
f9ac6543ab C++17 stuff 2020-09-30 22:05:17 +01:00
Tiger Wang
429117c1f6 Doors: check power & toggle correctly
* Fixed upper half ignoring its updates
* Fixes #4945
* Fixed doors playing sound effects when they didn't actually toggle
2020-09-28 23:40:19 +01:00
Tiger Wang
c9fbb43ac7
HandleEnchantItem: use a lambda (#4944) 2020-09-28 22:38:10 +00:00
KingCol13
8eca58a1c9
Fortune Drops (#4932)
+ Implemented and standardized all clamped discrete random drops.
+ Changed cItems Add from push_back to emplace_back. Implement fortune for crops.
+ Enabled hoes to be enchanted with efficiency, silk touch and fortune. Made leaves, gravel and crops affected by fortune.

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28 13:41:49 +01:00
KingCol13
32af227fa7
Enchanting consumes lapis, removes correct number of levels (#4934)
* Use lapis for enchanting, subtract correct number of levels.
* Enforced distancing regulation better than our government.

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28 00:51:23 +01:00
[IPSA] Chris de Claverie
9a548b3b3e
Plugin reload <plugin_name> feature (#4942)
+ Add `reload <pluginname>`
* Fixes #365

Co-authored-by: Alexander Harkness <me@bearbin.net>
Co-authored-by: pwnOrbitals <c.de-claverie@pm.me>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-27 23:15:03 +01:00
12xx12
410d6c0045
Fixing Mob spawner behaviour (#4930)
* fixed mob spawner failure (whoopsie in the BlockEntity.GetChunkZ())
Style

* fixed spawning behaviour

* fixed saving entity type saving

* checkstyle

* removed debug log

* removed short saving

* Style

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-27 20:02:16 +03:00
Tiger Wang
c158569af3 Remove unused Temporary namespace 2020-09-25 14:51:57 +01:00
Tiger Wang
4519469547 Do not call into things we don't own in destructors
- Remove improper accesses in cChunk destructor
* Fixes #4894
2020-09-25 14:51:16 +01:00
Tiger Wang
10bd15a11e Grass spread: check chunk & light validity correctly 2020-09-25 14:51:16 +01:00
Alexander Harkness
281beba50e
Fix the build. Merge conflict between two PRs (#4936) 2020-09-25 10:59:08 +00:00
KingCol13
a78fd671b2
Deleted BiomeDef.h and ChunkDef.h from Globals.h (#4885)
* Removed BiomeDef.h

* Removed ChunkDef.h from Globals.h

* Added to CONTRIBUTORS.

* Re-added empty last line to Globals.h

* Included stddef and StringUtils in BiomeDef.h

* Fixed build tools compiling. It compiles, but at what cost?

* Added include to src/Generating/Trees.h

* Include added in ChunkGeneratorThread.h

* Moved rearranged includes in LineBlockTracer.cpp

* Re-arrange headers in ChunkInterface.cpp

* Included ChunkDef.h in Path.h

* Included ChunkDef.h in NBTChunkSerializer.h

* Rearranged included and added required includes to headers.

* Removed unnecessary included in StringUtils.h.
2020-09-25 09:13:59 +00:00
Tiger Wang
5bd12814db Put phonograph on right part of visual spectrum 2020-09-25 09:07:34 +00:00
Tiger Wang
7574f68a48 BlockEntity: clarify ConvertToPickups behaviour 2020-09-25 09:07:01 +00:00
Tiger Wang
c53a0ba5f6 Unify block entity pickup conversion
- Removed normal BlockHandler knowledge of block entities during conversion
+ Added cBlockEntity::ConvertToPickups that handles it
2020-09-25 09:07:01 +00:00
Tiger Wang
1a60164848 Small cleanup in Jukeboxes
* Fixed creative players not tracking stats, and the code trying to "place" a record when they used one
2020-09-25 09:07:01 +00:00
Tiger Wang
a2ecbf6a2e Fix cItems::AddItemGrid adding empty items 2020-09-25 09:07:01 +00:00
12xx12
b5410c718e
Fix ice behaviour in world (#4927)
+ Added proper ice melting under light influence

Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-24 13:53:49 +01:00
Tiger Wang
3edcafdf8b TABS OUT OF BED! TABS IN THE CORRIDORS! 2020-09-23 14:34:15 +01:00
Tiger Wang
71b96ab921 Limit fortune level, style fixes 2020-09-23 14:34:15 +01:00
12xx12
a0dd311d02
Added dtEnvitonment to player damage text (#4925)
+ Added dtEnvironment to string conversion
+ Added dtEnvironment to player damage strings
2020-09-22 12:38:55 +01:00
12xx12
51e026a3ae added dtEnvironment to string conversion 2020-09-21 22:58:38 +01:00
Tiger Wang
6183b28f93
Implement redstone quasi-connectivity (#4889) 2020-09-21 20:39:58 +01:00
KrystilizeNevaDies
23bca00831
Implement Dropspenser Hook (#4903)
* Implement Dropspenser Hook

Implemented a hook for dropspensing.
HOOK_DROPSPENSE

When plugin callback returns true then dropspense is cancelled

* Update src/Bindings/PluginManager.h

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

* Create OnDropSpense.lua

* Fix indent

* Forgot include

Forgot to include the plugin manager. Although now im confused why it was working on my end without including the plugin manager

* Update plugins.lua with dropspense

* fix typos

* haha notepad++ go brr

Co-authored-by: peterbell10 <peterbell10@live.co.uk>
2020-09-21 15:31:45 +00:00
theophriene
0a1bf06c6f
Trapdoor crash fix (#4890)
* [WIP] Trapdoor crash fix

* Fixed code style

* Updated commentary in the code

* Updated commentary in the code again

* Fix copy-past error

* Fix another copy-past error!

* Fixed orientation & clipping

* Remove redundant clause

* Some code cleanup

* Fixed compilation error

* Moved logic into helper function, slightly reorganised the caller

* Fixed comments

* Fixed comments, what an idiot

* Added to CONTRIBUTORS

* Fixed bitwise error

* Use cYawRotator

* Reduce indent

Co-authored-by: Elias Thomson <fiv.pids@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-21 14:41:31 +00:00
Alexander Harkness
8de71fc9d6
Synchronously save chunks on server shutdown (#4900)
+ Synchronously save chunks on server shutdown. Fixes #4884
2020-09-21 13:12:09 +01:00
KingCol13
b6b7fb1a65
Implement fortune for ores, glowstone and sea lanterns (#4897)
* Implemented fortune for ores, glowstone and sea lanterns (but nothing organic or flint).

* Cleanup printf

* Stopped playing golf, gave the Camels a FirstHump and moved the FortuneDropMult comment. Thanks for the review :).

* Got rid of FortuneDropMult and replaced with Peter's massive optimization/simplification.

* Fixed default lapis max droprate (8 -> 9).

* Clamp max drops for non-redstone ores to 10.

* Comment justifying the clamp.
2020-09-20 18:06:28 +00:00
Tiger Wang
5a16620322
Cauldron: backport "use" behaviour to 1.12 (#4902)
* Cauldron: backport "use" behaviour to 1.12
2020-09-20 15:39:17 +01:00
Tiger Wang
68cced73af
BlockHandler initialisation is a constant expression (#4891)
* BlockHandler initialisation is a constant expression

If we can't make it all namespaces, this is the next best I guess.

+ Tag handlers constexpr, const as needed
+ Inherit constructors
* Privatise handler functions

* More constexpr

Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-20 13:50:52 +00:00
12xx12
6a0669fb98
Added armor and shulker box cleaning (#4875)
+ Added armor and shulker box cleaning
2020-09-20 02:24:58 +01:00
12xx12
f8de67aace Added end portal and enchanting table block entities 2020-09-20 01:40:20 +01:00
12xx12
a2935efaff
Fixed missing case: in entity damaging crashin the server (#4899)
* made snow golems not crashing the server anymore

* changed damage type to environment

* updated damage in API dopcumentation and changed enderman damage type

* removed incidental d in the code

* added dtEnvironment to ArmorCoversAgainst

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-19 17:31:36 +00:00
12xx12
1a211b6c46
Changing jungle trees a bit (#4823)
* switch range on jungle tree generation and renamed a confusing variable

* changed two numbers to match vanilla behaviour

* made jungle trees closer to vanilla behaviour

- matched variable names to new checkstyle
- made branch generation independent from noise at block position

* replaced random provider with Noise

* implemented changes suggested by peterbell10

* changed the way to determine the size of the leaves on branches

Co-authored-by: peterbell10 <peterbell10@live.co.uk>

Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: peterbell10 <peterbell10@live.co.uk>
Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-19 16:51:26 +00:00