-
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.
- Loading branch information
Showing
15 changed files
with
443 additions
and
116 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
8 changes: 8 additions & 0 deletions
8
src/main/java/io/github/axolotlclient/oldanimations/ducks/Sneaky.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,8 @@ | ||
package io.github.axolotlclient.oldanimations.ducks; | ||
|
||
/* welcome back! */ | ||
public interface Sneaky { | ||
|
||
/* we need to easily share the interpolated eye height with some other classes */ | ||
float axolotlclient$getEyeHeight(); | ||
} |
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
46 changes: 46 additions & 0 deletions
46
src/main/java/io/github/axolotlclient/oldanimations/mixin/BiPedModelMixin.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,46 @@ | ||
package io.github.axolotlclient.oldanimations.mixin; | ||
|
||
import net.minecraft.client.render.entity.model.BiPedModel; | ||
import net.minecraft.client.render.model.ModelPart; | ||
import net.minecraft.entity.Entity; | ||
import org.objectweb.asm.Opcodes; | ||
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.Slice; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(BiPedModel.class) | ||
public abstract class BiPedModelMixin { | ||
|
||
@Shadow | ||
public ModelPart rightArm; | ||
|
||
@Inject( | ||
method = "setAngles", | ||
at = @At( | ||
value = "FIELD", | ||
opcode = Opcodes.PUTFIELD, | ||
target = "Lnet/minecraft/client/render/model/ModelPart;posY:F", | ||
shift = At.Shift.AFTER | ||
), | ||
slice = @Slice( | ||
from = @At( | ||
value = "FIELD", | ||
opcode = Opcodes.GETFIELD, | ||
target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I", | ||
ordinal = 0 | ||
), | ||
to = @At( | ||
value = "FIELD", | ||
opcode = Opcodes.GETFIELD, | ||
target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I", | ||
ordinal = 2 | ||
) | ||
) | ||
) | ||
private void axolotlclient$oldArmPosition(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn, CallbackInfo ci) { | ||
rightArm.posY = 0.0f; | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
...in/java/io/github/axolotlclient/oldanimations/mixin/FishingBobberEntityRendererMixin.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,49 @@ | ||
package io.github.axolotlclient.oldanimations.mixin; | ||
|
||
import io.github.axolotlclient.oldanimations.OldAnimations; | ||
import io.github.axolotlclient.oldanimations.ducks.Sneaky; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.render.entity.FishingBobberEntityRenderer; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; | ||
|
||
@Mixin(FishingBobberEntityRenderer.class) | ||
public class FishingBobberEntityRendererMixin { | ||
|
||
@ModifyArgs(method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;<init>(DDD)V")) | ||
private void axolotlclient$modifyLinePosition(Args args) { | ||
if (isRodEnabled()) { | ||
/* original values from 1.7 */ | ||
args.set(0, (double) args.get(0) - 0.24D); | ||
args.set(2, (double) args.get(2) + 0.45D); | ||
} | ||
} | ||
|
||
@ModifyConstant(method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;DDDFF)V", constant = @Constant(doubleValue = 0.8D)) | ||
public double axolotlclient$moveLinePosition(double constant) { | ||
/* original value from 1.7 */ | ||
if (isRodEnabled()) constant += 0.05D; | ||
return constant; | ||
} | ||
|
||
@Redirect(method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSneaking()Z")) | ||
public boolean axolotlclient$removeSneakTranslation(PlayerEntity instance) { | ||
return !isRodEnabled() && instance.isSneaking(); | ||
} | ||
|
||
@Redirect(method = "render(Lnet/minecraft/entity/projectile/FishingBobberEntity;DDDFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getEyeHeight()F")) | ||
public float axolotlclient$useLerpEyeHeight_Fish(PlayerEntity instance) { | ||
if (OldAnimations.getInstance().enabled.get() && OldAnimations.getInstance().rod.get()) { | ||
return ((Sneaky) MinecraftClient.getInstance().gameRenderer).axolotlclient$getEyeHeight(); | ||
} | ||
return instance.getEyeHeight(); | ||
} | ||
|
||
@Unique | ||
private static boolean isRodEnabled() { | ||
return OldAnimations.getInstance().enabled.get() && OldAnimations.getInstance().rod.get(); | ||
} | ||
} |
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
Oops, something went wrong.