优化抛壳代码

This commit is contained in:
17146 2024-10-20 00:41:28 +08:00
parent b1acd37a59
commit e5724fa0a3
20 changed files with 69 additions and 146 deletions

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.AK12Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -110,12 +111,6 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.35f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.35f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.AK47Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -110,12 +111,6 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.35f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.35f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.shotgun.Aa12Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -103,12 +104,6 @@ public class Aa12ItemModel extends GeoModel<Aa12Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.55f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.machinegun.DevotionItem;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -119,12 +120,6 @@ public class DevotionItemModel extends GeoModel<DevotionItem> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.55f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.handgun.Glock17Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -117,15 +118,9 @@ public class Glock17ItemModel extends GeoModel<Glock17Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 0.7f, 1f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(0.7f, 1f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
slide.setPosZ(1.5f);
bullet.setScaleX(0);

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.handgun.Glock18Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -125,15 +126,9 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 0.7f, 1f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(0.7f, 1f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
slide.setPosZ(1.5f);
bullet.setScaleX(0);

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.Hk416Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -83,7 +84,7 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
shen.setPosX(0.2f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -106,14 +107,8 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.55f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.handgun.M1911Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -115,14 +116,8 @@ public class M1911ItemModel extends GeoModel<M1911Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 0.7f, 1f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(0.7f, 1f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
slide.setPosZ(1.5f);

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.M4Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -108,12 +109,6 @@ public class M4ItemModel extends GeoModel<M4Item> {
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.55f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.machinegun.M60Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -126,7 +127,7 @@ public class M60ItemModel extends GeoModel<M60Item> {
tiba.setRotZ((float) (-0.25f * fp + 0.4 * fr));
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -138,14 +139,8 @@ public class M60ItemModel extends GeoModel<M60Item> {
float numR = (float) (1 - 0.88 * zt);
float numP = (float) (1 - 0.28 * zt);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.45f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.45f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getInt("gun_reloading_time") > 0) {
main.setRotX(numR * main.getRotX());
@ -165,6 +160,6 @@ public class M60ItemModel extends GeoModel<M60Item> {
shell.setScaleY(1);
shell.setScaleZ(1);
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.Mk14Item;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -69,17 +70,12 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
double fr = ClientEventHandler.fireRot;
gun.setPosX(3.105f * (float) zp);
gun.setPosY(0.53f * (float) zp - (float) (0.2f * zpz));
gun.setPosZ(3.7f * (float) zp + (float) (0.2f * zpz));
gun.setRotZ((float) (0.05f * zpz));
gun.setScaleZ(1f - (0.7f * (float) zp));
scope.setScaleZ(1f - (0.7f * (float) zp));
yugu.setScaleZ(1f - (0.7f * (float) zp));
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
@ -98,7 +94,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt)));
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
rex.setRotZ(0.01f * (float)(ClientEventHandler.recoilHorizon * fp));
rex.setRotZ(0.01f * (float) (ClientEventHandler.recoilHorizon * fp));
rex.setPosY(-0.23f * (float) (fp + 2.3 * fr));
action.setPosZ(2.5f * (float) fp);
@ -108,7 +104,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -131,16 +127,10 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 0.9f, 0.95f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(0.9f, 0.95f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
bolt.setPosZ(2.5f);

View file

@ -102,7 +102,7 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -132,6 +132,6 @@ public class MosinNagantItemModel extends GeoModel<MosinNagantItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
}
}

View file

@ -90,7 +90,7 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 4.3));
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -113,6 +113,6 @@ public class Ntw20Model extends GeoModel<Ntw20Item> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
}
}

View file

@ -86,7 +86,7 @@ public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
}
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -109,6 +109,6 @@ public class Qbz95ItemModel extends GeoModel<Qbz95Item> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.machinegun.RpkItem;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -61,24 +62,15 @@ public class RpkItemModel extends GeoModel<RpkItem> {
double fr = ClientEventHandler.fireRot;
gun.setPosX(1.69f * (float) zp);
gun.setPosY(-0.33f * (float) zp - (float) (0.1f * zpz));
gun.setPosZ(3.2f * (float) zp + (float) (0.2f * zpz));
gun.setRotZ((float) (0.05f * zpz));
gun.setScaleZ(1f - (0.55f * (float) zp));
scope.setScaleZ(1f - (0.9f * (float) zp));
button.setScaleX(1f - (0.2f * (float) zp));
button.setScaleY(1f - (0.3f * (float) zp));
button.setScaleZ(1f - (0.3f * (float) zp));
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.65));
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
@ -98,7 +90,7 @@ public class RpkItemModel extends GeoModel<RpkItem> {
shuan.setPosZ(2.4f * (float) fp);
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -121,14 +113,8 @@ public class RpkItemModel extends GeoModel<RpkItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.55f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.55f);
}
}

View file

@ -101,7 +101,7 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
charge.setRotZ(charge.getRotZ() + times * 0.05f);
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -128,6 +128,6 @@ public class SentinelItemModel extends GeoModel<SentinelItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.rifle.SksItem;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -29,7 +30,6 @@ public class SksItemModel extends GeoModel<SksItem> {
return new ResourceLocation(ModUtils.MODID, "textures/item/sks.png");
}
@Override
public void setCustomAnimations(SksItem animatable, long instanceId, AnimationState animationState) {
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
@ -87,7 +87,7 @@ public class SksItemModel extends GeoModel<SksItem> {
shuan.setPosZ(2f * (float) fp);
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -110,16 +110,10 @@ public class SksItemModel extends GeoModel<SksItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 0.7f, 1.2f);
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(0.7f, 1.2f, shell1, shell2, shell3, shell4, shell5);
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
shell.setScaleX(0);

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.sniper.SvdItem;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -111,7 +112,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
holo.setScaleY(0.75f);
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -137,14 +138,8 @@ public class SvdItemModel extends GeoModel<SvdItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1f, 0.65f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1f, 0.65f);
}
}

View file

@ -4,6 +4,7 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.mcreator.superbwarfare.init.ModTags;
import net.mcreator.superbwarfare.item.gun.smg.VectorItem;
import net.mcreator.superbwarfare.tools.AnimUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
@ -95,7 +96,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
CoreGeoBone root = getAnimationProcessor().getBone("root");
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosX((float) (movePosX + 20 * ClientEventHandler.drawTime + 9.3f * mph));
root.setPosY((float) (swayY + movePosY - 40 * ClientEventHandler.drawTime - 2f * vY));
root.setRotX((float) (swayX - Mth.DEG_TO_RAD * 60 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotX - 0.15f * vY));
root.setRotY((float) (0.2f * movePosX + Mth.DEG_TO_RAD * 300 * ClientEventHandler.drawTime + Mth.DEG_TO_RAD * turnRotY));
@ -118,16 +119,10 @@ public class VectorItemModel extends GeoModel<VectorItem> {
camera.setRotY(numR * camera.getRotY());
camera.setRotZ(numR * camera.getRotZ());
}
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(),Mth.RAD_TO_DEG * camera.getRotY(), 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());
CoreGeoBone shell1 = getAnimationProcessor().getBone("shell1");
CoreGeoBone shell2 = getAnimationProcessor().getBone("shell2");
CoreGeoBone shell3 = getAnimationProcessor().getBone("shell3");
CoreGeoBone shell4 = getAnimationProcessor().getBone("shell4");
CoreGeoBone shell5 = getAnimationProcessor().getBone("shell5");
ClientEventHandler.handleShells(1.2f, 0.45f, shell1, shell2, shell3, shell4, shell5);
AnimUtils.handleShellsAnimation(getAnimationProcessor(), 1.2f, 0.45f);
}
}

View file

@ -2,8 +2,11 @@ package net.mcreator.superbwarfare.tools;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.mcreator.superbwarfare.event.ClientEventHandler;
import net.minecraft.client.model.geom.ModelPart;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationProcessor;
public class AnimUtils {
public static void renderPartOverBone(ModelPart model, GeoBone bone, PoseStack stack, VertexConsumer buffer, int packedLightIn, int packedOverlayIn, float alpha) {
@ -21,4 +24,14 @@ public class AnimUtils {
model.yRot = 0.0f;
model.zRot = 0.0f;
}
public static void handleShellsAnimation(AnimationProcessor<?> animationProcessor, float x, float y) {
CoreGeoBone shell1 = animationProcessor.getBone("shell1");
CoreGeoBone shell2 = animationProcessor.getBone("shell2");
CoreGeoBone shell3 = animationProcessor.getBone("shell3");
CoreGeoBone shell4 = animationProcessor.getBone("shell4");
CoreGeoBone shell5 = animationProcessor.getBone("shell5");
ClientEventHandler.handleShells(x, y, shell1, shell2, shell3, shell4, shell5);
}
}