修复无人机和火炮无法攻击的bug,修复火炮开火后视角抖动消失bug

This commit is contained in:
Atsuihsio 2024-11-23 15:53:17 +08:00
parent 088358c5e0
commit d73dd83a7a
3 changed files with 11 additions and 4 deletions

View file

@ -4,4 +4,4 @@ org.gradle.daemon=false
mc_version=1.20.1
jei_version=15.2.0.27
cloth_config_version=11.1.106
mod_version=0.2.7
mod_version=0.2.8

View file

@ -114,7 +114,9 @@ public class ClickHandler {
}
}
if (player.getMainHandItem().is(ModTags.Items.GUN)) {
if (player.getMainHandItem().is(ModTags.Items.GUN)
|| stack.is(ModItems.MONITOR.get())
|| (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity && player.getMainHandItem().getItem() instanceof CannonShellItem)) {
if (button == ModKeyMappings.FIRE.getKey().getValue()) {
handleWeaponFirePress(player, stack);
}
@ -232,7 +234,9 @@ public class ClickHandler {
ModUtils.PACKET_HANDLER.sendToServer(new SensitivityMessage(false));
}
if (player.getMainHandItem().is(ModTags.Items.GUN)) {
if (player.getMainHandItem().is(ModTags.Items.GUN)
|| stack.is(ModItems.MONITOR.get())
|| (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity && player.getMainHandItem().getItem() instanceof CannonShellItem)) {
if (key == ModKeyMappings.FIRE.getKey().getValue()) {
handleWeaponFirePress(player, stack);
}

View file

@ -6,6 +6,7 @@ import net.mcreator.superbwarfare.config.client.DisplayConfig;
import net.mcreator.superbwarfare.entity.DroneEntity;
import net.mcreator.superbwarfare.entity.ICannonEntity;
import net.mcreator.superbwarfare.init.*;
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
import net.mcreator.superbwarfare.network.ModVariables;
import net.mcreator.superbwarfare.network.message.ShootMessage;
import net.mcreator.superbwarfare.perk.AmmoPerk;
@ -968,7 +969,7 @@ public class ClientEventHandler {
angle = Math.atan(Mth.abs((float) cameraLocation) / (lookDistance + 2.9)) * Mth.RAD_TO_DEG;
}
if (player.getMainHandItem().is(ModTags.Items.GUN)) {
if (player.getMainHandItem().is(ModTags.Items.GUN) || (player.getVehicle() != null && player.getVehicle() instanceof ICannonEntity && player.getMainHandItem().getItem() instanceof CannonShellItem)) {
event.setPitch((float) (pitch + cameraRot[0] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.2 : 0) * turnRot[0] + 3 * velocityY));
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK) {
event.setYaw((float) (yaw + cameraRot[1] + (DisplayConfig.CAMERA_ROTATE.get() ? 0.8 : 0) * turnRot[1] - (cameraLocation > 0 ? 1 : -1) * angle * zoomPos));
@ -1078,6 +1079,8 @@ public class ClientEventHandler {
for (int i = 0; i < 5; i++) {
shellIndexTime[i] = 0;
}
zoom = false;
ClickHandler.switchZoom = false;
}
}