修改灵敏度mixin的fov设置
This commit is contained in:
parent
a84f2d8b59
commit
cbfde8f234
1 changed files with 9 additions and 5 deletions
|
@ -18,23 +18,27 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|||
*/
|
||||
@Mixin(MouseHandler.class)
|
||||
public class MouseHandlerMixin {
|
||||
|
||||
@ModifyVariable(method = "turnPlayer()V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 2)
|
||||
private double sensitivity(double original) {
|
||||
float additionalAdsSensitivity = 1.0F;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
if (player == null) {
|
||||
return original;
|
||||
}
|
||||
|
||||
ItemStack stack = mc.player.getMainHandItem();
|
||||
|
||||
boolean flag = false;
|
||||
float sens = 0.01f;
|
||||
float fov = (float) player.getPersistentData().getDouble("fov");
|
||||
|
||||
float original_fov = 60;
|
||||
float original_fov = mc.options.fov().get();
|
||||
|
||||
if (mc.player != null && !mc.player.getMainHandItem().isEmpty() && mc.options.getCameraType() == CameraType.FIRST_PERSON) {
|
||||
|
||||
if (stack.is(TargetModTags.Items.GUN) && (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||
|
||||
additionalAdsSensitivity = Mth.clamp(1.5F * fov / original_fov, 0.25F, 0.8F);
|
||||
|
||||
flag = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue