修复XY100乘客弹药读取,调整bmp2导弹弹药显示,修复快艇乘客有准星的bug
This commit is contained in:
parent
a7a1ca56d8
commit
01cdec74c2
4 changed files with 17 additions and 7 deletions
|
@ -47,6 +47,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||
import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity.LOADED_MISSILE;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity.MISSILE_COUNT;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.COAX_HEAT;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity.HEAT;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity.AMMO;
|
||||
|
@ -259,7 +260,7 @@ public class VehicleHudOverlay {
|
|||
double heat = 1 - bmp2.getEntityData().get(COAX_HEAT) / 100.0F;
|
||||
guiGraphics.drawString(mc.font, Component.literal(" 7.62MM ПКТ " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp2.getAmmoCount(player))), w / 2 - 33, h - 65, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false);
|
||||
} else {
|
||||
guiGraphics.drawString(mc.font, Component.literal(" 9M113 " + bmp2.getEntityData().get(LOADED_MISSILE) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp2.getAmmoCount(player))), w / 2 - 33, h - 65, 0x66FF00, false);
|
||||
guiGraphics.drawString(mc.font, Component.literal(" 9M113 " + bmp2.getEntityData().get(LOADED_MISSILE) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp2.getEntityData().get(MISSILE_COUNT))), w / 2 - 33, h - 65, 0x66FF00, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ public class VehicleHudOverlay {
|
|||
double heat2 = bmp201.getEntityData().get(COAX_HEAT) / 100.0F;
|
||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("7.62MM ПКТ " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp201.getAmmoCount(player))), 30, -9, Mth.hsvToRgb(0F, (float) heat2, 1.0F), false);
|
||||
} else {
|
||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("9M113 " + bmp201.getEntityData().get(LOADED_MISSILE) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp201.getAmmoCount(player))), 30, -9, -1, false);
|
||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("9M113 " + bmp201.getEntityData().get(LOADED_MISSILE) + " " + (InventoryTool.hasCreativeAmmoBox(player) ? "∞" : bmp201.getEntityData().get(MISSILE_COUNT))), 30, -9, -1, false);
|
||||
}
|
||||
}
|
||||
// YX-100
|
||||
|
|
|
@ -63,7 +63,7 @@ public class VehicleMgHudOverlay {
|
|||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
if (player.getVehicle() instanceof LandArmorEntity iLand && iLand instanceof WeaponVehicleEntity && iLand instanceof MobileVehicleEntity mobileVehicle) {
|
||||
if (player.getVehicle() instanceof LandArmorEntity iLand && iLand instanceof WeaponVehicleEntity weaponVehicle && iLand instanceof MobileVehicleEntity mobileVehicle && weaponVehicle.hasWeapon(mobileVehicle.getSeatIndex(player))) {
|
||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle) {
|
||||
float fovAdjust = (float) 70 / Minecraft.getInstance().options.fov().get();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
public static final EntityDataAccessor<Integer> COAX_HEAT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> LOADED_MISSILE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Integer> MISSILE_COUNT = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.INT);
|
||||
public static final EntityDataAccessor<Float> TRACK_L = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
||||
public static final EntityDataAccessor<Float> TRACK_R = SynchedEntityData.defineId(Bmp2Entity.class, EntityDataSerializers.FLOAT);
|
||||
|
||||
|
@ -129,6 +129,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
this.entityData.define(HEAT, 0);
|
||||
this.entityData.define(COAX_HEAT, 0);
|
||||
this.entityData.define(LOADED_MISSILE, 0);
|
||||
this.entityData.define(MISSILE_COUNT, 0);
|
||||
this.entityData.define(TRACK_L, 0f);
|
||||
this.entityData.define(TRACK_R, 0f);
|
||||
}
|
||||
|
@ -318,8 +319,10 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
} else if (getWeaponIndex(0) == 1) {
|
||||
this.entityData.set(AMMO, ammoCount);
|
||||
} else {
|
||||
this.entityData.set(AMMO, countItem(ModItems.WIRE_GUIDE_MISSILE.get()));
|
||||
this.entityData.set(AMMO, this.getEntityData().get(LOADED_MISSILE));
|
||||
}
|
||||
|
||||
this.entityData.set(MISSILE_COUNT, countItem(ModItems.WIRE_GUIDE_MISSILE.get()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -910,7 +910,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
@Override
|
||||
public boolean canShoot(Player player) {
|
||||
return switch (getSeatIndex(player)) {
|
||||
case 0 -> this.entityData.get(LOADED_AMMO) > 0;
|
||||
case 0 -> this.entityData.get(LOADED_AMMO) > 0 && getEnergy() > 10000;
|
||||
case 1 -> (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire;
|
||||
default -> false;
|
||||
};
|
||||
|
@ -918,7 +918,13 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
|
||||
@Override
|
||||
public int getAmmoCount(Player player) {
|
||||
return this.entityData.get(LOADED_AMMO);
|
||||
if (player == getNthEntity(0)) {
|
||||
return this.entityData.get(LOADED_AMMO);
|
||||
}
|
||||
if (player == getNthEntity(1)) {
|
||||
return this.entityData.get(MG_AMMO);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue