修改载具武器所需物品实现方式

This commit is contained in:
17146 2025-03-10 00:59:57 +08:00
parent a194f82503
commit eb9fc3b1a4
2 changed files with 9 additions and 6 deletions

View file

@ -126,7 +126,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.fireTime(0) .fireTime(0)
.durability(60) .durability(60)
.velocity(40) .velocity(40)
.sound(ModSounds.INTO_MISSILE.get()), .sound(ModSounds.INTO_MISSILE.get())
.ammo(ModItems.AP_5_INCHES.get()),
// HE // HE
new CannonShellWeapon() new CannonShellWeapon()
.hitDamage(100) .hitDamage(100)
@ -136,7 +137,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.fireTime(2) .fireTime(2)
.durability(1) .durability(1)
.velocity(25) .velocity(25)
.sound(ModSounds.INTO_CANNON.get()), .sound(ModSounds.INTO_CANNON.get())
.ammo(ModItems.HE_5_INCHES.get()),
}, },
new VehicleWeapon[]{ new VehicleWeapon[]{
// 机枪 // 机枪
@ -144,7 +146,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get()) .damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
.headShot(2) .headShot(2)
.zoom(false) .zoom(false)
.bypassArmorRate(0.4f), .bypassArmorRate(0.4f)
.ammo(ModItems.HEAVY_AMMO.get()),
} }
}; };
} }

View file

@ -3,7 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle.weapon;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Item;
public abstract class VehicleWeapon { public abstract class VehicleWeapon {
@ -12,7 +12,7 @@ public abstract class VehicleWeapon {
// 武器的名称 // 武器的名称
public Component name; public Component name;
// 武器使用的弹药类型 // 武器使用的弹药类型
public ItemStack ammo; public Item ammo;
// 装弹类型 // 装弹类型
public AmmoType ammoType = AmmoType.INDIRECT; public AmmoType ammoType = AmmoType.INDIRECT;
// 最大装弹量对直接读取备弹的武器无效 // 最大装弹量对直接读取备弹的武器无效
@ -39,7 +39,7 @@ public abstract class VehicleWeapon {
return this; return this;
} }
public VehicleWeapon ammo(ItemStack ammo) { public VehicleWeapon ammo(Item ammo) {
this.ammo = ammo; this.ammo = ammo;
return this; return this;
} }