重写战术冲刺

This commit is contained in:
Atsuishio 2025-04-11 00:46:25 +08:00 committed by Light_Quanta
parent fcf0ce65b4
commit d585e9852d
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
43 changed files with 162 additions and 251 deletions

View file

@ -27,9 +27,6 @@ public class PlayerVariable implements INBTSerializable<CompoundTag> {
public int sniperAmmo = 0;
public int heavyAmmo = 0;
public boolean playerDoubleJump = false;
public boolean tacticalSprint = false;
public int tacticalSprintTime = 600;
public boolean tacticalSprintExhaustion = false;
public boolean edit = false;
public void sync(Entity entity) {
@ -63,9 +60,6 @@ public class PlayerVariable implements INBTSerializable<CompoundTag> {
}
nbt.putBoolean("DoubleJump", playerDoubleJump);
nbt.putBoolean("TacticalSprint", tacticalSprint);
nbt.putInt("TacticalSprintTime", tacticalSprintTime);
nbt.putBoolean("TacticalSprintExhaustion", tacticalSprintExhaustion);
nbt.putBoolean("EditMode", edit);
return nbt;
@ -77,9 +71,6 @@ public class PlayerVariable implements INBTSerializable<CompoundTag> {
}
playerDoubleJump = tag.getBoolean("DoubleJump");
tacticalSprint = tag.getBoolean("TacticalSprint");
tacticalSprintTime = tag.getInt("TacticalSprintTime");
tacticalSprintExhaustion = tag.getBoolean("TacticalSprintExhaustion");
edit = tag.getBoolean("EditMode");
return this;
@ -94,9 +85,6 @@ public class PlayerVariable implements INBTSerializable<CompoundTag> {
clone.sniperAmmo = this.sniperAmmo;
clone.heavyAmmo = this.heavyAmmo;
clone.playerDoubleJump = this.playerDoubleJump;
clone.tacticalSprint = this.tacticalSprint;
clone.tacticalSprintTime = this.tacticalSprintTime;
clone.tacticalSprintExhaustion = this.tacticalSprintExhaustion;
clone.edit = this.edit;
return clone;
@ -112,8 +100,6 @@ public class PlayerVariable implements INBTSerializable<CompoundTag> {
&& sniperAmmo == other.sniperAmmo
&& heavyAmmo == other.heavyAmmo
&& playerDoubleJump == other.playerDoubleJump
&& tacticalSprint == other.tacticalSprint
&& tacticalSprintExhaustion == other.tacticalSprintExhaustion
&& edit == other.edit;
}

View file

@ -57,7 +57,7 @@ public class ClientRenderHandler {
event.registerBelowAll(HandsomeFrameOverlay.ID, new HandsomeFrameOverlay());
event.registerBelowAll(SpyglassRangeOverlay.ID, new SpyglassRangeOverlay());
event.registerBelowAll(HelicopterHudOverlay.ID, new HelicopterHudOverlay());
event.registerBelowAll(BreathOverlay.ID, new BreathOverlay());
event.registerBelowAll(StaminaOverlay.ID, new StaminaOverlay());
event.registerBelowAll(MortarInfoOverlay.ID, new MortarInfoOverlay());
}

View file

@ -20,7 +20,7 @@ public class PoseTool {
}
}
if (entityLiving.isSprinting() && entityLiving.onGround() && entityLiving.getPersistentData().getDouble("noRun") == 0) {
if (entityLiving.isSprinting() && entityLiving.onGround()) {
return HumanoidModel.ArmPose.CROSSBOW_CHARGE;
} else {
return HumanoidModel.ArmPose.BOW_AND_ARROW;

View file

@ -97,7 +97,7 @@ public class CrossHairOverlay implements LayeredDraw.Layer {
if (shouldRenderCrossHair(player) || (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON && stack.is(ModItems.MINIGUN.get())) || (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && (ClientEventHandler.zoomTime > 0 || ClientEventHandler.pullPos > 0))) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/point.png"), w / 2f - 7.5f + moveX, h / 2f - 7.5f + moveY, 0, 0, 16, 16, 16, 16);
if (!player.isSprinting() || player.getPersistentData().getDouble("noRun") > 0) {
if (!player.isSprinting() || ClientEventHandler.cantSprint > 0) {
if (stack.is(ModTags.Items.SHOTGUN)) {
if (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug) {
normalCrossHair(guiGraphics, w, h, spread, moveX, moveY);
@ -113,7 +113,7 @@ public class CrossHairOverlay implements LayeredDraw.Layer {
if (stack.is(ModItems.BOCEK.get())) {
if (ClientEventHandler.zoomPos < 0.7) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/point.png"), w / 2f - 7.5f + moveX, h / 2f - 7.5f + moveY, 0, 0, 16, 16, 16, 16);
if (!player.isSprinting() || player.getPersistentData().getDouble("noRun") > 0 || ClientEventHandler.pullPos > 0) {
if (!player.isSprinting() || ClientEventHandler.cantSprint > 0 || ClientEventHandler.pullPos > 0) {
if (ClientEventHandler.zoomTime < 0.1) {
if (perk instanceof AmmoPerk ammoPerk && ammoPerk.slug) {
normalCrossHair(guiGraphics, w, h, spread, moveX, moveY);

View file

@ -21,9 +21,9 @@ import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.ParametersAreNonnullByDefault;
@OnlyIn(Dist.CLIENT)
public class BreathOverlay implements LayeredDraw.Layer {
public class StaminaOverlay implements LayeredDraw.Layer {
public static final ResourceLocation ID = Mod.loc("breath");
public static final ResourceLocation ID = Mod.loc("stamina");
@Override
@ParametersAreNonnullByDefault
@ -45,15 +45,15 @@ public class BreathOverlay implements LayeredDraw.Layer {
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderColor(1, 1, 1, (float) Mth.clamp(ClientEventHandler.breathSwitchTime, 0, 1));
RenderSystem.setShaderColor(1, 1, 1, (float) Mth.clamp(ClientEventHandler.switchTime, 0, 1));
guiGraphics.fill(RenderType.guiOverlay(), w / 2 - 64, h / 2 + 100, w / 2 + 64, h / 2 + 101, -90, -16777216);
guiGraphics.fill(RenderType.guiOverlay(), w / 2 - 64, h / 2 + 100, w / 2 + 64 - (int) (1.28 * ClientEventHandler.breathTime), h / 2 + 101, -90, -1);
guiGraphics.fill(RenderType.guiOverlay(), w / 2 - 64, h / 2 + 100, w / 2 + 64 - (int) (1.28 * ClientEventHandler.switchTime), h / 2 + 101, -90, -1);
guiGraphics.pose().popPose();
}
private static boolean shouldRenderCrossHair(Player player) {
if (player == null) return false;
return ClientEventHandler.breathSwitchTime > 0;
return ClientEventHandler.switchTime > 0;
}
}

View file

@ -122,9 +122,11 @@ public class ClientEventHandler {
public static boolean zoom = false;
public static boolean breath = false;
public static int breathTime = 0;
public static double breathSwitchTime = 0;
public static boolean breathExhaustion = false;
public static boolean tacticalSprint = false;
public static float stamina = 0;
public static double switchTime = 0;
public static boolean exhaustion = false;
public static boolean holdFireVehicle = false;
public static boolean zoomVehicle = false;
@ -159,6 +161,7 @@ public class ClientEventHandler {
public static float cameraPitch;
public static float cameraYaw;
public static float cameraRoll;
public static float cantSprint = 0;
@SubscribeEvent
@ -279,38 +282,92 @@ public class ClientEventHandler {
handleVariableDecrease();
aimAtVillager(player);
gunBreath();
staminaSystem();
handlePlayerSprint();
}
//屏息
public static void gunBreath() {
if (!breathExhaustion && zoom) {
//耐力
public static void staminaSystem() {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null) {
return;
}
if (!exhaustion && zoom) {
breath = ModKeyMappings.BREATH.isDown();
}
tacticalSprint = !exhaustion && !zoom && isMoving() && player.isSprinting() && player.getVehicle() == null && player.onGround();
ItemStack stack = player.getMainHandItem();
float sprintCost;
if (stack.is(ModTags.Items.GUN)) {
var data = GunData.from(stack);
sprintCost = (float) (0.5 + 0.02 * data.weight());
} else {
sprintCost = 0.5f;
}
if (breath) {
breathTime++;
} else if (breathTime > 0) {
breathTime--;
stamina += 0.5f;
} else if (tacticalSprint) {
stamina += sprintCost;
} else if (stamina > 0) {
stamina = Math.max(stamina - 0.5f, 0);
}
if (breathTime >= 100) {
breathExhaustion = true;
if (stamina >= 100) {
exhaustion = true;
breath = false;
tacticalSprint = false;
}
if (breathExhaustion && breathTime == 0) {
breathExhaustion = false;
if (exhaustion && stamina <= 0) {
exhaustion = false;
}
if (ModKeyMappings.BREATH.isDown() && zoom) {
breathSwitchTime = Math.min(breathSwitchTime + 0.5, 5);
} else if (breathSwitchTime > 0 && breathTime == 0) {
breathSwitchTime -= 0.15;
if (ModKeyMappings.BREATH.isDown() || tacticalSprint) {
switchTime = Math.min(switchTime + 0.65, 5);
} else if (switchTime > 0 && stamina == 0) {
switchTime = Math.max(switchTime - 0.15, 0);
}
if (!zoom) {
breath = false;
} else {
tacticalSprint = false;
}
if (tacticalSprint && player.onGround()) {
player.setDeltaMovement(player.getDeltaMovement().multiply(1.2, 1, 1.2));
}
}
/**
* 禁止玩家奔跑
*/
private static void handlePlayerSprint() {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null) {
return;
}
if (player.isShiftKeyDown()
|| player.isPassenger()
|| player.isInWater()
|| ClientEventHandler.zoom) {
cantSprint = 3;
}
if (cantSprint > 0) {
cantSprint--;
}
if (ClientEventHandler.zoom || ClientEventHandler.holdFire) {
player.setSprinting(false);
}
}
@ -469,7 +526,7 @@ public class ClientEventHandler {
double weight = data.weight();
double speed = 1 - (0.04 * weight);
if (player.getPersistentData().getDouble("noRun") == 0 && player.isSprinting() && !zoom) {
if (ClientEventHandler.cantSprint == 0 && player.isSprinting() && !zoom) {
cantFireTime = Mth.clamp(cantFireTime + 3 * times, 0, 24);
} else {
cantFireTime = Mth.clamp(cantFireTime - 6 * speed * times, 0, 40);
@ -676,6 +733,8 @@ public class ClientEventHandler {
shellIndex++;
}
cantSprint = 10;
shellIndexTime[shellIndex] = 0.001;
randomShell[0] = (1 + 0.2 * (Math.random() - 0.5));
@ -1099,7 +1158,7 @@ public class ClientEventHandler {
&& drawTime < 0.01
&& !cap.edit) {
if (Minecraft.getInstance().player != null) {
Minecraft.getInstance().player.getPersistentData().putDouble("noRun", 5);
cantSprint = 5;
}
if (cantFireTime <= 10) {
zoomTime = Mth.clamp(zoomTime + 0.03 * speed * times, 0, 1);
@ -1536,6 +1595,7 @@ public class ClientEventHandler {
bowTimer = 0;
handTimer = 0;
handPos = 0;
cantSprint = 20;
}
private static void handleWeaponDraw(LivingEntity entity) {

View file

@ -392,7 +392,6 @@ public class LivingEventHandler {
var newData = GunData.from(newStack);
newTag = newData.tag();
player.getPersistentData().putDouble("noRun", 40);
newTag.putBoolean("draw", true);
if (newData.bolt.defaultActionTime() > 0) {
newData.bolt.setActionTime(0);
@ -415,8 +414,6 @@ public class LivingEventHandler {
newData.charge.timer.reset();
}
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
int level = newData.perk.getLevel(ModPerks.KILLING_TALLY);
if (level != 0) {
GunsTool.setPerkIntTag(newTag, "KillingTally", 0);
@ -426,10 +423,6 @@ public class LivingEventHandler {
PacketDistributor.sendToPlayer(serverPlayer, new DrawClientMessage(true));
}
cap.tacticalSprint = false;
player.setData(ModAttachments.PLAYER_VARIABLE, cap);
cap.sync(player);
newData.save();
}
}

View file

@ -1,7 +1,6 @@
package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.config.common.GameplayConfig;
import com.atsuishio.superbwarfare.config.server.MiscConfig;
import com.atsuishio.superbwarfare.init.ModAttachments;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModTags;
@ -16,9 +15,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -58,12 +54,6 @@ public class PlayerEventHandler {
public static void onPlayerRespawned(PlayerEvent.PlayerRespawnEvent event) {
Player player = event.getEntity();
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
cap.tacticalSprintExhaustion = false;
cap.tacticalSprintTime = 600;
player.setData(ModAttachments.PLAYER_VARIABLE, cap);
cap.sync(player);
handleRespawnReload(player);
handleRespawnAutoArmor(player);
@ -83,91 +73,12 @@ public class PlayerEventHandler {
public static void onPlayerTick(PlayerTickEvent.Post event) {
Player player = event.getEntity();
ItemStack stack = player.getMainHandItem();
var variable = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
if (stack.is(ModTags.Items.GUN)) {
handlePlayerSprint(player);
handleSpecialWeaponAmmo(player);
}
handleGround(player);
handleTacticalSprint(player);
variable.sync(player);
}
private static void handleTacticalSprint(Player player) {
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
ItemStack stack = player.getMainHandItem();
int sprintCost;
if (stack.is(ModTags.Items.GUN)) {
var data = GunData.from(stack);
sprintCost = (int) (5 + 0.2 * data.weight());
} else {
sprintCost = 5;
}
if (!player.isSprinting()) {
cap.tacticalSprint = false;
player.getPersistentData().putBoolean("canTacticalSprint", true);
}
if (player.isSprinting()
&& !cap.tacticalSprintExhaustion
&& player.getPersistentData().getBoolean("canTacticalSprint")
) {
cap.tacticalSprint = true;
player.getPersistentData().putBoolean("canTacticalSprint", false);
}
if (cap.tacticalSprint) {
cap.tacticalSprintTime = Mth.clamp(cap.tacticalSprintTime - sprintCost, 0, 1000);
if (MiscConfig.ALLOW_TACTICAL_SPRINT.get()) {
player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 2, 0, false, false));
}
} else {
cap.tacticalSprintTime = Mth.clamp(cap.tacticalSprintTime + 7, 0, 1000);
}
if (cap.tacticalSprintTime == 0) {
cap.tacticalSprintExhaustion = true;
cap.tacticalSprint = false;
}
if (cap.tacticalSprintTime == 1000) {
cap.tacticalSprintExhaustion = false;
player.getPersistentData().putBoolean("canTacticalSprint", true);
}
player.setData(ModAttachments.PLAYER_VARIABLE, cap);
}
/**
* 判断玩家是否在奔跑
*/
private static void handlePlayerSprint(Player player) {
if (!player.level().isClientSide) return;
if (ClientEventHandler.holdFire) {
player.getPersistentData().putDouble("noRun", 10);
}
if (player.isShiftKeyDown()
|| player.isPassenger()
|| player.isInWater()
|| ClientEventHandler.zoom
) player.getPersistentData().putDouble("noRun", 3);
if (player.getPersistentData().getDouble("noRun") > 0) {
player.getPersistentData().putDouble("noRun", (player.getPersistentData().getDouble("noRun") - 1));
}
if (ClientEventHandler.zoom || ClientEventHandler.holdFire) {
player.setSprinting(false);
}
}
private static void handleGround(Player player) {

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -70,9 +69,9 @@ public class Glock17Item extends GunItem implements GeoItem {
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run"));

View file

@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -70,9 +69,9 @@ public class Glock18Item extends GunItem implements GeoItem {
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -70,9 +69,9 @@ public class M1911Item extends GunItem implements GeoItem {
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -70,9 +69,9 @@ public class Mp443Item extends GunItem implements GeoItem {
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.glock.run"));

View file

@ -18,7 +18,6 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -141,16 +140,16 @@ public class Trachelium extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (stock) {
if (grip) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_fast_stock"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_stock_grip"));
}
} else {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_fast_stock"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_stock"));
@ -158,13 +157,13 @@ public class Trachelium extends GunItem implements GeoItem {
}
} else {
if (grip) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_grip"));
}
} else {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.trachelium.run"));

View file

@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import software.bernie.geckolib.animatable.GeoItem;
@ -82,10 +81,10 @@ public class Ntw20Item extends GunItem implements GeoItem {
var data = GunData.from(stack);
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(data.reload.normal() || data.reload.empty())
&& ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && data.bolt.actionTime() == 0) {
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ntw_20.run"));

View file

@ -27,7 +27,6 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.animal.Pig;
import net.minecraft.world.entity.player.Player;
@ -81,8 +80,8 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.javelin.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.javelin.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.javelin.run"));

View file

@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
@ -79,8 +78,8 @@ public class M79Item extends GunItem implements GeoItem, SpecialFireWeapon {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m79.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m79.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m79.run"));

View file

@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
@ -82,8 +81,8 @@ public class RpgItem extends GunItem implements GeoItem, SpecialFireWeapon {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.run"));

View file

@ -22,7 +22,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlotGroup;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
@ -119,7 +118,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
var data = GunData.from(stack);
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !data.reload.empty()
&& data.reload.stage() != 1
&& data.reload.stage() != 2
@ -128,7 +127,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
&& ClientEventHandler.gunMelee == 0
&& !data.reloading()
) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sc.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sc.run"));

View file

@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -58,8 +57,8 @@ public class DevotionItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.reload_normal"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.devotion.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.devotion.run"));

View file

@ -15,7 +15,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -77,8 +76,8 @@ public class M60Item extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload2"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m60.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m60.run"));

View file

@ -19,7 +19,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -79,8 +78,8 @@ public class MinigunItem extends GunItem implements GeoItem {
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.minigun.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.minigun.run"));

View file

@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -93,8 +92,8 @@ public class RpkItem extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.run_fast"));
} else {
if (grip) {

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -86,8 +85,8 @@ public class AK12Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak12.run_fast"));
} else {
if (grip) {

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -94,8 +93,8 @@ public class AK47Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ak47.run_fast"));
} else {
if (grip) {

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -89,8 +88,8 @@ public class Hk416Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.run_fast"));
} else {
if (grip) {

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -55,8 +54,8 @@ public class InsidiousItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.insidious.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.insidious.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.insidious.run"));

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -90,8 +89,8 @@ public class M4Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m4.run_fast"));
} else {
if (grip) {

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -83,10 +82,10 @@ public class MarlinItem extends GunItem implements GeoItem {
if (transformType != null && transformType.firstPerson()) {
if (player.isSprinting()
&& player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& ClientEventHandler.drawTime < 0.01
&& !data.reloading()) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.marlin.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.marlin.run"));

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -91,8 +90,8 @@ public class Mk14Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m14.run_fast"));
} else {
if (grip) {

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -94,8 +93,8 @@ public class Qbz95Item extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.qbz95.run_fast"));
} else {
if (grip) {

View file

@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -68,8 +67,8 @@ public class SksItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.reload_normal"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sks.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sks.run"));

View file

@ -16,7 +16,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -65,8 +64,8 @@ public class Aa12Item extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aa12.reload_normal"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aa12.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aa12.run"));

View file

@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -66,8 +65,8 @@ public class HomemadeShotgunItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload_normal"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ab.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.ab.run"));

View file

@ -14,7 +14,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -91,10 +90,10 @@ public class M870Item extends GunItem implements GeoItem {
if (player.isSprinting()
&& player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& ClientEventHandler.drawTime < 0.01
&& !data.reloading()) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m870.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m870.run"));

View file

@ -16,7 +16,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -70,8 +69,8 @@ public class VectorItem extends GunItem implements GeoItem {
}
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.vec.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -58,8 +57,8 @@ public class HuntingRifleItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.hunting_rifle.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.hunting_rifle.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.hunting_rifle.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -87,7 +86,7 @@ public class K98Item extends GunItem implements GeoItem {
var data = GunData.from(stack);
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !data.reload.empty()
&& data.reload.stage() != 1
&& data.reload.stage() != 2
@ -95,7 +94,7 @@ public class K98Item extends GunItem implements GeoItem {
&& ClientEventHandler.drawTime < 0.01
&& !data.reloading()
) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && data.bolt.actionTime() == 0) {
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.k98.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -49,7 +48,6 @@ public class M98bItem extends GunItem implements GeoItem {
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
var data = GunData.from(stack);
final var tag = data.tag();
if (data.bolt.actionTime() > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
@ -72,12 +70,11 @@ public class M98bItem extends GunItem implements GeoItem {
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
var data = GunData.from(stack);
final var tag = data.tag();
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(data.reload.normal() || data.reload.empty()) && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && data.bolt.actionTime() == 0) {
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.run"));

View file

@ -13,7 +13,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -85,7 +84,7 @@ public class MosinNagantItem extends GunItem implements GeoItem {
var data = GunData.from(stack);
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !(GunData.from(stack).reload.empty())
&& data.reload.stage() != 1
&& data.reload.stage() != 2
@ -93,7 +92,7 @@ public class MosinNagantItem extends GunItem implements GeoItem {
&& ClientEventHandler.drawTime < 0.01
&& !data.reloading()
) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && data.bolt.actionTime() == 0) {
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mosin.run"));

View file

@ -16,7 +16,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
@ -73,7 +72,6 @@ public class SentinelItem extends GunItem implements GeoItem, EnergyStorageItem
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
var data = GunData.from(stack);
final var tag = data.tag();
if (data.bolt.actionTime() > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
@ -100,15 +98,14 @@ public class SentinelItem extends GunItem implements GeoItem, EnergyStorageItem
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
var data = GunData.from(stack);
final var tag = data.tag();
if (player.isSprinting() && player.onGround()
&& player.getPersistentData().getDouble("noRun") == 0
&& ClientEventHandler.cantSprint == 0
&& !data.reloading()
&& !data.charging()
&& ClientEventHandler.drawTime < 0.01
) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED) && data.bolt.actionTime() == 0) {
if (ClientEventHandler.tacticalSprint && data.bolt.actionTime() == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.run"));

View file

@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Rarity;
@ -63,8 +62,8 @@ public class SvdItem extends GunItem implements GeoItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.reload_normal"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.svd.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.svd.run"));

View file

@ -22,7 +22,6 @@ import net.minecraft.client.player.LocalPlayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
@ -68,8 +67,8 @@ public class BocekItem extends GunItem implements GeoItem, SpecialFireWeapon {
ItemStack stack = player.getMainHandItem();
if (!stack.is(ModTags.Items.GUN)) return PlayState.STOP;
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.bocek.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.bocek.run"));

View file

@ -22,7 +22,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
@ -97,8 +96,8 @@ public class TaserItem extends GunItem implements GeoItem, SpecialFireWeapon, En
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.taser.reload"));
}
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0 && ClientEventHandler.drawTime < 0.01) {
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 && ClientEventHandler.drawTime < 0.01) {
if (ClientEventHandler.tacticalSprint) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.taser.run_fast"));
} else {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.taser.run"));