diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java index b2bfe9ea8..ace8e6b91 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java @@ -2,6 +2,8 @@ package com.atsuishio.superbwarfare.client.overlay; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.client.KillMessageConfig; +import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; +import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; import com.atsuishio.superbwarfare.event.KillMessageHandler; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; @@ -170,42 +172,85 @@ public class KillMessageOverlay { ); } + Player player = Minecraft.getInstance().player; boolean renderItem = false; int itemIconW = damageTypeIcon != null ? w - targetNameWidth - 64 : w - targetNameWidth - 46; - // 如果是枪械击杀,则渲染枪械图标 - if (record.stack.getItem() instanceof GunItem gunItem) { - renderItem = true; - ResourceLocation resourceLocation = gunItem.getGunIcon(); + if (player != null && player.getVehicle() instanceof VehicleEntity vehicleEntity) { + // 载具图标 + if ((vehicleEntity instanceof IArmedVehicleEntity iArmedVehicle && iArmedVehicle.isDriver(player) && iArmedVehicle.banHand()) || record.damageType == ModDamageTypes.VEHICLE_STRIKE) { + renderItem = true; - preciseBlit(gui, - resourceLocation, - itemIconW, - top, - 0, - 0, - 32, - 8, - -32, - 8 - ); - } + ResourceLocation resourceLocation = vehicleEntity.getVehicleIcon(); - // TODO 如果是特殊武器击杀,则渲染对应图标 - if (record.stack.getItem().getDescriptionId().equals("item.dreamaticvoyage.world_peace_staff")) { - renderItem = true; + preciseBlit(gui, + resourceLocation, + itemIconW, + top, + 0, + 0, + 32, + 8, + -32, + 8 + ); + } else { + if (record.stack.getItem() instanceof GunItem gunItem) { + renderItem = true; - preciseBlit(gui, - WORLD_PEACE_STAFF, - itemIconW, - top, - 0, - 0, - 32, - 8, - 32, - 8 - ); + ResourceLocation resourceLocation = gunItem.getGunIcon(); + + preciseBlit(gui, + resourceLocation, + itemIconW, + top, + 0, + 0, + 32, + 8, + -32, + 8 + ); + } + } + + } else { + + // 如果是枪械击杀,则渲染枪械图标 + if (record.stack.getItem() instanceof GunItem gunItem) { + renderItem = true; + + ResourceLocation resourceLocation = gunItem.getGunIcon(); + + preciseBlit(gui, + resourceLocation, + itemIconW, + top, + 0, + 0, + 32, + 8, + -32, + 8 + ); + } + + // TODO 如果是特殊武器击杀,则渲染对应图标 + if (record.stack.getItem().getDescriptionId().equals("item.dreamaticvoyage.world_peace_staff")) { + renderItem = true; + + preciseBlit(gui, + WORLD_PEACE_STAFF, + itemIconW, + top, + 0, + 0, + 32, + 8, + 32, + 8 + ); + } } // 渲染击杀者名称 diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 660ba24ae..dd5271c2e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -21,6 +21,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -778,4 +779,9 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli public int getWeaponType() { return entityData.get(WEAPON_TYPE); } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/ah_6_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java index 181efb05f..60626857d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java @@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; @@ -552,4 +553,9 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, public int zoomFov() { return 5; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/annihilator_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java index 375944d6d..310393f11 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Bmp2Entity.java @@ -23,6 +23,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -818,4 +819,9 @@ public class Bmp2Entity extends ContainerMobileEntity implements GeoEntity, ICha public int getWeaponType() { return entityData.get(WEAPON_TYPE); } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/bmp2_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 209047674..8a7795e82 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -21,6 +21,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -785,4 +786,9 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC public int getWeaponType() { return entityData.get(WEAPON_TYPE); } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/lav150_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index de41f74de..36176dbad 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -21,6 +21,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; @@ -447,4 +448,9 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit public int zoomFov() { return 5; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/sherman_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index 1486b1d36..cee24cafc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -18,6 +18,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; @@ -498,4 +499,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn public int zoomFov() { return 5; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/mle_1934_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java index 0eca1a7be..43d6d4f75 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java @@ -20,6 +20,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -568,4 +569,9 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity, public int zoomFov() { return 1; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/speedboat_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java index 92da4495e..525e70659 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity.vehicle; +import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity; @@ -16,6 +17,7 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -358,4 +360,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { public int getMaxEnergy() { return MAX_ENERGY; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/tom_6_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java index 2958ed5f4..3a407129d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity.vehicle; +import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModParticleTypes; @@ -15,6 +16,7 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -410,4 +412,8 @@ public class VehicleEntity extends Entity { return super.getDismountLocationForPassenger(passenger); } + + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/gun_icon/default_icon.png"); + } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java index e8d264c6f..380f3fd84 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/WheelChairEntity.java @@ -1,5 +1,6 @@ package com.atsuishio.superbwarfare.entity.vehicle; +import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.entity.MortarEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; @@ -13,6 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; @@ -302,4 +304,9 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity { public int getMaxEnergy() { return MAX_ENERGY; } + + @Override + public ResourceLocation getVehicleIcon() { + return ModUtils.loc("textures/vehicle_icon/wheel_chair_icon.png"); + } } diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/ah_6_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/ah_6_icon.png new file mode 100644 index 000000000..5648dbdb4 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/ah_6_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/annihilator_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/annihilator_icon.png new file mode 100644 index 000000000..f8e04e880 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/annihilator_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/bmp2_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/bmp2_icon.png new file mode 100644 index 000000000..f6b6abd07 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/bmp2_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/lav150_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/lav150_icon.png new file mode 100644 index 000000000..2345661d7 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/lav150_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/mle1934_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/mle1934_icon.png new file mode 100644 index 000000000..54b8af12c Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/mle1934_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/sherman_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/sherman_icon.png new file mode 100644 index 000000000..2995966fb Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/sherman_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/speedboat_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/speedboat_icon.png new file mode 100644 index 000000000..4eb8719c8 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/speedboat_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/tom_6_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/tom_6_icon.png new file mode 100644 index 000000000..01afbf077 Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/tom_6_icon.png differ diff --git a/src/main/resources/assets/superbwarfare/textures/vehicle_icon/wheel_chair_icon.png b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/wheel_chair_icon.png new file mode 100644 index 000000000..9368aedcc Binary files /dev/null and b/src/main/resources/assets/superbwarfare/textures/vehicle_icon/wheel_chair_icon.png differ