Commit Graph

247 Commits

Author SHA1 Message Date
Spottedleaf
9c46dcbb94 Remove unused read/write methods on ChunkSystemSectionStorage
As with the last commit, these were only used in the legacy
region file I/O code and as such there is no reason to maintain
them.
2024-10-24 07:10:48 -07:00
Spottedleaf
9a1e04389a Adjust SectionStorageMixin to destroy hooks
In the legacy implementation of the region file I/O (before
the chunk system), these hooks were actually used. Now, they are not
and so there is no point in maintaining them.
2024-10-24 07:01:46 -07:00
Spottedleaf
29084d8e3f Properly sync on dimension data during ServerChunkCache#close
Note that this data was still saved, but we did not block until
it was finished.
2024-10-23 22:57:27 -07:00
Spottedleaf
41790ecf1a Implement overwrite for DistanceManager#getSpawnCandidateChunks 2024-10-23 22:53:34 -07:00
Spottedleaf
8af7bccdfd Adjust PlatformHooks#convertNBT to take TypeReference
DataFixTypes has a limited number of types, which will limit its
usage on Paper.
2024-10-23 22:10:41 -07:00
Spottedleaf
5f9b3571f8 Fix compile
Did not implement the other half of changes required in the last
commit...
2024-10-23 21:36:36 -07:00
Spottedleaf
9adfb2514d Change PlatformHooks#onChunkHolderTicketChange to take ChunkHolder
This makes compatibility on Paper easier to implement
as NewChunkHolder is not always available.
2024-10-23 21:33:54 -07:00
Jason Penilla
bf2cd1c571 fabric: fix crash when fabric-lifecycle-events-v1 not present 2024-10-23 18:23:42 -07:00
Jason Penilla
dad9a5c2eb Update to 1.21.3 and update cloth config api 2024-10-23 10:34:20 -07:00
Jason Penilla
a3acd46ee1 Fix explosion mixin
The field is a ServerLevel not a Level
2024-10-22 13:45:05 -07:00
Spottedleaf
3e8cb80336 Update to 1.21.2 2024-10-22 10:16:03 -07:00
Spottedleaf
5c3e713be7 Misc changes reviewing 1.21.2 update for Paper 2024-10-22 09:30:56 -07:00
Spottedleaf
284631c321 Use ThreadLocal in FlowingFluidMixin#COLLISION_OCCLUSION_CACHE
While the cache is safe to access from multiple threads, doing
so may incur false/true cache line sharing and reduce the
performance of the cache.
2024-10-22 09:30:54 -07:00
Spottedleaf
666c4cb1a3 Update to 1.21.2-rc1 2024-10-22 09:30:12 -07:00
Spottedleaf
19b523eecd Add async chunk writing
The RegionFile IO scheduler is now capable of taking in
a Completable<CompoundTag> for the chunk data instead of
CompoundTag. This allows writes to be scheduled without
the write value immediately.
2024-10-22 09:28:49 -07:00
Spottedleaf
4a748778dc Update to 1.21.2-pre1
For collisions, need to check out the new applyEffectsFromBlocks
function and see if there are any improvements we can make.

For the chunk system, we need to implement async chunk saving.
The current async unload structure will not work, as it is designed
to only handle 1 pending save at any given time.
2024-10-22 09:28:49 -07:00
Jason Penilla
a70073ae3e Setup issue templates (#53)
* Setup issue templates

* try to change order
2024-10-22 09:21:13 -07:00
Jason Penilla
6724814c02 Apply Lithium overrides on NeoForge (#57)
* Apply Lithium overrides on NeoForge

closes #56

* Update readme

* Sort overrides
2024-10-22 09:20:40 -07:00
Jason Penilla
f32a08738e Adjust min/max section optimizations (#55)
* Change min/max section optimisations

* Correctly init dimension type

We need to initialise the field as early as possible in the constructor
to avoid problems.

Also, do not cache min/max section in EntityLookup. Note that mods
that implement worlds with variable heights will not work still,
as the entity slices expect a fixed height.

* Cache calculated height values

---------

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2024-10-17 18:02:22 -07:00
Jason Penilla
56e48ed069 Back to 0.1.0-SNAPSHOT 2024-10-15 13:04:47 -07:00
Jason Penilla
9da99576a6 0.1.0-beta.6 v0.1.0-beta.6 2024-10-15 12:56:32 -07:00
Jason Penilla
dfbe1bcf8b Fix Mixin application failure in production
Work around https://github.com/FabricMC/tiny-remapper/issues/137
2024-10-15 12:45:22 -07:00
Jason Penilla
ae29196221 Back to 0.1.0-SNAPSHOT 2024-10-14 19:45:01 -07:00
Jason Penilla
f1eb61cc51 0.1.0-beta.5 v0.1.0-beta.5 2024-10-14 19:17:38 -07:00
Jason Penilla
58c933938f fabric: Call ServerChunkEvents.CHUNK_LOAD/CHUNK_UNLOAD, add and call FabricHooks.ON_EXPLOSION event (#52)
fixes #16
related to #45
2024-10-14 19:06:58 -07:00
Jason Penilla
1dc3cb5f14 Improve LeafProfiler output formatting (#28)
make it readable
2024-10-14 18:03:04 -07:00
Jason Penilla
2acfc6a68e Add missing require = 3 to util_threading_detector PalettedContainer constructor injection, and simplify fast_palette PalettedContainer constructor injection. 2024-10-02 10:54:52 -07:00
Jason Penilla
c22538c364 Back to 0.1.0-SNAPSHOT 2024-09-30 19:22:12 -07:00
Jason Penilla
e244c60375 0.1.0-beta.4 v0.1.0-beta.4 2024-09-30 19:10:12 -07:00
Jason Penilla
65253d5199 Re-fix dev-time conflict with lithium height overrides
See cfa80c44 and 2acd5cc2
2024-09-30 19:00:00 -07:00
Jason Penilla
6e82b034b7 Fix typo in previous commit
Also for some reason the issue resolved by cfa80c44 seems to be back...
2024-09-30 18:52:01 -07:00
Jason Penilla
a7cd78e63b Disable lithium mixin.util.entity_movement_tracking mixins, see #33 2024-09-30 18:43:25 -07:00
Jason Penilla
05ba7066d9 Add NeoForge/Mojang names for redirects in NaturalSpawnerMixin 2024-09-30 10:17:28 -07:00
Spottedleaf
340ac4e8f5 Fix incorrect fluid pushing velocity
Forgot to re-assign the flow vector variable with the scaled
flow.
2024-09-30 04:39:05 -07:00
Spottedleaf
a4770aca2b Fix performance regression in Entity#updateFluidHeightAndDoFluidPushing
The upper bounds from Vanilla are exclusive, but we were treating
them as inclusive which changes behavior and increases the number
of blocks read.
2024-09-30 04:39:05 -07:00
Spottedleaf
a8d4ce526b Optimise block/chunk reading in Entity#updateFluidHeightAndDoFluidPushing
Like other block reading code, a lot of time gets spent retrieving
the chunk and retrieving the section which we can avoid.
2024-09-30 04:39:05 -07:00
Spottedleaf
2acd5cc213 Optimise Level#isOutsideBuildHeight
We can cache the min/max build height to avoid the indirection
required to compute them.
2024-09-30 04:39:05 -07:00
Spottedleaf
07dce0ffe6 Change ShapesMixin#or to perform unoptimised intermediate joins
We can delay the shape optimisation to the final operation, which
should provide a perform boost for merging many shapes.
2024-09-30 04:39:05 -07:00
Spottedleaf
c2e2f0b9f2 Optimise countEntries for low size SimpleBitStorage
We can use a simple array lookup table by palette id when the
number of palette entries is low. This eliminates the need for
the map lookup on each entry.
2024-09-30 04:39:05 -07:00
Spottedleaf
1374ea34ee Replace ticking block coordinate set with ShortList
We can store a position (ranging from 0-4095) into a short,
so we can use ShortList to cut the memory usage in half.
2024-09-30 04:39:05 -07:00
Spottedleaf
fef4872a3a Do not calculate block counts on the client
It appears that this call is very expensive. We instead substitute
an exact check with setting the special colliding blocks to whether
the palette initially contains a special colliding block, and after
on block updating by whether any special colliding block was set.
2024-09-30 04:39:04 -07:00
Spottedleaf
a9678c76eb Fix missing range scale for passenger entities in entity tracker 2024-09-30 04:39:04 -07:00
Spottedleaf
bafa195546 Ensure relative block position methods return an immutable instance
If the relative distance is 0, then we would return the current
instance - which may be a mutable instance. However, Vanilla overrides
the relative function to return an immutable instance even when
the distance is zero. To ensure that this behavior is kept, we return
an immutable instance when the distance is zero.
2024-09-30 04:39:04 -07:00
Spottedleaf
04c6e6c01a Track broadcast chunks separately from player ticking chunks
Not all broadcast chunks are ticking in the new chunk system,
so we need to track them separately to ensure updates take place
in non-simulation range chunks.
2024-09-30 04:39:04 -07:00
Spottedleaf
7351872730 Avoid performing biome lookup for mob cost when entity has no cost
Most mob types do not have a cost with any biomes, so there is
no point in performing the lookup.
2024-09-30 04:39:04 -07:00
Spottedleaf
77b977ac17 Reduce chunk tick iteration count
By only iterating over chunks that are both ticking AND near players
or marked for ticking, we can reduce the number of chunks to iterate
over in higher SD settings.
2024-09-30 04:39:04 -07:00
Spottedleaf
f0d122f358 Optimise MobCounts implementation
Use of a map for category->count is inefficient as the key
is an enum. We can use a simple int array, which reduces
the get() and compute() calls to an array access.
2024-09-30 02:29:22 -07:00
Spottedleaf
aa240eb16d Modify isInWall to use same block retrieval as CollisionUtil 2024-09-30 02:25:24 -07:00
Spottedleaf
f9c99d1e32 Avoid streams for block retrieval in Entity#move
Profiling shows that the streams alone account for half of the time
for this specific check (inside fire/lava).
2024-09-30 02:25:24 -07:00
Spottedleaf
3fa0ff67a7 Optimise checkInsideBlocks
Use the same block retrieving algorithm as CollisionUtil
2024-09-30 02:25:24 -07:00