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

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)
.durability(60)
.velocity(40)
.sound(ModSounds.INTO_MISSILE.get()),
.sound(ModSounds.INTO_MISSILE.get())
.ammo(ModItems.AP_5_INCHES.get()),
// HE
new CannonShellWeapon()
.hitDamage(100)
@ -136,7 +137,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.fireTime(2)
.durability(1)
.velocity(25)
.sound(ModSounds.INTO_CANNON.get()),
.sound(ModSounds.INTO_CANNON.get())
.ammo(ModItems.HE_5_INCHES.get()),
},
new VehicleWeapon[]{
// 机枪
@ -144,7 +146,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
.headShot(2)
.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.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Item;
public abstract class VehicleWeapon {
@ -12,7 +12,7 @@ public abstract class VehicleWeapon {
// 武器的名称
public Component name;
// 武器使用的弹药类型
public ItemStack ammo;
public Item ammo;
// 装弹类型
public AmmoType ammoType = AmmoType.INDIRECT;
// 最大装弹量对直接读取备弹的武器无效
@ -39,7 +39,7 @@ public abstract class VehicleWeapon {
return this;
}
public VehicleWeapon ammo(ItemStack ammo) {
public VehicleWeapon ammo(Item ammo) {
this.ammo = ammo;
return this;
}