重制M98B动画,优化nbt

This commit is contained in:
Atsuihsio 2024-06-06 17:16:03 +08:00
parent 2f0e39e54c
commit 657accc719
25 changed files with 2775 additions and 2162 deletions

View file

@ -117,6 +117,8 @@ public class M60ItemModel extends GeoModel<M60Item> {
} }
} }
tiba.setRotZ((float) (-0.25f * fp + 0.4 * fr));
CoreGeoBone flare = getAnimationProcessor().getBone("flare"); CoreGeoBone flare = getAnimationProcessor().getBone("flare");
if (stack.getOrCreateTag().getDouble("flash_time") > 0) { if (stack.getOrCreateTag().getDouble("flash_time") > 0) {

View file

@ -69,16 +69,16 @@ public class M98bItemModel extends GeoModel<M98bItem> {
gun.setPosX(2.245f * (float) p); gun.setPosX(2.245f * (float) p);
gun.setPosY(0.5225f * (float) p - (float) (0.4f * zp)); gun.setPosY(0.3f * (float) p - (float) (0.2f * zp));
gun.setPosZ(6.2f * (float) p + (float) (0.3f * zp)); gun.setPosZ(4.2f * (float) p + (float) (0.3f * zp));
gun.setRotZ((float) (0.02f * zp)); gun.setRotZ((float) (0.02f * zp));
CoreGeoBone holo = getAnimationProcessor().getBone("scope2"); CoreGeoBone holo = getAnimationProcessor().getBone("scope2");
CoreGeoBone flare = getAnimationProcessor().getBone("flare"); CoreGeoBone flare = getAnimationProcessor().getBone("flare");
CoreGeoBone qiang = getAnimationProcessor().getBone("qiang"); CoreGeoBone qiang = getAnimationProcessor().getBone("qiang");
if (gun.getPosX() > 2) { if (gun.getPosX() > 1.9) {
holo.setScaleX(1); holo.setScaleX(1);
holo.setScaleY(1); holo.setScaleY(1);
qiang.setScaleX(0); qiang.setScaleX(0);
@ -148,5 +148,13 @@ public class M98bItemModel extends GeoModel<M98bItem> {
move.setRotY(Mth.DEG_TO_RAD * (float) yRot); move.setRotY(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

@ -104,7 +104,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt"); CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
if (stack.getOrCreateTag().getDouble("gj") == 1) { if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
bolt.setPosZ(6); bolt.setPosZ(6);
} }

View file

@ -38,7 +38,7 @@ public class SksItemModel extends GeoModel<SksItem> {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
if (stack.getOrCreateTag().getDouble("gj") == 1) { if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
bolt.setPosZ(3f); bolt.setPosZ(3f);
} }

View file

@ -42,7 +42,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
if (stack.getOrCreateTag().getDouble("gj") == 1) { if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
bolt.setPosZ(3.25f); bolt.setPosZ(3.25f);
} }

View file

@ -252,9 +252,11 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
this.setPosRaw(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z); this.setPosRaw(this.getX() + vec.x, this.getY() + vec.y, this.getZ() + vec.z);
} }
Vec3 movement = this.getDeltaMovement(); double x = vec.x;
double y = vec.y;
double z = vec.z;
this.setDeltaMovement(movement.x, movement.y - 0.05, movement.z); this.setDeltaMovement(x - 0.02 * x, y - 0.05, z - 0.02 * z);
this.tickCount++; this.tickCount++;
if (this.tickCount > 30) { if (this.tickCount > 30) {

View file

@ -81,9 +81,11 @@ public class GunEventHandler {
} else { } else {
stack.getOrCreateTag().putDouble("animindex", 1); stack.getOrCreateTag().putDouble("animindex", 1);
} }
/*
空仓挂机
*/
if (stack.getOrCreateTag().getInt("ammo") == 1) { if (stack.getOrCreateTag().getInt("ammo") == 1) {
stack.getOrCreateTag().putDouble("gj", 1); stack.getOrCreateTag().putDouble("HoldOpen", 1);
} }
/* /*
@ -134,10 +136,10 @@ public class GunEventHandler {
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) {
zoom_add_cooldown = 5; zoom_add_cooldown = 5;
stack.getOrCreateTag().putDouble("marlin_animation_time", 15); stack.getOrCreateTag().putDouble("marlin_animation_time", 15);
stack.getOrCreateTag().putDouble("fastfiring", 0); stack.getOrCreateTag().putBoolean("fastfiring", false);
} else { } else {
stack.getOrCreateTag().putDouble("marlin_animation_time", 10); stack.getOrCreateTag().putDouble("marlin_animation_time", 10);
stack.getOrCreateTag().putDouble("fastfiring", 1); stack.getOrCreateTag().putBoolean("fastfiring", true);
} }
} }
@ -153,14 +155,14 @@ public class GunEventHandler {
在开火动画的最后1tick设置需要拉栓上膛的武器拉栓动画的倒计时为data里的拉栓时间 在开火动画的最后1tick设置需要拉栓上膛的武器拉栓动画的倒计时为data里的拉栓时间
*/ */
if (stack.getOrCreateTag().getInt("fire_animation") == 1 && stack.getOrCreateTag().getBoolean("need_bolt_action")) { if (stack.getOrCreateTag().getInt("fire_animation") == 1 && stack.getOrCreateTag().getBoolean("need_bolt_action")) {
stack.getOrCreateTag().putDouble("bolt_action_anim", stack.getOrCreateTag().getDouble("bolt_action_time")); stack.getOrCreateTag().putInt("bolt_action_anim", stack.getOrCreateTag().getInt("bolt_action_time"));
player.getCooldowns().addCooldown(stack.getItem(), (int) stack.getOrCreateTag().getDouble("bolt_action_time")); player.getCooldowns().addCooldown(stack.getItem(), stack.getOrCreateTag().getInt("bolt_action_time"));
playGunBoltSounds(player); playGunBoltSounds(player);
} }
if (stack.getOrCreateTag().getDouble("bolt_action_anim") > 0) { if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
stack.getOrCreateTag().putDouble("bolt_action_anim", stack.getOrCreateTag().getDouble("bolt_action_anim") - 1); stack.getOrCreateTag().putInt("bolt_action_anim", stack.getOrCreateTag().getInt("bolt_action_anim") - 1);
} }
if (stack.getOrCreateTag().getDouble("bolt_action_anim") == 1) { if (stack.getOrCreateTag().getInt("bolt_action_anim") == 1) {
stack.getOrCreateTag().putBoolean("need_bolt_action", false); stack.getOrCreateTag().putBoolean("need_bolt_action", false);
} }
} }

View file

@ -189,8 +189,8 @@ public class LivingEventHandler {
player.getPersistentData().putDouble("zoom_pos", 0); player.getPersistentData().putDouble("zoom_pos", 0);
player.getPersistentData().putDouble("zoom_animation_time", 0); player.getPersistentData().putDouble("zoom_animation_time", 0);
if (newStack.getOrCreateTag().getDouble("bolt_action_time") > 0) { if (newStack.getOrCreateTag().getInt("bolt_action_time") > 0) {
newStack.getOrCreateTag().putDouble("bolt_action_anim", 0); newStack.getOrCreateTag().putInt("bolt_action_anim", 0);
} }
} }
} }

View file

@ -71,7 +71,7 @@ public abstract class GunItem extends Item {
tag.putDouble("empty", 1); tag.putDouble("empty", 1);
} }
if (itemstack.getItem() == TargetModItems.SKS.get() && tag.getInt("ammo") == 0) { if (itemstack.getItem() == TargetModItems.SKS.get() && tag.getInt("ammo") == 0) {
tag.putDouble("gj", 1); tag.putDouble("HoldOpen", 1);
} }
if (itemstack.getItem() == TargetModItems.M_60.get() && tag.getInt("ammo") <= 5) { if (itemstack.getItem() == TargetModItems.M_60.get() && tag.getInt("ammo") <= 5) {
tag.putDouble("empty", 1); tag.putDouble("empty", 1);

View file

@ -93,7 +93,7 @@ public class Kraber extends GunItem implements GeoItem, AnimatedItem {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.kraber.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.kraber.draw"));
} }
if (stack.getOrCreateTag().getDouble("bolt_action_anim") > 0) { if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.shift")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.shift"));
} }

View file

@ -82,7 +82,7 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.m98b.draw"));
} }
if (stack.getOrCreateTag().getDouble("bolt_action_anim") > 0) { if (stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.shift"));
} }
@ -91,11 +91,11 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
} }
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.m98b.reload")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.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.m98b.reload2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.reload_normal"));
} }
if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) { if (player.isSprinting() && player.onGround() && player.getPersistentData().getDouble("noRun") == 0) {
@ -175,7 +175,7 @@ public class M98bItem 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") == 79) { if (tag.getDouble("reload_time") == 83) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_EMPTY.get(), 100, 1); SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_EMPTY.get(), 100, 1);
@ -195,7 +195,7 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
GunsTool.reload(entity, GunInfo.Type.SNIPER); GunsTool.reload(entity, GunInfo.Type.SNIPER);
} }
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) { } else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
if (tag.getDouble("reload_time") == 57) { if (tag.getDouble("reload_time") == 61) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (entity instanceof ServerPlayer serverPlayer) { if (entity instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_NORMAL.get(), 100, 1); SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_NORMAL.get(), 100, 1);

View file

@ -95,11 +95,11 @@ public class MarlinItem extends GunItem implements GeoItem, AnimatedItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.fire2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.fire2"));
} }
if (stack.getOrCreateTag().getDouble("marlin_animation_time") > 0 && stack.getOrCreateTag().getDouble("fastfiring") == 0) { if (stack.getOrCreateTag().getDouble("marlin_animation_time") > 0 && !stack.getOrCreateTag().getBoolean("fastfiring")) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift"));
} }
if (stack.getOrCreateTag().getDouble("marlin_animation_time") > 0 && stack.getOrCreateTag().getDouble("fastfiring") == 1) { if (stack.getOrCreateTag().getDouble("marlin_animation_time") > 0 && stack.getOrCreateTag().getBoolean("fastfiring")) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.marlin.shift2"));
} }

View file

@ -173,7 +173,7 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
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") == 5 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
tag.putDouble("gj", 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);

View file

@ -101,11 +101,11 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.draw")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.sentinel.draw"));
} }
if (stack.getOrCreateTag().getBoolean("zoom_fire") && stack.getOrCreateTag().getDouble("bolt_action_anim") > 0) { if (stack.getOrCreateTag().getBoolean("zoom_fire") && stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift2"));
} }
if (!stack.getOrCreateTag().getBoolean("zoom_fire") && stack.getOrCreateTag().getDouble("bolt_action_anim") > 0) { if (!stack.getOrCreateTag().getBoolean("zoom_fire") && stack.getOrCreateTag().getInt("bolt_action_anim") > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.shift"));
} }

View file

@ -192,7 +192,7 @@ public class SksItem extends GunItem implements GeoItem, AnimatedItem {
tag.putBoolean("empty_reload", false); tag.putBoolean("empty_reload", false);
} }
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) { if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
tag.putDouble("gj", 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);

View file

@ -166,7 +166,7 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
tag.putBoolean("empty_reload", false); tag.putBoolean("empty_reload", false);
} }
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) { if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
tag.putDouble("gj", 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.SNIPER); GunsTool.reload(entity, GunInfo.Type.SNIPER);

View file

@ -93,12 +93,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", 57); tag.putDouble("reload_time", 61);
} 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", 79); tag.putDouble("reload_time", 83);
} }
} }
if (player.getMainHandItem().getItem() == TargetModItems.KRABER.get() if (player.getMainHandItem().getItem() == TargetModItems.KRABER.get()

View file

@ -58,9 +58,9 @@ public class PressFireProcedure {
} }
// 栓动武器左键手动拉栓 // 栓动武器左键手动拉栓
if (mainHandItem.is(TargetModTags.Items.GUN) && tag.getDouble("bolt_action_time") > 0 && tag.getInt("ammo") > 0 && tag.getDouble("bolt_action_anim") == 0) { if (mainHandItem.is(TargetModTags.Items.GUN) && tag.getInt("bolt_action_time") > 0 && tag.getInt("ammo") > 0 && tag.getInt("bolt_action_anim") == 0) {
if (!player.getCooldowns().isOnCooldown(mainHandItem.getItem()) && mainHandItem.getOrCreateTag().getDouble("need_bolt_action") == 1) { if (!player.getCooldowns().isOnCooldown(mainHandItem.getItem()) && mainHandItem.getOrCreateTag().getDouble("need_bolt_action") == 1) {
mainHandItem.getOrCreateTag().putDouble("bolt_action_anim", mainHandItem.getOrCreateTag().getDouble("bolt_action_time")); mainHandItem.getOrCreateTag().putInt("bolt_action_anim", mainHandItem.getOrCreateTag().getInt("bolt_action_time"));
GunEventHandler.playGunBoltSounds(player); GunEventHandler.playGunBoltSounds(player);
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@
128, 128,
128 128
], ],
"gui_light": "front",
"display": { "display": {
"thirdperson_righthand": { "thirdperson_righthand": {
"translation": [ "translation": [
@ -32,9 +33,9 @@
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ "translation": [
0, 0.25,
-11.75, -10.75,
-19.75 -17.25
], ],
"scale": [ "scale": [
4, 4,
@ -68,19 +69,19 @@
}, },
"gui": { "gui": {
"rotation": [ "rotation": [
30, 165.69,
-145, -39.63,
0 178.66
], ],
"translation": [ "translation": [
0.25, -3.4,
-1, -1,
0 0
], ],
"scale": [ "scale": [
0.6, 0.5,
0.6, 0.5,
0.6 0.5
] ]
}, },
"head": { "head": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 38 KiB