优化换弹
This commit is contained in:
parent
30e656d423
commit
b8c87ef8ba
48 changed files with 205 additions and 1274 deletions
|
@ -51,31 +51,31 @@ public class M60ItemModel extends GeoModel<M60Item> {
|
||||||
r.setRotX(1.5f);
|
r.setRotX(1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") < 5 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 5 && stack.getOrCreateTag().getBoolean("bullet_chain")) {
|
||||||
b5.setScaleX(0);
|
b5.setScaleX(0);
|
||||||
b5.setScaleY(0);
|
b5.setScaleY(0);
|
||||||
b5.setScaleZ(0);
|
b5.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") < 4 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 4 && stack.getOrCreateTag().getBoolean("bullet_chain")) {
|
||||||
b4.setScaleX(0);
|
b4.setScaleX(0);
|
||||||
b4.setScaleY(0);
|
b4.setScaleY(0);
|
||||||
b4.setScaleZ(0);
|
b4.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") < 3 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 3 && stack.getOrCreateTag().getBoolean("bullet_chain")) {
|
||||||
b3.setScaleX(0);
|
b3.setScaleX(0);
|
||||||
b3.setScaleY(0);
|
b3.setScaleY(0);
|
||||||
b3.setScaleZ(0);
|
b3.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") < 2 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 2 && stack.getOrCreateTag().getBoolean("bullet_chain")) {
|
||||||
b2.setScaleX(0);
|
b2.setScaleX(0);
|
||||||
b2.setScaleY(0);
|
b2.setScaleY(0);
|
||||||
b2.setScaleZ(0);
|
b2.setScaleZ(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getInt("ammo") < 1 && stack.getOrCreateTag().getDouble("empty") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") < 1 && stack.getOrCreateTag().getBoolean("bullet_chain")) {
|
||||||
b1.setScaleX(0);
|
b1.setScaleX(0);
|
||||||
b1.setScaleY(0);
|
b1.setScaleY(0);
|
||||||
b1.setScaleZ(0);
|
b1.setScaleZ(0);
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class Mk14ItemModel extends GeoModel<Mk14Item> {
|
||||||
|
|
||||||
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
|
CoreGeoBone bolt = getAnimationProcessor().getBone("bolt");
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
|
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
|
||||||
bolt.setPosZ(2.5f);
|
bolt.setPosZ(2.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SksItemModel extends GeoModel<SksItem> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(TargetModTags.Items.GUN)) return;
|
if (!stack.is(TargetModTags.Items.GUN)) return;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
|
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
|
||||||
bolt.setPosZ(2.5f);
|
bolt.setPosZ(2.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class SvdItemModel extends GeoModel<SvdItem> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(TargetModTags.Items.GUN)) return;
|
if (!stack.is(TargetModTags.Items.GUN)) return;
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("HoldOpen") == 1) {
|
if (stack.getOrCreateTag().getBoolean("HoldOpen")) {
|
||||||
bolt.setPosZ(3.25f);
|
bolt.setPosZ(3.25f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class GunEventHandler {
|
||||||
空仓挂机
|
空仓挂机
|
||||||
*/
|
*/
|
||||||
if (stack.getOrCreateTag().getInt("ammo") == 1) {
|
if (stack.getOrCreateTag().getInt("ammo") == 1) {
|
||||||
stack.getOrCreateTag().putDouble("HoldOpen", 1);
|
stack.getOrCreateTag().putBoolean("HoldOpen", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -103,8 +103,13 @@ public class GunEventHandler {
|
||||||
stack.getOrCreateTag().putInt("fire_animation", interval);
|
stack.getOrCreateTag().putInt("fire_animation", interval);
|
||||||
player.getPersistentData().putInt("noRun_time", interval + 2);
|
player.getPersistentData().putInt("noRun_time", interval + 2);
|
||||||
stack.getOrCreateTag().putDouble("flash_time", 2);
|
stack.getOrCreateTag().putDouble("flash_time", 2);
|
||||||
|
|
||||||
stack.getOrCreateTag().putDouble("empty", 1);
|
stack.getOrCreateTag().putDouble("empty", 1);
|
||||||
|
|
||||||
|
if (player.getMainHandItem().getItem() == TargetModItems.M_60.get()) {
|
||||||
|
stack.getOrCreateTag().putBoolean("bullet_chain", true);
|
||||||
|
}
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_4.get() || player.getMainHandItem().getItem() == TargetModItems.HK_416.get()) {
|
if (player.getMainHandItem().getItem() == TargetModItems.M_4.get() || player.getMainHandItem().getItem() == TargetModItems.HK_416.get()) {
|
||||||
if (stack.getOrCreateTag().getDouble("fire_sequence") == 1) {
|
if (stack.getOrCreateTag().getDouble("fire_sequence") == 1) {
|
||||||
stack.getOrCreateTag().putDouble("fire_sequence", 0);
|
stack.getOrCreateTag().putDouble("fire_sequence", 0);
|
||||||
|
@ -361,9 +366,9 @@ public class GunEventHandler {
|
||||||
playGunNormalReloadSounds(player);
|
playGunNormalReloadSounds(player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tag.putInt("gun_reloading_time",(int)tag.getDouble("normal_reload_time"));
|
tag.putInt("gun_reloading_time",(int)tag.getDouble("empty_reload_time"));
|
||||||
stack.getOrCreateTag().putBoolean("is_normal_reloading",true);
|
stack.getOrCreateTag().putBoolean("is_empty_reloading",true);
|
||||||
playGunNormalReloadSounds(player);
|
playGunEmptyReloadSounds(player);
|
||||||
}
|
}
|
||||||
tag.putBoolean("start_reload",false);
|
tag.putBoolean("start_reload",false);
|
||||||
}
|
}
|
||||||
|
@ -372,6 +377,34 @@ public class GunEventHandler {
|
||||||
tag.putInt("gun_reloading_time",tag.getInt("gun_reloading_time") - 1);
|
tag.putInt("gun_reloading_time",tag.getInt("gun_reloading_time") - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.RPG.get()) {
|
||||||
|
if (tag.getInt("gun_reloading_time") == 84) {
|
||||||
|
tag.putBoolean("empty", false);
|
||||||
|
}
|
||||||
|
if (tag.getInt("gun_reloading_time") == 7) {
|
||||||
|
tag.putBoolean("close_hammer", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.MK_14.get()) {
|
||||||
|
if (tag.getInt("gun_reloading_time") == 18) {
|
||||||
|
tag.putBoolean("HoldOpen", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.SKS.get()) {
|
||||||
|
if (tag.getInt("gun_reloading_time") == 14) {
|
||||||
|
tag.putBoolean("HoldOpen", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.getItem() == TargetModItems.M_60.get()) {
|
||||||
|
if (tag.getInt("gun_reloading_time") == 55) {
|
||||||
|
tag.putBoolean("bullet_chain", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tag.getInt("gun_reloading_time") == 1) {
|
if (tag.getInt("gun_reloading_time") == 1) {
|
||||||
if (stack.is(TargetModTags.Items.OPEN_BOLT)) {
|
if (stack.is(TargetModTags.Items.OPEN_BOLT)) {
|
||||||
if(tag.getInt("ammo") == 0) {
|
if(tag.getInt("ammo") == 0) {
|
||||||
|
@ -389,14 +422,24 @@ public class GunEventHandler {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.is(TargetModTags.Items.SHOTGUN)) {
|
if (stack.is(TargetModTags.Items.SHOTGUN)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SHOTGUN ,true);
|
if (stack.getItem() == TargetModItems.ABEKIRI.get()) {
|
||||||
|
GunsTool.reload(player, GunInfo.Type.SHOTGUN);
|
||||||
|
} else {
|
||||||
|
GunsTool.reload(player, GunInfo.Type.SHOTGUN ,true);
|
||||||
|
}
|
||||||
} else if (stack.is(TargetModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(TargetModTags.Items.SNIPER_RIFLE)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SNIPER ,true);
|
GunsTool.reload(player, GunInfo.Type.SNIPER ,true);
|
||||||
} else if (stack.is(TargetModTags.Items.HANDGUN) || stack.is(TargetModTags.Items.SMG)) {
|
} else if (stack.is(TargetModTags.Items.HANDGUN) || stack.is(TargetModTags.Items.SMG)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.HANDGUN ,true);
|
GunsTool.reload(player, GunInfo.Type.HANDGUN ,true);
|
||||||
} else if (stack.is(TargetModTags.Items.RIFLE)) {
|
} else if (stack.is(TargetModTags.Items.RIFLE)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.RIFLE ,true);
|
if (stack.getItem() == TargetModItems.M_60.get()) {
|
||||||
|
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
||||||
|
} else {
|
||||||
|
GunsTool.reload(player, GunInfo.Type.RIFLE ,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
stack.getOrCreateTag().putBoolean("is_normal_reloading", false);
|
||||||
|
stack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
||||||
}
|
}
|
||||||
public static void playGunEmptyReload(Player player) {
|
public static void playGunEmptyReload(Player player) {
|
||||||
|
|
||||||
|
@ -410,7 +453,19 @@ public class GunEventHandler {
|
||||||
GunsTool.reload(player, GunInfo.Type.HANDGUN);
|
GunsTool.reload(player, GunInfo.Type.HANDGUN);
|
||||||
} else if (stack.is(TargetModTags.Items.RIFLE)) {
|
} else if (stack.is(TargetModTags.Items.RIFLE)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
||||||
|
} else if (stack.getItem() == TargetModItems.TASER.get()) {
|
||||||
|
stack.getOrCreateTag().putInt("ammo", 1);
|
||||||
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == TargetModItems.TASER_ELECTRODE.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
|
} else if (stack.getItem() == TargetModItems.M_79.get()) {
|
||||||
|
stack.getOrCreateTag().putInt("ammo", 1);
|
||||||
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == TargetModItems.GRENADE_40MM.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
|
} else if (stack.getItem() == TargetModItems.RPG.get()) {
|
||||||
|
stack.getOrCreateTag().putInt("ammo", 1);
|
||||||
|
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == TargetModItems.ROCKET.get(), 1, player.inventoryMenu.getCraftSlots());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stack.getOrCreateTag().putBoolean("is_normal_reloading", false);
|
||||||
|
stack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playGunEmptyReloadSounds(Player player) {
|
public static void playGunEmptyReloadSounds(Player player) {
|
||||||
|
|
|
@ -13,14 +13,14 @@ public class TargetModSounds {
|
||||||
|
|
||||||
public static final RegistryObject<SoundEvent> TASER_FIRE_1P = REGISTRY.register("taser_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_fire_1p")));
|
public static final RegistryObject<SoundEvent> TASER_FIRE_1P = REGISTRY.register("taser_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_fire_1p")));
|
||||||
public static final RegistryObject<SoundEvent> TASER_FIRE_3P = REGISTRY.register("taser_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_fire_3p")));
|
public static final RegistryObject<SoundEvent> TASER_FIRE_3P = REGISTRY.register("taser_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> TASER_RELOAD = REGISTRY.register("taser_reload", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_reload")));
|
public static final RegistryObject<SoundEvent> TASER_RELOAD_EMPTY = REGISTRY.register("taser_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "taser_reload_empty")));
|
||||||
public static final RegistryObject<SoundEvent> SHOCK = REGISTRY.register("shock", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "shock")));
|
public static final RegistryObject<SoundEvent> SHOCK = REGISTRY.register("shock", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "shock")));
|
||||||
public static final RegistryObject<SoundEvent> ELECTRIC = REGISTRY.register("electric", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "electric")));
|
public static final RegistryObject<SoundEvent> ELECTRIC = REGISTRY.register("electric", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "electric")));
|
||||||
public static final RegistryObject<SoundEvent> TRACHELIUM_FIRE_1P = REGISTRY.register("trachelium_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_fire_1p")));
|
public static final RegistryObject<SoundEvent> TRACHELIUM_FIRE_1P = REGISTRY.register("trachelium_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_fire_1p")));
|
||||||
public static final RegistryObject<SoundEvent> TRACHELIUM_FIRE_3P = REGISTRY.register("trachelium_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_fire_3p")));
|
public static final RegistryObject<SoundEvent> TRACHELIUM_FIRE_3P = REGISTRY.register("trachelium_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> TRACHELIUM_FAR = REGISTRY.register("trachelium_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_far")));
|
public static final RegistryObject<SoundEvent> TRACHELIUM_FAR = REGISTRY.register("trachelium_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_far")));
|
||||||
public static final RegistryObject<SoundEvent> TRACHELIUM_VERYFAR = REGISTRY.register("trachelium_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_veryfar")));
|
public static final RegistryObject<SoundEvent> TRACHELIUM_VERYFAR = REGISTRY.register("trachelium_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_veryfar")));
|
||||||
public static final RegistryObject<SoundEvent> TRACHELIUM_RELOAD = REGISTRY.register("trachelium_reload", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_reload")));
|
public static final RegistryObject<SoundEvent> TRACHELIUM_RELOAD_EMPTY = REGISTRY.register("trachelium_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "trachelium_reload_empty")));
|
||||||
public static final RegistryObject<SoundEvent> TRIGGER_CLICK = REGISTRY.register("triggerclick", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "triggerclick")));
|
public static final RegistryObject<SoundEvent> TRIGGER_CLICK = REGISTRY.register("triggerclick", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "triggerclick")));
|
||||||
public static final RegistryObject<SoundEvent> HIT = REGISTRY.register("hit", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hit")));
|
public static final RegistryObject<SoundEvent> HIT = REGISTRY.register("hit", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hit")));
|
||||||
public static final RegistryObject<SoundEvent> TARGET_DOWN = REGISTRY.register("targetdown", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "targetdown")));
|
public static final RegistryObject<SoundEvent> TARGET_DOWN = REGISTRY.register("targetdown", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "targetdown")));
|
||||||
|
@ -35,7 +35,7 @@ public class TargetModSounds {
|
||||||
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_FIRE_3P = REGISTRY.register("hunting_rifle_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_fire_3p")));
|
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_FIRE_3P = REGISTRY.register("hunting_rifle_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_FAR = REGISTRY.register("hunting_rifle_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_far")));
|
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_FAR = REGISTRY.register("hunting_rifle_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_far")));
|
||||||
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_VERYFAR = REGISTRY.register("hunting_rifle_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_veryfar")));
|
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_VERYFAR = REGISTRY.register("hunting_rifle_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_veryfar")));
|
||||||
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_RELOAD = REGISTRY.register("hunting_rifle_reload", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_reload")));
|
public static final RegistryObject<SoundEvent> HUNTING_RIFLE_RELOAD_EMPTY = REGISTRY.register("hunting_rifle_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "hunting_rifle_reload_empty")));
|
||||||
public static final RegistryObject<SoundEvent> OUCH = REGISTRY.register("ouch", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "ouch")));
|
public static final RegistryObject<SoundEvent> OUCH = REGISTRY.register("ouch", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "ouch")));
|
||||||
public static final RegistryObject<SoundEvent> STEP = REGISTRY.register("step", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "step")));
|
public static final RegistryObject<SoundEvent> STEP = REGISTRY.register("step", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "step")));
|
||||||
public static final RegistryObject<SoundEvent> GROWL = REGISTRY.register("growl", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "growl")));
|
public static final RegistryObject<SoundEvent> GROWL = REGISTRY.register("growl", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "growl")));
|
||||||
|
@ -44,7 +44,7 @@ public class TargetModSounds {
|
||||||
public static final RegistryObject<SoundEvent> M_79_FIRE_3P = REGISTRY.register("m_79_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_fire_3p")));
|
public static final RegistryObject<SoundEvent> M_79_FIRE_3P = REGISTRY.register("m_79_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> M_79_FAR = REGISTRY.register("m_79_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_far")));
|
public static final RegistryObject<SoundEvent> M_79_FAR = REGISTRY.register("m_79_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_far")));
|
||||||
public static final RegistryObject<SoundEvent> M_79_VERYFAR = REGISTRY.register("m_79_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_veryfar")));
|
public static final RegistryObject<SoundEvent> M_79_VERYFAR = REGISTRY.register("m_79_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_veryfar")));
|
||||||
public static final RegistryObject<SoundEvent> M_79_RELOAD = REGISTRY.register("m_79_reload", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_reload")));
|
public static final RegistryObject<SoundEvent> M_79_RELOAD_EMPTY = REGISTRY.register("m_79_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "m_79_reload_empty")));
|
||||||
public static final RegistryObject<SoundEvent> SKS_FIRE_1P = REGISTRY.register("sks_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_fire_1p")));
|
public static final RegistryObject<SoundEvent> SKS_FIRE_1P = REGISTRY.register("sks_fire_1p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_fire_1p")));
|
||||||
public static final RegistryObject<SoundEvent> SKS_FIRE_3P = REGISTRY.register("sks_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_fire_3p")));
|
public static final RegistryObject<SoundEvent> SKS_FIRE_3P = REGISTRY.register("sks_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> SKS_RELOAD_NORMAL = REGISTRY.register("sks_reload_normal", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_reload_normal")));
|
public static final RegistryObject<SoundEvent> SKS_RELOAD_NORMAL = REGISTRY.register("sks_reload_normal", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "sks_reload_normal")));
|
||||||
|
@ -76,7 +76,7 @@ public class TargetModSounds {
|
||||||
public static final RegistryObject<SoundEvent> RPG_FIRE_3P = REGISTRY.register("rpg_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_fire_3p")));
|
public static final RegistryObject<SoundEvent> RPG_FIRE_3P = REGISTRY.register("rpg_fire_3p", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_fire_3p")));
|
||||||
public static final RegistryObject<SoundEvent> RPG_FAR = REGISTRY.register("rpg_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_far")));
|
public static final RegistryObject<SoundEvent> RPG_FAR = REGISTRY.register("rpg_far", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_far")));
|
||||||
public static final RegistryObject<SoundEvent> RPG_VERYFAR = REGISTRY.register("rpg_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_veryfar")));
|
public static final RegistryObject<SoundEvent> RPG_VERYFAR = REGISTRY.register("rpg_veryfar", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_veryfar")));
|
||||||
public static final RegistryObject<SoundEvent> RPG_RELOAD = REGISTRY.register("rpg_reload", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_reload")));
|
public static final RegistryObject<SoundEvent> RPG_RELOAD_EMPTY = REGISTRY.register("rpg_reload_empty", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "rpg_reload_empty")));
|
||||||
public static final RegistryObject<SoundEvent> MORTAR_FIRE = REGISTRY.register("mortar_fire", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_fire")));
|
public static final RegistryObject<SoundEvent> MORTAR_FIRE = REGISTRY.register("mortar_fire", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_fire")));
|
||||||
public static final RegistryObject<SoundEvent> MORTAR_LOAD = REGISTRY.register("mortar_load", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_load")));
|
public static final RegistryObject<SoundEvent> MORTAR_LOAD = REGISTRY.register("mortar_load", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_load")));
|
||||||
public static final RegistryObject<SoundEvent> MORTAR_DISTANT = REGISTRY.register("mortar_distant", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_distant")));
|
public static final RegistryObject<SoundEvent> MORTAR_DISTANT = REGISTRY.register("mortar_distant", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation("target", "mortar_distant")));
|
||||||
|
|
|
@ -94,11 +94,11 @@ public class Abekiri extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ab.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,62 +164,6 @@ public class Abekiri extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addShotgunTips(list, stack, 8);
|
TooltipTool.addShotgunTips(list, stack, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 99) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (!entity.level().isClientSide()) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.ABEKIRI_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SHOTGUN);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") == 1) {
|
|
||||||
if (tag.getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (!entity.level().isClientSide()) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.ABEKIRI_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SHOTGUN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
ItemStack stack = new ItemStack(TargetModItems.ABEKIRI.get());
|
ItemStack stack = new ItemStack(TargetModItems.ABEKIRI.get());
|
||||||
GunsTool.initCreativeGun(stack, TargetModItems.ABEKIRI.getId().getPath());
|
GunsTool.initCreativeGun(stack, TargetModItems.ABEKIRI.getId().getPath());
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.devotion.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,63 +159,6 @@ public class Devotion extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
var itemTag = itemstack.getOrCreateTag();
|
|
||||||
var id = itemTag.getDouble("id");
|
|
||||||
var mainHandItem = entity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
|
||||||
var mainHandItemTag = mainHandItem.getOrCreateTag();
|
|
||||||
|
|
||||||
if (mainHandItemTag.getDouble("id") != itemTag.getDouble("id")) {
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getBoolean("reloading") && itemTag.getInt("ammo") == 0) {
|
|
||||||
if (itemTag.getDouble("reload_time") == 92) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer player) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.DEVOTION_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
|
||||||
&& mainHandItemTag.getDouble("id") == id) {
|
|
||||||
if (itemTag.getDouble("reload_time") > 0) {
|
|
||||||
itemTag.putDouble("reload_time", itemTag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getDouble("reload_time") == 1 && mainHandItemTag.getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (itemTag.getBoolean("reloading") && itemTag.getInt("ammo") > 0) {
|
|
||||||
if (itemTag.getDouble("reload_time") == 70) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer player) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.DEVOTION_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
|
||||||
&& mainHandItemTag.getDouble("id") == id) {
|
|
||||||
if (itemTag.getDouble("reload_time") > 0) {
|
|
||||||
itemTag.putDouble("reload_time", (itemTag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getDouble("reload_time") == 1 && mainHandItemTag.getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.DEVOTION_RELOAD_EMPTY.get(), TargetModSounds.DEVOTION_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.DEVOTION_RELOAD_EMPTY.get(), TargetModSounds.DEVOTION_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -44,8 +44,6 @@ public abstract class GunItem extends Item {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag tag = itemstack.getOrCreateTag();
|
|
||||||
|
|
||||||
if (!ItemNBTTool.getBoolean(itemstack, "init", false)) {
|
if (!ItemNBTTool.getBoolean(itemstack, "init", false)) {
|
||||||
GunsTool.initGun(level, itemstack, this.getDescriptionId().substring(this.getDescriptionId().lastIndexOf('.') + 1));
|
GunsTool.initGun(level, itemstack, this.getDescriptionId().substring(this.getDescriptionId().lastIndexOf('.') + 1));
|
||||||
GunsTool.genUUID(itemstack);
|
GunsTool.genUUID(itemstack);
|
||||||
|
@ -53,16 +51,16 @@ public abstract class GunItem extends Item {
|
||||||
}
|
}
|
||||||
GunsTool.pvpModeCheck(itemstack, level);
|
GunsTool.pvpModeCheck(itemstack, level);
|
||||||
|
|
||||||
if (tag.getBoolean("draw")) {
|
if (itemstack.getOrCreateTag().getBoolean("draw")) {
|
||||||
tag.putBoolean("draw", false);
|
itemstack.getOrCreateTag().putBoolean("draw", false);
|
||||||
tag.putInt("draw_time", 0);
|
itemstack.getOrCreateTag().putInt("draw_time", 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);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
double weight = tag.getDouble("weight");
|
double weight = itemstack.getOrCreateTag().getDouble("weight");
|
||||||
|
|
||||||
if (weight == 0) {
|
if (weight == 0) {
|
||||||
player.getCooldowns().addCooldown(itemstack.getItem(), 12);
|
player.getCooldowns().addCooldown(itemstack.getItem(), 12);
|
||||||
|
@ -73,27 +71,27 @@ public abstract class GunItem extends Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemstack.getItem() == TargetModItems.RPG.get() && tag.getInt("ammo") == 0) {
|
if (itemstack.getItem() == TargetModItems.RPG.get() && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
tag.putDouble("empty", 1);
|
itemstack.getOrCreateTag().putDouble("empty", 1);
|
||||||
}
|
}
|
||||||
if (itemstack.getItem() == TargetModItems.SKS.get() && tag.getInt("ammo") == 0) {
|
if (itemstack.getItem() == TargetModItems.SKS.get() && itemstack.getOrCreateTag().getInt("ammo") == 0) {
|
||||||
tag.putDouble("HoldOpen", 1);
|
itemstack.getOrCreateTag().putBoolean("HoldOpen", true);
|
||||||
}
|
}
|
||||||
if (itemstack.getItem() == TargetModItems.M_60.get() && tag.getInt("ammo") <= 5) {
|
if (itemstack.getItem() == TargetModItems.M_60.get() && itemstack.getOrCreateTag().getInt("ammo") <= 5) {
|
||||||
tag.putDouble("empty", 1);
|
itemstack.getOrCreateTag().putBoolean("bullet_chain", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()) {
|
if (mainHandItem.getItem() == itemstack.getItem()) {
|
||||||
if (tag.getInt("draw_time") < 50) {
|
if (itemstack.getOrCreateTag().getInt("draw_time") < 50) {
|
||||||
tag.putInt("draw_time", (tag.getInt("draw_time") + 1));
|
itemstack.getOrCreateTag().putInt("draw_time", (itemstack.getOrCreateTag().getInt("draw_time") + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag.getInt("fire_animation") > 0) {
|
if (itemstack.getOrCreateTag().getInt("fire_animation") > 0) {
|
||||||
tag.putInt("fire_animation", (tag.getInt("fire_animation") - 1));
|
itemstack.getOrCreateTag().putInt("fire_animation", (itemstack.getOrCreateTag().getInt("fire_animation") - 1));
|
||||||
}
|
}
|
||||||
if (tag.getDouble("flash_time") > 0) {
|
if (itemstack.getOrCreateTag().getDouble("flash_time") > 0) {
|
||||||
tag.putDouble("flash_time", (tag.getDouble("flash_time") - 1));
|
itemstack.getOrCreateTag().putDouble("flash_time", (itemstack.getOrCreateTag().getDouble("flash_time") - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class Hk416Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,65 +169,6 @@ public class Hk416Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
double id;
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 61) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.HK_416_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 53) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
{
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.HK_416_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.HK_416_RELOAD_EMPTY.get(), TargetModSounds.HK_416_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.HK_416_RELOAD_EMPTY.get(), TargetModSounds.HK_416_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class HuntingRifle extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.HUNTING_RIFLE_RELOAD.get());
|
return Set.of(TargetModSounds.HUNTING_RIFLE_RELOAD_EMPTY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -93,7 +93,7 @@ public class HuntingRifle extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.hunting_rifle.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.hunting_rifle.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.hunting_rifle.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.hunting_rifle.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,44 +159,6 @@ public class HuntingRifle extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
var itemTag = itemstack.getOrCreateTag();
|
|
||||||
double id = itemTag.getDouble("id");
|
|
||||||
|
|
||||||
var mainHandItem = entity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
|
||||||
var mainHandItemTag = mainHandItem.getOrCreateTag();
|
|
||||||
|
|
||||||
if (mainHandItemTag.getDouble("id") != itemTag.getDouble("id")) {
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getBoolean("reloading") && itemTag.getInt("ammo") == 0) {
|
|
||||||
if (itemTag.getDouble("reload_time") == 61) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.HUNTING_RIFLE_RELOAD.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
|
||||||
&& mainHandItemTag.getDouble("id") == id) {
|
|
||||||
if (itemTag.getDouble("reload_time") > 0) {
|
|
||||||
itemTag.putDouble("reload_time", (itemTag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getDouble("reload_time") == 1 && mainHandItemTag.getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
ItemStack stack = new ItemStack(TargetModItems.HUNTING_RIFLE.get());
|
ItemStack stack = new ItemStack(TargetModItems.HUNTING_RIFLE.get());
|
||||||
GunsTool.initCreativeGun(stack, TargetModItems.HUNTING_RIFLE.getId().getPath());
|
GunsTool.initCreativeGun(stack, TargetModItems.HUNTING_RIFLE.getId().getPath());
|
||||||
|
|
|
@ -105,11 +105,11 @@ public class Kraber extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.kraber.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,62 +166,6 @@ public class Kraber extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.KRABER_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 65) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.KRABER_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlot slot, ItemStack stack) {
|
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlot slot, ItemStack stack) {
|
||||||
Multimap<Attribute, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
|
Multimap<Attribute, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m4.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,62 +169,6 @@ public class M4Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 61) {
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_4_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 53) {
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_4_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.M_4_RELOAD_EMPTY.get(), TargetModSounds.M_4_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.M_4_RELOAD_EMPTY.get(), TargetModSounds.M_4_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.fire2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.fire2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m60.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,68 +151,6 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 129) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_60_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") <= 55) {
|
|
||||||
tag.putDouble("empty", 0);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 111) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_60_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") <= 55) {
|
|
||||||
tag.putDouble("empty", 0);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.M_60_RELOAD_EMPTY.get(), TargetModSounds.M_60_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.M_60_RELOAD_EMPTY.get(), TargetModSounds.M_60_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.M_79_RELOAD.get());
|
return Set.of(TargetModSounds.M_79_RELOAD_EMPTY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public M79Item() {
|
public M79Item() {
|
||||||
|
@ -96,7 +96,7 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m79.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m79.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m79.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m79.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,38 +178,6 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
itemStack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
itemStack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
int ammo1 = 1 - tag.getInt("ammo");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading")) {
|
|
||||||
if (tag.getDouble("reload_time") == 61) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_79_RELOAD.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
tag.putInt("ammo", tag.getInt("ammo") + Math.min(ammo1, tag.getInt("max_ammo")));
|
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.GRENADE_40MM.get() == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,11 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m98b.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,62 +165,6 @@ public class M98bItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 83) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 61) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_98B_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(
|
return Set.of(
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.m14.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,64 +147,6 @@ public class Mk14Item extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 78) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 18 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
tag.putDouble("HoldOpen", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 55) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.MK_14_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.MK_14_RELOAD_EMPTY.get(), TargetModSounds.MK_14_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.MK_14_RELOAD_EMPTY.get(), TargetModSounds.MK_14_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.getBoolean("reloading") && tag.getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.rpg.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.RPG_RELOAD.get());
|
return Set.of(TargetModSounds.RPG_RELOAD_EMPTY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -182,45 +182,6 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
var tag = itemStack.getOrCreateTag();
|
var tag = itemStack.getOrCreateTag();
|
||||||
tag.putInt("max_ammo", getAmmoCount(player));
|
tag.putInt("max_ammo", getAmmoCount(player));
|
||||||
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading")) {
|
|
||||||
if (tag.getDouble("reload_time") == 97) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity.getServer() != null) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.RPG_RELOAD.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 84) {
|
|
||||||
tag.putBoolean("empty", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 7) {
|
|
||||||
tag.putBoolean("close_hammer", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getInt("max_ammo") >= 0) {
|
|
||||||
tag.putInt("ammo", 1);
|
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, player.inventoryMenu.getCraftSlots());
|
|
||||||
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class RpkItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.ak47.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,63 +169,6 @@ public class RpkItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemstack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 92) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.RPK_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemstack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 70) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.RPK_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemstack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.RPK_RELOAD_EMPTY.get(), TargetModSounds.RPK_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.RPK_RELOAD_EMPTY.get(), TargetModSounds.RPK_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -116,17 +116,14 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.reload2"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.reload2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (stack.getOrCreateTag().getDouble("charging_time") > 127 && stack.getOrCreateTag().getBoolean("charging")) {
|
|
||||||
// return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.chargep"));
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("charging_time") < 127 && stack.getOrCreateTag().getDouble("charging_time") > 0 && stack.getOrCreateTag().getBoolean("charging")) {
|
if (stack.getOrCreateTag().getDouble("charging_time") < 127 && stack.getOrCreateTag().getDouble("charging_time") > 0 && stack.getOrCreateTag().getBoolean("charging")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.charge"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.charge"));
|
||||||
|
@ -177,100 +174,16 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
super.inventoryTick(itemStack, world, entity, slot, selected);
|
||||||
if (entity instanceof Player player) {
|
var tag = itemStack.getOrCreateTag();
|
||||||
double cid;
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 73) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SENTINEL_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 53) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SENTINEL_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tag.getDouble("firing") > 0) {
|
|
||||||
tag.putDouble("firing", tag.getDouble("firing") - 1);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("zoom_firing") > 0) {
|
|
||||||
tag.putDouble("zoom_firing", tag.getDouble("zoom_firing") - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cid = tag.getDouble("cid");
|
if (tag.getDouble("power") > 0) {
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("cid") != tag.getDouble("cid")) {
|
tag.putDouble("add_damage", 0.2857142857142857 * tag.getDouble("damage") * tag.getDouble("damageadd"));
|
||||||
tag.putBoolean("charging", false);
|
tag.putDouble("power", tag.getDouble("power") - 0.025);
|
||||||
tag.putDouble("charging_time", 0);
|
} else {
|
||||||
}
|
tag.putDouble("add_damage", 0);
|
||||||
if (tag.getBoolean("charging")) {
|
}
|
||||||
if (tag.getDouble("charging_time") == 127) {
|
if (tag.getDouble("crot") > 0) {
|
||||||
entity.getPersistentData().putDouble("cid", cid);
|
tag.putDouble("crot", tag.getDouble("crot") - 1);
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SENTINEL_CHARGE.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
if (tag.getDouble("charging_time") > 0) {
|
|
||||||
tag.putDouble("charging_time", tag.getDouble("charging_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("charging", false);
|
|
||||||
tag.putDouble("charging_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("charging_time") == 16 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
tag.putDouble("power", 100);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("charging_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
|
|
||||||
tag.putBoolean("charging", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tag.getDouble("power") > 0) {
|
|
||||||
tag.putDouble("add_damage", 0.2857142857142857 * tag.getDouble("damage") * tag.getDouble("damageadd"));
|
|
||||||
tag.putDouble("power", tag.getDouble("power") - 0.025);
|
|
||||||
} else {
|
|
||||||
tag.putDouble("add_damage", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("crot") > 0) {
|
|
||||||
tag.putDouble("crot", tag.getDouble("crot") - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,11 @@ public class SksItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sks.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,64 +166,6 @@ public class SksItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 72) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SKS_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
tag.putDouble("HoldOpen", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 51) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SKS_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", tag.getDouble("reload_time") - 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.RIFLE, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getGunInstance() {
|
public static ItemStack getGunInstance() {
|
||||||
ItemStack stack = new ItemStack(TargetModItems.SKS.get());
|
ItemStack stack = new ItemStack(TargetModItems.SKS.get());
|
||||||
GunsTool.initCreativeGun(stack, TargetModItems.SKS.getId().getPath());
|
GunsTool.initCreativeGun(stack, TargetModItems.SKS.getId().getPath());
|
||||||
|
|
|
@ -89,11 +89,11 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.svd.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,64 +140,6 @@ public class SvdItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
TooltipTool.addGunTips(list, stack);
|
TooltipTool.addGunTips(list, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemStack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemStack, world, entity, slot, selected);
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
var tag = itemStack.getOrCreateTag();
|
|
||||||
double id = tag.getDouble("id");
|
|
||||||
if (player.getMainHandItem().getOrCreateTag().getDouble("id") != tag.getDouble("id")) {
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getBoolean("reloading") && tag.getInt("ammo") == 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 67) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SVD_RELOAD_EMPTY.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 14 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
tag.putDouble("HoldOpen", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER);
|
|
||||||
}
|
|
||||||
} else if (tag.getBoolean("reloading") && tag.getInt("ammo") > 0) {
|
|
||||||
if (tag.getDouble("reload_time") == 53) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.SVD_RELOAD_NORMAL.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
|
||||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (tag.getDouble("reload_time") > 0) {
|
|
||||||
tag.putDouble("reload_time", (tag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tag.putBoolean("reloading", false);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (tag.getDouble("reload_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.SNIPER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.SVD_RELOAD_EMPTY.get(), TargetModSounds.SVD_RELOAD_NORMAL.get());
|
return Set.of(TargetModSounds.SVD_RELOAD_EMPTY.get(), TargetModSounds.SVD_RELOAD_NORMAL.get());
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.TASER_RELOAD.get());
|
return Set.of(TargetModSounds.TASER_RELOAD_EMPTY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,7 +114,7 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.taser.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.taser.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.taser.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.taser.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,44 +197,6 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
if (entity instanceof Player player) {
|
if (entity instanceof Player player) {
|
||||||
stack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
stack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
|
||||||
|
|
||||||
ItemStack heldItem = player.getMainHandItem();
|
|
||||||
|
|
||||||
double id = stack.getOrCreateTag().getDouble("id");
|
|
||||||
if (heldItem.getOrCreateTag().getDouble("id") != stack.getOrCreateTag().getDouble("id")) {
|
|
||||||
stack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
stack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
stack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading")) {
|
|
||||||
if (stack.getOrCreateTag().getDouble("reload_time") == 54) {
|
|
||||||
player.getPersistentData().putDouble("id", id);
|
|
||||||
|
|
||||||
if (!player.level().isClientSide()) {
|
|
||||||
SoundTool.playLocalSound(player, TargetModSounds.TASER_RELOAD.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (heldItem.getItem() == stack.getItem() && heldItem.getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (stack.getOrCreateTag().getDouble("reload_time") > 0) {
|
|
||||||
stack.getOrCreateTag().putDouble("reload_time", (stack.getOrCreateTag().getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
stack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
stack.getOrCreateTag().putDouble("reload_time", 0);
|
|
||||||
stack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getDouble("reload_time") == 1 && heldItem.getOrCreateTag().getDouble("id") == id) {
|
|
||||||
if (stack.getOrCreateTag().getInt("max_ammo") >= 1) {
|
|
||||||
stack.getOrCreateTag().putInt("ammo", 1);
|
|
||||||
|
|
||||||
player.getInventory().clearOrCountMatchingItems(p -> p.getItem() == TargetModItems.TASER_ELECTRODE.get(), 1, player.inventoryMenu.getCraftSlots());
|
|
||||||
stack.getOrCreateTag().putBoolean("reloading", false);
|
|
||||||
stack.getOrCreateTag().putBoolean("empty_reload", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int charge_speed = EnchantmentHelper.getTagEnchantmentLevel(TargetModEnchantments.SUPER_RECHARGE.get(), stack);
|
int charge_speed = EnchantmentHelper.getTagEnchantmentLevel(TargetModEnchantments.SUPER_RECHARGE.get(), stack);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class Trachelium extends GunItem implements GeoItem, AnimatedItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SoundEvent> getReloadSound() {
|
public Set<SoundEvent> getReloadSound() {
|
||||||
return Set.of(TargetModSounds.TRACHELIUM_RELOAD.get());
|
return Set.of(TargetModSounds.TRACHELIUM_RELOAD_EMPTY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,7 +99,7 @@ public class Trachelium extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.reload"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.trachelium.reload"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,43 +160,6 @@ public class Trachelium extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return slotChanged;
|
return slotChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
|
||||||
|
|
||||||
var itemTag = itemstack.getOrCreateTag();
|
|
||||||
double id = itemTag.getDouble("id");
|
|
||||||
var mainHandItem = entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY;
|
|
||||||
var mainHandItemTag = mainHandItem.getOrCreateTag();
|
|
||||||
|
|
||||||
if (mainHandItemTag.getDouble("id") != itemTag.getDouble("id")) {
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getBoolean("reloading")) {
|
|
||||||
if (itemTag.getDouble("reload_time") == 62) {
|
|
||||||
entity.getPersistentData().putDouble("id", id);
|
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
|
||||||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.TRACHELIUM_RELOAD.get(), 100, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mainHandItem.getItem() == itemstack.getItem()
|
|
||||||
&& mainHandItemTag.getDouble("id") == id) {
|
|
||||||
if (itemTag.getDouble("reload_time") > 0) {
|
|
||||||
itemTag.putDouble("reload_time", (itemTag.getDouble("reload_time") - 1));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemTag.putBoolean("reloading", false);
|
|
||||||
itemTag.putBoolean("empty_reload", false);
|
|
||||||
itemTag.putDouble("reload_time", 0);
|
|
||||||
}
|
|
||||||
if (itemTag.getDouble("reload_time") == 1 && mainHandItemTag.getDouble("id") == id) {
|
|
||||||
GunsTool.reload(entity, GunInfo.Type.HANDGUN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> list, TooltipFlag flag) {
|
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> list, TooltipFlag flag) {
|
||||||
list.add(Component.translatable("des.target.trachelium_1").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC));
|
list.add(Component.translatable("des.target.trachelium_1").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC));
|
||||||
|
|
|
@ -94,11 +94,11 @@ public class VectorItem extends GunItem implements GeoItem, AnimatedItem {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.fire"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.fire"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_empty_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload_empty"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload_empty"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.getOrCreateTag().getBoolean("reloading") && !stack.getOrCreateTag().getBoolean("empty_reload")) {
|
if (stack.getOrCreateTag().getBoolean("is_normal_reloading")) {
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload_normal"));
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.vec.reload_normal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,15 +97,8 @@ public class FireModeMessage {
|
||||||
if (tag.getDouble("burst") == 1) {
|
if (tag.getDouble("burst") == 1) {
|
||||||
tag.putInt("fire_mode", 1);
|
tag.putInt("fire_mode", 1);
|
||||||
setFireMode(player, tag);
|
setFireMode(player, tag);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == TargetModItems.SENTINEL.get() && !(player.getCooldowns().isOnCooldown(item)) && !tag.getBoolean("charging") && !tag.getBoolean("reloading")) {
|
|
||||||
tag.putBoolean("charging", true);
|
|
||||||
tag.putDouble("cid", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("charging_time", 128);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,12 +71,23 @@ public class ReloadMessage {
|
||||||
return;
|
return;
|
||||||
} else if (stack.is(TargetModTags.Items.RIFLE) && capability.rifleAmmo == 0) {
|
} else if (stack.is(TargetModTags.Items.RIFLE) && capability.rifleAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
|
} else if (stack.getItem() == TargetModItems.TASER.get() && tag.getInt("max_ammo") == 0) {
|
||||||
|
return;
|
||||||
|
} else if (stack.getItem() == TargetModItems.M_79.get() && tag.getInt("max_ammo") == 0) {
|
||||||
|
return;
|
||||||
|
} else if (stack.getItem() == TargetModItems.RPG.get() && tag.getInt("max_ammo") == 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(TargetModTags.Items.OPEN_BOLT) && can_reload) {
|
if (stack.is(TargetModTags.Items.OPEN_BOLT) && can_reload) {
|
||||||
//有OPEN_BOLT的枪非空仓换弹子弹会多一发
|
if (stack.getItem() == TargetModItems.M_60.get() || stack.getItem() == TargetModItems.ABEKIRI.get()) {
|
||||||
if (tag.getInt("ammo") < tag.getDouble("mag") + 1) {
|
if (tag.getInt("ammo") < tag.getDouble("mag")) {
|
||||||
tag.putBoolean("start_reload",true);
|
tag.putBoolean("start_reload",true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tag.getInt("ammo") < tag.getDouble("mag") + 1) {
|
||||||
|
tag.putBoolean("start_reload",true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (tag.getInt("ammo") < tag.getDouble("mag")){
|
} else if (tag.getInt("ammo") < tag.getDouble("mag")){
|
||||||
tag.putBoolean("start_reload",true);
|
tag.putBoolean("start_reload",true);
|
||||||
|
|
|
@ -18,261 +18,6 @@ public class PlayerReloadProcedure {
|
||||||
if (!(entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
if (!(entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
|
||||||
CompoundTag tag = player.getMainHandItem().getOrCreateTag();
|
CompoundTag tag = player.getMainHandItem().getOrCreateTag();
|
||||||
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.TASER.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 1
|
|
||||||
&& tag.getInt("max_ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 55);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.TRACHELIUM.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 8
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 62);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.HUNTING_RIFLE.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 1
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("reload_time", 61);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_79.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 1
|
|
||||||
&& tag.getInt("max_ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 61);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.RPG.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 1
|
|
||||||
&& tag.getInt("max_ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 97);
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.ABEKIRI.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 2
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") == 1) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 83);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 99);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_98B.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 6
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 61);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 83);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.KRABER.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 5
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 65);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 83);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.VECTOR.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 34
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 43);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 61);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.MK_14.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 21
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 55);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 78);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SKS.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 21
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 51);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 72);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((player.getMainHandItem().getItem() == TargetModItems.M_4.get()
|
|
||||||
|| player.getMainHandItem().getItem() == TargetModItems.HK_416.get())
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 31
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 53);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 61);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.DEVOTION.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
|
||||||
&& tag.getInt("ammo") < 56) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 70);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 92);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.RPK.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
|
||||||
&& tag.getInt("ammo") < 76) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 70);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 92);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& !tag.getBoolean("charging")
|
|
||||||
&& tag.getInt("ammo") < 6
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 53);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 73);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.SVD.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& tag.getInt("ammo") < 11
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 53);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 67);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.M_60.get()
|
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
|
||||||
&& !tag.getBoolean("reloading")
|
|
||||||
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo > 0
|
|
||||||
&& tag.getInt("ammo") < 100) {
|
|
||||||
if (tag.getInt("ammo") > 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putBoolean("empty_reload", false);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 111);
|
|
||||||
} else if (tag.getInt("ammo") == 0) {
|
|
||||||
tag.putBoolean("reloading", true);
|
|
||||||
tag.putDouble("empty_reload", 1);
|
|
||||||
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
|
|
||||||
tag.putDouble("reload_time", 129);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.getMainHandItem().getItem() == TargetModItems.MARLIN.get()
|
if (player.getMainHandItem().getItem() == TargetModItems.MARLIN.get()
|
||||||
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
|
||||||
&& !tag.getBoolean("reloading")
|
&& !tag.getBoolean("reloading")
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"taser_reload": {
|
"taser_reload_empty": {
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "target:taser/taser_reload",
|
"name": "target:taser/taser_reload",
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"trachelium_reload": {
|
"trachelium_reload_empty": {
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "target:trachelium/trachelium_reload",
|
"name": "target:trachelium/trachelium_reload",
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hunting_rifle_reload": {
|
"hunting_rifle_reload_empty": {
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "target:hunting_rifle/hunting_rifle_reload",
|
"name": "target:hunting_rifle/hunting_rifle_reload",
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"m_79_reload": {
|
"m_79_reload_empty": {
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "target:m_79/m_79_reload",
|
"name": "target:m_79/m_79_reload",
|
||||||
|
@ -375,7 +375,7 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"rpg_reload": {
|
"rpg_reload_empty": {
|
||||||
"sounds": [
|
"sounds": [
|
||||||
{
|
{
|
||||||
"name": "target:rpg/rpg_reload",
|
"name": "target:rpg/rpg_reload",
|
||||||
|
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 83,
|
||||||
|
"empty_reload_time": 99
|
||||||
}
|
}
|
|
@ -16,5 +16,7 @@
|
||||||
"semi": 0,
|
"semi": 0,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 70,
|
||||||
|
"empty_reload_time": 92
|
||||||
}
|
}
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 53,
|
||||||
|
"empty_reload_time": 61
|
||||||
}
|
}
|
|
@ -14,5 +14,6 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"empty_reload_time": 61
|
||||||
}
|
}
|
|
@ -19,5 +19,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 65,
|
||||||
|
"empty_reload_time": 83
|
||||||
}
|
}
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 53,
|
||||||
|
"empty_reload_time": 61
|
||||||
}
|
}
|
|
@ -16,5 +16,7 @@
|
||||||
"semi": 0,
|
"semi": 0,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 111,
|
||||||
|
"empty_reload_time": 129
|
||||||
}
|
}
|
|
@ -12,5 +12,6 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"empty_reload_time": 61
|
||||||
}
|
}
|
|
@ -18,5 +18,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 61,
|
||||||
|
"empty_reload_time": 83
|
||||||
}
|
}
|
|
@ -18,5 +18,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 55,
|
||||||
|
"empty_reload_time": 78
|
||||||
}
|
}
|
|
@ -12,5 +12,6 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"empty_reload_time": 97
|
||||||
}
|
}
|
|
@ -16,5 +16,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 70,
|
||||||
|
"empty_reload_time": 92
|
||||||
}
|
}
|
|
@ -16,5 +16,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 53,
|
||||||
|
"empty_reload_time": 73
|
||||||
}
|
}
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 51,
|
||||||
|
"empty_reload_time": 72
|
||||||
}
|
}
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"normal_reload_time": 53,
|
||||||
|
"empty_reload_time": 67
|
||||||
}
|
}
|
|
@ -12,5 +12,6 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"empty_reload_time": 55
|
||||||
}
|
}
|
|
@ -15,5 +15,6 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 0,
|
"burst": 0,
|
||||||
"auto": 0,
|
"auto": 0,
|
||||||
"burst_size": 1
|
"burst_size": 1,
|
||||||
|
"empty_reload_time": 62
|
||||||
}
|
}
|
|
@ -15,5 +15,7 @@
|
||||||
"semi": 1,
|
"semi": 1,
|
||||||
"burst": 1,
|
"burst": 1,
|
||||||
"auto": 1,
|
"auto": 1,
|
||||||
"burst_size": 3
|
"burst_size": 3,
|
||||||
|
"normal_reload_time": 43,
|
||||||
|
"empty_reload_time": 61
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
{
|
{
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
|
"target:abekiri",
|
||||||
|
"target:m_60",
|
||||||
"target:ak_47",
|
"target:ak_47",
|
||||||
"target:svd",
|
"target:svd",
|
||||||
"target:mk_14",
|
"target:mk_14",
|
||||||
|
|
Loading…
Add table
Reference in a new issue