添加载具血量Jade显示
This commit is contained in:
parent
52b9888543
commit
9e924a0602
4 changed files with 41 additions and 2 deletions
|
@ -2,7 +2,9 @@ package com.atsuishio.superbwarfare.compat.jade;
|
|||
|
||||
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.EnergyVehicleProvider;
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.VehicleHealthProvider;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.EnergyVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
||||
import snownee.jade.api.IWailaClientRegistration;
|
||||
import snownee.jade.api.IWailaCommonRegistration;
|
||||
import snownee.jade.api.IWailaPlugin;
|
||||
|
@ -18,6 +20,7 @@ public class SbwJadePlugin implements IWailaPlugin {
|
|||
|
||||
@Override
|
||||
public void registerClient(IWailaClientRegistration registration) {
|
||||
registration.registerEntityComponent(VehicleHealthProvider.INSTANCE, VehicleEntity.class);
|
||||
registration.registerEntityComponent(EnergyVehicleProvider.INSTANCE, EnergyVehicleEntity.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.atsuishio.superbwarfare.compat.jade.providers;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import snownee.jade.api.EntityAccessor;
|
||||
import snownee.jade.api.IEntityComponentProvider;
|
||||
import snownee.jade.api.ITooltip;
|
||||
import snownee.jade.api.config.IPluginConfig;
|
||||
import snownee.jade.impl.ui.HealthElement;
|
||||
|
||||
public enum VehicleHealthProvider implements IEntityComponentProvider {
|
||||
INSTANCE;
|
||||
|
||||
private static final ResourceLocation ID = new ResourceLocation(ModUtils.MODID, "vehicle_health");
|
||||
|
||||
public void appendTooltip(ITooltip tooltip, EntityAccessor accessor, IPluginConfig config) {
|
||||
// 对EntityHealthProvider的拙劣模仿
|
||||
|
||||
var vehicle = (VehicleEntity) accessor.getEntity();
|
||||
float health = vehicle.getHealth();
|
||||
float maxHealth = vehicle.getMaxHealth();
|
||||
tooltip.add(new HealthElement(maxHealth, health));
|
||||
}
|
||||
|
||||
public ResourceLocation getUid() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getDefaultPriority() {
|
||||
return -4501;
|
||||
}
|
||||
}
|
||||
|
|
@ -522,5 +522,6 @@
|
|||
"jei.superbwarfare.ancient_cpu": "Mysterious ancient technology, can be found at ancient cities.",
|
||||
"jei.superbwarfare.charging_station": "Generates power by consuming fuel or food, and can also accept FE energy input. This block supplies FE energy to adjacent blocks, and can also charge rechargeable vehicles within range.",
|
||||
|
||||
"config.jade.plugin_superbwarfare.energy_vehicle": "Energy Vehicle"
|
||||
"config.jade.plugin_superbwarfare.energy_vehicle": "Energy Vehicle",
|
||||
"config.jade.plugin_superbwarfare.vehicle_health": "Vehicle Health"
|
||||
}
|
|
@ -522,5 +522,6 @@
|
|||
"jei.superbwarfare.ancient_cpu": "神秘的古代科技,可以在古城找到。",
|
||||
"jei.superbwarfare.charging_station": "使用燃料或食物进行发电,也可以接收主动输入的FE能量。能够为相邻的方块提供FE能量,为周围一定范围内的可充能载具充能。",
|
||||
|
||||
"config.jade.plugin_superbwarfare.energy_vehicle": "能量载具"
|
||||
"config.jade.plugin_superbwarfare.energy_vehicle": "能量载具",
|
||||
"config.jade.plugin_superbwarfare.vehicle_health": "载具血量"
|
||||
}
|
Loading…
Add table
Reference in a new issue