forked from CaffeineMC/lithium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: entity.fast_hand_swing: only calculate hand swing progress when …
…hand is swinging
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/me/jellysquid/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package me.jellysquid.mods.lithium.mixin.entity.fast_hand_swing; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
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.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntityMixin { | ||
@Shadow | ||
public boolean handSwinging; | ||
|
||
@Shadow | ||
public int handSwingTicks; | ||
|
||
@Inject( | ||
method = "tickHandSwing()V", | ||
at = @At("HEAD"), | ||
cancellable = true | ||
) | ||
private void skipGetDuration(CallbackInfo ci) { | ||
if (!this.handSwinging && this.handSwingTicks == 0) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters