Commit Graph

156 Commits

Author SHA1 Message Date
Spottedleaf
007551903b Properly check empty context-sensitive collision shape
The emptyCollisionShape() function only checks whether the
cached collision shape (not the context-sensitive collision shape)
is empty. In places where we use the context-sensitive
collision, we need to check the context-sensitive shape instead.
2024-08-29 07:47:08 -07:00
Spottedleaf
92e5f2c81e Fall back to regular sync load if not on tick thread for syncLoadNonFull
Some mods are erroneously asynchronously performing
nearby structure lookups (which is not safe in Vanilla due to
the StructureCheck usage). However, syncLoadNonFull should
be thread-safe to invoke off-main as Vanilla's equivalent is.

This makes asynchronous structure lookups safe in Moonrise, but
mods should still perform these on-main as Vanilla does not safely
support asynchronous calls.
2024-08-28 21:17:45 -07:00
embeddedt
d7bed57111 Replace StateHolder.values with custom map (#10)
* Replace StateHolder.values with custom map

* Code style

* remove newline

* Address review

* qualify `this` and add final
2024-08-28 21:15:44 -07:00
Jason Penilla
f376944ddd Specify import order and final locals/params in editorconfig 2024-08-27 15:00:59 -07:00
Jason Penilla
bbdd8e1c4d Remove ModernFix config recommendation
This was a non-crucial adjustment, and ModernFix will apply it automatically when detecting Moonrise in the next version.
2024-08-24 13:39:20 -07:00
Jason Penilla
2e0f0abb11 Fix level loading screen showing 0% until in-game (#7)
* Fix level loading screen showing 0% until in-game

* Schedule loading screen updates

* null check progress listener

* move out of loop
2024-08-23 20:30:14 -07:00
Jason Penilla
b8f281aa79 Reduce cache size for non-existent region file coordinates
Also use the default initial size
2024-08-23 19:35:10 -07:00
Jason Penilla
dff8c59d51 Remove note on light suppression
light suppression is fixed in vanilla
2024-08-23 13:56:53 -07:00
Jason Penilla
03a3f72752 Add note to readme about vanilla behavior 2024-08-23 13:45:46 -07:00
Spottedleaf
5269b0bcb0 Set version to 0.1.0-SNAPSHOT 2024-08-23 11:52:29 -07:00
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
Jason Penilla
58a51d914b Update compatible versions and build against 1.21.1 2024-08-18 20:42:56 -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
48504e990e Start README 2024-08-14 13:06:16 -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
0dd063ecac Update neoforge version 2024-08-07 05:59:00 -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
426d2ec30c gen ide runs 2024-08-07 00:15:56 -07:00
Jason Penilla
5eb3f82cee fix neo dev run 2024-08-07 00:04:09 -07:00