RPK更换弹鼓,调整音效,重制动画,优化武器切换动画流程

This commit is contained in:
Atsuihsio 2024-05-15 17:19:38 +08:00
parent e759939003
commit c23a46ee00
20 changed files with 6340 additions and 6529 deletions

View file

@ -45,11 +45,11 @@ public class RpkItemModel extends GeoModel<RpkItem> {
double zp = 0; double zp = 0;
zp = player.getPersistentData().getDouble("zoomposz"); zp = player.getPersistentData().getDouble("zoomposz");
gun.setPosX(2.13f * (float) p); gun.setPosX(1.69f * (float) p);
gun.setPosY(0.545f * (float) p - (float) (0.6f * zp)); gun.setPosY(-0.33f * (float) p - (float) (0.6f * zp));
gun.setPosZ(5.0f * (float) p + (float) (0.5f * zp)); gun.setPosZ(3.2f * (float) p + (float) (0.5f * zp));
gun.setRotZ((float) (0.05f * zp)); gun.setRotZ((float) (0.05f * zp));
@ -63,12 +63,11 @@ public class RpkItemModel extends GeoModel<RpkItem> {
button.setScaleZ(1f - (0.3f * (float) p)); button.setScaleZ(1f - (0.3f * (float) p));
gun.setRotZ(-0.087f * (float) p + (float) (0.05f * zp));
CoreGeoBone holo = getAnimationProcessor().getBone("holo"); CoreGeoBone holo = getAnimationProcessor().getBone("holo");
if (gun.getPosX() > 1.8) { if (gun.getPosX() > 1.65f) {
holo.setScaleX(1); holo.setScaleX(0.9f);
holo.setScaleY(1); holo.setScaleY(0.9f);
hide.setScaleX(0); hide.setScaleX(0);
hide.setScaleY(0); hide.setScaleY(0);
hide.setScaleZ(0); hide.setScaleZ(0);

View file

@ -141,7 +141,7 @@ public class LivingEntityEventHandler {
if (newStack.getItem() != oldStack.getItem()) { if (newStack.getItem() != oldStack.getItem()) {
stopGunReloadSound(serverLevel, oldGun); stopGunReloadSound(serverLevel, oldGun);
newStack.getOrCreateTag().putDouble("drawtime", 0); newStack.getOrCreateTag().putDouble("draw", 1);
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.zoom = false; capability.zoom = false;
capability.syncPlayerVariables(player); capability.syncPlayerVariables(player);
@ -157,7 +157,7 @@ public class LivingEntityEventHandler {
!newStack.getOrCreateTag().getUUID("gun_uuid").equals(oldStack.getOrCreateTag().getUUID("gun_uuid"))) { !newStack.getOrCreateTag().getUUID("gun_uuid").equals(oldStack.getOrCreateTag().getUUID("gun_uuid"))) {
stopGunReloadSound(serverLevel, oldGun); stopGunReloadSound(serverLevel, oldGun);
newStack.getOrCreateTag().putDouble("drawtime", 0); newStack.getOrCreateTag().putDouble("draw", 1);
player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.zoom = false; capability.zoom = false;
capability.syncPlayerVariables(player); capability.syncPlayerVariables(player);

View file

@ -242,17 +242,17 @@ public class PlayerReloadProcedure {
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem())) && !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
&& tag.getDouble("reloading") == 0 && tag.getDouble("reloading") == 0
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0 && (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
&& tag.getDouble("ammo") < 51) { && tag.getDouble("ammo") < 76) {
if (tag.getDouble("ammo") > 0) { if (tag.getDouble("ammo") > 0) {
tag.putDouble("reloading", 1); tag.putDouble("reloading", 1);
tag.putDouble("emptyreload", 0); tag.putDouble("emptyreload", 0);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810))); tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("reloadtime", 41); tag.putDouble("reloadtime", 66);
} else if (tag.getDouble("ammo") == 0) { } else if (tag.getDouble("ammo") == 0) {
tag.putDouble("reloading", 1); tag.putDouble("reloading", 1);
tag.putDouble("emptyreload", 1); tag.putDouble("emptyreload", 1);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810))); tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("reloadtime", 57); tag.putDouble("reloadtime", 83);
} }
} }
if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get() if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get()

View file

@ -19,7 +19,7 @@ public class RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
itemstack.getOrCreateTag().putDouble("reloadtime", 0); itemstack.getOrCreateTag().putDouble("reloadtime", 0);
} }
if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) { if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") == 0) {
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 57) { if (itemstack.getOrCreateTag().getDouble("reloadtime") == 83) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (!entity.level().isClientSide() && entity.getServer() != null) { if (!entity.level().isClientSide() && entity.getServer() != null) {
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4, entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,
@ -40,7 +40,7 @@ public class RpkWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
GunReload.reload(entity, GunInfo.Type.RIFLE); GunReload.reload(entity, GunInfo.Type.RIFLE);
} }
} else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) { } else if (itemstack.getOrCreateTag().getDouble("reloading") == 1 && itemstack.getOrCreateTag().getDouble("ammo") > 0) {
if (itemstack.getOrCreateTag().getDouble("reloadtime") == 41) { if (itemstack.getOrCreateTag().getDouble("reloadtime") == 66) {
entity.getPersistentData().putDouble("id", id); entity.getPersistentData().putDouble("id", id);
if (!entity.level().isClientSide() && entity.getServer() != null) { if (!entity.level().isClientSide() && entity.getServer() != null) {
entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4, entity.getServer().getCommands().performPrefixedCommand(new CommandSourceStack(CommandSource.NULL, entity.position(), entity.getRotationVector(), entity.level() instanceof ServerLevel ? (ServerLevel) entity.level() : null, 4,

View file

@ -1,33 +1,37 @@
package net.mcreator.target.procedures; package net.mcreator.target.procedures;
import net.mcreator.target.init.TargetModItems;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class WeaponDrawLightProcedure { public class WeaponDrawLightProcedure {
public static void execute(Entity entity, ItemStack itemstack) { public static void execute(Entity entity, ItemStack itemStack) {
if (entity == null) if (entity == null) return;
return; CompoundTag tag = itemStack.getOrCreateTag();
if (itemstack.getOrCreateTag().getDouble("drawtime") == 1) { Item mainHandItem = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem();
{ if (tag.getDouble("draw") == 1) {
boolean _setval = false; tag.putDouble("draw", 0);
tag.putDouble("drawtime", 0);
if (entity instanceof Player _player)
_player.getCooldowns().addCooldown(itemStack.getItem(), 11);
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.zooming = _setval; capability.zooming = false;
capability.syncPlayerVariables(entity); capability.syncPlayerVariables(entity);
}); });
} }
if (entity instanceof Player _player)
_player.getCooldowns().addCooldown(itemstack.getItem(), 13); if (mainHandItem == itemStack.getItem()) {
if (tag.getDouble("drawtime") < 11) {
tag.putDouble("drawtime", (tag.getDouble("drawtime") + 1));
} }
if (itemstack.getOrCreateTag().getDouble("fireanim") > 0) {
itemstack.getOrCreateTag().putDouble("fireanim", (itemstack.getOrCreateTag().getDouble("fireanim") - 1));
}
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()) {
if (itemstack.getOrCreateTag().getDouble("drawtime") < 11) {
itemstack.getOrCreateTag().putDouble("drawtime", (itemstack.getOrCreateTag().getDouble("drawtime") + 1));
} }
if (tag.getDouble("fireanim") > 0) {
tag.putDouble("fireanim", (tag.getDouble("fireanim") - 1));
} }
} }
} }

View file

@ -14,8 +14,9 @@ public class WeaponDrawProcedure {
if (entity == null) return; if (entity == null) return;
CompoundTag tag = itemStack.getOrCreateTag(); CompoundTag tag = itemStack.getOrCreateTag();
Item mainHandItem = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem(); Item mainHandItem = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem();
if (tag.getDouble("draw") == 1) {
if (tag.getDouble("drawtime") == 1) { tag.putDouble("draw", 0);
tag.putDouble("drawtime", 0);
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.zooming = false; capability.zooming = false;
capability.syncPlayerVariables(entity); capability.syncPlayerVariables(entity);
@ -29,6 +30,7 @@ public class WeaponDrawProcedure {
tag.putDouble("gj", 1); tag.putDouble("gj", 1);
} }
} }
if (mainHandItem == itemStack.getItem()) { if (mainHandItem == itemStack.getItem()) {
if (tag.getDouble("drawtime") < 16) { if (tag.getDouble("drawtime") < 16) {
tag.putDouble("drawtime", (tag.getDouble("drawtime") + 1)); tag.putDouble("drawtime", (tag.getDouble("drawtime") + 1));

View file

@ -1,5 +1,7 @@
package net.mcreator.target.procedures; package net.mcreator.target.procedures;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -9,30 +11,31 @@ import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.init.TargetModItems; import net.mcreator.target.init.TargetModItems;
public class WeapondrawhaveyProcedure { public class WeapondrawhaveyProcedure {
public static void execute(Entity entity, ItemStack itemstack) { public static void execute(Entity entity, ItemStack itemStack) {
if (entity == null) if (entity == null) return;
return; CompoundTag tag = itemStack.getOrCreateTag();
if (itemstack.getOrCreateTag().getDouble("drawtime") == 1) { Item mainHandItem = (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem();
{ if (tag.getDouble("draw") == 1) {
boolean _setval = false; tag.putDouble("draw", 0);
tag.putDouble("drawtime", 0);
entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
capability.zooming = _setval; capability.zooming = false;
capability.syncPlayerVariables(entity); capability.syncPlayerVariables(entity);
}); });
}
if (entity instanceof Player _player) if (entity instanceof Player _player)
_player.getCooldowns().addCooldown(itemstack.getItem(), 32); _player.getCooldowns().addCooldown(itemStack.getItem(), 29);
if (itemstack.getItem() == TargetModItems.M_60.get() && itemstack.getOrCreateTag().getDouble("ammo") <= 5) { if (itemStack.getItem() == TargetModItems.M_60.get() && tag.getDouble("ammo") <= 5) {
itemstack.getOrCreateTag().putDouble("empty", 1); tag.putDouble("empty", 1);
} }
} }
if ((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == itemstack.getItem()) {
if (itemstack.getOrCreateTag().getDouble("drawtime") < 29) { if (mainHandItem == itemStack.getItem()) {
itemstack.getOrCreateTag().putDouble("drawtime", (itemstack.getOrCreateTag().getDouble("drawtime") + 1)); if (tag.getDouble("drawtime") < 29) {
tag.putDouble("drawtime", (tag.getDouble("drawtime") + 1));
} }
} }
if (itemstack.getOrCreateTag().getDouble("fireanim") > 0) { if (tag.getDouble("fireanim") > 0) {
itemstack.getOrCreateTag().putDouble("fireanim", (itemstack.getOrCreateTag().getDouble("fireanim") - 1)); tag.putDouble("fireanim", (tag.getDouble("fireanim") - 1));
} }
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -31,15 +31,10 @@
] ]
}, },
"firstperson_righthand": { "firstperson_righthand": {
"rotation": [
0,
0,
5
],
"translation": [ "translation": [
1.75, -0.25,
-12.75, -10,
-18.25 -14.25
], ],
"scale": [ "scale": [
4, 4,
@ -52,6 +47,11 @@
-1, -1,
3, 3,
2.5 2.5
],
"scale": [
0,
0,
0
] ]
}, },
"ground": { "ground": {
@ -68,19 +68,19 @@
}, },
"gui": { "gui": {
"rotation": [ "rotation": [
30, 165.69,
-145, -39.63,
0 178.66
], ],
"translation": [ "translation": [
0, -2.75,
0.25, -1,
0 0
], ],
"scale": [ "scale": [
3.5, 0.6,
3.5, 0.6,
3.5 0.6
] ]
}, },
"fixed": { "fixed": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

@ -8,7 +8,7 @@
"damage": 8.75, "damage": 8.75,
"headshot": 2, "headshot": 2,
"velocity": 35, "velocity": 35,
"mag": 50, "mag": 75,
"projectileamount": 1, "projectileamount": 1,
"fire_interval": 2 "fire_interval": 2
} }