添加Jade联动
This commit is contained in:
parent
66333b050e
commit
52b9888543
6 changed files with 96 additions and 7 deletions
13
build.gradle
13
build.gradle
|
@ -89,6 +89,9 @@ repositories {
|
|||
}
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,19 +104,25 @@ dependencies {
|
|||
|
||||
implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20.1:4.4.6')
|
||||
|
||||
// 可选mod依赖
|
||||
|
||||
// JEI相关
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
|
||||
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
|
||||
// at runtime, use the full JEI jar for Forge
|
||||
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
|
||||
|
||||
// Cloth Config相关
|
||||
implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}")
|
||||
|
||||
// Jade相关
|
||||
implementation fg.deobf("curse.maven:jade-324717:${jade_version}")
|
||||
|
||||
// 测试用mod
|
||||
implementation fg.deobf("curse.maven:oculus-581495:6020952")
|
||||
implementation fg.deobf("curse.maven:embeddium-908741:5681725")
|
||||
|
||||
implementation fg.deobf("curse.maven:timeless-and-classics-zero-1028108:6069384")
|
||||
|
||||
implementation fg.deobf("curse.maven:create-328085:5838779")
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ org.gradle.jvmargs=-Xmx3G
|
|||
org.gradle.daemon=false
|
||||
|
||||
minecraft_version_range=[1.20.1,1.21)
|
||||
minecraft_version=1.20.1
|
||||
forge_version=47.2.0
|
||||
forge_version_range=[47,)
|
||||
loader_version_range=[47,)
|
||||
|
@ -10,8 +11,10 @@ mod_id=superbwarfare
|
|||
mod_name=Superb Warfare
|
||||
mod_license=GNU General Public License v3.0
|
||||
mod_description=A Warfare Mod
|
||||
minecraft_version=1.20.1
|
||||
jei_version=15.2.0.27
|
||||
cloth_config_version=11.1.106
|
||||
mod_version=0.5.6
|
||||
mod_authors=Atsuishio, Roki27, Light_Quanta
|
||||
|
||||
# dependencies
|
||||
jei_version=15.2.0.27
|
||||
cloth_config_version=11.1.106
|
||||
jade_version=4681833
|
|
@ -0,0 +1,23 @@
|
|||
package com.atsuishio.superbwarfare.compat.jade;
|
||||
|
||||
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.EnergyVehicleProvider;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.EnergyVehicleEntity;
|
||||
import snownee.jade.api.IWailaClientRegistration;
|
||||
import snownee.jade.api.IWailaCommonRegistration;
|
||||
import snownee.jade.api.IWailaPlugin;
|
||||
import snownee.jade.api.WailaPlugin;
|
||||
|
||||
|
||||
@WailaPlugin
|
||||
public class SbwJadePlugin implements IWailaPlugin {
|
||||
@Override
|
||||
public void register(IWailaCommonRegistration registration) {
|
||||
registration.registerEntityDataProvider(EnergyVehicleProvider.INSTANCE, EnergyVehicleEntity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerClient(IWailaClientRegistration registration) {
|
||||
registration.registerEntityComponent(EnergyVehicleProvider.INSTANCE, EnergyVehicleEntity.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.compat.jade.providers;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.EnergyVehicleEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import snownee.jade.api.EntityAccessor;
|
||||
import snownee.jade.api.IEntityComponentProvider;
|
||||
import snownee.jade.api.IServerDataProvider;
|
||||
import snownee.jade.api.ITooltip;
|
||||
import snownee.jade.api.config.IPluginConfig;
|
||||
|
||||
public enum EnergyVehicleProvider implements IEntityComponentProvider,
|
||||
IServerDataProvider<EntityAccessor> {
|
||||
INSTANCE;
|
||||
|
||||
private static final ResourceLocation ID = new ResourceLocation(ModUtils.MODID, "energy_vehicle");
|
||||
|
||||
|
||||
@Override
|
||||
public void appendTooltip(
|
||||
ITooltip tooltip,
|
||||
EntityAccessor accessor,
|
||||
IPluginConfig config
|
||||
) {
|
||||
// TODO 正确实现能量显示
|
||||
if (!accessor.getServerData().contains("Energy")) return;
|
||||
|
||||
tooltip.add(
|
||||
Component.translatable(
|
||||
accessor.getServerData().getInt("Energy")
|
||||
+ " / "
|
||||
+ accessor.getServerData().getInt("MaxEnergy")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerData(CompoundTag data, EntityAccessor accessor) {
|
||||
var vehicle = (EnergyVehicleEntity) accessor.getEntity();
|
||||
data.putInt("Energy", vehicle.getEnergy());
|
||||
data.putInt("MaxEnergy", vehicle.getMaxEnergy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getUid() {
|
||||
return ID;
|
||||
}
|
||||
}
|
|
@ -520,5 +520,7 @@
|
|||
"des.superbwarfare.tips.ammo_type.rocket": "ROCKET",
|
||||
|
||||
"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."
|
||||
"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"
|
||||
}
|
|
@ -520,5 +520,7 @@
|
|||
"des.superbwarfare.tips.ammo_type.rocket": "ROCKET",
|
||||
|
||||
"jei.superbwarfare.ancient_cpu": "神秘的古代科技,可以在古城找到。",
|
||||
"jei.superbwarfare.charging_station": "使用燃料或食物进行发电,也可以接收主动输入的FE能量。能够为相邻的方块提供FE能量,为周围一定范围内的可充能载具充能。"
|
||||
"jei.superbwarfare.charging_station": "使用燃料或食物进行发电,也可以接收主动输入的FE能量。能够为相邻的方块提供FE能量,为周围一定范围内的可充能载具充能。",
|
||||
|
||||
"config.jade.plugin_superbwarfare.energy_vehicle": "能量载具"
|
||||
}
|
Loading…
Add table
Reference in a new issue