去营业妨碍化MK14EBR,重置mk14ebr动画

This commit is contained in:
Atsuihsio 2024-06-17 17:52:42 +08:00
parent 333b7440d3
commit 58a12c2cf9
12 changed files with 18132 additions and 10313 deletions

View file

@ -29,14 +29,16 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
@Override @Override
public void setCustomAnimations(Mk14Item animatable, long instanceId, AnimationState animationState) { public void setCustomAnimations(Mk14Item animatable, long instanceId, AnimationState animationState) {
CoreGeoBone gun = getAnimationProcessor().getBone("0"); CoreGeoBone gun = getAnimationProcessor().getBone("bones");
CoreGeoBone scope = getAnimationProcessor().getBone("elcan"); CoreGeoBone scope = getAnimationProcessor().getBone("scope");
CoreGeoBone flare = getAnimationProcessor().getBone("flare"); CoreGeoBone flare = getAnimationProcessor().getBone("flare");
CoreGeoBone rex = getAnimationProcessor().getBone("rex"); CoreGeoBone rex = getAnimationProcessor().getBone("rex");
CoreGeoBone l = getAnimationProcessor().getBone("l"); CoreGeoBone l = getAnimationProcessor().getBone("l");
CoreGeoBone r = getAnimationProcessor().getBone("r"); CoreGeoBone r = getAnimationProcessor().getBone("r");
CoreGeoBone body = getAnimationProcessor().getBone("mk14_default"); CoreGeoBone yugu = getAnimationProcessor().getBone("yugu");
CoreGeoBone shuan = getAnimationProcessor().getBone("shuan"); CoreGeoBone jing = getAnimationProcessor().getBone("jing");
CoreGeoBone qiangguan = getAnimationProcessor().getBone("qiangguan");
CoreGeoBone action = getAnimationProcessor().getBone("action");
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
@ -52,17 +54,19 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
double zp = 0; double zp = 0;
zp = player.getPersistentData().getDouble("zoom_pos_z"); zp = player.getPersistentData().getDouble("zoom_pos_z");
gun.setPosX(6.372f * (float) p); gun.setPosX(3.105f * (float) p);
gun.setPosY(0.59f * (float) p - (float) (0.2f * zp)); gun.setPosY(0.53f * (float) p - (float) (0.2f * zp));
gun.setPosZ(6.2f * (float) p + (float) (0.5f * zp)); gun.setPosZ(3.7f * (float) p + (float) (0.2f * zp));
gun.setRotZ((float) (0.05f * zp)); gun.setRotZ((float) (0.05f * zp));
gun.setScaleZ(1f - (0.8f * (float) p)); gun.setScaleZ(1f - (0.7f * (float) p));
scope.setScaleZ(1f - (0.99f * (float) p)); scope.setScaleZ(1f - (0.85f * (float) p));
yugu.setScaleZ(1f - (0.7f * (float) p));
CoreGeoBone shen = getAnimationProcessor().getBone("shen"); CoreGeoBone shen = getAnimationProcessor().getBone("shen");
@ -70,33 +74,39 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
double fr = player.getPersistentData().getDouble("fire_rot"); double fr = player.getPersistentData().getDouble("fire_rot");
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
shen.setPosY(0.02f * (float) (fp + 2 * fr)); shen.setPosY(0.06f * (float) (fp + 2 * fr));
shen.setPosZ(2.8f * (float) (fp + 0.54f * fr)); shen.setPosZ(0.9f * (float) (fp + 0.54f * fr));
shen.setRotX(0.003f * (float) (fp + fr)); shen.setRotX(0.005f * (float) (fp + fr));
shen.setRotZ(0f); shen.setRotZ(0.01f * (float)((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon * fp) * (float) fp);
} else { } else {
shen.setPosY(0.04f * (float) (fp + 2 * fr)); shen.setPosY(0.04f * (float) (fp + 2 * fr));
shen.setPosZ(3.5f * (float) (fp + 0.54f * fr)); shen.setPosZ(1.2f * (float) (fp + 0.54f * fr));
shen.setRotX(0.07f * (float) (0.18f * fp + fr)); shen.setRotX(0.07f * (float) (0.18f * fp + fr));
shen.setRotZ(-0.04f * (float) (fp + 1.3 * fr)); shen.setRotZ(-0.04f * (float) (fp + 1.3 * fr));
} }
rex.setRotZ(0.01f * (float)((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon * fp) * (float) fp);
rex.setPosY(-0.23f * (float) (fp + 2.3 * fr));
shen.setPosX(0.5f * (float)fr * (float)((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon * fp)); shen.setPosX(0.5f * (float)fr * (float)((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).recoilHorizon * fp));
if (gun.getPosX() > 5.5f) { action.setPosZ(2.5f * (float) fp);
rex.setScaleX(2.2f); if (gun.getPosX() > 2.5f) {
rex.setScaleY(2.2f); rex.setHidden(false);
body.setScaleZ(0.4f); jing.setHidden(true);
qiangguan.setHidden(true);
} else { } else {
rex.setScaleX(0); rex.setHidden(true);
rex.setScaleY(0); jing.setHidden(false);
body.setScaleZ(1); qiangguan.setHidden(false);
} }
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt"); CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) { if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
bolt.setPosZ(6); bolt.setPosZ(2.5f);
} }
if (stack.getOrCreateTag().getDouble("flash_time") > 0) { if (stack.getOrCreateTag().getDouble("flash_time") > 0) {
@ -121,7 +131,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
root.setPosX(PosX); root.setPosX(PosX);
root.setPosY((float) y + 2.5f * PosY); root.setPosY((float) y + 1.2f * PosY);
root.setRotX((float) x); root.setRotX((float) x);
@ -147,10 +157,18 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
double zRot = player.getPersistentData().getDouble("zRot"); double zRot = player.getPersistentData().getDouble("zRot");
move.setRotX(1.6f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy); move.setRotX(0.9f * Mth.DEG_TO_RAD * (float) xRot - 0.15f * (float) vy);
move.setRotY(1.6f * Mth.DEG_TO_RAD * (float) yRot); move.setRotY(0.9f * Mth.DEG_TO_RAD * (float) yRot);
move.setRotZ(2.7f * (float) m + Mth.DEG_TO_RAD * (float) zRot); move.setRotZ(2.7f * (float) m + Mth.DEG_TO_RAD * (float) zRot);
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());
} }
} }

View file

@ -79,34 +79,34 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
if (this.animationProcedure.equals("empty")) { if (this.animationProcedure.equals("empty")) {
if (stack.getOrCreateTag().getInt("draw_time") < 16) { if (stack.getOrCreateTag().getInt("draw_time") < 16) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.model.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m14.draw"));
} }
if (stack.getOrCreateTag().getInt("fire_animation") > 0) { if (stack.getOrCreateTag().getInt("fire_animation") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.fire")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.fire"));
} }
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) { if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.reloadempty")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_empty"));
} }
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) { if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.reload")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_normal"));
} }
if (stack.getOrCreateTag().getInt("fire_mode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) { if (stack.getOrCreateTag().getInt("fire_mode") == 0 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.changefirerate2"));
} }
if (stack.getOrCreateTag().getInt("fire_mode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) { if (stack.getOrCreateTag().getInt("fire_mode") == 2 && stack.getOrCreateTag().getDouble("cg") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.model.changefirerate")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14changefirerate"));
} }
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) { if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.model.run")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m14.run"));
} }
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.model.idle")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m14.idle"));
} }
return PlayState.STOP; return PlayState.STOP;
} }
@ -156,7 +156,7 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
tag.putDouble("reload_time", 0); tag.putDouble("reload_time", 0);
} }
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) { if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
if (tag.getDouble("reload_time") == 55) { if (tag.getDouble("reload_time") == 78) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_EMPTY.get(), 100, 1); SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_EMPTY.get(), 100, 1);
@ -172,14 +172,14 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
tag.putBoolean("empty_reload", false); tag.putBoolean("empty_reload", false);
tag.putDouble("reload_time", 0); tag.putDouble("reload_time", 0);
} }
if (tag.getDouble("reload_time") == 5 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) { if (tag.getDouble("reload_time") == 18 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
tag.putDouble("HoldOpen", 0); tag.putDouble("HoldOpen", 0);
} }
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) { if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
GunsTool.reload(entity, GunInfo.Type.RIFLE); GunsTool.reload(entity, GunInfo.Type.RIFLE);
} }
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) { } else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
if (tag.getDouble("reload_time") == 45) { if (tag.getDouble("reload_time") == 55) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_NORMAL.get(), 100, 1); SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_NORMAL.get(), 100, 1);

View file

@ -144,12 +144,12 @@ public class PlayerReloadProcedure {
tag.putBoolean("reloading", true); tag.putBoolean("reloading", true);
tag.putBoolean("empty_reload", false); tag.putBoolean("empty_reload", false);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810))); tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("reload_time", 45); tag.putDouble("reload_time", 55);
} else if (tag.getInt("ammo") == 0) { } else if (tag.getInt("ammo") == 0) {
tag.putBoolean("reloading", true); tag.putBoolean("reloading", true);
tag.putDouble("empty_reload", 1); tag.putDouble("empty_reload", 1);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810))); tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("reload_time", 55); tag.putDouble("reload_time", 78);
} }
} }
if (player.getMainHandItem().getItem() == TargetModItems.SKS.get() if (player.getMainHandItem().getItem() == TargetModItems.SKS.get()

File diff suppressed because it is too large Load diff

View file

@ -2,8 +2,8 @@
"credit": "Made with Blockbench", "credit": "Made with Blockbench",
"parent": "builtin/entity", "parent": "builtin/entity",
"texture_size": [ "texture_size": [
220, 128,
220 128
], ],
"display": { "display": {
"thirdperson_righthand": { "thirdperson_righthand": {
@ -32,14 +32,14 @@
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ "translation": [
10, -2.75,
-35, -3.75,
-18 1.5
], ],
"scale": [ "scale": [
3, 2,
3, 2,
3 2
] ]
}, },
"firstperson_lefthand": { "firstperson_lefthand": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB