diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java index b5fca79be..2ca10e4f0 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/CrossHairOverlay.java @@ -95,7 +95,7 @@ public class CrossHairOverlay implements LayeredDraw.Layer { float finPosX = ((w - finLength) / 2) + moveX; float finPosY = ((h - finLength) / 2) + moveY; - 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.bowPullPos > 0))) { + if (shouldRenderCrossHair(player) || (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON && (stack.is(ModItems.MINIGUN.get()) || stack.is(ModItems.AURELIA_SCEPTRE.get()))) || (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && (ClientEventHandler.zoomTime > 0 || ClientEventHandler.bowPullPos > 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() || ClientEventHandler.cantSprint > 0) { if (data.projectileAmount() > 1) { diff --git a/src/main/java/com/atsuishio/superbwarfare/data/gun/DefaultGunData.java b/src/main/java/com/atsuishio/superbwarfare/data/gun/DefaultGunData.java index 983545c90..256285990 100644 --- a/src/main/java/com/atsuishio/superbwarfare/data/gun/DefaultGunData.java +++ b/src/main/java/com/atsuishio/superbwarfare/data/gun/DefaultGunData.java @@ -35,7 +35,7 @@ public class DefaultGunData { @SerializedName("MeleeDamage") public double meleeDamage; @SerializedName("MeleeDuration") - public int meleeDuration = 26; + public int meleeDuration = 16; @SerializedName("MeleeDamageTime") public int meleeDamageTime = 6; diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEnumExtensions.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEnumExtensions.java index e22424606..238faef9c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEnumExtensions.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEnumExtensions.java @@ -48,7 +48,7 @@ public class ModEnumExtensions { false, (IArmPoseTransformer) (model, entity, arm) -> { if (arm != HumanoidArm.LEFT) { - model.rightArm.xRot = -67.5f * Mth.DEG_TO_RAD + model.head.xRot; + model.rightArm.xRot = -67.5f * Mth.DEG_TO_RAD + model.head.xRot + 0.2f * model.rightArm.xRot; model.rightArm.yRot = 5f * Mth.DEG_TO_RAD; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/item/gun/handgun/AureliaSceptre.java b/src/main/java/com/atsuishio/superbwarfare/item/gun/handgun/AureliaSceptre.java index c3f0cb9a2..44bc600ea 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/gun/handgun/AureliaSceptre.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/gun/handgun/AureliaSceptre.java @@ -69,13 +69,20 @@ public class AureliaSceptre extends GunItem implements GeoItem { if (player.isSprinting() && player.onGround() && ClientEventHandler.cantSprint == 0 - && !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01) { + && !(GunData.from(stack).reload.normal() || GunData.from(stack).reload.empty()) && ClientEventHandler.drawTime < 0.01 && ClientEventHandler.gunMelee == 0) { return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aurelia_sceptre.run")); } return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aurelia_sceptre.idle")); } + private PlayState meleePredicate(AnimationState event) { + if (ClientEventHandler.gunMelee > 0) { + return event.setAndContinue(RawAnimation.begin().thenPlay("animation.aurelia_sceptre.hit")); + } + + return event.setAndContinue(RawAnimation.begin().thenLoop("animation.aurelia_sceptre.idle")); + } @Override @ParametersAreNonnullByDefault @@ -93,6 +100,8 @@ public class AureliaSceptre extends GunItem implements GeoItem { public void registerControllers(AnimatableManager.ControllerRegistrar data) { var idleController = new AnimationController<>(this, "idleController", 6, this::idlePredicate); data.add(idleController); + var meleeController = new AnimationController<>(this, "meleeController", 0, this::meleePredicate); + data.add(meleeController); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/SecondaryCataclysm.java b/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/SecondaryCataclysm.java index 3aa8726a0..bdbd7a276 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/SecondaryCataclysm.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/gun/launcher/SecondaryCataclysm.java @@ -102,10 +102,6 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, EnergyStorag return event.setAndContinue(RawAnimation.begin().thenPlay("animation.secondary_cataclysm.iterativeload2")); } - if (ClientEventHandler.gunMelee > 0) { - return event.setAndContinue(RawAnimation.begin().thenPlay("animation.secondary_cataclysm.hit")); - } - if (data.reload.stage() == 3) { return event.setAndContinue(RawAnimation.begin().thenPlay("animation.secondary_cataclysm.finish")); } @@ -140,6 +136,14 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, EnergyStorag return event.setAndContinue(RawAnimation.begin().thenLoop("animation.secondary_cataclysm.idle")); } + private PlayState meleePredicate(AnimationState event) { + if (ClientEventHandler.gunMelee > 0) { + return event.setAndContinue(RawAnimation.begin().thenPlay("animation.secondary_cataclysm.hit")); + } + + return event.setAndContinue(RawAnimation.begin().thenLoop("animation.secondary_cataclysm.idle")); + } + @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return this.cache; @@ -151,6 +155,8 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, EnergyStorag data.add(reloadAnimController); var idleController = new AnimationController<>(this, "idleController", 3, this::idlePredicate); data.add(idleController); + var meleeController = new AnimationController<>(this, "meleeController", 0, this::meleePredicate); + data.add(meleeController); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/network/message/send/MeleeAttackMessage.java b/src/main/java/com/atsuishio/superbwarfare/network/message/send/MeleeAttackMessage.java index f0076f86b..1c44a2889 100644 --- a/src/main/java/com/atsuishio/superbwarfare/network/message/send/MeleeAttackMessage.java +++ b/src/main/java/com/atsuishio/superbwarfare/network/message/send/MeleeAttackMessage.java @@ -1,11 +1,14 @@ package com.atsuishio.superbwarfare.network.message.send; import com.atsuishio.superbwarfare.Mod; +import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import io.netty.buffer.ByteBuf; import net.minecraft.core.UUIDUtil; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.neoforged.neoforge.network.handling.IPayloadContext; @@ -27,7 +30,9 @@ public record MeleeAttackMessage(UUID uuid) implements CustomPacketPayload { Entity lookingEntity = EntityFindUtil.findEntity(player.level(), String.valueOf(message.uuid)); if (lookingEntity != null) { + player.level().playSound(null, lookingEntity.getOnPos(), ModSounds.MELEE_HIT.get(), SoundSource.PLAYERS, 1, (float) ((2 * org.joml.Math.random() - 1) * 0.1f + 1.0f)); player.attack(lookingEntity); + player.swing(InteractionHand.MAIN_HAND, true); } } diff --git a/src/main/resources/assets/superbwarfare/animations/aurelia_sceptre.animation.json b/src/main/resources/assets/superbwarfare/animations/aurelia_sceptre.animation.json index 41111627b..11a840eac 100644 --- a/src/main/resources/assets/superbwarfare/animations/aurelia_sceptre.animation.json +++ b/src/main/resources/assets/superbwarfare/animations/aurelia_sceptre.animation.json @@ -321,6 +321,227 @@ } } } + }, + "animation.aurelia_sceptre.hit": { + "animation_length": 0.75, + "bones": { + "0": { + "rotation": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.0917": { + "post": [5.45037, -8.76229, -6.05976], + "lerp_mode": "catmullrom" + }, + "0.1667": { + "post": [-37.91942, -6.87966, -12.98807], + "lerp_mode": "catmullrom" + }, + "0.25": { + "post": [32.46398, -3.01888, -5.49135], + "lerp_mode": "catmullrom" + }, + "0.3167": { + "post": [62.96398, -3.01888, 7.65865], + "lerp_mode": "catmullrom" + }, + "0.4": { + "post": [-3.31817, 1.5984, -4.23932], + "lerp_mode": "catmullrom" + }, + "0.5167": { + "post": [2.67338, -0.86851, 1.03602], + "lerp_mode": "catmullrom" + }, + "0.6333": { + "post": [-3.32, 0.68, -0.56], + "lerp_mode": "catmullrom" + }, + "0.75": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + }, + "position": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.0667": { + "post": [-1.34989, 0.86657, -0.04567], + "lerp_mode": "catmullrom" + }, + "0.1667": { + "post": [-4.3, 5.25, 12.7], + "lerp_mode": "catmullrom" + }, + "0.25": { + "post": [-1.3, 0.2, -1.25], + "lerp_mode": "catmullrom" + }, + "0.3": { + "post": [-0.05, -2, -10.1], + "lerp_mode": "catmullrom" + }, + "0.4": { + "post": [0.09403, -0.43078, -1.00188], + "lerp_mode": "catmullrom" + }, + "0.475": { + "post": [-0.1, 0.02, 1.05], + "lerp_mode": "catmullrom" + }, + "0.5833": { + "post": [-0.09328, 0.05092, -0.10899], + "lerp_mode": "catmullrom" + }, + "0.675": { + "post": [-0.01, 0.01, 0.24], + "lerp_mode": "catmullrom" + }, + "0.75": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + } + }, + "tiba": { + "rotation": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.0667": { + "post": [0, 0, -12], + "lerp_mode": "catmullrom" + }, + "0.15": { + "post": [0, 0, 2.15], + "lerp_mode": "catmullrom" + }, + "0.2417": { + "post": [0, 0, 19.73], + "lerp_mode": "catmullrom" + }, + "0.3083": { + "post": [0, 0, -7.5], + "lerp_mode": "catmullrom" + }, + "0.4": { + "post": [0, 0, 12.77], + "lerp_mode": "catmullrom" + }, + "0.4833": { + "post": [0, 0, -2.77], + "lerp_mode": "catmullrom" + }, + "0.6": { + "post": [0, 0, 1.57], + "lerp_mode": "catmullrom" + }, + "0.75": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + } + }, + "camera": { + "rotation": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.1": { + "post": [1.25, -1, -2], + "lerp_mode": "catmullrom" + }, + "0.2083": { + "post": [1.25, -0.75, 1.05], + "lerp_mode": "catmullrom" + }, + "0.3": { + "post": [1.91, -1.57, -3.13], + "lerp_mode": "catmullrom" + }, + "0.3333": { + "post": [-2.08, 0.85, 3.57], + "lerp_mode": "catmullrom" + }, + "0.4417": { + "post": [1.04, -1.31, -0.57], + "lerp_mode": "catmullrom" + }, + "0.5667": { + "post": [-0.13, 0.13, 0.22], + "lerp_mode": "catmullrom" + }, + "0.75": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + } + }, + "Lefthand": { + "rotation": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.125": { + "post": [21.61661, -11.28972, 0.39608], + "lerp_mode": "catmullrom" + }, + "0.2167": { + "post": [22.74209, -8.3908, 3.37338], + "lerp_mode": "catmullrom" + }, + "0.3583": { + "post": [-6.60975, -0.94004, 4.56374], + "lerp_mode": "catmullrom" + }, + "0.475": { + "post": [1.6, 2.5, -1.45], + "lerp_mode": "catmullrom" + }, + "0.5583": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + }, + "position": { + "0.0": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + }, + "0.05": { + "post": [-1.13, -0.73, -3.46], + "lerp_mode": "catmullrom" + }, + "0.125": { + "post": [-3, 1.25, -9.2], + "lerp_mode": "catmullrom" + }, + "0.2167": { + "post": [-3, 1.65, -5.55], + "lerp_mode": "catmullrom" + }, + "0.3583": { + "post": [1.85, -4, 8.3], + "lerp_mode": "catmullrom" + }, + "0.475": { + "post": [0, 0.95, 0], + "lerp_mode": "catmullrom" + }, + "0.5583": { + "post": [0, 0, 0], + "lerp_mode": "catmullrom" + } + } + } + } } } } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/guns/aurelia_sceptre.json b/src/main/resources/data/superbwarfare/guns/aurelia_sceptre.json index 71cd000e4..629983cb4 100644 --- a/src/main/resources/data/superbwarfare/guns/aurelia_sceptre.json +++ b/src/main/resources/data/superbwarfare/guns/aurelia_sceptre.json @@ -1,6 +1,6 @@ { "ID": "superbwarfare:aurelia_sceptre", - "Spread": 1.5, + "Spread": 2.5, "RecoilX": 0.0005, "RecoilY": 0.0001, "Damage": 5.5,