优化开火动画逻辑
This commit is contained in:
parent
4316f1d866
commit
29e77af9ab
34 changed files with 218 additions and 396 deletions
|
@ -59,8 +59,8 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
|||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
||||
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
|
@ -121,12 +121,6 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public class Aa12ItemModel extends GeoModel<Aa12Item> {
|
|||
gun.setRotZ((float) (0.02f * zpz));
|
||||
gun.setScaleZ(1f - (0.4f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.02f * (float) (fp + 2 * fr));
|
||||
|
@ -109,9 +109,6 @@ public class Aa12ItemModel extends GeoModel<Aa12Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ public class AbekiriItemModel extends GeoModel<AbekiriItem> {
|
|||
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosX(-0.2f * (float) (fp + 2 * fr));
|
||||
shen.setPosY(0.2f * (float) (fp + 2 * fr));
|
||||
|
@ -105,11 +105,6 @@ public class AbekiriItemModel extends GeoModel<AbekiriItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ public class BocekItemModel extends GeoModel<BocekItem> {
|
|||
stack.getOrCreateTag().putBoolean("HoloHidden", !((shen_pos.getPosX() < -0.7 && gun.getPosZ() < -2.6)));
|
||||
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
fire.setPosY(-0.01f * (float) (fp + 2 * fr));
|
||||
|
@ -135,11 +135,6 @@ public class BocekItemModel extends GeoModel<BocekItem> {
|
|||
move.setRotZ(2.7f * (float) mph + Mth.DEG_TO_RAD * (float) turnRotZ);
|
||||
|
||||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,22 +49,13 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
|
|||
double zpz = ClientEventHandler.getZoomPosZ();
|
||||
|
||||
gun.setPosX(2.17f * (float) zp);
|
||||
|
||||
gun.setPosY(0.17f * (float) zp - (float) (0.5f * zpz));
|
||||
|
||||
gun.setPosZ(8.8f * (float) zp + (float) (0.6f * zpz));
|
||||
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
|
||||
gun.setScaleZ(1f - (0.7f * (float) zp));
|
||||
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
CoreGeoBone number = getAnimationProcessor().getBone("number");
|
||||
|
||||
double bp = player.getPersistentData().getDouble("boltpos");
|
||||
|
||||
bolt.setPosZ(-2f * (float) bp);
|
||||
|
||||
CoreGeoBone holo = getAnimationProcessor().getBone("holo");
|
||||
if (gun.getPosX() > 1.2) {
|
||||
number.setScaleX(1);
|
||||
|
@ -76,8 +67,8 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.05f * (float) (fp + 2 * fr));
|
||||
|
@ -91,8 +82,7 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
|
|||
shen.setRotZ(-0.04f * (float) (fp + 1.3 * fr));
|
||||
}
|
||||
shen.setPosX(0.5f * (float)fr * (float)((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).recoilHorizon * fp));
|
||||
|
||||
|
||||
bolt.setPosZ(-2f * (float) fp);
|
||||
|
||||
CoreGeoBone n0 = getAnimationProcessor().getBone("00");
|
||||
CoreGeoBone n1 = getAnimationProcessor().getBone("1");
|
||||
|
@ -661,11 +651,6 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ public class Glock17ItemModel extends GeoModel<Glock17Item> {
|
|||
|
||||
gun.setRotZ(-11 * Mth.DEG_TO_RAD * (float) zp + (float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.03f * (float) (fp + 2 * fr));
|
||||
|
@ -137,11 +137,6 @@ public class Glock17ItemModel extends GeoModel<Glock17Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
|
|||
|
||||
gun.setRotZ(-11 * Mth.DEG_TO_RAD * (float) zp + (float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.03f * (float) (fp + 2 * fr));
|
||||
|
@ -145,11 +145,6 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 3.1));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(-0.01f * (float) (fp + 2 * fr));
|
||||
|
@ -114,11 +114,6 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ public class HuntingRifleItemModel extends GeoModel<HuntingRifleItem> {
|
|||
|
||||
gun.setScaleZ(1f - (0.5f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosX(-0.05f * (float) (fp + 0.2 * fr));
|
||||
shen.setPosY(0.3f * (float) (fp + 2 * fr));
|
||||
|
@ -117,11 +117,6 @@ public class HuntingRifleItemModel extends GeoModel<HuntingRifleItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class JavelinItemModel extends GeoModel<JavelinItem> {
|
|||
javelin.setHidden(gun.getPosZ() > 15.85);
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosZ() > 15.85));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosY(0.28f * (float) (fp + 2 * fr));
|
||||
shen.setPosZ(3.8f * (float) (fp + 0.54f * fr));
|
||||
|
@ -90,11 +90,6 @@ public class JavelinItemModel extends GeoModel<JavelinItem> {
|
|||
move.setRotZ(2.7f * (float) mph + Mth.DEG_TO_RAD * (float) turnRotZ);
|
||||
|
||||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ public class K98ItemModel extends GeoModel<K98Item> {
|
|||
gun.setScaleZ(1f - (0.7f * (float) zp));
|
||||
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.1f * (float) (fp + 2 * fr));
|
||||
|
@ -130,11 +130,6 @@ public class K98ItemModel extends GeoModel<K98Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class M1911ItemModel extends GeoModel<M1911Item> {
|
|||
|
||||
gun.setScaleZ(1f - (0.35f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.03f * (float) (fp + 2 * fr));
|
||||
|
@ -135,11 +135,6 @@ public class M1911ItemModel extends GeoModel<M1911Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.02f * (float) (fp + 2 * fr));
|
||||
|
@ -114,11 +114,6 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
|||
|
||||
gun.setRotZ(-0.087f * (float) zp + (float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(-0.03f * (float) (fp + 2 * fr));
|
||||
|
@ -157,11 +157,6 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ public class M79ItemModel extends GeoModel<M79Item> {
|
|||
|
||||
gun.setRotZ((float) (0.05f * zpz));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.4f * (float) (fp + 2 * fr));
|
||||
|
@ -112,11 +112,6 @@ public class M79ItemModel extends GeoModel<M79Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public class M870ItemModel extends GeoModel<M870Item> {
|
|||
|
||||
gun.setScaleZ(1f - (0.2f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.2f * (float) (fp + 2 * fr));
|
||||
|
@ -115,11 +115,6 @@ public class M870ItemModel extends GeoModel<M870Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class M98bItemModel extends GeoModel<M98bItem> {
|
|||
ItemStack stack = player.getMainHandItem();
|
||||
if (!stack.is(ModTags.Items.GUN)) return;
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.4f * (float) (fp + 2 * fr));
|
||||
|
@ -124,11 +124,6 @@ public class M98bItemModel extends GeoModel<M98bItem> {
|
|||
scope.setPosY(numP * scope.getPosY());
|
||||
scope.setPosZ(numP * scope.getPosZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class MarlinItemModel extends GeoModel<MarlinItem> {
|
|||
|
||||
gun.setScaleZ(1f - (0.5f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosX(-0.2f * (float) (fp + 2 * fr));
|
||||
shen.setPosY(0.4f * (float) (fp + 2 * fr));
|
||||
|
@ -112,11 +112,6 @@ public class MarlinItemModel extends GeoModel<MarlinItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class MinigunItemModel extends GeoModel<MinigunItem> {
|
|||
gun.setRotZ((float) (gun.getRotZ() + times * -0.008f * stack.getOrCreateTag().getDouble("minigun_rotation")));
|
||||
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosY(0.1f * (float) (fp + 2 * fr));
|
||||
shen.setPosZ(2.2f * (float) (0.5 * fp + 1.54f * fr));
|
||||
|
@ -90,11 +90,6 @@ public class MinigunItemModel extends GeoModel<MinigunItem> {
|
|||
move.setRotZ(2.7f * (float) mph + Mth.DEG_TO_RAD * (float) turnRotZ);
|
||||
|
||||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
|||
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.06f * (float) (fp + 2 * fr));
|
||||
|
@ -145,11 +145,6 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.4));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.07f * (float) (fp + 2 * fr));
|
||||
|
@ -142,11 +142,6 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
|
|||
r.setRotX(-1.5f);
|
||||
}
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.4f * (float) (fp + 2 * fr));
|
||||
|
@ -127,11 +127,6 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 3.1));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(-0.01f * (float) (fp + 2 * fr));
|
||||
|
@ -119,11 +119,6 @@ public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ public class RpgItemModel extends GeoModel<RpgItem> {
|
|||
hammer.setRotX(-90 * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.02f * (float) (fp + 2 * fr));
|
||||
|
@ -115,11 +115,6 @@ public class RpgItemModel extends GeoModel<RpgItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.65));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(-0.01f * (float) (fp + 2 * fr));
|
||||
|
@ -131,11 +131,6 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
|
|||
CoreGeoBone holo = getAnimationProcessor().getBone("holo");
|
||||
holo.setPosY(0.09f);
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.4f * (float) (fp + 2 * fr));
|
||||
|
@ -138,11 +138,6 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@ public class SksItemModel extends GeoModel<SksItem> {
|
|||
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.04f * (float) (fp + 2 * fr));
|
||||
|
@ -126,11 +126,6 @@ public class SksItemModel extends GeoModel<SksItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ public class SvdItemModel extends GeoModel<SvdItem> {
|
|||
|
||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.02f * (float) (fp + 2 * fr));
|
||||
|
@ -142,11 +142,6 @@ public class SvdItemModel extends GeoModel<SvdItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ public class TaserItemModel extends GeoModel<TaserItem> {
|
|||
redcover.setScaleZ(1);
|
||||
}
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosX(-0.05f * (float) (fp + 0.2 * fr));
|
||||
shen.setPosY(0.1f * (float) (fp + 2 * fr));
|
||||
|
@ -138,11 +138,6 @@ public class TaserItemModel extends GeoModel<TaserItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
|
|||
|
||||
gun.setScaleZ(1f - (0.2f * (float) zp));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
shen.setPosX(-0.4f * (float) (fp + 0.2 * fr));
|
||||
shen.setPosY(0.6f * (float) (fp + 2 * fr));
|
||||
|
@ -106,11 +106,6 @@ public class TracheliumItemModel extends GeoModel<Trachelium> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public class VectorItemModel extends GeoModel<VectorItem> {
|
|||
|
||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 2));
|
||||
|
||||
double fp = player.getPersistentData().getDouble("fire_pos");
|
||||
double fr = player.getPersistentData().getDouble("fire_rot");
|
||||
double fp = ClientEventHandler.getFirePos();
|
||||
double fr = ClientEventHandler.getFireRot();
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
shen.setPosY(0.05f * (float) (fp + 2 * fr));
|
||||
|
@ -130,11 +130,6 @@ public class VectorItemModel extends GeoModel<VectorItem> {
|
|||
camera.setRotY(numR * camera.getRotY());
|
||||
camera.setRotZ(numR * camera.getRotZ());
|
||||
}
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
|
||||
player.getPersistentData().putDouble("camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package net.mcreator.superbwarfare.entity.model;
|
|||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||
import net.mcreator.superbwarfare.event.ClientEventHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
||||
|
@ -52,10 +52,6 @@ public class Mk42Model extends GeoModel<Mk42Entity> {
|
|||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
if (animatable.getFirstPassenger() == null) return;
|
||||
Entity gunner = animatable.getFirstPassenger();
|
||||
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package net.mcreator.superbwarfare.entity.model;
|
|||
|
||||
import net.mcreator.superbwarfare.ModUtils;
|
||||
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||
import net.mcreator.superbwarfare.event.ClientEventHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
||||
|
@ -52,10 +52,6 @@ public class Mle1934Model extends GeoModel<Mle1934Entity> {
|
|||
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
|
||||
if (animatable.getFirstPassenger() == null) return;
|
||||
Entity gunner = animatable.getFirstPassenger();
|
||||
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||
gunner.getPersistentData().putDouble("cannon_camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,25 +34,35 @@ import static net.mcreator.superbwarfare.entity.DroneEntity.ROT_Z;
|
|||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
|
||||
public class ClientEventHandler {
|
||||
protected static double zoomTime = 0;
|
||||
protected static double zoomPos = 0;
|
||||
protected static double zoomPosZ = 0;
|
||||
private static double swayTime = 0;
|
||||
private static double zoomTimer = 0;
|
||||
private static double zoomPos = 0;
|
||||
private static double zoomPosZ = 0;
|
||||
private static double swayTimer = 0;
|
||||
private static double swayX = 0;
|
||||
private static double swayY = 0;
|
||||
private static double moveXTimer = 0;
|
||||
private static double moveYTimer = 0;
|
||||
private static double movePosX = 0;
|
||||
private static double movePosY = 0;
|
||||
private static double moveRotZ = 0;
|
||||
private static double movePosHorizon = 0;
|
||||
private static double velocityY = 0;
|
||||
private static double turnRotX = 0;
|
||||
private static double turnRotY = 0;
|
||||
private static double turnRotZ = 0;
|
||||
private static double cameraRotX = 0;
|
||||
private static double cameraRotY = 0;
|
||||
private static double cameraRotZ = 0;
|
||||
private static double firePosTimer = 0;
|
||||
private static double fireRotTimer = 0;
|
||||
private static double firePos = 0;
|
||||
private static double firePosZ = 0;
|
||||
private static double fireRot = 0;
|
||||
private static double droneCameraRotX = 0;
|
||||
private static double droneCameraRotY = 0;
|
||||
private static double droneRotX = 0;
|
||||
private static double droneRotZ = 0;
|
||||
|
||||
protected static double swayX = 0;
|
||||
|
||||
protected static double swayY = 0;
|
||||
|
||||
private static double moveXTime = 0;
|
||||
private static double moveYTime = 0;
|
||||
protected static double movePosX = 0;
|
||||
protected static double movePosY = 0;
|
||||
protected static double moveRotZ = 0;
|
||||
protected static double movePosHorizon = 0;
|
||||
protected static double velocityY = 0;
|
||||
protected static double turnRotX = 0;
|
||||
protected static double turnRotY = 0;
|
||||
protected static double turnRotZ = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void handleWeaponTurn(RenderHandEvent event) {
|
||||
|
@ -65,12 +75,12 @@ public class ClientEventHandler {
|
|||
float yRotOffset = Mth.lerp(event.getPartialTick(), player.yBobO, player.yBob);
|
||||
float xRot = player.getViewXRot(event.getPartialTick()) - xRotOffset;
|
||||
float yRot = player.getViewYRot(event.getPartialTick()) - yRotOffset;
|
||||
turnRotX = Mth.clamp(0.05 * xRot, -5, 5) * (1 - 0.75 * zoomTime);
|
||||
turnRotY = Mth.clamp(0.05 * yRot, -10, 10) * (1 - 0.75 * zoomTime);
|
||||
turnRotZ = Mth.clamp(0.1 * yRot, -10, 10) * (1 - zoomTime);
|
||||
turnRotX = Mth.clamp(0.05 * xRot, -5, 5) * (1 - 0.75 * zoomTimer);
|
||||
turnRotY = Mth.clamp(0.05 * yRot, -10, 10) * (1 - 0.75 * zoomTimer);
|
||||
turnRotZ = Mth.clamp(0.1 * yRot, -10, 10) * (1 - zoomTimer);
|
||||
|
||||
data.putDouble("droneCameraRotX", Mth.clamp(0.25f * xRot, -10, 10));
|
||||
data.putDouble("droneCameraRotY", Mth.clamp(0.25f * yRot, -20, 10));
|
||||
droneCameraRotX = Mth.clamp(0.25f * xRot, -10, 10);
|
||||
droneCameraRotY = Mth.clamp(0.25f * yRot, -20, 10);
|
||||
}
|
||||
|
||||
public static double getTurnRotX() {
|
||||
|
@ -89,9 +99,9 @@ public class ClientEventHandler {
|
|||
public static void computeCameraAngles(ViewportEvent.ComputeCameraAngles event) {
|
||||
ClientLevel level = Minecraft.getInstance().level;
|
||||
Entity entity = event.getCamera().getEntity();
|
||||
if (level != null && entity instanceof LivingEntity living && entity.isPassenger() && entity.getVehicle() instanceof ICannonEntity) {
|
||||
handleCannonCamera(event, living);
|
||||
}
|
||||
|
||||
handlePlayerCameraShake(event);
|
||||
|
||||
if (level != null && entity instanceof LivingEntity living
|
||||
&& living.getMainHandItem().is(ModItems.MONITOR.get())
|
||||
&& living.getMainHandItem().getOrCreateTag().getBoolean("Using")
|
||||
|
@ -101,8 +111,6 @@ public class ClientEventHandler {
|
|||
if (Minecraft.getInstance().gameRenderer.currentEffect() != null && Minecraft.getInstance().gameRenderer.currentEffect().getName().equals("superbwarfare:shaders/post/scan_pincushion.json")) {
|
||||
Minecraft.getInstance().gameRenderer.shutdownEffect();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (level != null && entity instanceof LivingEntity living && living.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||
handleWeaponSway(living);
|
||||
|
@ -111,7 +119,6 @@ public class ClientEventHandler {
|
|||
handlePlayerBreath(living);
|
||||
handleWeaponFire(event, living);
|
||||
handleShockCamera(event, living);
|
||||
handlePlayerCameraShake(event, living);
|
||||
handleBowPullAnimation(living);
|
||||
}
|
||||
}
|
||||
|
@ -127,20 +134,20 @@ public class ClientEventHandler {
|
|||
|
||||
if (drone != null) {
|
||||
|
||||
if (data.getDouble("droneRotZ") > drone.getEntityData().get(ROT_Z)) {
|
||||
data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") - 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2), drone.getEntityData().get(ROT_Z), Double.POSITIVE_INFINITY));
|
||||
if (droneRotZ > drone.getEntityData().get(ROT_Z)) {
|
||||
droneRotZ = Mth.clamp(droneRotZ - 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - droneRotZ, 2), drone.getEntityData().get(ROT_Z), Double.POSITIVE_INFINITY);
|
||||
} else {
|
||||
data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") + 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_Z)));
|
||||
droneRotZ = Mth.clamp(droneRotZ + 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - droneRotZ, 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_Z));
|
||||
}
|
||||
|
||||
if (data.getDouble("droneRotX") > drone.getEntityData().get(ROT_X)) {
|
||||
data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") - 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2), drone.getEntityData().get(ROT_X), Double.POSITIVE_INFINITY));
|
||||
if (droneRotX > drone.getEntityData().get(ROT_X)) {
|
||||
droneRotX = Mth.clamp(droneRotX - 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - droneRotX, 2), drone.getEntityData().get(ROT_X), Double.POSITIVE_INFINITY);
|
||||
} else {
|
||||
data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_X)));
|
||||
droneRotX = Mth.clamp(droneRotX + 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - droneRotX, 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_X));
|
||||
}
|
||||
|
||||
event.setPitch((float) (pitch + data.getDouble("droneCameraRotX") - 0.15f * Mth.RAD_TO_DEG * data.getDouble("droneRotZ")));
|
||||
event.setRoll((float) (roll + data.getDouble("droneCameraRotY") - 0.5f * Mth.RAD_TO_DEG * data.getDouble("droneRotX")));
|
||||
event.setPitch((float) (pitch + droneCameraRotX - 0.15f * Mth.RAD_TO_DEG * droneRotZ));
|
||||
event.setRoll((float) (roll + droneCameraRotY - 0.5f * Mth.RAD_TO_DEG * droneRotX));
|
||||
}
|
||||
|
||||
if (drone != null && stack.getOrCreateTag().getBoolean("Using")) {
|
||||
|
@ -168,17 +175,6 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private static void handleCannonCamera(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
||||
var data = entity.getPersistentData();
|
||||
double yaw = event.getYaw();
|
||||
double pitch = event.getPitch();
|
||||
double roll = event.getRoll();
|
||||
|
||||
event.setPitch((float) (pitch + data.getDouble("cannon_camera_rot_x")));
|
||||
event.setYaw((float) (yaw + data.getDouble("cannon_camera_rot_y")));
|
||||
event.setRoll((float) (roll + data.getDouble("cannon_camera_rot_z")));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderHand(RenderHandEvent event) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
@ -216,9 +212,9 @@ public class ClientEventHandler {
|
|||
pose = 1;
|
||||
}
|
||||
|
||||
swayTime += 0.05 * times;
|
||||
swayX = pose * -0.008 * Math.sin(swayTime) * (1 - 0.95 * zoomTime);
|
||||
swayY = pose * 0.125 * Math.sin(swayTime - 1.585) * (1 - 0.95 * zoomTime) - 3 * moveRotZ;
|
||||
swayTimer += 0.05 * times;
|
||||
swayX = pose * -0.008 * Math.sin(swayTimer) * (1 - 0.95 * zoomTimer);
|
||||
swayY = pose * 0.125 * Math.sin(swayTimer - 1.585) * (1 - 0.95 * zoomTimer) - 3 * moveRotZ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +242,7 @@ public class ClientEventHandler {
|
|||
on_ground = 0.001;
|
||||
}
|
||||
|
||||
if (Minecraft.getInstance().options.keyUp.isDown() && data.getDouble("firetime") == 0 && zoomTime == 0) {
|
||||
if (Minecraft.getInstance().options.keyUp.isDown() && firePosTimer == 0 && zoomTimer == 0) {
|
||||
moveRotZ = Mth.clamp(moveRotZ + 0.007 * times,0,0.14);
|
||||
} else {
|
||||
moveRotZ = Mth.clamp(moveRotZ - 0.007 * times,0,0.14);
|
||||
|
@ -255,46 +251,46 @@ public class ClientEventHandler {
|
|||
if ((Minecraft.getInstance().options.keyLeft.isDown()
|
||||
|| Minecraft.getInstance().options.keyRight.isDown()
|
||||
|| Minecraft.getInstance().options.keyUp.isDown()
|
||||
|| Minecraft.getInstance().options.keyDown.isDown()) && data.getDouble("firetime") == 0) {
|
||||
|| Minecraft.getInstance().options.keyDown.isDown()) && firePosTimer == 0) {
|
||||
|
||||
if (moveYTime < 1.25) {
|
||||
moveYTime += 1.2 * on_ground * times * move_speed;
|
||||
if (moveYTimer < 1.25) {
|
||||
moveYTimer += 1.2 * on_ground * times * move_speed;
|
||||
} else {
|
||||
moveYTime = 0.25;
|
||||
moveYTimer = 0.25;
|
||||
}
|
||||
|
||||
if (moveXTime < 2) {
|
||||
moveXTime += 1.2 * on_ground * times * move_speed;
|
||||
if (moveXTimer < 2) {
|
||||
moveXTimer += 1.2 * on_ground * times * move_speed;
|
||||
} else {
|
||||
moveXTime = 0;
|
||||
moveXTimer = 0;
|
||||
}
|
||||
|
||||
movePosX= 0.2 * Math.sin(1 * Math.PI * moveXTime) * (1 - 0.95 * zoomTime);
|
||||
movePosY = -0.135 * Math.sin(2 * Math.PI * (moveYTime - 0.25)) * (1 - 0.95 * zoomTime);
|
||||
movePosX= 0.2 * Math.sin(1 * Math.PI * moveXTimer) * (1 - 0.95 * zoomTimer);
|
||||
movePosY = -0.135 * Math.sin(2 * Math.PI * (moveYTimer - 0.25)) * (1 - 0.95 * zoomTimer);
|
||||
|
||||
} else {
|
||||
if (moveYTime > 0.25) {
|
||||
moveYTime -= 0.5 * times;
|
||||
if (moveYTimer > 0.25) {
|
||||
moveYTimer -= 0.5 * times;
|
||||
} else {
|
||||
moveYTime = 0.25;
|
||||
moveYTimer = 0.25;
|
||||
}
|
||||
|
||||
if (moveXTime > 0) {
|
||||
moveXTime -= 0.5 * times;
|
||||
if (moveXTimer > 0) {
|
||||
moveXTimer -= 0.5 * times;
|
||||
} else {
|
||||
moveXTime = 0;
|
||||
moveXTimer = 0;
|
||||
}
|
||||
|
||||
if (movePosX > 0) {
|
||||
movePosX -= 1.5 * (Math.pow(movePosX, 2) * times) * (1 - 0.75 * zoomTime);
|
||||
movePosX -= 1.5 * (Math.pow(movePosX, 2) * times) * (1 - 0.75 * zoomTimer);
|
||||
} else {
|
||||
movePosX += 1.5 * (Math.pow(movePosX, 2) * times) * (1 - 0.75 * zoomTime);
|
||||
movePosX += 1.5 * (Math.pow(movePosX, 2) * times) * (1 - 0.75 * zoomTimer);
|
||||
}
|
||||
|
||||
if (movePosY > 0) {
|
||||
movePosY -= 1.5 * (Math.pow(movePosY, 2) * times) * (1 - 0.75 * zoomTime);
|
||||
movePosY -= 1.5 * (Math.pow(movePosY, 2) * times) * (1 - 0.75 * zoomTimer);
|
||||
} else {
|
||||
movePosY += 1.5 * (Math.pow(movePosY, 2) * times) * (1 - 0.75 * zoomTime);
|
||||
movePosY += 1.5 * (Math.pow(movePosY, 2) * times) * (1 - 0.75 * zoomTimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,18 +300,18 @@ public class ClientEventHandler {
|
|||
movePosHorizon -= 2 * times * Math.pow(movePosHorizon, 2);
|
||||
}
|
||||
if (Minecraft.getInstance().options.keyRight.isDown()) {
|
||||
movePosHorizon = Mth.clamp(movePosHorizon + Math.pow(Math.abs(movePosHorizon) + 0.05, 2) * 0.2 * times, -0.5,0.5) * (1 - zoomTime);
|
||||
movePosHorizon = Mth.clamp(movePosHorizon + Math.pow(Math.abs(movePosHorizon) + 0.05, 2) * 0.2 * times, -0.5,0.5) * (1 - zoomTimer);
|
||||
} else if (Minecraft.getInstance().options.keyLeft.isDown()) {
|
||||
movePosHorizon = Mth.clamp(movePosHorizon - Math.pow(Math.abs(movePosHorizon) + 0.05, 2) * 0.2 * times, -0.5,0.5) * (1 - zoomTime);
|
||||
movePosHorizon = Mth.clamp(movePosHorizon - Math.pow(Math.abs(movePosHorizon) + 0.05, 2) * 0.2 * times, -0.5,0.5) * (1 - zoomTimer);
|
||||
}
|
||||
|
||||
double velocity = entity.getDeltaMovement().y();
|
||||
|
||||
if (-0.8 < velocity + 0.078 && velocity + 0.078 < 0.8) {
|
||||
if (velocityY < entity.getDeltaMovement().y() + 0.078) {
|
||||
velocityY = Mth.clamp((velocityY + 0.55 * Math.pow((velocity + 0.078) - velocityY , 2)), -0.8, 0.8) * (1 - 0.8 * zoomTime);
|
||||
velocityY = Mth.clamp((velocityY + 0.55 * Math.pow((velocity + 0.078) - velocityY , 2)), -0.8, 0.8) * (1 - 0.8 * zoomTimer);
|
||||
} else {
|
||||
velocityY = Mth.clamp((velocityY - 0.55 * Math.pow((velocity + 0.078) - velocityY , 2)), -0.8, 0.8) * (1 - 0.8 * zoomTime);
|
||||
velocityY = Mth.clamp((velocityY - 0.55 * Math.pow((velocity + 0.078) - velocityY , 2)), -0.8, 0.8) * (1 - 0.8 * zoomTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,16 +340,16 @@ public class ClientEventHandler {
|
|||
private static void handleWeaponZoom() {
|
||||
float times = 5 * Minecraft.getInstance().getDeltaFrameTime();
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS) {
|
||||
zoomTime = Mth.clamp(zoomTime + 0.03 * times,0,1);
|
||||
zoomTimer = Mth.clamp(zoomTimer + 0.03 * times,0,1);
|
||||
} else {
|
||||
zoomTime = Mth.clamp(zoomTime - 0.04 * times,0,1);
|
||||
zoomTimer = Mth.clamp(zoomTimer - 0.04 * times,0,1);
|
||||
}
|
||||
zoomPos = 0.5 * Math.cos(Math.PI * Math.pow(Math.pow(zoomTime, 2) - 1, 2)) + 0.5;
|
||||
zoomPosZ = -Math.pow(2 * zoomTime - 1, 2) + 1;
|
||||
zoomPos = 0.5 * Math.cos(Math.PI * Math.pow(Math.pow(zoomTimer, 2) - 1, 2)) + 0.5;
|
||||
zoomPosZ = -Math.pow(2 * zoomTimer - 1, 2) + 1;
|
||||
}
|
||||
|
||||
public static double getZoomTime() {
|
||||
return zoomTime;
|
||||
return zoomTimer;
|
||||
}
|
||||
|
||||
public static double getZoomPos() {
|
||||
|
@ -373,62 +369,60 @@ public class ClientEventHandler {
|
|||
ItemStack stack = entity.getMainHandItem();
|
||||
amplitude = 15000 * stack.getOrCreateTag().getDouble("recoil_y")
|
||||
* stack.getOrCreateTag().getDouble("recoil_x");
|
||||
var data = entity.getPersistentData();
|
||||
|
||||
var capability = entity.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null);
|
||||
if (capability.orElse(new ModVariables.PlayerVariables()).firing > 0) {
|
||||
data.putDouble("firetime", 0.001);
|
||||
data.putDouble("fire_rotx_time", 0.001);
|
||||
data.putDouble("firepos2", 0.1);
|
||||
firePosTimer = 0.001;
|
||||
fireRotTimer = 0.001;
|
||||
firePosZ = 0.1;
|
||||
}
|
||||
|
||||
data.putDouble("firepos2", Mth.clamp(data.getDouble("firepos2") - 0.01 * times, 0, 0.6));
|
||||
firePosZ = Mth.clamp(firePosZ - 0.01 * times, 0, 0.6);
|
||||
|
||||
if (0 < data.getDouble("firetime")) {
|
||||
data.putDouble("firetime", (data.getDouble("firetime") + 0.25 * (1.1 - data.getDouble("firetime")) * times));
|
||||
if (0 < firePosTimer) {
|
||||
firePosTimer += 0.25 * (1.1 - firePosTimer) * times;
|
||||
}
|
||||
if (0 < data.getDouble("firetime") && data.getDouble("firetime") < 0.454) {
|
||||
data.putDouble("fire_pos",
|
||||
((-18.34) * Math.pow(data.getDouble("firetime"), 2) + 8.58 * data.getDouble("firetime") + data.getDouble("firepos2")));
|
||||
if (0 < firePosTimer && firePosTimer < 0.454) {
|
||||
firePos = (-18.34) * Math.pow(firePosTimer, 2) + 8.58 * firePosTimer + firePosZ;
|
||||
}
|
||||
if (0.454 <= data.getDouble("firetime") && data.getDouble("firetime") < 1) {
|
||||
data.putDouble("fire_pos",
|
||||
(4.34 * Math.pow(data.getDouble("firetime"), 2) - 6.5 * data.getDouble("firetime") + 2.167 + data.getDouble("firepos2")));
|
||||
if (0.454 <= firePosTimer && firePosTimer < 1) {
|
||||
firePos = 4.34 * Math.pow(firePosTimer, 2) - 6.5 * firePosTimer + 2.167 + firePosZ;
|
||||
}
|
||||
|
||||
|
||||
if (0 < data.getDouble("fire_rotx_time") && data.getDouble("fire_rotx_time") < 1.732) {
|
||||
data.putDouble("fire_rotx_time", (data.getDouble("fire_rotx_time") + 0.18 * (1.9 - data.getDouble("fire_rotx_time")) * times));
|
||||
if (0 < fireRotTimer && fireRotTimer < 1.732) {
|
||||
fireRotTimer += 0.18 * (1.9 - fireRotTimer) * times;
|
||||
}
|
||||
|
||||
if (0 < data.getDouble("fire_rotx_time") && data.getDouble("fire_rotx_time") < 1.732) {
|
||||
data.putDouble("fire_rot",
|
||||
(1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)));
|
||||
if (0 < fireRotTimer && fireRotTimer < 1.732) {
|
||||
fireRot = 1 / 6.3 * (fireRotTimer - 0.5) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2));
|
||||
if ((capability.orElse(new ModVariables.PlayerVariables())).recoilHorizon > 0) {
|
||||
event.setYaw((float) (yaw - 1.3 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 1 * Mth.clamp(0.3 - data.getDouble("fire_rotx_time"), 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setPitch((float) (pitch + 1.3 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 1 * Mth.clamp(0.3 - data.getDouble("fire_rotx_time"), 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setRoll((float) (roll + 4.2 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 3 * Mth.clamp(0.5 - data.getDouble("fire_rotx_time"), 0, 0.5) * (2 * Math.random() - 1)));
|
||||
event.setYaw((float) (yaw - 1.3 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 1 * Mth.clamp(0.3 - fireRotTimer, 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setPitch((float) (pitch + 1.3 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 1 * Mth.clamp(0.3 - fireRotTimer, 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setRoll((float) (roll + 4.2 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 3 * Mth.clamp(0.5 - fireRotTimer, 0, 0.5) * (2 * Math.random() - 1)));
|
||||
} else if ((capability.orElse(new ModVariables.PlayerVariables())).recoilHorizon <= 0) {
|
||||
event.setYaw((float) (yaw + 1.3 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 1 * Mth.clamp(0.3 - data.getDouble("fire_rotx_time"), 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setPitch((float) (pitch - 1.3 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 1 * Mth.clamp(0.3 - data.getDouble("fire_rotx_time"), 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setRoll((float) (roll - 4.2 * amplitude * (1 / 6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * Math.sin(6.3 * (data.getDouble("fire_rotx_time") - 0.5)) * (3 - Math.pow(data.getDouble("fire_rotx_time"), 2)) + 3 * Mth.clamp(0.5 - data.getDouble("fire_rotx_time"), 0, 0.5) * (2 * Math.random() - 1)));
|
||||
event.setYaw((float) (yaw + 1.3 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 1 * Mth.clamp(0.3 - fireRotTimer, 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setPitch((float) (pitch - 1.3 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 1 * Mth.clamp(0.3 - fireRotTimer, 0, 1) * (2 * Math.random() - 1)));
|
||||
event.setRoll((float) (roll - 4.2 * amplitude * (1 / 6.3 * (fireRotTimer - 0.5)) * Math.sin(6.3 * (fireRotTimer - 0.5)) * (3 - Math.pow(fireRotTimer, 2)) + 3 * Mth.clamp(0.5 - fireRotTimer, 0, 0.5) * (2 * Math.random() - 1)));
|
||||
}
|
||||
}
|
||||
if (0 <= data.getDouble("firetime") && data.getDouble("firetime") <= 0.25) {
|
||||
data.putDouble("boltpos", (-Math.pow(8 * data.getDouble("firetime") - 1, 2) + 1));
|
||||
|
||||
if (firePosTimer >= 1) {
|
||||
firePosTimer = 0;
|
||||
}
|
||||
if (0.25 < data.getDouble("firetime") && data.getDouble("firetime") < 1) {
|
||||
data.putDouble("boltpos", 0);
|
||||
}
|
||||
if (data.getDouble("firetime") >= 1) {
|
||||
data.putDouble("firetime", 0);
|
||||
}
|
||||
if (data.getDouble("fire_rotx_time") >= 1.732) {
|
||||
data.putDouble("fire_rotx_time", 0);
|
||||
data.putDouble("fire_rot", 0);
|
||||
if (fireRotTimer >= 1.732) {
|
||||
fireRotTimer = 0;
|
||||
fireRot = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static double getFirePos() {
|
||||
return firePos;
|
||||
}
|
||||
|
||||
public static double getFireRot() {
|
||||
return fireRot;
|
||||
}
|
||||
|
||||
private static void handlePlayerBreath(LivingEntity entity) {
|
||||
float times = 4 * Minecraft.getInstance().getDeltaFrameTime();
|
||||
var data = entity.getPersistentData();
|
||||
|
@ -448,19 +442,19 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private static void handlePlayerCameraShake(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
||||
var data = entity.getPersistentData();
|
||||
public static void shake(double boneRotX, double boneRotY, double boneRotZ) {
|
||||
cameraRotX = boneRotX;
|
||||
cameraRotY = boneRotY;
|
||||
cameraRotZ = boneRotZ;
|
||||
}
|
||||
|
||||
private static void handlePlayerCameraShake(ViewportEvent.ComputeCameraAngles event) {
|
||||
double yaw = event.getYaw();
|
||||
double pitch = event.getPitch();
|
||||
double roll = event.getRoll();
|
||||
if (entity.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||
|
||||
event.setPitch((float) (pitch + data.getDouble("camera_rot_x") + 0.2 * data.getDouble("xRot") + 3 * data.getDouble("vy")));
|
||||
|
||||
event.setYaw((float) (yaw + data.getDouble("camera_rot_y") + 0.8 * data.getDouble("yRot")));
|
||||
|
||||
event.setRoll((float) (roll + data.getDouble("camera_rot_z") + 0.35 * data.getDouble("zRot")));
|
||||
}
|
||||
event.setPitch((float) (pitch + cameraRotX + 0.2 * turnRotX + 3 * velocityY));
|
||||
event.setYaw((float) (yaw + cameraRotY + 0.8 * turnRotY));
|
||||
event.setRoll((float) (roll + cameraRotZ + 0.35 * turnRotZ));
|
||||
}
|
||||
|
||||
private static void handleBowPullAnimation(LivingEntity entity) {
|
||||
|
|
Loading…
Add table
Reference in a new issue