Skip to content

Commit

Permalink
Fix Neoforge
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Oct 25, 2024
1 parent d45a67d commit 10d67f1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ private static boolean canNoneExpire(SortedArraySet<Ticket<?>> tickets) {
return true;
}

@Redirect(method = { "method_14041", "lambda$getTickets$7" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/util/SortedArraySet;create(I)Lnet/minecraft/util/SortedArraySet;"))
@Redirect(
method = { "method_14041", "lambda$getTickets$5" }, // Fabric, Neoforge
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/SortedArraySet;create(I)Lnet/minecraft/util/SortedArraySet;"))
private static SortedArraySet<Ticket<?>> useLithiumSortedArraySet(int initialCapacity) {
return new ChunkTicketSortedArraySet<>(initialCapacity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class LevelChunkMixin {

@Inject(
method = { "method_31719", "lambda$updateBlockEntityTicker$6" }, // Fabric, Neoforge
method = { "method_31719", "lambda$updateBlockEntityTicker$7" }, // Fabric, Neoforge
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addBlockEntityTicker(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V"),
locals = LocalCapture.CAPTURE_FAILHARD
)
Expand All @@ -28,7 +28,7 @@ private void setBlockEntityTickingOrder(BlockEntity blockEntity, BlockEntityTick
}

@Inject(
method = { "method_31719", "lambda$updateBlockEntityTicker$6" }, // Fabric, Neoforge
method = { "method_31719", "lambda$updateBlockEntityTicker$7" }, // Fabric, Neoforge
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/chunk/LevelChunk$RebindableTickingBlockEntityWrapper;rebind(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V"),
locals = LocalCapture.CAPTURE_FAILHARD
)
Expand Down
4 changes: 0 additions & 4 deletions lithium-fabric-mixin-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ mixin.gen.biome_noise_cache=false
Mob AI optimizations

### `mixin.ai.pathing`

(default: `false`)
A faster code path is used for determining what kind of path-finding node type is associated with a
given block. Additionally, a faster chunk cache will be used for accessing blocks while evaluating
Expand Down Expand Up @@ -149,7 +148,6 @@ FluidStates store directly whether they are empty
Fluid optimizations

### `mixin.block.fluid.flow`

(default: `false`)
Fluid flow optimization

Expand Down Expand Up @@ -480,7 +478,6 @@ Allow accessing certain fields and functions that are normally inaccessible
Allows access to existing BlockEntities without creating new ones

### `mixin.util.block_tracking`

(default: `false`)
Chunk sections count certain blocks inside them and provide a method to quickly check whether a chunk contains any of these blocks. Furthermore, chunk sections can notify registered listeners about certain blocks being placed or broken.
Requirements:
Expand Down Expand Up @@ -617,7 +614,6 @@ Requirements:
Faster block and fluid access due to inlining and reduced method size

### `mixin.world.inline_height`

(default: `false`)
Reduces indirection by inlining world height access methods

Expand Down
36 changes: 8 additions & 28 deletions lithium-neoforge-mixin-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ mixin.gen.biome_noise_cache=false
Mob AI optimizations

### `mixin.ai.pathing`
(default: `true`)

(default: `false`)
A faster code path is used for determining what kind of path-finding node type is associated with a
given block. Additionally, a faster chunk cache will be used for accessing blocks while evaluating
paths.
Expand Down Expand Up @@ -95,18 +96,10 @@ Disable the parent animal sensor when an animal is not a baby. Would differ from
(default: `true`)
Patches that reduce memory allocations

### `mixin.alloc.blockstate`
(default: `true`)
Improve the BlockState withTable lookup by using a custom table implementation.

### `mixin.alloc.chunk_random`
(default: `true`)
Random block ticking uses fewer block position allocations, thereby reducing the object allocation rate.

### `mixin.alloc.chunk_ticking`
(default: `true`)
Reuse large chunk lists

### `mixin.alloc.composter`
(default: `true`)
Composters will reuse the available slot arrays that are requested by hoppers
Expand All @@ -123,10 +116,6 @@ Entity trackers use a fastutil set for storing players instead of an IdentityHas
(default: `true`)
Avoid `Enum#values()` array copy in frequently called code

### `mixin.alloc.enum_values.living_entity`
(default: `true`)
Avoid `Enum#values()` array copy in frequently called code

### `mixin.alloc.enum_values.piston_block`
(default: `true`)
Avoid `Enum#values()` array copy in frequently called code
Expand Down Expand Up @@ -160,7 +149,8 @@ FluidStates store directly whether they are empty
Fluid optimizations

### `mixin.block.fluid.flow`
(default: `true`)

(default: `false`)
Fluid flow optimization

### `mixin.block.hopper`
Expand Down Expand Up @@ -250,10 +240,6 @@ Use ReferenceArraySet instead of HashSet to store the fluids the entity is curre
(default: `true`)
Uses fastutil hashmaps for gamerules

### `mixin.collections.goals`
(default: `true`)
Uses fastutil hashsets for goals in the AI goal selector

### `mixin.collections.mob_spawning`
(default: `true`)
Uses custom hashset/list combination for faster mob spawn checks
Expand Down Expand Up @@ -430,10 +416,6 @@ Requirements:
(default: `true`)
Only check positions with expiring tickets during ticket expiration. Can cause reordering of chunks unloading. The chunk unloading order in vanilla is predictable, but depends on the hash of the chunk position of the tickets and the hashes of the other chunk tickets, and the order of creation of the chunk tickets when hash collisions occur. No known contraptions depend on the unload order.

### `mixin.profiler`
(default: `true`)
Avoid indirection when accessing the profiler

### `mixin.shapes`
(default: `true`)
Various VoxelShape optimizations
Expand Down Expand Up @@ -479,7 +461,8 @@ Allow accessing certain fields and functions that are normally inaccessible
Allows access to existing BlockEntities without creating new ones

### `mixin.util.block_tracking`
(default: `true`)

(default: `false`)
Chunk sections count certain blocks inside them and provide a method to quickly check whether a chunk contains any of these blocks. Furthermore, chunk sections can notify registered listeners about certain blocks being placed or broken.
Requirements:
- `mixin.util.data_storage=true`
Expand Down Expand Up @@ -600,10 +583,6 @@ Various improvements to explosions.
(default: `true`)
Various improvements to explosion block damage, e.g. not accessing blocks along an explosion ray multiple times

### `mixin.world.explosions.cache_exposure`
(default: `true`)
Caches entity explosion exposure to avoid duplicate calculations.

### `mixin.world.game_events`
(default: `true`)
Various improvements to game events (vibrations) that are detected by allays, wardens and several sculk blocks.
Expand All @@ -619,7 +598,8 @@ Requirements:
Faster block and fluid access due to inlining and reduced method size

### `mixin.world.inline_height`
(default: `true`)

(default: `false`)
Reduces indirection by inlining world height access methods

### `mixin.world.raycast`
Expand Down
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Lithium is a free and open-source optimization mod for Minecraft which makes a w
[[dependencies.lithium]]
modId = "minecraft"
type = "required"
versionRange = "[1.21,1.21.1]"
versionRange = "[1.21.2,1.21.3]"
ordering = "NONE"
side = "BOTH"

Expand Down

0 comments on commit 10d67f1

Please sign in to comment.