规范maxammo命名

This commit is contained in:
Light_Quanta 2024-05-18 20:16:08 +08:00
parent 6bf852b967
commit 0cf2ec0f90
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
11 changed files with 18 additions and 18 deletions

View file

@ -51,7 +51,7 @@ public class BocekItemModel extends GeoModel<BocekItem> {
arrow.setScaleZ(0);
}
if (stack.getOrCreateTag().getInt("maxammo") == 0) {
if (stack.getOrCreateTag().getInt("max_ammo") == 0) {
jian.setScaleX(0);
jian.setScaleY(0);
jian.setScaleZ(0);

View file

@ -158,7 +158,7 @@ public class AmmoBarOverlay {
if (stack.getItem() == TargetModItems.BOCEK.get() || stack.getItem() == TargetModItems.M_79.get()
|| stack.getItem() == TargetModItems.RPG.get() || stack.getItem() == TargetModItems.TASER.get()) {
return stack.getOrCreateTag().getInt("maxammo");
return stack.getOrCreateTag().getInt("max_ammo");
}
if (stack.getItem() == TargetModItems.MINIGUN.get()) {
return (player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo;

View file

@ -183,19 +183,19 @@ public class PlayerEventHandler {
ItemStack stack = player.getMainHandItem();
if (stack.is(TargetModTags.Items.RIFLE)) {
stack.getOrCreateTag().putInt("maxammo",
stack.getOrCreateTag().putInt("max_ammo",
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).rifleAmmo));
}
if (stack.is(TargetModTags.Items.HANDGUN) || stack.is(TargetModTags.Items.SMG)) {
stack.getOrCreateTag().putInt("maxammo",
stack.getOrCreateTag().putInt("max_ammo",
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).handgunAmmo));
}
if (stack.is(TargetModTags.Items.SHOTGUN)) {
stack.getOrCreateTag().putInt("maxammo",
stack.getOrCreateTag().putInt("max_ammo",
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).shotgunAmmo));
}
if (stack.is(TargetModTags.Items.SNIPER_RIFLE)) {
stack.getOrCreateTag().putInt("maxammo",
stack.getOrCreateTag().putInt("max_ammo",
((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo));
}
}
@ -336,7 +336,7 @@ public class PlayerEventHandler {
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).bowPullHold) {
if (mainHandItem.getItem() == TargetModItems.BOCEK.get()
&& tag.getInt("maxammo") > 0
&& tag.getInt("max_ammo") > 0
&& !player.getCooldowns().isOnCooldown(mainHandItem.getItem())
&& tag.getDouble("power") < 12
) {

View file

@ -158,7 +158,7 @@ public class BocekItem extends GunItem implements GeoItem, AnimatedItem {
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) {
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
}
// TODO 合并至GunReload

View file

@ -172,7 +172,7 @@ public class M79Item extends GunItem implements GeoItem, AnimatedItem {
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) {
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
}
M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
}

View file

@ -174,7 +174,7 @@ public class RpgItem extends GunItem implements GeoItem, AnimatedItem {
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) {
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
}
RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure.execute(entity, itemstack);
}

View file

@ -173,7 +173,7 @@ public class Taser extends GunItem implements GeoItem, AnimatedItem {
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) {
itemstack.getOrCreateTag().putInt("maxammo", getAmmoCount(player));
itemstack.getOrCreateTag().putInt("max_ammo", getAmmoCount(player));
}
TasercooldownProcedure.execute(entity, itemstack);
}

View file

@ -41,7 +41,7 @@ public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
}
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
if (itemstack.getOrCreateTag().getInt("maxammo") >= ammo1) {
if (itemstack.getOrCreateTag().getInt("max_ammo") >= ammo1) {
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + ammo1));
if (entity instanceof Player _player) {
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
@ -50,7 +50,7 @@ public class M79WuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
itemstack.getOrCreateTag().putBoolean("reloading", false);
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
} else {
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + itemstack.getOrCreateTag().getInt("maxammo")));
itemstack.getOrCreateTag().putInt("ammo", (itemstack.getOrCreateTag().getInt("ammo") + itemstack.getOrCreateTag().getInt("max_ammo")));
if (entity instanceof Player _player) {
ItemStack _stktoremove = new ItemStack(TargetModItems.GRENADE_40MM.get());
_player.getInventory().clearOrCountMatchingItems(p -> _stktoremove.getItem() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());

View file

@ -22,7 +22,7 @@ public class PlayerReloadProcedure {
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
&& !tag.getBoolean("reloading")
&& tag.getInt("ammo") < 1
&& tag.getInt("maxammo") > 0) {
&& tag.getInt("max_ammo") > 0) {
tag.putBoolean("reloading", true);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("reload_time", 55);
@ -51,7 +51,7 @@ public class PlayerReloadProcedure {
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
&& !tag.getBoolean("reloading")
&& tag.getInt("ammo") < 1
&& tag.getInt("maxammo") > 0) {
&& tag.getInt("max_ammo") > 0) {
tag.putBoolean("reloading", true);
tag.putDouble("empty_reload", 1);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
@ -61,7 +61,7 @@ public class PlayerReloadProcedure {
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
&& !tag.getBoolean("reloading")
&& tag.getInt("ammo") < 1
&& tag.getInt("maxammo") > 0) {
&& tag.getInt("max_ammo") > 0) {
tag.putBoolean("reloading", true);
tag.putDouble("empty_reload", 1);
tag.putDouble("id", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));

View file

@ -42,7 +42,7 @@ public class RpgWuPinZaiBeiBaoZhongShiMeiKeFaShengProcedure {
tag.putDouble("empty", 0);
}
if (tag.getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
if (tag.getInt("maxammo") >= 0) {
if (tag.getInt("max_ammo") >= 0) {
tag.putInt("ammo", 1);
if (entity instanceof Player _player) {
_player.getInventory().clearOrCountMatchingItems(p -> TargetModItems.ROCKET.get() == p.getItem(), 1, _player.inventoryMenu.getCraftSlots());

View file

@ -42,7 +42,7 @@ public class TasercooldownProcedure {
itemstack.getOrCreateTag().putBoolean("empty_reload", false);
}
if (itemstack.getOrCreateTag().getDouble("reload_time") == 1 && (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getOrCreateTag().getDouble("id") == id) {
if (itemstack.getOrCreateTag().getInt("maxammo") >= 1) {
if (itemstack.getOrCreateTag().getInt("max_ammo") >= 1) {
itemstack.getOrCreateTag().putInt("ammo", 1);
if (entity instanceof Player _player) {
ItemStack _stktoremove = new ItemStack(TargetModItems.TASER_ELECTRODE.get());