Commit Graph

129 Commits

Author SHA1 Message Date
Spottedleaf
0266b87e0f Change ChunkMapMixin#read to asynchronously load data
There's no reason to sync read the data, as the return value
is a CompletableFuture - and Vanilla performs this function
asynchronously as well.
2024-08-22 16:01:57 -07:00
Jason Penilla
1b189fc0c1 Implement dummy IO worker for compat with mods that directly call loadAsync (#5)
This change is targeting Distant Horizons compatibility, however further changes are needed on their side to read starlight data.
2024-08-22 15:57:34 -07:00
Jason Penilla
3f80f358d1 Make currently loading chunk available during entity loading (#4)
Fixes deadlock when mods attempt to retrieve the current chunk while loading entities (from screenEntity or otherwise)
2024-08-22 10:12:46 -07:00
Spottedleaf
5788bb64aa Do not always fail hard for null Property values in StateHolder
Some mods pass null to methods in this class that would not NPE
on Vanilla, so we need to preserve that behaviour.
2024-08-20 19:46:20 -07:00
Jason Penilla
c9fe98b213 Document and improve mod compatibility (#3) 2024-08-19 11:28:27 -07:00
Spottedleaf
a83025a52f Optimise BiomeManager#getFiddle
The floorMod and subtraction by 0.5 can be done before converting
to double, and the division by 1024 may be converted to a simple
multiplication. At this point, the result is exactly the same.

However, to remove the extra multiplication by 0.9, it can be
moved into the multiplication by 1/1024. This may affect
the result to one ULP, but I do not forsee that causing any problems.
2024-08-14 17:56:25 -07:00
Spottedleaf
0391e7beff Use custom random in block random ticking
The CAS performed by the regular random appears expensive.
These changes drop my server tick time locally @ tickSpeed = 10,000
from 53ms to 37ms.
2024-08-14 14:48:01 -07:00
Spottedleaf
5385e6f2cb Fix ViewDistanceHolder#setSendViewDistance updating tick distance
It should update the send view distance.
2024-08-14 12:22:33 -07:00
Spottedleaf
763fb751cb Add TickThread check to ServerChunkCache#getChunkNow
We shouldn't be using the currently loading chunk unless
we are on the main thread.
2024-08-14 12:17:46 -07:00
Spottedleaf
fc9d35c4b0 Store ticking blocks in chunk sections as positions only
Since we no longer use the state stored directly in the
IBlockDataList, it makes no sense to use IBlockDataList
at all.
2024-08-13 23:53:27 -07:00
Spottedleaf
a749c7282b Cache x coordinate multiplier for CollisionUtil#sliceShapeOptimised
This is consistent with how the rest of the collision patch iterates
the voxel bitset.
2024-08-12 16:56:26 -07:00
Spottedleaf
e68d381fc5 Avoid creating SliceShape when retrieving Voxelshape faces
SliceShape is not always the ideal shape, as sometimes the
face result is empty or full cube - but is represented as
SliceShape. Additionally, sometimes SliceShape should be
empty but isEmpty() is false.
2024-08-11 22:11:59 -07:00
Spottedleaf
c0a2e488fc Fix client command registration for Fabric
The dispatcher is not actually available during mod init. So,
use the event callback.
2024-08-10 20:29:29 -07:00
Spottedleaf
c5778192f6 Add overwrite for StateHolder#trySetValue
Now that we do not initialise the Vanilla table field,
we need to overwrite this method as well with our own
implementation.
2024-08-10 16:16:11 -07:00
Spottedleaf
65481aee6d Fix init in FlowingFluidMixin
The fluid state may have additional properties, so it is
inappropriate to iterate over all of the states and assume
that there will be no duplicate values with the same falling
and level property values.
2024-08-10 14:59:06 -07:00
Spottedleaf
edad8be41f Drastically reduce memory footprint of ZeroCollidingReferenceStateTable
We can linearize the table lookup by generating an index per
state using the property values.
2024-08-10 14:33:54 -07:00
Jason Penilla
cbdcab7267 Get BooleanProperty equals injection working using @WrapOperation on the instanceof check 2024-08-09 10:15:23 -07:00
Spottedleaf
f4f76707ed Add default implementation for Property id lookups
Just in case mods implement their own Properties which are
neither boolean, enum, nor integer.
2024-08-09 01:23:47 -07:00
Spottedleaf
4b8778cbe7 Class check EnumPropertyMixin#getIdFor
This should prevent invalid usages with the wrong enum type.
2024-08-08 23:33:27 -07:00
Jason Penilla
2b5c570ec3 Make BooleanPropertyMixin and UtilMixin more compatible 2024-08-08 22:18:36 -07:00
Spottedleaf
13374ad4a0 Make thread count mixin less aggressive
Redirect the thread pool construction instead of overwriting
the method.
2024-08-08 21:28:39 -07:00
Jason Penilla
cd5b6c037b Initial profiler commands (#2)
* Initial profiler commands

* copy paste

* leaf

* add todo

* command feedback

* Allow all commands in SP without cheats

* fix SP command check

* make client commands actual client commands

* Start client profile command implementation

* Remove ArgumentParser class

---------

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2024-08-08 21:07:13 -07:00
Spottedleaf
55e053b4be Add profiler instance back
This time we wrap the Vanilla profiler so that the F3 screen
works.
2024-08-08 17:30:56 -07:00
Spottedleaf
2fcae456b9 Band-aid fix bad mods throwing on getAmount()
https://github.com/JDKDigital/productivetrees/issues/16
2024-08-08 16:49:59 -07:00
Spottedleaf
09d9292f90 Adjust default config location
Place the config in config/
2024-08-08 16:22:52 -07:00
Spottedleaf
bbe9c0c041 Fix collidedY being ignored in EntityMixin#calculateStepHeights 2024-08-08 16:11:04 -07:00
Spottedleaf
8a10eac5a2 Update Entity#collide to new step height calculation
I missed the step height changes. This should bring the function
in-line with Vanilla.
2024-08-08 15:48:50 -07:00
Spottedleaf
810c57a99d Remove final qualifier from methods implemented in Level
Some mods override these.
2024-08-07 16:43:53 -07:00
Spottedleaf
ff20c163a4 Remove TODO for ExplosionMixin onExplosionHit
Didn't need to be ported to Paper, was only broken here.
2024-08-07 06:36:05 -07:00
Spottedleaf
2f97c1e3c3 Always invoke config initialisers
This resolves an issue where the worker threads were not
initialised if the config file did not exist already.
2024-08-07 06:18:30 -07:00
Spottedleaf
1053a51d1d Initial pass of implementing clobbered neoforge API 2024-08-07 05:34:01 -07:00
Spottedleaf
c3f31b1c90 Replace tabs with spaces 2024-08-07 02:09:40 -07:00
Spottedleaf
5bc1ba2feb Some neoforge compatibility
Drop farm block mixin, doesn't appear to be fixing streams
anymore so it's not useful.

Also, implement the force ticks api and make it thread-safe.
2024-08-07 02:06:18 -07:00
Jason Penilla
eada4f58bc Make mixins not public and add editorconfig 2024-08-07 02:05:40 -07:00
Spottedleaf
93eca8e994 Add configuration UI for some elements of the moonrise config
Mostly the important things: chunk load rates,
thread pool threads, and bug fix toggles.
2024-08-07 01:38:53 -07:00
Jason Penilla
d8f82ec045 setup config screen 2024-08-06 22:22:23 -07:00
Jason Penilla
d93cc978e3 Add PlatformHooks 2024-08-06 21:49:44 -07:00
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
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
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
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