Skip to content

Commit

Permalink
Skip sprinting particle creation server side
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Jan 17, 2025
1 parent 4607fd8 commit f10a886
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"

modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation 'com.github.2No2Name:McTester:v0.3.3'
// modImplementation 'com.github.2No2Name:McTester:v0.3.3'

Set<String> fabricApiModulesCompileOnly = [
"fabric-transfer-api-v1"
Expand Down
4 changes: 4 additions & 0 deletions lithium-mixin-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ Accesses entities of the correct type directly instead of accessing all nearby e
(default: `true`)
Skips repeated checks whether the equipment of an entity changed. Instead equipment updates are detected

### `mixin.entity.sprinting_particles`
(default: `true`)
Skips trying to create sprinting particles for all entities on the server side.

### `mixin.experimental`
(default: `false`)
Various experimental optimizations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.jellysquid.mods.lithium.mixin.entity.sprinting_particles;

import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(Entity.class)
public abstract class EntityMixin {

@Shadow
public abstract World getWorld();

@Redirect(
method = "baseTick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;shouldSpawnSprintingParticles()Z")
)
private boolean skipParticlesOnServerSide(Entity instance) {
if (instance.getWorld().isClient()) {
return instance.shouldSpawnSprintingParticles();
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@MixinConfigOption(description = "Skips trying to create sprinting particles for all entities on the server side.")
package me.jellysquid.mods.lithium.mixin.entity.sprinting_particles;

import net.caffeinemc.gradle.MixinConfigOption;
1 change: 1 addition & 0 deletions src/main/resources/lithium.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"entity.skip_equipment_change_check.ArmorStandEntityMixin",
"entity.skip_equipment_change_check.LivingEntityMixin",
"entity.skip_equipment_change_check.MobEntityMixin",
"entity.sprinting_particles.EntityMixin",
"experimental.chunk_tickets.ChunkTicketManagerMixin",
"experimental.entity.block_caching.EntityMixin",
"experimental.entity.block_caching.block_support.EntityMixin",
Expand Down

0 comments on commit f10a886

Please sign in to comment.