删除了错误的方法调用
This commit is contained in:
parent
83cfabe908
commit
a2998559da
1 changed files with 1 additions and 28 deletions
|
@ -6,7 +6,6 @@ import net.mcreator.target.init.TargetModSounds;
|
||||||
import net.mcreator.target.init.TargetModTags;
|
import net.mcreator.target.init.TargetModTags;
|
||||||
import net.mcreator.target.network.TargetModVariables;
|
import net.mcreator.target.network.TargetModVariables;
|
||||||
import net.mcreator.target.tools.SoundTool;
|
import net.mcreator.target.tools.SoundTool;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
@ -26,14 +25,6 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber
|
@Mod.EventBusSubscriber
|
||||||
public class PlayerEventHandler {
|
public class PlayerEventHandler {
|
||||||
private static boolean notInGame() {
|
|
||||||
Minecraft mc = Minecraft.getInstance();
|
|
||||||
if (mc.player == null) return true;
|
|
||||||
if (mc.getOverlay() != null) return true;
|
|
||||||
if (mc.screen != null) return true;
|
|
||||||
if (!mc.mouseHandler.isMouseGrabbed()) return true;
|
|
||||||
return !mc.isWindowActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPlayerRespawned(PlayerEvent.PlayerRespawnEvent event) {
|
public static void onPlayerRespawned(PlayerEvent.PlayerRespawnEvent event) {
|
||||||
|
@ -63,7 +54,6 @@ public class PlayerEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.phase == TickEvent.Phase.END) {
|
if (event.phase == TickEvent.Phase.END) {
|
||||||
handlePlayerCancelZoom(player);
|
|
||||||
handlePlayerProne(player);
|
handlePlayerProne(player);
|
||||||
handlePlayerSprint(player);
|
handlePlayerSprint(player);
|
||||||
handleWeaponLevel(player);
|
handleWeaponLevel(player);
|
||||||
|
@ -78,23 +68,6 @@ public class PlayerEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 玩家不在游戏内时取消瞄准
|
|
||||||
*/
|
|
||||||
private static void handlePlayerCancelZoom(Player player) {
|
|
||||||
if (notInGame()) {
|
|
||||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.zoom = false;
|
|
||||||
capability.syncPlayerVariables(player);
|
|
||||||
});
|
|
||||||
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
|
||||||
capability.zooming = false;
|
|
||||||
capability.syncPlayerVariables(player);
|
|
||||||
});
|
|
||||||
player.getPersistentData().putDouble("zoom_animation_time", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断玩家是否趴下
|
* 判断玩家是否趴下
|
||||||
*/
|
*/
|
||||||
|
@ -362,7 +335,7 @@ public class PlayerEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < recoil && recoil < 2.5) {
|
if (0 < recoil && recoil < 2.5) {
|
||||||
float newPitch = ((float) (player.getXRot() - 6f * recoilY * ry * (sinRes + Mth.clamp(0.8 - recoil,0,0.8))));
|
float newPitch = ((float) (player.getXRot() - 6f * recoilY * ry * (sinRes + Mth.clamp(0.8 - recoil, 0, 0.8))));
|
||||||
player.setXRot(newPitch);
|
player.setXRot(newPitch);
|
||||||
player.xRotO = player.getXRot();
|
player.xRotO = player.getXRot();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue