修复异常的灵敏度变动
This commit is contained in:
parent
72ca233504
commit
03417ecd8d
5 changed files with 16 additions and 34 deletions
|
@ -86,11 +86,11 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m60.draw"));
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") > 0 && stack.getOrCreateTag().getDouble("animindex") == 0) {
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") > 0) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.fire"));
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") > 0 && stack.getOrCreateTag().getDouble("animindex") == 1) {
|
||||
if (stack.getOrCreateTag().getInt("fire_animation") > 0) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.fire2"));
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,11 @@ public class MarlinItem extends GunItem implements GeoItem, AnimatedItem {
|
|||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.marlin.draw"));
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getInt("flash_time") > 0 && stack.getOrCreateTag().getDouble("animindex") == 0) {
|
||||
if (stack.getOrCreateTag().getInt("flash_time") > 0) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.fire"));
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getInt("flash_time") > 0 && stack.getOrCreateTag().getDouble("animindex") == 1) {
|
||||
if (stack.getOrCreateTag().getInt("flash_time") > 0) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.fire2"));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.mcreator.superbwarfare.init.ModTags;
|
|||
import net.minecraft.client.CameraType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
@ -24,7 +23,6 @@ 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;
|
||||
|
||||
|
@ -50,22 +48,14 @@ public class MouseHandlerMixin {
|
|||
return original;
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
float sens = 0.2f;
|
||||
double fov = ClientEventHandler.fov;
|
||||
double zoom = stack.getOrCreateTag().getDouble("zoom") + stack.getOrCreateTag().getDouble("custom_zoom");
|
||||
float customSens = (float) stack.getOrCreateTag().getInt("sensitivity");
|
||||
|
||||
float originalFov = mc.options.fov().get();
|
||||
|
||||
if (!player.getMainHandItem().isEmpty() && mc.options.getCameraType() == CameraType.FIRST_PERSON) {
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
additionalAdsSensitivity = (float) Mth.clamp((1 + 0.1f * customSens) * (1.25F * fov / originalFov) * (1 + 0.2f * Math.pow((originalFov / fov), 1.25)), 0.125F, 2F);
|
||||
} else {
|
||||
additionalAdsSensitivity = Mth.clamp((1 + 0.1f * customSens) * 1.25F, 0.125F, 2F);
|
||||
}
|
||||
flag = true;
|
||||
return original / Math.max((1 + (0.25 * (zoom - (0.2 * customSens)) * ClientEventHandler.zoomTime)), 0.1);
|
||||
}
|
||||
|
||||
return original * additionalAdsSensitivity * (1.0 - sens * (flag ? 1 : 0));
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,29 +75,21 @@ public class ShootMessage {
|
|||
&& !stack.getOrCreateTag().getBoolean("need_bolt_action")) {
|
||||
|
||||
int singleInterval = 0;
|
||||
if (mode == 0) {
|
||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.holdFire = false;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
singleInterval = coolDownTick;
|
||||
}
|
||||
|
||||
int burstCooldown = 0;
|
||||
if (mode == 1) {
|
||||
|
||||
if (mode != 2) {
|
||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
capability.holdFire = false;
|
||||
capability.syncPlayerVariables(player);
|
||||
});
|
||||
stack.getOrCreateTag().putInt("burst_fire", (stack.getOrCreateTag().getInt("burst_fire") - 1));
|
||||
burstCooldown = stack.getOrCreateTag().getInt("burst_fire") == 0 ? coolDownTick + 4 : 0;
|
||||
if (mode == 0) {
|
||||
singleInterval = coolDownTick;
|
||||
} else if (mode == 1) {
|
||||
burstCooldown = stack.getOrCreateTag().getInt("burst_fire") == 0 ? coolDownTick + 3 : 0;
|
||||
stack.getOrCreateTag().putInt("burst_fire", (stack.getOrCreateTag().getInt("burst_fire") - 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.getOrCreateTag().getDouble("animindex") == 1) {
|
||||
stack.getOrCreateTag().putDouble("animindex", 0);
|
||||
} else {
|
||||
stack.getOrCreateTag().putDouble("animindex", 1);
|
||||
}
|
||||
/*
|
||||
空仓挂机
|
||||
*/
|
||||
|
|
|
@ -22,5 +22,5 @@
|
|||
"finish_time": 12,
|
||||
"BypassesArmor": 0.05,
|
||||
"SoundRadius": 16,
|
||||
"rpm": 90
|
||||
"rpm": 80
|
||||
}
|
Loading…
Add table
Reference in a new issue