From 23782753f6d642687c14f1c4224614158026574e Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Sat, 18 May 2024 15:19:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=89=8B=E6=8C=81=E6=AD=A6=E5=99=A8=E8=B5=B0=E8=B7=AF=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/model/item/AK47ItemModel.java | 10 +- .../client/model/item/Aa12ItemModel.java | 11 +- .../client/model/item/AbekiriItemModel.java | 10 +- .../client/model/item/BocekItemModel.java | 10 +- .../client/model/item/DevotionItemModel.java | 10 +- .../client/model/item/Hk416ItemModel.java | 10 +- .../model/item/HuntingRifleItemModel.java | 10 +- .../client/model/item/KraberItemModel.java | 10 +- .../target/client/model/item/M4ItemModel.java | 10 +- .../client/model/item/M60ItemModel.java | 10 +- .../client/model/item/M79ItemModel.java | 10 +- .../client/model/item/M870ItemModel.java | 10 +- .../client/model/item/M98bItemModel.java | 15 +- .../client/model/item/MarlinItemModel.java | 10 +- .../client/model/item/MinigunItemModel.java | 10 +- .../client/model/item/Mk14ItemModel.java | 10 +- .../client/model/item/RpgItemModel.java | 10 +- .../client/model/item/RpkItemModel.java | 10 +- .../client/model/item/SentinelItemModel.java | 10 +- .../client/model/item/SksItemModel.java | 11 +- .../client/model/item/SvdItemModel.java | 10 +- .../client/model/item/TaserItemModel.java | 10 +- .../model/item/TracheliumItemModel.java | 10 +- .../client/model/item/VectorItemModel.java | 10 +- .../mcreator/target/entity/Target1Entity.java | 2 +- .../target/event/ClientEventHandler.java | 342 +++++++++++------- .../target/event/GunEventHandler.java | 1 + .../target/event/PlayerEventHandler.java | 2 +- .../target/mixins/GameRendererMixin.java | 2 +- .../target/procedures/M870fireProcedure.java | 1 - .../assets/target/geo/devotion.geo.json | 6 +- .../assets/target/geo/sentinel.geo.json | 6 +- 32 files changed, 435 insertions(+), 174 deletions(-) diff --git a/src/main/java/net/mcreator/target/client/model/item/AK47ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/AK47ItemModel.java index 71c6b88a6..fab968b56 100644 --- a/src/main/java/net/mcreator/target/client/model/item/AK47ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/AK47ItemModel.java @@ -100,14 +100,22 @@ public class AK47ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/Aa12ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/Aa12ItemModel.java index 7b8433e1c..7056235e0 100644 --- a/src/main/java/net/mcreator/target/client/model/item/Aa12ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/Aa12ItemModel.java @@ -84,14 +84,22 @@ public class Aa12ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + 2.5f * PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; @@ -106,6 +114,7 @@ public class Aa12ItemModel extends GeoModel { double vy = 0; vy = player.getPersistentData().getDouble("vy"); + move.setPosY(-1 * (float) vy); move.setPosX(9.3f * (float) m); diff --git a/src/main/java/net/mcreator/target/client/model/item/AbekiriItemModel.java b/src/main/java/net/mcreator/target/client/model/item/AbekiriItemModel.java index c7f6712e9..54a1f0352 100644 --- a/src/main/java/net/mcreator/target/client/model/item/AbekiriItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/AbekiriItemModel.java @@ -76,14 +76,22 @@ public class AbekiriItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/BocekItemModel.java b/src/main/java/net/mcreator/target/client/model/item/BocekItemModel.java index cb566bcc7..30b6a716c 100644 --- a/src/main/java/net/mcreator/target/client/model/item/BocekItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/BocekItemModel.java @@ -127,14 +127,22 @@ public class BocekItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/DevotionItemModel.java b/src/main/java/net/mcreator/target/client/model/item/DevotionItemModel.java index 2ced4766f..4e6c043e6 100644 --- a/src/main/java/net/mcreator/target/client/model/item/DevotionItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/DevotionItemModel.java @@ -628,14 +628,22 @@ public class DevotionItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/Hk416ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/Hk416ItemModel.java index 087a94a56..852c10f87 100644 --- a/src/main/java/net/mcreator/target/client/model/item/Hk416ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/Hk416ItemModel.java @@ -91,14 +91,22 @@ public class Hk416ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/HuntingRifleItemModel.java b/src/main/java/net/mcreator/target/client/model/item/HuntingRifleItemModel.java index c4cfe5de7..f8d11d282 100644 --- a/src/main/java/net/mcreator/target/client/model/item/HuntingRifleItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/HuntingRifleItemModel.java @@ -83,14 +83,22 @@ public class HuntingRifleItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/KraberItemModel.java b/src/main/java/net/mcreator/target/client/model/item/KraberItemModel.java index 573285949..428416ad3 100644 --- a/src/main/java/net/mcreator/target/client/model/item/KraberItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/KraberItemModel.java @@ -96,14 +96,22 @@ public class KraberItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/M4ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/M4ItemModel.java index 37ce50642..d1492d0ca 100644 --- a/src/main/java/net/mcreator/target/client/model/item/M4ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/M4ItemModel.java @@ -81,14 +81,22 @@ public class M4ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/M60ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/M60ItemModel.java index bab3b3427..58f77b672 100644 --- a/src/main/java/net/mcreator/target/client/model/item/M60ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/M60ItemModel.java @@ -124,14 +124,22 @@ public class M60ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/M79ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/M79ItemModel.java index d128c6ef5..eb0931070 100644 --- a/src/main/java/net/mcreator/target/client/model/item/M79ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/M79ItemModel.java @@ -75,14 +75,22 @@ public class M79ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/M870ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/M870ItemModel.java index ee41d1f4c..93e803329 100644 --- a/src/main/java/net/mcreator/target/client/model/item/M870ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/M870ItemModel.java @@ -102,14 +102,22 @@ public class M870ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + 2.5f * PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/M98bItemModel.java b/src/main/java/net/mcreator/target/client/model/item/M98bItemModel.java index 979237d51..f28dca137 100644 --- a/src/main/java/net/mcreator/target/client/model/item/M98bItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/M98bItemModel.java @@ -96,15 +96,28 @@ public class M98bItemModel extends GeoModel { } CoreGeoBone root = getAnimationProcessor().getBone("root"); + CoreGeoBone zhunxing = getAnimationProcessor().getBone("shi"); + + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + + zhunxing.setPosX(75 * PosX); + + zhunxing.setPosY(75 * PosY); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/MarlinItemModel.java b/src/main/java/net/mcreator/target/client/model/item/MarlinItemModel.java index 0e95edc16..008db39b0 100644 --- a/src/main/java/net/mcreator/target/client/model/item/MarlinItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/MarlinItemModel.java @@ -91,14 +91,22 @@ public class MarlinItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + 2.5f * PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/MinigunItemModel.java b/src/main/java/net/mcreator/target/client/model/item/MinigunItemModel.java index d6f96e885..772b495c1 100644 --- a/src/main/java/net/mcreator/target/client/model/item/MinigunItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/MinigunItemModel.java @@ -73,14 +73,22 @@ public class MinigunItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/Mk14ItemModel.java b/src/main/java/net/mcreator/target/client/model/item/Mk14ItemModel.java index 813cb9326..43a66138b 100644 --- a/src/main/java/net/mcreator/target/client/model/item/Mk14ItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/Mk14ItemModel.java @@ -113,14 +113,22 @@ public class Mk14ItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + 2.5f * PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/RpgItemModel.java b/src/main/java/net/mcreator/target/client/model/item/RpgItemModel.java index 1eb254a11..7f9e1d5be 100644 --- a/src/main/java/net/mcreator/target/client/model/item/RpgItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/RpgItemModel.java @@ -81,14 +81,22 @@ public class RpgItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/RpkItemModel.java b/src/main/java/net/mcreator/target/client/model/item/RpkItemModel.java index 2cb987026..3e04a3b45 100644 --- a/src/main/java/net/mcreator/target/client/model/item/RpkItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/RpkItemModel.java @@ -112,14 +112,22 @@ public class RpkItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/SentinelItemModel.java b/src/main/java/net/mcreator/target/client/model/item/SentinelItemModel.java index 1cd6a97b9..2721f0775 100644 --- a/src/main/java/net/mcreator/target/client/model/item/SentinelItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/SentinelItemModel.java @@ -114,14 +114,22 @@ public class SentinelItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/SksItemModel.java b/src/main/java/net/mcreator/target/client/model/item/SksItemModel.java index b4948a9f1..8770e4bf5 100644 --- a/src/main/java/net/mcreator/target/client/model/item/SksItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/SksItemModel.java @@ -97,14 +97,22 @@ public class SksItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; @@ -119,6 +127,7 @@ public class SksItemModel extends GeoModel { double vy = 0; vy = player.getPersistentData().getDouble("vy"); + move.setPosY(-1 * (float) vy); move.setPosX(9.3f * (float) m); diff --git a/src/main/java/net/mcreator/target/client/model/item/SvdItemModel.java b/src/main/java/net/mcreator/target/client/model/item/SvdItemModel.java index d85fee049..c2a170104 100644 --- a/src/main/java/net/mcreator/target/client/model/item/SvdItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/SvdItemModel.java @@ -120,14 +120,22 @@ public class SvdItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/TaserItemModel.java b/src/main/java/net/mcreator/target/client/model/item/TaserItemModel.java index 10dbd0142..0ced41833 100644 --- a/src/main/java/net/mcreator/target/client/model/item/TaserItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/TaserItemModel.java @@ -54,14 +54,22 @@ public class TaserItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/TracheliumItemModel.java b/src/main/java/net/mcreator/target/client/model/item/TracheliumItemModel.java index 5e46e6f02..05cfb6b09 100644 --- a/src/main/java/net/mcreator/target/client/model/item/TracheliumItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/TracheliumItemModel.java @@ -77,14 +77,22 @@ public class TracheliumItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/client/model/item/VectorItemModel.java b/src/main/java/net/mcreator/target/client/model/item/VectorItemModel.java index e47b1d718..c39e9408d 100644 --- a/src/main/java/net/mcreator/target/client/model/item/VectorItemModel.java +++ b/src/main/java/net/mcreator/target/client/model/item/VectorItemModel.java @@ -85,14 +85,22 @@ public class VectorItemModel extends GeoModel { CoreGeoBone root = getAnimationProcessor().getBone("root"); + float PosX = (float)player.getPersistentData().getDouble("gun_move_posX"); + float PosY = (float)player.getPersistentData().getDouble("gun_move_posY"); + double y = 0; double x = 0; y = player.getPersistentData().getDouble("y"); x = player.getPersistentData().getDouble("x"); - root.setPosY((float) y); + root.setPosX(PosX); + + root.setPosY((float) y + PosY); + root.setRotX((float) x); + root.setRotZ(0.1f * PosX); + CoreGeoBone move = getAnimationProcessor().getBone("move"); double m = 0; diff --git a/src/main/java/net/mcreator/target/entity/Target1Entity.java b/src/main/java/net/mcreator/target/entity/Target1Entity.java index 22985d9fe..6ec1bc9d8 100644 --- a/src/main/java/net/mcreator/target/entity/Target1Entity.java +++ b/src/main/java/net/mcreator/target/entity/Target1Entity.java @@ -248,7 +248,7 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE } if (this.getPersistentData().getDouble("target_down") < 20 && this.getPersistentData().getDouble("target_down") > -1) { this.setYRot(this.getYRot()); - this.setXRot((float) (-90 + 20 - this.getPersistentData().getDouble("target_down")) * 4.5f); + this.setXRot((float) (-90 + 20 - this.getPersistentData().getDouble("target_down")) * 5.14f); this.setYBodyRot(this.getYRot()); this.setYHeadRot(this.getYRot()); this.yRotO = this.getYRot(); diff --git a/src/main/java/net/mcreator/target/event/ClientEventHandler.java b/src/main/java/net/mcreator/target/event/ClientEventHandler.java index 25b419822..11b3d4767 100644 --- a/src/main/java/net/mcreator/target/event/ClientEventHandler.java +++ b/src/main/java/net/mcreator/target/event/ClientEventHandler.java @@ -39,177 +39,237 @@ public class ClientEventHandler { if (fps <= 0) { fps = 1f; } + float times = 90f / fps; - if (entity.getPersistentData().getDouble("move") < 0) { - entity.getPersistentData().putDouble("move", ((entity.getPersistentData().getDouble("move") + 1 * times * Math.pow(entity.getPersistentData().getDouble("move"), 2) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time"))) - * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); + var data = entity.getPersistentData(); + double move_speed = (float) entity.getDeltaMovement().horizontalDistanceSqr(); + double on_ground; + if (entity.onGround()) { + on_ground = 2.4; } else { - entity.getPersistentData().putDouble("move", ((entity.getPersistentData().getDouble("move") - 1 * times * Math.pow(entity.getPersistentData().getDouble("move"), 2) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time"))) - * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); + on_ground = 0.1; } - if (entity.getPersistentData().getDouble("move_right") == 1) { - entity.getPersistentData().putDouble("move", - ((entity.getPersistentData().getDouble("move") + Math.pow(Math.abs(entity.getPersistentData().getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * entity.getPersistentData().getDouble("zoom_time"))) - * (1 - 0.1 * entity.getPersistentData().getDouble("zoom_time")))); - } else if (entity.getPersistentData().getDouble("move_left") == 1) { - entity.getPersistentData().putDouble("move", - ((entity.getPersistentData().getDouble("move") - Math.pow(Math.abs(entity.getPersistentData().getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * entity.getPersistentData().getDouble("zoom_time"))) - * (1 - 0.1 * entity.getPersistentData().getDouble("zoom_time")))); - } - if (entity.getPersistentData().getDouble("turnr") == 1) { - entity.getPersistentData().putDouble("turntimeyaw", (entity.getPersistentData().getDouble("turntimeyaw") + 0.08 * times * Math.pow(entity.getPersistentData().getDouble("amplitudeyaw"), 2))); - } - if (entity.getPersistentData().getDouble("turnl") == 1) { - entity.getPersistentData().putDouble("turntimeyaw", (entity.getPersistentData().getDouble("turntimeyaw") - 0.08 * times * Math.pow(entity.getPersistentData().getDouble("amplitudeyaw"), 2))); - } - if (entity.getPersistentData().getDouble("turntimeyaw") > 1) { - entity.getPersistentData().putDouble("turntimeyaw", 1); - } - if (entity.getPersistentData().getDouble("turntimeyaw") < -1) { - entity.getPersistentData().putDouble("turntimeyaw", (-1)); - } - if (entity.getPersistentData().getDouble("turntimeyaw") >= 0) { - if (entity.getPersistentData().getDouble("turnr") == 0) { - entity.getPersistentData().putDouble("turntimeyaw", (entity.getPersistentData().getDouble("turntimeyaw") - 0.02 * times)); + + if (data.getDouble("move_left") == 1 + || data.getDouble("move_right") == 1 + || data.getDouble("move_forward") == 1 + || data.getDouble("move_backward") == 1) { + + if (data.getDouble("gun_moveY_time") < 1.25) { + data.putDouble("gun_moveY_time", data.getDouble("gun_moveY_time") + on_ground * times * move_speed); + } else { + data.putDouble("gun_moveY_time", 0.25); } - } - if (entity.getPersistentData().getDouble("turntimeyaw") < 0) { - if (entity.getPersistentData().getDouble("turnl") == 0) { - entity.getPersistentData().putDouble("turntimeyaw", (entity.getPersistentData().getDouble("turntimeyaw") + 0.02 * times)); + + if (data.getDouble("gun_moveX_time") < 2) { + data.putDouble("gun_moveX_time", data.getDouble("gun_moveX_time") + on_ground * times * move_speed); + } else { + data.putDouble("gun_moveX_time", 0); } - } - if (entity.getPersistentData().getDouble("amplitudeyaw") < Math.abs(entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2"))) { - entity.getPersistentData().putDouble("amplitudeyaw", (entity.getPersistentData().getDouble("amplitudeyaw") - + 0.005 * Math.sin(0.5 * Math.PI * (Math.abs(entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2")) - entity.getPersistentData().getDouble("amplitudeyaw"))))); + + data.putDouble("gun_move_posY", 0.135 * Math.sin(2 * Math.PI * (data.getDouble("gun_moveY_time") - 0.25)) * (1 - 0.75 * data.getDouble("zoom_time"))); + + data.putDouble("gun_move_posX", 0.2 * Math.sin(1 * Math.PI * data.getDouble("gun_moveX_time")) * (1 - 0.75 * data.getDouble("zoom_time"))); + } else { - entity.getPersistentData().putDouble("amplitudeyaw", (entity.getPersistentData().getDouble("amplitudeyaw") - - 0.005 * Math.sin(0.5 * Math.PI * (Math.abs(entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2")) - entity.getPersistentData().getDouble("amplitudeyaw"))))); + if (data.getDouble("gun_moveY_time") > 0.25) { + data.putDouble("gun_moveY_time", data.getDouble("gun_moveY_time") - 0.5 * times); + } else { + data.putDouble("gun_moveY_time", 0.25); + } + + if (data.getDouble("gun_moveX_time") > 0) { + data.putDouble("gun_moveX_time", data.getDouble("gun_moveX_time") - 0.5 * times); + } else { + data.putDouble("gun_moveX_time", 0); + } + + if (data.getDouble("gun_move_posX") > 0) { + data.putDouble("gun_move_posX", data.getDouble("gun_move_posX") - 4 * (Math.pow(data.getDouble("gun_move_posX"), 2) * times) * (1 - 0.5 * data.getDouble("zoom_time"))); + } else { + data.putDouble("gun_move_posX", data.getDouble("gun_move_posX") + 4 * (Math.pow(data.getDouble("gun_move_posX"), 2) * times) * (1 - 0.5 * data.getDouble("zoom_time"))); + } + + if (data.getDouble("gun_move_posY") > 0) { + data.putDouble("gun_move_posY", data.getDouble("gun_move_posY") - 4 * (Math.pow(data.getDouble("gun_move_posY"), 2) * times) * (1 - 0.5 * data.getDouble("zoom_time"))); + } else { + data.putDouble("gun_move_posY", data.getDouble("gun_move_posY") + 4 * (Math.pow(data.getDouble("gun_move_posY"), 2) * times) * (1 - 0.5 * data.getDouble("zoom_time"))); + } + } - if (entity.getPersistentData().getDouble("amplitudeyaw") > 0) { - entity.getPersistentData().putDouble("amplitudeyaw", (entity.getPersistentData().getDouble("amplitudeyaw") - 0.01 * Math.pow(entity.getPersistentData().getDouble("amplitudeyaw"), 2))); + + if (data.getDouble("move") < 0) { + data.putDouble("move", ((data.getDouble("move") + 1 * times * Math.pow(data.getDouble("move"), 2) * (1 - 0.6 * data.getDouble("zoom_time"))) + * (1 - 1 * data.getDouble("zoom_time")))); } else { - entity.getPersistentData().putDouble("amplitudeyaw", (entity.getPersistentData().getDouble("amplitudeyaw") + 0.01 * Math.pow(entity.getPersistentData().getDouble("amplitudeyaw"), 2))); + data.putDouble("move", ((data.getDouble("move") - 1 * times * Math.pow(data.getDouble("move"), 2) * (1 - 0.6 * data.getDouble("zoom_time"))) + * (1 - 1 * data.getDouble("zoom_time")))); } - entity.getPersistentData().putDouble("yaw", (0.04 * Math.tan(0.25 * Math.PI * entity.getPersistentData().getDouble("turntimeyaw")) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); - if (entity.getPersistentData().getDouble("turnu") == 1) { - entity.getPersistentData().putDouble("turntimepitch", (entity.getPersistentData().getDouble("turntimepitch") + 0.02 * times)); + if (data.getDouble("move_right") == 1) { + data.putDouble("move", + ((data.getDouble("move") + Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time"))) + * (1 - 0.1 * data.getDouble("zoom_time")))); + } else if (data.getDouble("move_left") == 1) { + data.putDouble("move", + ((data.getDouble("move") - Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time"))) + * (1 - 0.1 * data.getDouble("zoom_time")))); } - if (entity.getPersistentData().getDouble("turnd") == 1) { - entity.getPersistentData().putDouble("turntimepitch", (entity.getPersistentData().getDouble("turntimepitch") - 0.02 * times)); + if (data.getDouble("turnr") == 1) { + data.putDouble("turntimeyaw", (data.getDouble("turntimeyaw") + 0.08 * times * Math.pow(data.getDouble("amplitudeyaw"), 2))); } - if (entity.getPersistentData().getDouble("turntimepitch") > 1) { - entity.getPersistentData().putDouble("turntimepitch", 1); + if (data.getDouble("turnl") == 1) { + data.putDouble("turntimeyaw", (data.getDouble("turntimeyaw") - 0.08 * times * Math.pow(data.getDouble("amplitudeyaw"), 2))); } - if (entity.getPersistentData().getDouble("turntimepitch") < -1) { - entity.getPersistentData().putDouble("turntimepitch", (-1)); + if (data.getDouble("turntimeyaw") > 1) { + data.putDouble("turntimeyaw", 1); } - if (entity.getPersistentData().getDouble("turntimepitch") >= 0) { - if (entity.getPersistentData().getDouble("turnu") == 0) { - entity.getPersistentData().putDouble("turntimepitch", (entity.getPersistentData().getDouble("turntimepitch") - 0.04 * times)); + if (data.getDouble("turntimeyaw") < -1) { + data.putDouble("turntimeyaw", (-1)); + } + if (data.getDouble("turntimeyaw") >= 0) { + if (data.getDouble("turnr") == 0) { + data.putDouble("turntimeyaw", (data.getDouble("turntimeyaw") - 0.02 * times)); } } - if (entity.getPersistentData().getDouble("turntimepitch") < 0) { - if (entity.getPersistentData().getDouble("turnd") == 0) { - entity.getPersistentData().putDouble("turntimepitch", (entity.getPersistentData().getDouble("turntimepitch") + 0.04 * times)); + if (data.getDouble("turntimeyaw") < 0) { + if (data.getDouble("turnl") == 0) { + data.putDouble("turntimeyaw", (data.getDouble("turntimeyaw") + 0.02 * times)); } } - if (entity.getPersistentData().getDouble("amplitudepitch") < Math.abs(entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2"))) { - entity.getPersistentData().putDouble("amplitudepitch", (entity.getPersistentData().getDouble("amplitudepitch") - + 0.00001 * Math.pow(Math.abs(entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2")) - entity.getPersistentData().getDouble("amplitudepitch"), 2))); + if (data.getDouble("amplitudeyaw") < Math.abs(data.getDouble("r1") - data.getDouble("r2"))) { + data.putDouble("amplitudeyaw", (data.getDouble("amplitudeyaw") + + 0.005 * Math.sin(0.5 * Math.PI * (Math.abs(data.getDouble("r1") - data.getDouble("r2")) - data.getDouble("amplitudeyaw"))))); } else { - entity.getPersistentData().putDouble("amplitudepitch", (entity.getPersistentData().getDouble("amplitudepitch") - - 0.00001 * Math.pow(Math.abs(entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2")) - entity.getPersistentData().getDouble("amplitudepitch"), 2))); + data.putDouble("amplitudeyaw", (data.getDouble("amplitudeyaw") + - 0.005 * Math.sin(0.5 * Math.PI * (Math.abs(data.getDouble("r1") - data.getDouble("r2")) - data.getDouble("amplitudeyaw"))))); } - if (entity.getPersistentData().getDouble("amplitudepitch") > 0) { - entity.getPersistentData().putDouble("amplitudepitch", (entity.getPersistentData().getDouble("amplitudepitch") - 0.01 * Math.pow(entity.getPersistentData().getDouble("amplitudepitch"), 2))); + if (data.getDouble("amplitudeyaw") > 0) { + data.putDouble("amplitudeyaw", (data.getDouble("amplitudeyaw") - 0.01 * Math.pow(data.getDouble("amplitudeyaw"), 2))); } else { - entity.getPersistentData().putDouble("amplitudepitch", (entity.getPersistentData().getDouble("amplitudepitch") + 0.01 * Math.pow(entity.getPersistentData().getDouble("amplitudepitch"), 2))); + data.putDouble("amplitudeyaw", (data.getDouble("amplitudeyaw") + 0.01 * Math.pow(data.getDouble("amplitudeyaw"), 2))); } - entity.getPersistentData().putDouble("gun_pitch", - ((0.15 * entity.getPersistentData().getDouble("amplitudepitch") * Math.tan(0.25 * Math.PI * entity.getPersistentData().getDouble("turntimepitch")) * (1 - 0.8 * entity.getPersistentData().getDouble("zoom_time")) - - 0.05 * entity.getPersistentData().getDouble("vy")) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); - if (entity.getPersistentData().getDouble("firetime") == 0) { - entity.getPersistentData().putDouble("rottime", (entity.getPersistentData().getDouble("rottime") + 1)); - if (entity.getPersistentData().getDouble("rottime") >= 3) { - entity.getPersistentData().putDouble("rottime", 0); + data.putDouble("yaw", (0.04 * Math.tan(0.25 * Math.PI * data.getDouble("turntimeyaw")) * (1 - 1 * data.getDouble("zoom_time")))); + if (data.getDouble("turnu") == 1) { + data.putDouble("turntimepitch", (data.getDouble("turntimepitch") + 0.02 * times)); + } + if (data.getDouble("turnd") == 1) { + data.putDouble("turntimepitch", (data.getDouble("turntimepitch") - 0.02 * times)); + } + if (data.getDouble("turntimepitch") > 1) { + data.putDouble("turntimepitch", 1); + } + if (data.getDouble("turntimepitch") < -1) { + data.putDouble("turntimepitch", (-1)); + } + if (data.getDouble("turntimepitch") >= 0) { + if (data.getDouble("turnu") == 0) { + data.putDouble("turntimepitch", (data.getDouble("turntimepitch") - 0.04 * times)); } - if (entity.getPersistentData().getDouble("rottime") == 1) { - entity.getPersistentData().putDouble("r1", (entity.getYRot())); - entity.getPersistentData().putDouble("p1", (entity.getXRot())); + } + if (data.getDouble("turntimepitch") < 0) { + if (data.getDouble("turnd") == 0) { + data.putDouble("turntimepitch", (data.getDouble("turntimepitch") + 0.04 * times)); } - if (entity.getPersistentData().getDouble("rottime") == 2) { - entity.getPersistentData().putDouble("r2", (entity.getYRot())); - entity.getPersistentData().putDouble("p2", (entity.getXRot())); + } + if (data.getDouble("amplitudepitch") < Math.abs(data.getDouble("p1") - data.getDouble("p2"))) { + data.putDouble("amplitudepitch", (data.getDouble("amplitudepitch") + + 0.00001 * Math.pow(Math.abs(data.getDouble("p1") - data.getDouble("p2")) - data.getDouble("amplitudepitch"), 2))); + } else { + data.putDouble("amplitudepitch", (data.getDouble("amplitudepitch") + - 0.00001 * Math.pow(Math.abs(data.getDouble("p1") - data.getDouble("p2")) - data.getDouble("amplitudepitch"), 2))); + } + if (data.getDouble("amplitudepitch") > 0) { + data.putDouble("amplitudepitch", (data.getDouble("amplitudepitch") - 0.01 * Math.pow(data.getDouble("amplitudepitch"), 2))); + } else { + data.putDouble("amplitudepitch", (data.getDouble("amplitudepitch") + 0.01 * Math.pow(data.getDouble("amplitudepitch"), 2))); + } + data.putDouble("gun_pitch", + ((0.15 * data.getDouble("amplitudepitch") * Math.tan(0.25 * Math.PI * data.getDouble("turntimepitch")) * (1 - 0.8 * data.getDouble("zoom_time")) + - 0.05 * data.getDouble("vy")) * (1 - 1 * data.getDouble("zoom_time")))); + if (data.getDouble("firetime") == 0) { + data.putDouble("rottime", (data.getDouble("rottime") + 1)); + if (data.getDouble("rottime") >= 3) { + data.putDouble("rottime", 0); } - if (0 > entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2")) { - entity.getPersistentData().putDouble("rot", (entity.getPersistentData().getDouble("rot") - 0.01)); - } else if (0 < entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2")) { - entity.getPersistentData().putDouble("rot", (entity.getPersistentData().getDouble("rot") + 0.01)); - } else if (0 == entity.getPersistentData().getDouble("r1") - entity.getPersistentData().getDouble("r2")) { - entity.getPersistentData().putDouble("rot", 0); + if (data.getDouble("rottime") == 1) { + data.putDouble("r1", (entity.getYRot())); + data.putDouble("p1", (entity.getXRot())); } - if (0 > entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2")) { - entity.getPersistentData().putDouble("pit", (entity.getPersistentData().getDouble("pit") - 0.01)); - } else if (0 < entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2")) { - entity.getPersistentData().putDouble("pit", (entity.getPersistentData().getDouble("pit") + 0.01)); - } else if (0 == entity.getPersistentData().getDouble("p1") - entity.getPersistentData().getDouble("p2")) { - entity.getPersistentData().putDouble("pit", 0); + if (data.getDouble("rottime") == 2) { + data.putDouble("r2", (entity.getYRot())); + data.putDouble("p2", (entity.getXRot())); } - if (entity.getPersistentData().getDouble("rot") < 0) { - entity.getPersistentData().putDouble("rot", (entity.getPersistentData().getDouble("rot") + 2 * times * Math.pow(entity.getPersistentData().getDouble("rot"), 2))); - if (entity.getPersistentData().getDouble("rot") < -0.04) { - entity.getPersistentData().putDouble("turnr", 1); - entity.getPersistentData().putDouble("turnl", 0); + if (0 > data.getDouble("r1") - data.getDouble("r2")) { + data.putDouble("rot", (data.getDouble("rot") - 0.01)); + } else if (0 < data.getDouble("r1") - data.getDouble("r2")) { + data.putDouble("rot", (data.getDouble("rot") + 0.01)); + } else if (0 == data.getDouble("r1") - data.getDouble("r2")) { + data.putDouble("rot", 0); + } + if (0 > data.getDouble("p1") - data.getDouble("p2")) { + data.putDouble("pit", (data.getDouble("pit") - 0.01)); + } else if (0 < data.getDouble("p1") - data.getDouble("p2")) { + data.putDouble("pit", (data.getDouble("pit") + 0.01)); + } else if (0 == data.getDouble("p1") - data.getDouble("p2")) { + data.putDouble("pit", 0); + } + if (data.getDouble("rot") < 0) { + data.putDouble("rot", (data.getDouble("rot") + 2 * times * Math.pow(data.getDouble("rot"), 2))); + if (data.getDouble("rot") < -0.04) { + data.putDouble("turnr", 1); + data.putDouble("turnl", 0); } - } else if (entity.getPersistentData().getDouble("rot") > 0) { - entity.getPersistentData().putDouble("rot", (entity.getPersistentData().getDouble("rot") - 2 * times * Math.pow(entity.getPersistentData().getDouble("rot"), 2))); - if (entity.getPersistentData().getDouble("rot") > 0.04) { - entity.getPersistentData().putDouble("turnl", 1); - entity.getPersistentData().putDouble("turnr", 0); + } else if (data.getDouble("rot") > 0) { + data.putDouble("rot", (data.getDouble("rot") - 2 * times * Math.pow(data.getDouble("rot"), 2))); + if (data.getDouble("rot") > 0.04) { + data.putDouble("turnl", 1); + data.putDouble("turnr", 0); } } else { - entity.getPersistentData().putDouble("rot", 0); - entity.getPersistentData().putDouble("turnl", 0); - entity.getPersistentData().putDouble("turnr", 0); + data.putDouble("rot", 0); + data.putDouble("turnl", 0); + data.putDouble("turnr", 0); } - if (entity.getPersistentData().getDouble("pit") < 0) { - entity.getPersistentData().putDouble("pit", (entity.getPersistentData().getDouble("pit") + 2 * times * Math.pow(entity.getPersistentData().getDouble("pit"), 2))); - if (entity.getPersistentData().getDouble("pit") < -0.034) { - entity.getPersistentData().putDouble("turnu", 1); - entity.getPersistentData().putDouble("turnd", 0); + if (data.getDouble("pit") < 0) { + data.putDouble("pit", (data.getDouble("pit") + 2 * times * Math.pow(data.getDouble("pit"), 2))); + if (data.getDouble("pit") < -0.034) { + data.putDouble("turnu", 1); + data.putDouble("turnd", 0); } - } else if (entity.getPersistentData().getDouble("pit") > 0) { - entity.getPersistentData().putDouble("pit", (entity.getPersistentData().getDouble("pit") - 2 * times * Math.pow(entity.getPersistentData().getDouble("pit"), 2))); - if (entity.getPersistentData().getDouble("pit") > 0.034) { - entity.getPersistentData().putDouble("turnd", 1); - entity.getPersistentData().putDouble("turnu", 0); + } else if (data.getDouble("pit") > 0) { + data.putDouble("pit", (data.getDouble("pit") - 2 * times * Math.pow(data.getDouble("pit"), 2))); + if (data.getDouble("pit") > 0.034) { + data.putDouble("turnd", 1); + data.putDouble("turnu", 0); } } else { - entity.getPersistentData().putDouble("pit", 0); - entity.getPersistentData().putDouble("turnd", 0); - entity.getPersistentData().putDouble("turnu", 0); + data.putDouble("pit", 0); + data.putDouble("turnd", 0); + data.putDouble("turnu", 0); } } else { - entity.getPersistentData().putDouble("pit", 0); - entity.getPersistentData().putDouble("turnl", 0); - entity.getPersistentData().putDouble("turnr", 0); - entity.getPersistentData().putDouble("turnd", 0); - entity.getPersistentData().putDouble("turnu", 0); + data.putDouble("pit", 0); + data.putDouble("turnl", 0); + data.putDouble("turnr", 0); + data.putDouble("turnd", 0); + data.putDouble("turnu", 0); } - if (-0.8 < entity.getDeltaMovement().y() + 0.078 && entity.getDeltaMovement().y() + 0.078 < 0.8) { - if (entity.getPersistentData().getDouble("vy") < entity.getDeltaMovement().y() + 0.078) { - entity.getPersistentData().putDouble("vy", - ((entity.getPersistentData().getDouble("vy") + 2 * Math.pow((entity.getDeltaMovement().y() + 0.078) - entity.getPersistentData().getDouble("vy"), 2)) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); + double velocity = entity.getDeltaMovement().y(); + + if (-0.8 < velocity + 0.078 && velocity + 0.078 < 0.8) { + if (data.getDouble("vy") < entity.getDeltaMovement().y() + 0.078) { + data.putDouble("vy", + ((data.getDouble("vy") + 0.5 * Math.pow((velocity + 0.078) - data.getDouble("vy"), 2)) * (1 - 0.4 * data.getDouble("zoom_time")))); } else { - entity.getPersistentData().putDouble("vy", - ((entity.getPersistentData().getDouble("vy") - 2 * Math.pow((entity.getDeltaMovement().y() + 0.078) - entity.getPersistentData().getDouble("vy"), 2)) * (1 - 1 * entity.getPersistentData().getDouble("zoom_time")))); + data.putDouble("vy", + ((data.getDouble("vy") - 0.5 * Math.pow((velocity + 0.078) - data.getDouble("vy"), 2)) * (1 - 0.4 * data.getDouble("zoom_time")))); } } - if (entity.getPersistentData().getDouble("vy") > 0.8) { - entity.getPersistentData().putDouble("vy", 0.8); + if (data.getDouble("vy") > 0.8) { + data.putDouble("vy", 0.8); } - if (entity.getPersistentData().getDouble("vy") < -0.8) { - entity.getPersistentData().putDouble("vy", (-0.8)); + if (data.getDouble("vy") < -0.8) { + data.putDouble("vy", (-0.8)); } } } @@ -220,22 +280,24 @@ public class ClientEventHandler { fps = 1f; } float times = 110f / fps; + var data = entity.getPersistentData(); + if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { - if (entity.getPersistentData().getDouble("zoom_time") < 1) { - entity.getPersistentData().putDouble("zoom_time", - (entity.getPersistentData().getDouble("zoom_time") + entity.getMainHandItem().getOrCreateTag().getDouble("zoom_speed") * 0.02 * times)); + if (data.getDouble("zoom_time") < 1) { + data.putDouble("zoom_time", + (data.getDouble("zoom_time") + entity.getMainHandItem().getOrCreateTag().getDouble("zoom_speed") * 0.02 * times)); } else { - entity.getPersistentData().putDouble("zoom_time", 1); + data.putDouble("zoom_time", 1); } } else { - if (entity.getPersistentData().getDouble("zoom_time") > 0) { - entity.getPersistentData().putDouble("zoom_time", (entity.getPersistentData().getDouble("zoom_time") - 0.02 * times)); + if (data.getDouble("zoom_time") > 0) { + data.putDouble("zoom_time", (data.getDouble("zoom_time") - 0.02 * times)); } else { - entity.getPersistentData().putDouble("zoom_time", 0); + data.putDouble("zoom_time", 0); } } - entity.getPersistentData().putDouble("zoom_pos", (0.5 * Math.cos(Math.PI * Math.pow(Math.pow(entity.getPersistentData().getDouble("zoom_time"), 2) - 1, 2)) + 0.5)); - entity.getPersistentData().putDouble("zoom_pos_z", (-Math.pow(2 * entity.getPersistentData().getDouble("zoom_time") - 1, 2) + 1)); + data.putDouble("zoom_pos", (0.5 * Math.cos(Math.PI * Math.pow(Math.pow(data.getDouble("zoom_time"), 2) - 1, 2)) + 0.5)); + data.putDouble("zoom_pos_z", (-Math.pow(2 * data.getDouble("zoom_time") - 1, 2) + 1)); } private static void handleWeaponFire(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) { diff --git a/src/main/java/net/mcreator/target/event/GunEventHandler.java b/src/main/java/net/mcreator/target/event/GunEventHandler.java index 389da1978..ece93420e 100644 --- a/src/main/java/net/mcreator/target/event/GunEventHandler.java +++ b/src/main/java/net/mcreator/target/event/GunEventHandler.java @@ -147,6 +147,7 @@ public class GunEventHandler { stack.getOrCreateTag().putInt("ammo", (stack.getOrCreateTag().getInt("ammo") - 1)); stack.getOrCreateTag().putInt("fire_animation", stack.getOrCreateTag().getInt("fire_interval")); + player.getPersistentData().putInt("noRun_time", stack.getOrCreateTag().getInt("fire_interval") + 2); stack.getOrCreateTag().putDouble("flash_time", 2); stack.getOrCreateTag().putDouble("empty", 1); diff --git a/src/main/java/net/mcreator/target/event/PlayerEventHandler.java b/src/main/java/net/mcreator/target/event/PlayerEventHandler.java index bcc162b81..66b5b3a6f 100644 --- a/src/main/java/net/mcreator/target/event/PlayerEventHandler.java +++ b/src/main/java/net/mcreator/target/event/PlayerEventHandler.java @@ -101,7 +101,7 @@ public class PlayerEventHandler { * 判断玩家是否在奔跑 */ private static void handlePlayerSprint(Player player) { - if (player.getMainHandItem().getOrCreateTag().getInt("fire_animation") > 0) { + if (player.getMainHandItem().getOrCreateTag().getInt("flash_time") > 0) { player.getPersistentData().putDouble("noRun", 20); } diff --git a/src/main/java/net/mcreator/target/mixins/GameRendererMixin.java b/src/main/java/net/mcreator/target/mixins/GameRendererMixin.java index 711c28326..8b97df913 100644 --- a/src/main/java/net/mcreator/target/mixins/GameRendererMixin.java +++ b/src/main/java/net/mcreator/target/mixins/GameRendererMixin.java @@ -20,7 +20,7 @@ public class GameRendererMixin { Player player = mc.player; if (player != null) { ItemStack stack = player.getMainHandItem(); - if (stack.is(TargetModTags.Items.GUN) && stack.getOrCreateTag().getBoolean("aiming")) { + if (stack.is(TargetModTags.Items.GUN)) { ci.cancel(); } } diff --git a/src/main/java/net/mcreator/target/procedures/M870fireProcedure.java b/src/main/java/net/mcreator/target/procedures/M870fireProcedure.java index e174c7368..f6254e25d 100644 --- a/src/main/java/net/mcreator/target/procedures/M870fireProcedure.java +++ b/src/main/java/net/mcreator/target/procedures/M870fireProcedure.java @@ -22,7 +22,6 @@ public class M870fireProcedure { GunsTool.spawnBullet(player); } player.getCooldowns().addCooldown(usehand.getItem(), 13); - usehand.getOrCreateTag().putDouble("recoil", 1); usehand.getOrCreateTag().putDouble("firing", 13); if (!player.level().isClientSide() && player.getServer() != null) { diff --git a/src/main/resources/assets/target/geo/devotion.geo.json b/src/main/resources/assets/target/geo/devotion.geo.json index 2dd712d71..4fd69e099 100644 --- a/src/main/resources/assets/target/geo/devotion.geo.json +++ b/src/main/resources/assets/target/geo/devotion.geo.json @@ -14206,11 +14206,11 @@ { "name": "holo", "parent": "0", - "pivot": [0, 3.67891, -4.5], + "pivot": [0, 3.85547, -80.5], "cubes": [ { - "origin": [-0.19125, 3.48766, -4.5], - "size": [0.3825, 0.3825, 0], + "origin": [-1.1934, 1.56032, -80.5], + "size": [2.3868, 2.3868, 0], "uv": { "north": {"uv": [59.53906, 60.625], "uv_size": [3.125, 2.625]}, "east": {"uv": [3.16406, 110.30469], "uv_size": [8, 8]}, diff --git a/src/main/resources/assets/target/geo/sentinel.geo.json b/src/main/resources/assets/target/geo/sentinel.geo.json index 029550a98..bec83ea95 100644 --- a/src/main/resources/assets/target/geo/sentinel.geo.json +++ b/src/main/resources/assets/target/geo/sentinel.geo.json @@ -43,11 +43,11 @@ { "name": "holo", "parent": "0", - "pivot": [0.34531, 4.12344, 2.75], + "pivot": [0.34531, 4.30078, -41.25], "cubes": [ { - "origin": [-0.24469, 3.93169, 2.75], - "size": [1.18, 0.3835, 0], + "origin": [-3.14011, 2.12036, -41.25], + "size": [6.97085, 2.26553, 0], "uv": { "north": {"uv": [0, 0], "uv_size": [2, 2]}, "east": {"uv": [0, 0], "uv_size": [0, 2]},