修复M79和二次灾变发射问题,移除无用代码

This commit is contained in:
Light_Quanta 2025-04-16 20:12:27 +08:00
parent 986a385478
commit e8fe60b719
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
6 changed files with 2 additions and 28 deletions

View file

@ -8,7 +8,6 @@ import com.atsuishio.superbwarfare.entity.projectile.JavelinMissileEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModEnumExtensions; import com.atsuishio.superbwarfare.init.ModEnumExtensions;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks; import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -184,10 +183,6 @@ public class JavelinItem extends GunItem implements GeoItem, ReleaseSpecialWeapo
data.save(); data.save();
} }
protected static boolean check(ItemStack stack) {
return stack.getItem() == ModItems.JAVELIN_MISSILE.get();
}
@Override @Override
public ResourceLocation getGunIcon() { public ResourceLocation getGunIcon() {
return Mod.loc("textures/gun_icon/javelin_icon.png"); return Mod.loc("textures/gun_icon/javelin_icon.png");

View file

@ -5,7 +5,6 @@ import com.atsuishio.superbwarfare.client.renderer.item.M79ItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent; import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent;
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity; import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks; import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -92,10 +91,6 @@ public class M79Item extends GunItem implements GeoItem, PressFireSpecialWeapon
data.add(idleController); data.add(idleController);
} }
protected static boolean check(ItemStack stack) {
return stack.getItem() == ModItems.GRENADE_40MM.get();
}
@Override @Override
public ResourceLocation getGunIcon() { public ResourceLocation getGunIcon() {
return Mod.loc("textures/gun_icon/m79_icon.png"); return Mod.loc("textures/gun_icon/m79_icon.png");
@ -129,8 +124,6 @@ public class M79Item extends GunItem implements GeoItem, PressFireSpecialWeapon
@Override @Override
public void fireOnPress(Player player, final GunData data, double spread, boolean zoom) { public void fireOnPress(Player player, final GunData data, double spread, boolean zoom) {
if (data.reloading()) return; if (data.reloading()) return;
ItemStack stack = data.stack();
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo.get() <= 0) return;
if (player.level() instanceof ServerLevel serverLevel) { if (player.level() instanceof ServerLevel serverLevel) {
GunGrenadeEntity gunGrenadeEntity = new GunGrenadeEntity(player, serverLevel, GunGrenadeEntity gunGrenadeEntity = new GunGrenadeEntity(player, serverLevel,

View file

@ -5,7 +5,6 @@ import com.atsuishio.superbwarfare.client.renderer.item.RpgItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent; import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent;
import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity; import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler; import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks; import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -120,10 +119,6 @@ public class RpgItem extends GunItem implements GeoItem, PressFireSpecialWeapon
super.inventoryTick(stack, world, entity, slot, selected); super.inventoryTick(stack, world, entity, slot, selected);
} }
protected static boolean check(ItemStack stack) {
return stack.getItem() == ModItems.ROCKET.get();
}
@Override @Override
public ResourceLocation getGunIcon() { public ResourceLocation getGunIcon() {
return Mod.loc("textures/gun_icon/rpg_icon.png"); return Mod.loc("textures/gun_icon/rpg_icon.png");

View file

@ -176,10 +176,6 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, PressFireSpe
} }
} }
protected static boolean check(ItemStack stack) {
return stack.getItem() == ModItems.GRENADE_40MM.get();
}
@Override @Override
public ResourceLocation getGunIcon() { public ResourceLocation getGunIcon() {
return Mod.loc("textures/gun_icon/secondary_cataclysm_icon.png"); return Mod.loc("textures/gun_icon/secondary_cataclysm_icon.png");
@ -239,7 +235,6 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, PressFireSpe
public void fireOnPress(Player player, final GunData data, double spread, boolean zoom) { public void fireOnPress(Player player, final GunData data, double spread, boolean zoom) {
if (data.reloading()) return; if (data.reloading()) return;
ItemStack stack = data.stack(); ItemStack stack = data.stack();
if (player.getCooldowns().isOnCooldown(stack.getItem()) || data.ammo.get() <= 0) return;
var stackCap = stack.getCapability(Capabilities.EnergyStorage.ITEM); var stackCap = stack.getCapability(Capabilities.EnergyStorage.ITEM);
var hasEnoughEnergy = stackCap != null && stackCap.getEnergyStored() >= 3000; var hasEnoughEnergy = stackCap != null && stackCap.getEnergyStored() >= 3000;

View file

@ -149,10 +149,6 @@ public class TaserItem extends GunItem implements GeoItem, EnergyStorageItem, Pr
} }
} }
protected static boolean check(ItemStack stack) {
return stack.getItem() == ModItems.TASER_ELECTRODE.get();
}
@Override @Override
public ResourceLocation getGunIcon() { public ResourceLocation getGunIcon() {
return Mod.loc("textures/gun_icon/taser_icon.png"); return Mod.loc("textures/gun_icon/taser_icon.png");

View file

@ -97,7 +97,7 @@ public record ShootMessage(double spread, boolean zoom) implements CustomPacketP
} else if (stack.is(ModItems.MINIGUN.get())) { } else if (stack.is(ModItems.MINIGUN.get())) {
var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch(); var cap = player.getData(ModAttachments.PLAYER_VARIABLE).watch();
if (data.hasAmmo(player) || InventoryTool.hasCreativeAmmoBox(player)) { if (data.hasAmmo(player)) {
tag.putDouble("heat", (tag.getDouble("heat") + 0.1)); tag.putDouble("heat", (tag.getDouble("heat") + 0.1));
if (tag.getDouble("heat") >= 50.5) { if (tag.getDouble("heat") >= 50.5) {
tag.putDouble("overheat", 40); tag.putDouble("overheat", 40);
@ -107,8 +107,8 @@ public record ShootMessage(double spread, boolean zoom) implements CustomPacketP
} }
} }
var perk = data.perk.get(Perk.Type.AMMO);
float pitch = tag.getDouble("heat") <= 40 ? 1 : (float) (1 - 0.025 * Math.abs(40 - tag.getDouble("heat"))); float pitch = tag.getDouble("heat") <= 40 ? 1 : (float) (1 - 0.025 * Math.abs(40 - tag.getDouble("heat")));
var perk = data.perk.get(Perk.Type.AMMO);
if (!player.level().isClientSide() && player instanceof ServerPlayer) { if (!player.level().isClientSide() && player instanceof ServerPlayer) {
float soundRadius = (float) data.soundRadius(); float soundRadius = (float) data.soundRadius();