Commit Graph

101 Commits

Author SHA1 Message Date
Jason Penilla
c8d18ca479 Split some mixins to their platforms 2024-08-06 21:49:44 -07:00
Jason Penilla
a87cf17bd1 Setup multi-project build 2024-08-06 21:49:42 -07:00
Jason Penilla
f463fbeb23 Initial NeoForge port
Gets into world with no other mods. Currently nukes a bunch of API calls.
2024-08-06 21:49:10 -07:00
Spottedleaf
4442452c52 Fix shading ConcurrentUtil dependencies
Update ConcurrentUtil to fix the dependency scopes
2024-08-06 21:40:39 -07:00
Spottedleaf
bfaddd34fc Update to ConcurrentUtil 0.0.2, and refactor I/O + worker pool
With ConcurrentUtil 0.0.2, we can make all thread pools
(worker+I/O) have their thread counts configurable on the fly.

The new I/O system splits the compression/decompression work
from the I/O. The compression/decompression is ran on the worker
pool, while the I/O is ran on the I/O pool. This allows for
better cpu utilisation control on systems with low core counts,
and allows higher read/write speeds on systems with higher
core counts.

Additionally, the I/O scheduling for thread counts > 1 is also
improved as it longer selects a thread to schedule based on the
chunk location.
2024-08-06 21:25:08 -07:00
Spottedleaf
6a2c6d27df Update build system, relocate libraries
We should be relocating our libraries just in case there are
other mods that ship the same libraries, although I doubt
any actually will.
2024-08-04 04:22:38 -07:00
Spottedleaf
ffec3386d3 Adjust description to remove mentions of client
We don't really have any client optimisations right now.
2024-08-01 18:22:37 -07:00
Spottedleaf
c2a0585f2a Update ConcurrentUtil to fix concurrent long map iteration on resize 2024-08-01 16:51:03 -07:00
Spottedleaf
63f4fea60c Make loading screen patch skip chunk waiting
We do actually need to wait for some other information from the
server before closing the screen.
2024-07-30 01:37:31 -07:00
Spottedleaf
c77e782eb1 Use yaml linebreak for header, trim header lines
This brings the header serialization in-line with the
comment serialization.
2024-07-29 19:33:08 -07:00
Spottedleaf
8faded3521 Disable loading screen
This will let users load worlds slightly faster.
2024-07-29 15:04:43 -07:00
Spottedleaf
3351f9d5df Skip reverse DNS lookup when connecting/pinging servers
The rDNS is not cheap and is not necessary. We skip the
rDNS by providing the input address as the host name when
the input address is a plain ipv4/ipv6 address.
2024-07-29 05:53:06 -07:00
Spottedleaf
c2375feaad Copy leftover changes to chunk system from Folia 2024-07-28 15:31:40 -07:00
Spottedleaf
4995ec5b58 Log throwable when failing to save chunk/poi/entity data 2024-07-17 11:46:55 -07:00
Spottedleaf
59c3043a35 Move ChunkSystem hook class to common util package
This class is supposed to be interfaced by a lot of other patches,
so it makes sense to move it here.
2024-07-17 08:03:42 -07:00
Spottedleaf
bbf85f323f Optimise chunk tick iteration
The basic problem with the chunk tick iteration is that
Vanilla will iterate over all chunk holders to find ticking chunks.
However, there are usually many more chunk holders than
ticking chunks. We can eliminate the cost of finding the
ticking chunks by maintaining our own list of ticking chunks.
2024-07-17 07:25:48 -07:00
Spottedleaf
cec8e6fd9d Optimise chunk tick checking during chunk tick
We don't need to check for this with the chunk system, as
ticking chunks are actually guaranteed to ticking. Additionally,
ticking chunks may only become non-ticking during the chunk holder
manager tick - which will not happen during chunk ticking.
2024-07-16 18:34:47 -07:00
Spottedleaf
8bc6b3c76d Fix priority scheduling logic 2024-07-16 18:27:36 -07:00
Spottedleaf
2d5fb18af3 Slightly improve getNoiseBiome
See reason note
2024-07-14 19:03:31 -07:00
Spottedleaf
4d4f341595 Fix incorrect coordinate for BlockState lookup
It was fastecause it was wrong! It now only appears
marginally faster.
2024-07-14 18:32:18 -07:00
Spottedleaf
b160a14068 Retrieve BlockState directly from chunk section for random tick
This appears to be faster than going directly to the global
palette, even though the global palette should be a simple list
get call.
2024-07-14 18:19:41 -07:00
Spottedleaf
225d5f937d Avoid collision shapes outside world border in findFreePosition
This is to correctly adhere to Vanilla behavior.
2024-07-14 12:56:30 -07:00
Spottedleaf
1f0ca522c7 Port random ticking patch from Paper 2024-07-14 12:55:46 -07:00
Spottedleaf
e0aac6916b Update raw palette array on value insertion for SingleValuePalette
It may be possible to invoke moonrise$getRawPalette before
the palette's single value is initialised, so we need to track
the returned raw palette array.
2024-07-14 05:14:36 -07:00
Spottedleaf
24657f1fd6 Update last chunk position in findSupportingBlock
Fixes fetching chunks needlessly multiple times.

Thanks Lulu13022002 for pointing this out
2024-07-13 11:38:57 -07:00
Spottedleaf
2eb4a71a35 Add todo.txt 2024-07-11 12:29:55 -07:00
Spottedleaf
523e8d98c4 Changes made while porting collision patch to Paper
1. Need a better solution for EntityMixin block/fire collision
2. Fixed inconsistent Vanilla behavior for ExplosionMixin
   Mostly revolved around the explosion intensity calculator,
   as well as the damage calculator
3. Optimise ExplosionMixin to not call getSeenPercent twice,
   which is a new "feature" of 1.21
4. Optimise VoxelShapeMixin#toAabbsUncached()
   The regular forAllBoxes method on VoxelShape will incur
   indirection costs due to the virtual method invoke on
   the coordinate retrieval as well as on the consumer itself
2024-07-11 11:57:18 -07:00
Spottedleaf
6d8e12ed6f Copy entity tracker optimisations from Folia 2024-07-11 09:00:54 -07:00
Spottedleaf
6ff9aca2db Increment ChunkHolderManager current tick
This is an oversight from copying from Folia. The current tick
should be incremented so that incremental autosave can properly
occur.
2024-07-11 08:56:00 -07:00
Spottedleaf
e73a2443c7 Synchronise config reloading
In the future, config will be writable by both client & server
and so synchronisation should be happening.
2024-07-08 05:54:22 -07:00
Spottedleaf
bd3f32c944 Execute chunk tasks mid-tick.
If the server tick length is high, then the amount of time
available to process chunk tasks inbetween ticks is low. As a
result, chunk loading and generation may appear to slow down.

To ensure that chunk tasks are always processed, we add logic to
execute chunk tasks during tile entity tick, entity tick, chunk
random ticking, and scheduled block/fluid ticking. The mid-tick task
execution is timed so that it is not prioritised over the server
tick.
2024-06-28 19:04:11 -07:00
Spottedleaf
2c97e8dc6e Fairly execute chunk tasks for all worlds
To ensure that a single world does not eat up allocated
processing time for tasks, execute tasks for all worlds
before returning from pollTaskInternal().
2024-06-28 18:08:46 -07:00
Spottedleaf
641694d07c Fix NPE when retrieving an entity with a null UUID
While the null UUID is almost certainly an error, the old
implementation did not NPE as it used a plain HashMap for lookup
by UUID, whereas we use a ConcurrentHashMap which will NPE on
null keys.
2024-06-23 18:51:14 -07:00
Spottedleaf
4c36d6db57 Fix unload queue storing chunks in wrong sections
The unload queue stored the chunks in the same section as
the chunk coordinate, when it needed to apply the unload shift.

Additionally, change the default region shift to the ticket
propagator shift as there is no benefit to using a low region
shift since no regionizing is occuring. This makes the unload
queue shift 6, which should reduce the number of sections to deal
with while processing unloads.
2024-06-21 11:44:53 -07:00
Spottedleaf
30cb658845 Move field initializations out of constructor injects
They should be less fragile for breakages.

Additionally, modify PoiManagerMixin to work around an issue where
our getOrCreate() method is not being invoked _because_ its return
type was PoiSection and not Object. Apparently, the JVM will search
the superclass when a direct match (params+return type) is not found.
2024-06-19 17:36:57 -07:00
Spottedleaf
044a23f34a Add debug chunks command
This feature dumps the entire chunk system state to disk, useful
for debugging the chunk system state without a debugger.
2024-06-19 11:53:06 -07:00
Spottedleaf
4911c5033a Move addition to full chunk map before calling callbacks
The full chunk map should mirror immediately the
full chunk status, so it should be added immediately after
upgrading to FULL or removed immediately before downgrading to
INACCESSIBLE.
2024-06-19 10:10:31 -07:00
Spottedleaf
393bd84ca8 Null check onComplete parameter for scheduleChunkLoad with gen = false
When gen = true, the parameter may be null. There is no reason it
should NPE then when gen = false.
2024-06-19 08:19:31 -07:00
Spottedleaf
ed3e278562 Fix NPE in ServerLevelMixin#moonrise$getFullChunkIfLoaded
d23825aa56
2024-06-18 18:31:48 -07:00
Spottedleaf
502cee89cd Fix respawning not loading chunks
We need to copy the real player field and view distance holder
object over, as Vanilla re-creates ServerPlayer objects unlike
CraftBukkit.
2024-06-18 16:20:34 -07:00
Spottedleaf
ac971bee98 Add relight command
This is simply for feature parity with Paper.
2024-06-18 15:58:54 -07:00
Spottedleaf
240faf56a4 Fix implementations of ChunkHolder#getChunkIfPresent
Implementations for ChunkStatuses below FULL are supposed to always
return ProtoChunk instances. However, since we used the last completed
status, it could return LevelChunk.

To resolve this, follow Vanilla behavior of tracking chunk
completions by status and replace old ProtoChunk statuses with
ImposterProtoChunk when the chunk generates to FULL.

Additionally, implement an optimisation for retrieving full chunks
by storing a map of pos -> LevelChunk. This requires only a simple
map lookup to occur for full chunks which are loaded.
2024-06-16 13:46:42 -07:00
Spottedleaf
62efccbd3f Null check max status in GenerationChunkHolder#getChunkIfPresent
If the ticket level is set to unloaded, then it will be null.
2024-06-16 12:12:42 -07:00
Spottedleaf
867f165eb6 WIP changes from stream 2024-06-15 07:33:34 -07:00
Spottedleaf
188ddaae7b Update to 1.21 2024-06-14 09:50:54 -07:00
Spottedleaf
fff73cff5b Add proper moonrise configuration
The config is stored under `moonrise.yaml` in the working
directory. Comments document each option.
2024-06-11 10:11:32 -07:00
Spottedleaf
23f201e5ed Sync chunk system changes from Paper
Additionally, slightly increase parallelism of ticket level
propagation
2024-06-05 12:56:43 -07:00
Spottedleaf
b6a8fed850 Add conformVisibility for mixin overwrites
We don't actually want to change the visibility of mixins when
overwriting them.

This reduces the surface area for mod conflicts.
2024-05-29 01:35:45 -07:00
Spottedleaf
c8fec9d3ac Add moonrise command
For now, includes the holderinfo and chunkinfo commands
from Paper.
2024-05-28 06:04:54 -07:00
Spottedleaf
3222ed8c6f Clamp tick distance by load distance
This brings expected behavior in-line more with Vanilla,
which will not always load chunks up to the tick distance.
2024-05-28 05:15:56 -07:00