Commit Graph

737 Commits

Author SHA1 Message Date
DeidaraMC 5c050c66ca fix: Entity#onGround returning true when entities aren't actually on ground 2024-04-30 23:06:41 -04:00
DeidaraMC 5bf4b4445a fix: projectile entities positions becoming desynced from the client 2024-04-30 20:36:51 -04:00
Alexander 2a7df1ab55
Lighting fix 35 (#2044)
* optimize light compute

* fix broken sections

* encodeHeightmap without magic

* separate heightmaps without empty sections optimization

* empty sections skip optimization

* working but not the best architecture

* AbstractHeightmap

* Anvil loading heightmaps.

* refactor

* Refactor

* some refactoring after refactoring

* test + cleanup

* refactor

* refactor

* refactor

* remove HeightMapContainer

---------

Co-authored-by: iam4722202468 <aceparent@gmail.com>
2024-04-30 03:52:21 +00:00
GreatWyrm 877e2bb4f2
chore: Cleanup some deprecations in the project (#2084) 2024-04-09 21:14:29 +00:00
DeidaraMC b71edf2706
feat: player support for lookAt and setView methods (#2072) 2024-03-31 03:54:27 +00:00
DeidaraMC a9f6d9f02b
feat: add TICK_END execution type to scheduler api (#2045)
* feat: implement TICK_END scheduler ExecutionType

* feat: add TICK_END scheduler ExecutionType

* fix: call processTickEnd on entity/instances, SchedulerImpl code cleanup

* deprecate ExecutionType#SYNC, replace with TICK_START

* chore: update scheduler test

* chore: scheduleEndOfTick cleanup

---------

Co-authored-by: iam <iam4722202468@users.noreply.github.com>
2024-03-30 23:51:08 -04:00
DeidaraMC 832f0e7f5a
feat: proper passenger position handling for most entities, fix passengers not always being applied to the client, don't sync passengers (#2060)
* feat: proper passenger position handling for most entities, fix passengers not being applied properly on the client sometimes

* chore: ditch the complex passenger solution as 1.20.5 makes this much simpler

* chore: change EntityViewer to check for a vehicle rather than isViewer, add a test case for this bug

* fix: test only worked in isolation

* chore: revert additional pos allocation

* chore: this instead of vehicle
2024-03-29 15:11:16 +00:00
DeidaraMC dc17d171ce
feat: vanilla style Instance#setWeather method overload, weather api improvements (#2064)
* feat: weather update

* chore: Weather#createIsRainingPacket use isRaining
2024-03-29 10:12:45 -04:00
DeidaraMC f09d3db999
fix: entity onGround applies correctly (#2059) 2024-03-28 08:22:21 +00:00
GreatWyrm f95d73eca8
Name magic values, respect client view distance setting (#2051)
* Name some magic values, replace getChunkViewDistance with ServerFlag.CHUNK_VIEW_DISTANCE, and respect client view distance settings (by using effective view distance when sending chunks)

* Attempt to fix test

* Preload chunks in test

* Fix OOM error for tests

* Rename constants and skin parts method

* Rename method
2024-03-27 22:08:36 -04:00
DeidaraMC 59ea880d26
feat: added player#teleportWithFlags for relative teleportation (#2029)
* feat: added player#teleportWithFlags for relative teleportation

* requested changes and improvements

* add the new teleport method override player

* chore: cleanup

* chore: change relative flags from enums to constants

---------

Co-authored-by: DeidaraMC <DeidaraMC>
2024-03-28 01:45:55 +00:00
DeidaraMC f034296f28
feat: add aerodynamics record and the capability to set custom horizontal air resistance (#2053)
* feat: add aerodynamics record and the ability to set horizontal drag

* feat: entity physics simulation overhaul

* fix: made physics utils private, renamed to match other utils

* chore: separate concept of chunks and tps from PhysicsUtils, remove bad PhysicsResult constants

* chore: remove synchronization from PhysicsUtils, SYNCHRONIZE_ONLY_ENTITIES collection > set

* chore: remove extra vec allocations

* chore: improved flyingVelocity test

* chore: add all entities with client side prediction to SYNCRHONIZE_ONLY_ENTITIES, refactor velocity

---------

Co-authored-by: iam <iam4722202468@users.noreply.github.com>
2024-03-27 19:21:07 +00:00
DeidaraMC ceeab08a2a
chore: minor entity class warning cleanup (#2049) 2024-03-25 23:33:24 -04:00
GreatWyrm fa0cd40ac1
Add bounds check to CreativeInventoryListener (#2042)
* Add bounds check to CreativeInventoryListener

* Add test and change bounds check to exclude crafting output slot
2024-03-25 05:47:12 +00:00
mworzala ee17c032e7
fix: use collision shape for Shape#isFaceFull instead of occlusion shape 2024-03-24 21:50:54 -04:00
iam 6e179dbd8a
Fix Lighting Invalidation (#2041)
-  Fix invalid lighting being sent to clients
-  Add cherry leaves to occludes
-  Fix lighting being generated when using loaded lighting
-  Send lighting to clients on block changes
-  Cleanup unused methods
-  Add sky lighting test for short grass
2024-03-24 16:23:26 -04:00
Samuel 17fd82a5c1
Scheduler try catch (#2037)
* try catch in SchedulerImpl to individually fail tasks

* Use exception manager

* chore: add a test

---------

Co-authored-by: mworzala <mattheworzala@gmail.com>
2024-03-21 21:42:24 +00:00
DeidaraMC 32f96683ee
feat: add weather to instances (#2032)
* feat: instance weather system

* chore: weather documentation

* chore: remove unused weather fields

* feat: linear weather interpolation

* chore: register weather command

---------

Co-authored-by: DeidaraMC <DeidaraMC>
Co-authored-by: mworzala <mattheworzala@gmail.com>
2024-03-19 16:44:51 +00:00
TheMode 9cfffc6ee4
Static packet ids (#2034) 2024-03-19 17:42:06 +01:00
DeidaraMC 705ec5cc07
fix: send EntityHeadLookPacket on teleport (#2031)
* fix: send EntityHeadLookPacket on teleport

* fix: new teleport test integration

---------

Co-authored-by: DeidaraMC <DeidaraMC>
2024-03-18 03:41:06 +00:00
Zax71 40ebd2b67f
Add `getUUID()` and `getUsername()` to MojangUtils (#2024)
* Add MojangUtils#getUUID() and MojangUtils#getUsername()

* Remove invalid UUID test as Java's UUID will not allow an invalid UUID

* Add `@Blocking` and some JavaDoc comments

* Override `MojangUtils#fromUuid(String)` with `MojangUtils#fromUuid(UUID)` and add a test

* Switch to IOException over custom ones
2024-03-18 03:25:35 +00:00
GreatWyrm 7e59603d5f
Add entity type to Material registry (for spawn eggs) (#2020)
* Add entity type to Material registry (for spawn eggs)

* Rename to spawn entity type and add javadoc
2024-03-14 00:50:54 -04:00
iam 5162a00b1e
Add particle data types (#2004)
* Add particle data types

* misc

* misc

* remove spaces

* defaults, tests, change what mattw said to

* RGBLike

* RGBLike

* RGBLike

* add back changes

* tests

* refactor

* annotations

* more fixes

* another test

* more tests + fix

* logging + checks consistency

* review changes

* review changes
2024-02-28 21:54:24 +00:00
GoldenStack 009ba773ed
Fix incorrect slot updating (#2007)
* Fix slot sending

* Test fixed slot sending

* Also send offhand slots
2024-02-27 08:35:30 -05:00
mworzala fb7e4b10e0
fix: require size when reading collection to prevent oom. Do not allow string longer than remaining bytes 2024-02-24 17:46:56 -05:00
Spanner fe46ed4ac2
Prioritise errors by chain length, build subcommands first (fix #1934) (#1935)
* Fix empty command chain causing NullPointerException

* Add test for empty command input

* Add test for #1934; subcommand priority issue

* Fix ConversionNode; process subcommands first

* Fix command error priority, add test for literal suggestions

* Test for subcommand priority in graph tests

(cherry picked from commit 2cdb3911b0)
2024-02-12 18:28:15 -05:00
iam 7320437640
Optionally load vanilla biomes (#1988)
* Add biomes from vanilla

* cleanup

* rework biomes

* nullability

* getByName string

* expose vanilla biomes

* not null

* before rename

* rename

* nbt cache

* fix

* fix

* fix

* final on vanilla biome
2024-02-12 15:25:46 -05:00
iam4722202468 3ea09e243f Add another test 2024-02-10 18:06:31 -05:00
iam4722202468 aca67fc5d8 Don't relight entire chunk 2024-02-10 18:06:31 -05:00
Steank d03466e5a3
Fix for #1883 (#1884)
* fix NPE when stopping server after MinecraftServer#init() but before starting

* add unit test

* fix for #1712

* fix hashCode contract violation between NamespaceID and KeyImpl objects
2024-02-09 15:53:52 -05:00
mworzala e1140b5856 chore: remove extensions 2024-02-09 14:27:43 -05:00
mworzala d6470594ae feat: handle ping request packet to make f3+3 ping graph functional
(cherry picked from commit 9fa936af0c298150a0d657415bea632b73f78048)
2024-02-09 14:27:43 -05:00
iam f0f81803a5 Fix lighting tests & heightmap (#137)
* fix tests

* fix heightmap lookup

(cherry picked from commit 7d717ada584bc3a3feaeda470113bb4adeb774ae)
2024-02-09 14:27:43 -05:00
mworzala a14dbf5cdd fix: shaped recipe protocol reorder
(cherry picked from commit 9d6752c86f)
2024-02-09 14:27:43 -05:00
mworzala 35a4c803d9 feat: expose isFaceFull for testing if a block shape has a full face
(cherry picked from commit cf4a2d134e)
2024-02-09 14:27:43 -05:00
mworzala 48d87db6e9 fix: InventoryCloseStateTest (#111)
(cherry picked from commit aec3694a4a)
2024-02-09 14:27:43 -05:00
GreatWyrm 7cec8f0bfc Fix server replaying the close window packet
(cherry picked from commit 4ba779d3f1)
2024-02-09 14:27:43 -05:00
mworzala f4cb5272f9 fix: re-merge connection states, remove OptifineSupport
(cherry picked from commit a0ca4895b1)
2024-02-09 14:27:43 -05:00
mworzala 69aeb8e2ea fix: preserve instance tag on #copy() (fix #112)
(cherry picked from commit 5f49033842)
2024-02-09 14:27:43 -05:00
mworzala 833c5fe365 fix: test failures
(cherry picked from commit c0d3f01fa2)
2024-02-09 14:27:43 -05:00
Matt Worzala 58b550c5ff Fix testing (v2) (#99)
* Fix Minecraft changes since 1.19 (Block.GRASS, recipe packet, DamageType.VOID)

* Add packets in play state

* Fix some tests via TestConnectionImpl and API changes

* fix: add some missing entity metas, group projectiles

---------

Co-authored-by: GoldenStack <goldenfire64yt@gmail.com>
(cherry picked from commit 89a665fdf5)
2024-02-09 14:27:43 -05:00
mworzala 2f85ce0231 stable configuration state join
(cherry picked from commit 465af0e051)
2024-02-09 14:27:43 -05:00
Tyreece Rozycki 2b236b441c fixes recipes for 1.20.1 (and probably 1.20.4) (#95)
* fixes recipes for 1.20.1 (and probably 1.20.4)

* add support for smithing trims and transforms

(cherry picked from commit 78cb62fa72)
2024-02-09 14:27:43 -05:00
mworzala 1c141e34c1 fix: allow placing at min y level
(cherry picked from commit 1554487748)
2024-02-09 14:27:43 -05:00
mworzala 58c03cc8d2 fix: ensure block placements can only happen inside the world border
(cherry picked from commit 0c5a177281)
2024-02-09 14:27:43 -05:00
Matt Worzala 6805c903f3 hollow-cube/command-parser-fixes (#54)
* Rewrite CommandParserImpl recursively (fix #1327)

* Fix for tests: CommandManagerTest, CommandParseTest

* Make attributes final inside Chain

* fix #1295 with argument type priority

* Don't include command name in list of arguments

* Add test for #1327

* Add test for #1295

* Fix suggestions with bad syntax

* Fix #1916

* Add test for #1916

* add failing test

* mess with arg order

* Fix `GraphImpl` causing syntax order issues

---------

Co-authored-by: Spanner <spanner77@protonmail.com>

(cherry picked from commit e9d0098418)
2024-02-09 14:27:43 -05:00
Matt Worzala c657be553f hollow-cube/prevent-block-placement-outside-world (#42)
* Prevent block place above 320

(cherry picked from commit d226c3994a)

* Move position of check

(cherry picked from commit ff7c4c108f)

* Add unit test

(cherry picked from commit 68500bf0d0)

* Add min y check

(cherry picked from commit 0ce77673a9)

---------

Co-authored-by: nucker <nuckermail@gmail.com>
(cherry picked from commit 8da8a70342)
2024-02-09 14:27:43 -05:00
Matt Worzala edf7b870c7 hollow-cube/add-gamemodechangeevent-and-fix-game-profile (#43)
* Resolve some todos and add connection.setProfile to EncryptionResponsePacket

* Add PlayerGameModeChangeEvent

(cherry picked from commit 1514d8ac1f)

* Add unit tests

(cherry picked from commit 9685e74f3b)

---------

Co-authored-by: GreatWyrm <alecmusante@gmail.com>
Co-authored-by: NxDs <7994264+NxDs@users.noreply.github.com>
(cherry picked from commit 2c567696ac)
2024-02-09 14:27:43 -05:00
Matt Worzala 9899f480b6 hollow-cube/display-name-and-team-fixes (#40)
* Update Player.java

* Remove useless team creation packets

* Send display names to new players

* Oops

* Add display name test

* Change to act

* Do not send display name if they do not have one

---------

Co-authored-by: emortaldev <me@emortal.dev>
(cherry picked from commit ab35ab0587)
2024-02-09 14:27:43 -05:00
iam c616b3498a hollow-cube/lighting-memory-reduction
Lighting reduce memory + Fix lighting not sending + Performance (#31)

* Reduce memory

* Clone

* Executor pool + cleanup

* Cleanup

* Don't batch, it's slower

* Parallel chunk loading for test

* Check below chunk 6. Sky light data doesn't appear to be saved above the highest point in the chunk height map.

* Fix weird locking

* ඞ

* Fix test

* Fix indentation

* Use short instead of int

* Use short instead of int

* Start removing borders

* Borders gone

* Cleanup

* Cleanup

* Remove borders fully - Still needs cleanup

* Cleanup 1

* Cleanup 2

* Cleanup 3

* Cleanup 4

* Cache

* Performance

* Performance

* Cleanup

* Cleanup

* Refactor

* Cleanup from self-review

(cherry picked from commit 12aa1e6b7b)
2024-02-09 14:27:43 -05:00