将趴下判定移动到客户端
This commit is contained in:
parent
cd06863f84
commit
7476308b9b
13 changed files with 56 additions and 47 deletions
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK12Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -149,7 +150,7 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.AK47Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -153,7 +154,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.machinegun.DevotionItem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -16,6 +15,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class DevotionItemModel extends GeoModel<DevotionItem> {
|
||||
|
||||
@Override
|
||||
|
@ -99,7 +100,7 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
|
|||
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
|
||||
root.setRotZ((float) (0.2f * movePosX + moveRotZ + Mth.DEG_TO_RAD * 90 * ClientEventHandler.drawTime + 2.7f * mph + Mth.DEG_TO_RAD * turnRotZ));
|
||||
|
||||
if (PlayerEventHandler.isProne(player)) {
|
||||
if (isProne(player)) {
|
||||
l.setRotX(1.5f);
|
||||
r.setRotX(1.5f);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.Hk416Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -146,7 +147,7 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.M4Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class M4ItemModel extends GeoModel<M4Item> {
|
||||
|
||||
public static float posYAlt = 0.5625f;
|
||||
|
@ -178,7 +179,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.machinegun.M60Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class M60ItemModel extends GeoModel<M60Item> {
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +53,7 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return;
|
||||
|
||||
if (PlayerEventHandler.isProne(player)) {
|
||||
if (isProne(player)) {
|
||||
l.setRotX(1.5f);
|
||||
r.setRotX(1.5f);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.Mk14Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -128,8 +129,8 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
|||
|
||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.4 * zt)));
|
||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt) * (barrelType == 1 ? 0.8 : 1.0) * (stockType == 2 ? 0.9 : 1.0) * (gripType == 1 ? 0.9 : 1.0) * (PlayerEventHandler.isProne(player) && gripType == 3 ? 0.9 : 1.0)));
|
||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.8 * zt) * (barrelType == 1 ? 0.4 : 1.0) * (stockType == 2 ? 0.6 : 1.0) * (gripType == 1 ? 0.7 : 1.0) * (PlayerEventHandler.isProne(player) && gripType == 3 ? 0.1 : 1.0)));
|
||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt) * (barrelType == 1 ? 0.8 : 1.0) * (stockType == 2 ? 0.9 : 1.0) * (gripType == 1 ? 0.9 : 1.0) * (isProne(player) && gripType == 3 ? 0.9 : 1.0)));
|
||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.8 * zt) * (barrelType == 1 ? 0.4 : 1.0) * (stockType == 2 ? 0.6 : 1.0) * (gripType == 1 ? 0.7 : 1.0) * (isProne(player) && gripType == 3 ? 0.1 : 1.0)));
|
||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.85 * zt)));
|
||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||
|
||||
|
@ -154,7 +155,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.atsuishio.superbwarfare.client.model.item;
|
|||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.sniper.Ntw20Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -16,6 +15,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class Ntw20Model extends GeoModel<Ntw20Item> {
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +67,7 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
|
|||
double fp = ClientEventHandler.firePos;
|
||||
double fr = ClientEventHandler.fireRot;
|
||||
|
||||
if (PlayerEventHandler.isProne(player)) {
|
||||
if (isProne(player)) {
|
||||
l.setRotX(-1.5f);
|
||||
r.setRotX(-1.5f);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.rifle.Qbz95Item;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -161,7 +162,7 @@ public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.handgun.Trachelium;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class TracheliumItemModel extends GeoModel<Trachelium> {
|
||||
|
||||
public static float posYAlt = -0.83f;
|
||||
|
@ -142,9 +143,9 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
|
|||
shen.setRotZ(fireRotZ);
|
||||
|
||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.4 * zt)));
|
||||
shen.setPosY((float) (shen.getPosY() * (1 - 0.5 * zt) * (PlayerEventHandler.isProne(player) ? 0.03 : 1)));
|
||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.7 * zt) * (PlayerEventHandler.isProne(player) ? 0.4 : 1)));
|
||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.27 * zt) * (barrelType == 1 ? 0.4 : 1.2) * (stockType == 2 ? 0.6 : 1.2) * (gripType == 1 ? 0.8 : 1.2) * (PlayerEventHandler.isProne(player) && gripType == 3 ? 0.03 : 1.2)));
|
||||
shen.setPosY((float) (shen.getPosY() * (1 - 0.5 * zt) * (isProne(player) ? 0.03 : 1)));
|
||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.7 * zt) * (isProne(player) ? 0.4 : 1)));
|
||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.27 * zt) * (barrelType == 1 ? 0.4 : 1.2) * (stockType == 2 ? 0.6 : 1.2) * (gripType == 1 ? 0.8 : 1.2) * (isProne(player) && gripType == 3 ? 0.03 : 1.2)));
|
||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.7 * zt)));
|
||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.65 * zt)));
|
||||
|
||||
|
@ -175,7 +176,7 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.ModUtils;
|
|||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.event.PlayerEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModTags;
|
||||
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
|
||||
import com.atsuishio.superbwarfare.tools.GunsTool;
|
||||
|
@ -17,6 +16,8 @@ import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.event.ClientEventHandler.isProne;
|
||||
|
||||
public class VectorItemModel extends GeoModel<VectorItem> {
|
||||
|
||||
public static float fireRotY = 0f;
|
||||
|
@ -137,7 +138,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
|
|||
|
||||
CoreGeoBone l = getAnimationProcessor().getBone("l");
|
||||
CoreGeoBone r = getAnimationProcessor().getBone("r");
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, PlayerEventHandler.isProne(player) ? -90 : 0);
|
||||
rotXBipod = Mth.lerp(1.5f * times, rotXBipod, isProne(player) ? -90 : 0);
|
||||
l.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
r.setRotX(rotXBipod * Mth.DEG_TO_RAD);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -219,10 +220,19 @@ public class ClientEventHandler {
|
|||
zoom = false;
|
||||
}
|
||||
|
||||
isProne(player);
|
||||
beamShoot(player, stack);
|
||||
handleLungeAttack(player, stack);
|
||||
}
|
||||
|
||||
public static boolean isProne(Player player) {
|
||||
Level level = player.level();
|
||||
if (player.getBbHeight() <= 1) return true;
|
||||
|
||||
return player.isCrouching() && level.getBlockState(BlockPos.containing(player.getX() + 0.7 * player.getLookAngle().x, player.getY() + 0.5, player.getZ() + 0.7 * player.getLookAngle().z)).canOcclude()
|
||||
&& !level.getBlockState(BlockPos.containing(player.getX() + 0.7 * player.getLookAngle().x, player.getY() + 1.5, player.getZ() + 0.7 * player.getLookAngle().z)).canOcclude();
|
||||
}
|
||||
|
||||
public static void handleLungeAttack(Player player, ItemStack stack) {
|
||||
if (stack.is(ModItems.LUNGE_MINE.get()) && lungeAttack == 0 && holdFire && !player.getCooldowns().isOnCooldown(stack.getItem())) {
|
||||
lungeAttack = 6;
|
||||
|
@ -284,7 +294,7 @@ public class ClientEventHandler {
|
|||
double walk = isMoving() ? 0.3 * basicDev : 0;
|
||||
double sprint = player.isSprinting() ? 0.25 * basicDev : 0;
|
||||
double crouching = player.isCrouching() ? -0.15 * basicDev : 0;
|
||||
double prone = PlayerEventHandler.isProne(player) ? -0.3 * basicDev : 0;
|
||||
double prone = isProne(player) ? -0.3 * basicDev : 0;
|
||||
double jump = player.onGround() ? 0 * basicDev : 0.35 * basicDev;
|
||||
double ride = player.onGround() ? -0.25 * basicDev : 0;
|
||||
|
||||
|
@ -669,9 +679,9 @@ public class ClientEventHandler {
|
|||
float pose;
|
||||
float times = 2 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
||||
|
||||
if (player.isCrouching() && player.getBbHeight() >= 1 && !PlayerEventHandler.isProne(player)) {
|
||||
if (player.isCrouching() && player.getBbHeight() >= 1 && !isProne(player)) {
|
||||
pose = 0.85f;
|
||||
} else if (PlayerEventHandler.isProne(player)) {
|
||||
} else if (isProne(player)) {
|
||||
pose = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 3 ? 0 : 0.25f;
|
||||
} else {
|
||||
pose = 1;
|
||||
|
@ -828,9 +838,9 @@ public class ClientEventHandler {
|
|||
float times = 2 * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8);
|
||||
double pose;
|
||||
|
||||
if (player.isShiftKeyDown() && player.getBbHeight() >= 1 && PlayerEventHandler.isProne(player)) {
|
||||
if (player.isShiftKeyDown() && player.getBbHeight() >= 1 && isProne(player)) {
|
||||
pose = 0.85;
|
||||
} else if (PlayerEventHandler.isProne(player)) {
|
||||
} else if (isProne(player)) {
|
||||
pose = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 3 ? 0 : 0.25f;
|
||||
} else {
|
||||
pose = 1;
|
||||
|
@ -1066,9 +1076,9 @@ public class ClientEventHandler {
|
|||
|
||||
// 计算后坐力
|
||||
float pose = 1;
|
||||
if (player.isShiftKeyDown() && player.getBbHeight() >= 1 && !PlayerEventHandler.isProne(player)) {
|
||||
if (player.isShiftKeyDown() && player.getBbHeight() >= 1 && !isProne(player)) {
|
||||
pose = 0.7f;
|
||||
} else if (PlayerEventHandler.isProne(player)) {
|
||||
} else if (isProne(player)) {
|
||||
if (GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.GRIP) == 3) {
|
||||
pose = 0.1f;
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.atsuishio.superbwarfare.init.ModTags;
|
|||
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||
import com.atsuishio.superbwarfare.network.message.SimulationDistanceMessage;
|
||||
import com.atsuishio.superbwarfare.tools.*;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
|
@ -20,9 +19,7 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.npc.AbstractVillager;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.schedule.Activity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
@ -90,7 +87,6 @@ public class PlayerEventHandler {
|
|||
handlePlayerSprint(player);
|
||||
handleSpecialWeaponAmmo(player);
|
||||
handleBocekPulling(player);
|
||||
isProne(player);
|
||||
aimAtVillager(player);
|
||||
}
|
||||
|
||||
|
@ -109,21 +105,13 @@ public class PlayerEventHandler {
|
|||
for (var e : gunner) {
|
||||
if (e == player) {
|
||||
// TODO 让村民恐慌并生气涨价
|
||||
villager.getBrain().addActivity(Activity.PANIC, );
|
||||
// villager.getBrain().addActivity(Activity.PANIC, );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isProne(Player player) {
|
||||
Level level = player.level();
|
||||
if (player.getBbHeight() <= 1) return true;
|
||||
|
||||
return player.isCrouching() && level.getBlockState(BlockPos.containing(player.getX() + 0.7 * player.getLookAngle().x, player.getY() + 0.5, player.getZ() + 0.7 * player.getLookAngle().z)).canOcclude()
|
||||
&& !level.getBlockState(BlockPos.containing(player.getX() + 0.7 * player.getLookAngle().x, player.getY() + 1.5, player.getZ() + 0.7 * player.getLookAngle().z)).canOcclude();
|
||||
}
|
||||
|
||||
private static void handleBreath(Player player) {
|
||||
if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).breath) {
|
||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||
|
|
Loading…
Add table
Reference in a new issue