修改Tag
This commit is contained in:
parent
499c4e739c
commit
249a45882d
13 changed files with 93 additions and 59 deletions
|
@ -178,16 +178,16 @@ public class AmmoBarOverlay {
|
||||||
return "" + stack.getOrCreateTag().getInt("max_ammo");
|
return "" + stack.getOrCreateTag().getInt("max_ammo");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.RIFLE)) {
|
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).rifleAmmo;
|
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).rifleAmmo;
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) {
|
if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).handgunAmmo;
|
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).handgunAmmo;
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).shotgunAmmo;
|
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).shotgunAmmo;
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).sniperAmmo;
|
return "" + (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).sniperAmmo;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -214,16 +214,16 @@ public class AmmoBarOverlay {
|
||||||
return "Rifle Ammo";
|
return "Rifle Ammo";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.RIFLE)) {
|
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
return " Rifle Ammo";
|
return " Rifle Ammo";
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) {
|
if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
return "Handgun Ammo";
|
return "Handgun Ammo";
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
return "Shotgun Ammo";
|
return "Shotgun Ammo";
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
return "Sniper Ammo";
|
return "Sniper Ammo";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -35,6 +35,6 @@ public class FourthTimesCharm extends Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
|
public boolean canApplyAtEnchantingTable(ItemStack itemstack) {
|
||||||
return itemstack.is(ModTags.Items.CAN_SHOOT_BULLET) && !itemstack.is(ModItems.MINIGUN.get()) && !itemstack.is(ModTags.Items.SHOTGUN);
|
return itemstack.is(ModTags.Items.CAN_SHOOT_BULLET) && !itemstack.is(ModItems.MINIGUN.get()) && !itemstack.is(ModTags.Items.USE_SHOTGUN_AMMO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,17 +492,17 @@ public class GunEventHandler {
|
||||||
public static void playGunNormalReload(Player player) {
|
public static void playGunNormalReload(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
if (stack.getItem() == ModItems.ABEKIRI.get()) {
|
if (stack.getItem() == ModItems.ABEKIRI.get()) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SHOTGUN);
|
GunsTool.reload(player, GunInfo.Type.SHOTGUN);
|
||||||
} else {
|
} else {
|
||||||
GunsTool.reload(player, GunInfo.Type.SHOTGUN, true);
|
GunsTool.reload(player, GunInfo.Type.SHOTGUN, true);
|
||||||
}
|
}
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SNIPER, true);
|
GunsTool.reload(player, GunInfo.Type.SNIPER, true);
|
||||||
} else if (stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.HANDGUN, true);
|
GunsTool.reload(player, GunInfo.Type.HANDGUN, true);
|
||||||
} else if (stack.is(ModTags.Items.RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
if (stack.getItem() == ModItems.M_60.get()) {
|
if (stack.getItem() == ModItems.M_60.get()) {
|
||||||
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -518,13 +518,13 @@ public class GunEventHandler {
|
||||||
public static void playGunEmptyReload(Player player) {
|
public static void playGunEmptyReload(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SHOTGUN);
|
GunsTool.reload(player, GunInfo.Type.SHOTGUN);
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.SNIPER);
|
GunsTool.reload(player, GunInfo.Type.SNIPER);
|
||||||
} else if (stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.HANDGUN);
|
GunsTool.reload(player, GunInfo.Type.HANDGUN);
|
||||||
} else if (stack.is(ModTags.Items.RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
GunsTool.reload(player, GunInfo.Type.RIFLE);
|
||||||
} else if (stack.getItem() == ModItems.TASER.get()) {
|
} else if (stack.getItem() == ModItems.TASER.get()) {
|
||||||
stack.getOrCreateTag().putInt("ammo", 1);
|
stack.getOrCreateTag().putInt("ammo", 1);
|
||||||
|
@ -632,13 +632,13 @@ public class GunEventHandler {
|
||||||
|
|
||||||
// 检查备弹
|
// 检查备弹
|
||||||
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
||||||
if (stack.is(ModTags.Items.SHOTGUN) && capability.shotgunAmmo == 0) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) && capability.shotgunAmmo == 0) {
|
||||||
tag.putBoolean("force_stage3_start", true);
|
tag.putBoolean("force_stage3_start", true);
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE) && capability.sniperAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO) && capability.sniperAmmo == 0) {
|
||||||
tag.putBoolean("force_stage3_start", true);
|
tag.putBoolean("force_stage3_start", true);
|
||||||
} else if ((stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
} else if ((stack.is(ModTags.Items.USE_HANDGUN_AMMO) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
||||||
tag.putBoolean("force_stage3_start", true);
|
tag.putBoolean("force_stage3_start", true);
|
||||||
} else if (stack.is(ModTags.Items.RIFLE) && capability.rifleAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0) {
|
||||||
tag.putBoolean("force_stage3_start", true);
|
tag.putBoolean("force_stage3_start", true);
|
||||||
} else {
|
} else {
|
||||||
tag.putInt("reload_stage", 2);
|
tag.putInt("reload_stage", 2);
|
||||||
|
@ -691,13 +691,13 @@ public class GunEventHandler {
|
||||||
|
|
||||||
// 备弹耗尽结束
|
// 备弹耗尽结束
|
||||||
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
var capability = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables());
|
||||||
if (stack.is(ModTags.Items.SHOTGUN) && capability.shotgunAmmo == 0) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) && capability.shotgunAmmo == 0) {
|
||||||
tag.putInt("reload_stage", 3);
|
tag.putInt("reload_stage", 3);
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE) && capability.sniperAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO) && capability.sniperAmmo == 0) {
|
||||||
tag.putInt("reload_stage", 3);
|
tag.putInt("reload_stage", 3);
|
||||||
} else if ((stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
} else if ((stack.is(ModTags.Items.USE_HANDGUN_AMMO) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
||||||
tag.putInt("reload_stage", 3);
|
tag.putInt("reload_stage", 3);
|
||||||
} else if (stack.is(ModTags.Items.RIFLE) && capability.rifleAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0) {
|
||||||
tag.putInt("reload_stage", 3);
|
tag.putInt("reload_stage", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,24 +732,24 @@ public class GunEventHandler {
|
||||||
|
|
||||||
tag.putInt("ammo", tag.getInt("ammo") + 1);
|
tag.putInt("ammo", tag.getInt("ammo") + 1);
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.shotgunAmmo = capability.shotgunAmmo - 1;
|
capability.shotgunAmmo -= 1;
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.sniperAmmo = capability.sniperAmmo - 1;
|
capability.sniperAmmo -= 1;
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
} else if ((stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG))) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.handgunAmmo = capability.handgunAmmo - 1;
|
capability.handgunAmmo -= 1;
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
} else if (stack.is(ModTags.Items.RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
capability.rifleAmmo = capability.rifleAmmo - 1;
|
capability.rifleAmmo -= 1;
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,15 +75,15 @@ public class LivingEventHandler {
|
||||||
if (DamageTypeTool.isGunDamage(damageSource)) {
|
if (DamageTypeTool.isGunDamage(damageSource)) {
|
||||||
double distance = entity.position().distanceTo(sourceentity.position());
|
double distance = entity.position().distanceTo(sourceentity.position());
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.SHOTGUN) || stack.getItem() == ModItems.BOCEK.get()) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) || stack.getItem() == ModItems.BOCEK.get()) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.03, 25);
|
damage = reduceDamageByDistance(amount, distance, 0.03, 25);
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.001, 200);
|
damage = reduceDamageByDistance(amount, distance, 0.001, 200);
|
||||||
} else if (stack.is(ModTags.Items.HANDGUN)) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.03, 50);
|
damage = reduceDamageByDistance(amount, distance, 0.03, 50);
|
||||||
} else if (stack.is(ModTags.Items.SMG)) {
|
} else if (stack.is(ModTags.Items.SMG)) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.03, 50);
|
damage = reduceDamageByDistance(amount, distance, 0.03, 50);
|
||||||
} else if (stack.is(ModTags.Items.RIFLE)) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.0025, 150);
|
damage = reduceDamageByDistance(amount, distance, 0.0025, 150);
|
||||||
}
|
}
|
||||||
event.setAmount((float) damage);
|
event.setAmount((float) damage);
|
||||||
|
@ -405,20 +405,19 @@ public class LivingEventHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float rate = level * 0.1f + (stack.is(ModTags.Items.SMG) || stack.is(ModTags.Items.RIFLE) ? 0.17f : 0f);
|
float rate = level * 0.1f + (stack.is(ModTags.Items.SMG) || stack.is(ModTags.Items.RIFLE) ? 0.07f : 0f);
|
||||||
int mag = stack.getOrCreateTag().getInt("mag");
|
int mag = stack.getOrCreateTag().getInt("mag");
|
||||||
int ammoReload = (int) Math.min(mag, mag * rate);
|
int ammoReload = (int) Math.min(mag, mag * rate);
|
||||||
|
|
||||||
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null)
|
player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
.ifPresent(capability -> {
|
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
if (stack.is(ModTags.Items.RIFLE)) {
|
|
||||||
capability.rifleAmmo -= Math.min(capability.rifleAmmo, ammoReload);
|
capability.rifleAmmo -= Math.min(capability.rifleAmmo, ammoReload);
|
||||||
} else if (stack.is(ModTags.Items.SMG) || stack.is(ModTags.Items.HANDGUN)) {
|
} else if (stack.is(ModTags.Items.USE_HANDGUN_AMMO)) {
|
||||||
capability.handgunAmmo -= Math.min(capability.handgunAmmo, ammoReload);
|
capability.handgunAmmo -= Math.min(capability.handgunAmmo, ammoReload);
|
||||||
}
|
}
|
||||||
capability.syncPlayerVariables(player);
|
capability.syncPlayerVariables(player);
|
||||||
|
|
||||||
stack.getOrCreateTag().putInt("ammo", ammoReload);
|
stack.getOrCreateTag().putInt("ammo", mag + ammoReload);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,19 +257,19 @@ public class PlayerEventHandler {
|
||||||
public static void handleAmmoCount(Player player) {
|
public static void handleAmmoCount(Player player) {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
if (stack.is(ModTags.Items.RIFLE)) {
|
if (stack.is(ModTags.Items.USE_RIFLE_AMMO)) {
|
||||||
stack.getOrCreateTag().putInt("max_ammo",
|
stack.getOrCreateTag().putInt("max_ammo",
|
||||||
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).rifleAmmo));
|
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).rifleAmmo));
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) {
|
if (stack.is(ModTags.Items.USE_HANDGUN_AMMO) || stack.is(ModTags.Items.SMG)) {
|
||||||
stack.getOrCreateTag().putInt("max_ammo",
|
stack.getOrCreateTag().putInt("max_ammo",
|
||||||
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).handgunAmmo));
|
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).handgunAmmo));
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SHOTGUN)) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO)) {
|
||||||
stack.getOrCreateTag().putInt("max_ammo",
|
stack.getOrCreateTag().putInt("max_ammo",
|
||||||
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).shotgunAmmo));
|
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).shotgunAmmo));
|
||||||
}
|
}
|
||||||
if (stack.is(ModTags.Items.SNIPER_RIFLE)) {
|
if (stack.is(ModTags.Items.USE_SNIPER_AMMO)) {
|
||||||
stack.getOrCreateTag().putInt("max_ammo",
|
stack.getOrCreateTag().putInt("max_ammo",
|
||||||
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).sniperAmmo));
|
((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).sniperAmmo));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,15 @@ public class ModTags {
|
||||||
public static class Items {
|
public static class Items {
|
||||||
public static final TagKey<Item> GUN = tag("gun");
|
public static final TagKey<Item> GUN = tag("gun");
|
||||||
|
|
||||||
|
public static final TagKey<Item> USE_HANDGUN_AMMO = tag("use_handgun_ammo");
|
||||||
|
public static final TagKey<Item> USE_RIFLE_AMMO = tag("use_rifle_ammo");
|
||||||
|
public static final TagKey<Item> USE_SHOTGUN_AMMO = tag("use_shotgun_ammo");
|
||||||
|
public static final TagKey<Item> USE_SNIPER_AMMO = tag("use_sniper_ammo");
|
||||||
|
|
||||||
|
public static final TagKey<Item> SMG = tag("smg");
|
||||||
public static final TagKey<Item> HANDGUN = tag("handgun");
|
public static final TagKey<Item> HANDGUN = tag("handgun");
|
||||||
public static final TagKey<Item> RIFLE = tag("rifle");
|
public static final TagKey<Item> RIFLE = tag("rifle");
|
||||||
public static final TagKey<Item> SHOTGUN = tag("shotgun");
|
|
||||||
public static final TagKey<Item> SNIPER_RIFLE = tag("sniper_rifle");
|
public static final TagKey<Item> SNIPER_RIFLE = tag("sniper_rifle");
|
||||||
public static final TagKey<Item> SMG = tag("smg");
|
|
||||||
|
|
||||||
public static final TagKey<Item> NORMAL_GUN = tag("normal_gun");
|
public static final TagKey<Item> NORMAL_GUN = tag("normal_gun");
|
||||||
public static final TagKey<Item> LEGENDARY_GUN = tag("legendary_gun");
|
public static final TagKey<Item> LEGENDARY_GUN = tag("legendary_gun");
|
||||||
|
|
|
@ -275,8 +275,8 @@ public class ModVariables {
|
||||||
public double cannonFiring = 0;
|
public double cannonFiring = 0;
|
||||||
public int cannonRecoil = 0;
|
public int cannonRecoil = 0;
|
||||||
public double targetAngle = 0;
|
public double targetAngle = 0;
|
||||||
public int rifleAmmo = 0;
|
|
||||||
public boolean refresh = false;
|
public boolean refresh = false;
|
||||||
|
public int rifleAmmo = 0;
|
||||||
public int handgunAmmo = 0;
|
public int handgunAmmo = 0;
|
||||||
public int shotgunAmmo = 0;
|
public int shotgunAmmo = 0;
|
||||||
public int sniperAmmo = 0;
|
public int sniperAmmo = 0;
|
||||||
|
@ -287,7 +287,6 @@ public class ModVariables {
|
||||||
public int tacticalSprintTime = 600;
|
public int tacticalSprintTime = 600;
|
||||||
public boolean tacticalSprintExhaustion = false;
|
public boolean tacticalSprintExhaustion = false;
|
||||||
|
|
||||||
|
|
||||||
public void syncPlayerVariables(Entity entity) {
|
public void syncPlayerVariables(Entity entity) {
|
||||||
if (entity instanceof ServerPlayer)
|
if (entity instanceof ServerPlayer)
|
||||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.DIMENSION.with(entity.level()::dimension), new PlayerVariablesSyncMessage(this, entity.getId()));
|
ModUtils.PACKET_HANDLER.send(PacketDistributor.DIMENSION.with(entity.level()::dimension), new PlayerVariablesSyncMessage(this, entity.getId()));
|
||||||
|
|
|
@ -60,13 +60,13 @@ public class ReloadMessage {
|
||||||
boolean can_single_reload = tag.getDouble("iterative_time") != 0;
|
boolean can_single_reload = tag.getDouble("iterative_time") != 0;
|
||||||
|
|
||||||
//检查备弹
|
//检查备弹
|
||||||
if (stack.is(ModTags.Items.SHOTGUN) && capability.shotgunAmmo == 0) {
|
if (stack.is(ModTags.Items.USE_SHOTGUN_AMMO) && capability.shotgunAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (stack.is(ModTags.Items.SNIPER_RIFLE) && capability.sniperAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_SNIPER_AMMO) && capability.sniperAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
} else if ((stack.is(ModTags.Items.HANDGUN) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
} else if ((stack.is(ModTags.Items.USE_HANDGUN_AMMO) || stack.is(ModTags.Items.SMG)) && capability.handgunAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (stack.is(ModTags.Items.RIFLE) && capability.rifleAmmo == 0) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) && capability.rifleAmmo == 0) {
|
||||||
return;
|
return;
|
||||||
} else if (stack.getItem() == ModItems.TASER.get() && tag.getInt("max_ammo") == 0) {
|
} else if (stack.getItem() == ModItems.TASER.get() && tag.getInt("max_ammo") == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
{
|
{
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
"superbwarfare:devotion",
|
|
||||||
"superbwarfare:m_4",
|
"superbwarfare:m_4",
|
||||||
"superbwarfare:hk_416",
|
"superbwarfare:hk_416",
|
||||||
"superbwarfare:rpk",
|
|
||||||
"superbwarfare:sks",
|
"superbwarfare:sks",
|
||||||
"superbwarfare:minigun",
|
|
||||||
"superbwarfare:mk_14",
|
"superbwarfare:mk_14",
|
||||||
"superbwarfare:m_60",
|
|
||||||
"superbwarfare:marlin",
|
"superbwarfare:marlin",
|
||||||
"superbwarfare:ak_47",
|
"superbwarfare:ak_47",
|
||||||
"superbwarfare:qbz_95"
|
"superbwarfare:qbz_95"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"superbwarfare:trachelium",
|
||||||
|
"superbwarfare:glock_17",
|
||||||
|
"superbwarfare:glock_18",
|
||||||
|
"superbwarfare:m_1911",
|
||||||
|
"superbwarfare:vector"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"superbwarfare:devotion",
|
||||||
|
"superbwarfare:m_4",
|
||||||
|
"superbwarfare:hk_416",
|
||||||
|
"superbwarfare:rpk",
|
||||||
|
"superbwarfare:sks",
|
||||||
|
"superbwarfare:minigun",
|
||||||
|
"superbwarfare:mk_14",
|
||||||
|
"superbwarfare:m_60",
|
||||||
|
"superbwarfare:marlin",
|
||||||
|
"superbwarfare:ak_47",
|
||||||
|
"superbwarfare:qbz_95"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"superbwarfare:hunting_rifle",
|
||||||
|
"superbwarfare:ntw_20",
|
||||||
|
"superbwarfare:sentinel",
|
||||||
|
"superbwarfare:svd",
|
||||||
|
"superbwarfare:m_98b"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue