Commit Graph

351 Commits

Author SHA1 Message Date
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
Spottedleaf
f7d9e5b422 Optimise findSupportingBlock to be like CollisionUtil
CollisionUtil's block iteration supports using the special
colliding blocks, as well as a superior (but more verbose)
chunk iteration.
2024-09-30 02:25:24 -07:00
Spottedleaf
5d1975154b Add dev override for max view distance 2024-09-30 02:25:24 -07:00
Spottedleaf
d21fa9f48c Use SimpleRandom for chunk tick shuffling 2024-09-30 02:25:24 -07:00
Spottedleaf
1c150afe83 Add and use reference counted ChunkData
ChunkData is stored directly on chunk holders, entity slices,
and on entities. Currently, this allows access to
NearbyPlayers$TrackedChunk without performing a map lookup.
2024-09-30 02:25:24 -07:00
Spottedleaf
d9988c86f4 Add direct lookup by chunk for NearbyPlayers
This simplifies the lookup code by reducing the number of "random"
accesses to 1 (get() call) assuming that the directByChunk array
is cached.
2024-09-30 02:25:24 -07:00
Jason Penilla
0958439e54 Improve mod compat for ShapesMixin (#36)
Use an inject instead of overwrite to avoid mixin conflicts - obviously this will still disregard any changes made by other
mixins, but at least it won't conflict immediately. This is useful because some library mods mixin here when only the content
mod actually needs the change.

Fixes incompatibility with CreativeCore but not LittleTiles
2024-09-29 18:32:04 -07:00
Jason Penilla
8d9d6488e8 Improve mod compat for EntityTickListMixin (#35)
Replaces an overwrite with a cancellable inject at head.

Fixes compat with mod AllTheLeaks
2024-09-29 18:23:17 -07:00
Jason Penilla
8ba83bc9c2 Adjust fluid state cache init for better compatibility (#31)
Some mods rely on data initialized in their fluid subclass constructor for the methods we call, which won't be available at the superclass constructor return.

Injecting into the registry add is a little ugly, but should be fine.

Fixes compat with Immersive Engineering.
2024-09-29 18:18:02 -07:00
Jason Penilla
0c60a6ac08 Update dependencies
Newer NeoForge has moved their coremods from JS to Java, which should slightly improve startup times (as the JS engine won't load without another mod that uses it), making this update relevant for development
2024-09-28 12:20:46 -07:00
Jason Penilla
d404dbc6c5 Fix entity cramming (#32)
We want to count non-passengers, not passengers
2024-09-24 15:29:11 -07:00
Jason Penilla
8d456890f1 Back to 0.1.0-SNAPSHOT 2024-09-17 16:58:55 -07:00
Jason Penilla
23eddfe918 0.1.0-beta.3 v0.1.0-beta.3 2024-09-15 13:53:16 -07:00
Jason Penilla
55ff406372 Update readme and mod metadata for Radium changes (#18) 2024-09-15 13:47:10 -07:00
Jason Penilla
3e25a2f4aa Update publishing metadata 2024-09-15 13:40:43 -07:00
Jason Penilla
cfa80c4488 Raise priority of collisions LevelMixin to apply after Lithium
Lithium replaces some of the height-related methods used by WorldUtil to return fields initialized in their constructor hook. We need to apply afterward to have them return valid data.

Given the application-order sensitive nature of the issue, it only presented in-dev.
2024-09-15 13:36:29 -07:00
Jason Penilla
453b635ef2 Fix explosion conflict with lithium 2024-09-15 12:43:13 -07:00
Jason Penilla
e07e4fdcc4 Reorder lithium overrides 2024-09-15 12:42:44 -07:00
Jason Penilla
81bb9701da Reformat FMJ to match editorconfig settings 2024-09-15 12:41:20 -07:00
Jason Penilla
d0a7f9af62 Add readme badges (#23) 2024-09-14 18:58:52 -07:00
Jason Penilla
fe7bcfc56a Back to 0.1.0-SNAPSHOT 2024-09-07 18:01:51 -07:00
Jason Penilla
44f8058b09 0.1.0-beta.2 v0.1.0-beta.2 2024-09-07 17:53:22 -07:00
Jason Penilla
d1f8e81913 Update gradle plugins and dependencies 2024-09-07 10:26:08 -07:00
Jason Penilla
dcef1320b2 Switch version back to 0.1.0-SNAPSHOT
We are still in the 0.1.0 beta cycle, bumping to 0.1.1-SNAPSHOT previously was an error
2024-09-07 10:25:17 -07:00
Jason Penilla
179b45cac5 Update lithium config overrides
`mixin.alloc.entity_tracker` does the same thing as useBetterIdentitySet, nothing more or less

closes #17
2024-09-07 10:06:10 -07:00
Jason Penilla
89e9cd52e4 fix(build): mark incompatibility with correct version of starlight 2024-09-03 12:04:19 -07:00
Jason Penilla
38c3f5fd80 0.1.1-SNAPSHOT 2024-09-03 11:58:01 -07:00
Jason Penilla
98e8a08e85 0.1.0-beta.1
this time maybe publishing will work
v0.1.0-beta.1
2024-09-03 11:50:08 -07:00
Jason Penilla
caf2960b6b fix(actions): populate release tag 2024-09-03 11:49:36 -07:00
Spottedleaf
a507c4c6a2 Set version to 0.1.0-beta.0 v0.1.0-beta.0 2024-09-03 11:40:04 -07:00
Jason Penilla
cfc73390d8 Setup automated publishing to CF and Modrinth (#15)
* Configure mod-publish-plugin

* Configure actions to run mod-publish-plugin

To publish a release:
- Set the mod version to x.x.x(-beta.x) in gradle.properties and commit
- Create a git tag named vx.x.x(-beta.x) (note the v prefix)
- Push commit, push tag
- Manually create a (pre-)release for the tag on GitHub web ui. The release notes will be reused for modrinth and CF.

The release creation will trigger the workflow and publish to modrinth and CF.

The build script will check for when the version contains `-beta.` and mark it as a beta on modrinth and CF.

After publishing a release, it's good practice to bump the version and add -SNAPSHOT, i.e. after releasing 0.0.1, push a commit changing the version to 0.0.2-SNAPSHOT. This ensures people downloading action artifacts have correct version numbers.

This commit also updates gradle/actions/setup-gradle which removes the need for a separate wrapper validation action (it is included in setup-gradle v4)

* Set project IDs
2024-09-03 11:37:56 -07:00
Spottedleaf
9066101f5d Update README.md 2024-09-03 10:13:11 -07:00
Spottedleaf
ae12fd4f7b Do not send chunk radius packet from PlayerList#setViewDistance
The underlying player chunk loader will do this for us. This fixes
sending possibly the wrong view distance.
2024-09-02 16:42:45 -07:00
Spottedleaf
901a417179 Only tick entity tracker if players are tracking or if at entity ticking
Vanilla will only tick if the entity moves or is at entity ticking
level. For Paper, I am concerned that using exact Vanilla behavior
may cause problems with plugins - so we will settle on ticking the
tracker as well if players are tracking the entity.

This should reduce ticking for larger VD settings.
2024-09-02 16:42:45 -07:00
Spottedleaf
1f1a0a5f6c Do not track entity unloads for tracker
ChunkMap#removeEntity is invoked for each entity remove, which
means that the TrackedEntity instance will always be cleared -
making our logic do nothing.
2024-09-02 16:42:29 -07:00
Jason Penilla
55e62621e6 Initial lithium compatibility on Fabric (#9)
* Initial lithium compatibility on Fabric

* Update readme

* Add lithium test run

* Revert editorconfig change
2024-09-02 13:43:07 -07:00
Spottedleaf
9c92ec48cd Disable MC-224294 by default
This is to adhere to Vanilla behavior...
2024-08-31 10:41:02 -07:00
Spottedleaf
37ca0e7b0d Config option to fix end island generation at far distances
See https://bugs.mojang.com/browse/MC-159283
2024-08-31 10:41:02 -07:00
Jason Penilla
bc3743cc43 Reuse a single ThreadingDetector instance for all PalettedContainers (#14)
We make all instance methods on ThreadingDetector no-op already, so no point in keeping multiple instances around. This saves around 100mb in my ATM10 SP world.
2024-08-30 17:14:59 -07:00
Spottedleaf
80aa5f80b8 Add explicit config init hooks
Last commit moved the config to ConfigHolder, which is no longer
referenced during init by any code. As a result, we need an explicit
init hook to initialise the class and the config.
2024-08-29 15:55:43 -07:00
Spottedleaf
920a7e8722 Move all config access to PlatformHooks
This will make porting these changes back to Paper much easier,
as we will just provide a PlatformHooks implementation.
2024-08-29 15:24:56 -07:00
Jason Penilla
25c0bd37c5 NeoForge: Call ChunkEvent.Unload on shutdown (#13)
This brings behavior in line with vanilla NeoForge.
2024-08-29 15:21:08 -07:00
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