添加通用方法

This commit is contained in:
17146 2025-06-03 16:27:37 +08:00 committed by Light_Quanta
parent ba553a76d0
commit 0333ee50eb
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 9 additions and 8 deletions

View file

@ -1,7 +1,5 @@
package com.atsuishio.superbwarfare.client; package com.atsuishio.superbwarfare.client;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.WheelChairEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.item.ContainerBlockItem; import com.atsuishio.superbwarfare.item.ContainerBlockItem;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -40,13 +38,8 @@ public class ContainerItemDecorator implements IItemDecorator {
var entity = entityType.create(level); var entity = entityType.create(level);
if (!(entity instanceof VehicleEntity vehicle)) return false; if (!(entity instanceof VehicleEntity vehicle)) return false;
ResourceLocation icon = null;
// TODO 给每一个载具加上item icon // TODO 给每一个载具加上item icon
if (vehicle instanceof WheelChairEntity) { ResourceLocation icon = vehicle.getVehicleItemIcon();
icon = Mod.loc("textures/item/perk/beast_bullet.png");
}
if (icon == null) return false; if (icon == null) return false;
var pose = guiGraphics.pose(); var pose = guiGraphics.pose();

View file

@ -1030,6 +1030,14 @@ public abstract class VehicleEntity extends Entity {
return original; return original;
} }
/**
* 载具在集装箱物品上显示的贴图
*/
@Nullable
public ResourceLocation getVehicleItemIcon() {
return null;
}
/** /**
* 渲染载具的第一人称UI * 渲染载具的第一人称UI
* 务必标记 @OnlyIn(Dist.CLIENT) ! * 务必标记 @OnlyIn(Dist.CLIENT) !