46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package dev.micle.totemofreviving;
|
|
|
|
import dev.micle.totemofreviving.proxy.IProxy;
|
|
import dev.micle.totemofreviving.proxy.Proxy;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.neoforged.api.distmarker.Dist;
|
|
import net.neoforged.bus.api.IEventBus;
|
|
import net.neoforged.fml.ModContainer;
|
|
import net.neoforged.fml.ModList;
|
|
import net.neoforged.fml.common.Mod;
|
|
import net.neoforged.fml.loading.FMLEnvironment;
|
|
|
|
import java.util.Optional;
|
|
|
|
@Mod(TotemOfReviving.MOD_ID)
|
|
public final class TotemOfReviving {
|
|
public static final String MOD_ID = "totem_of_reviving";
|
|
|
|
private static IProxy proxy;
|
|
|
|
public TotemOfReviving(IEventBus modEventBus, ModContainer modContainer) {
|
|
proxy = FMLEnvironment.dist == Dist.CLIENT
|
|
? new Proxy.Client(modEventBus, modContainer)
|
|
: new Proxy.Server(modEventBus, modContainer);
|
|
}
|
|
|
|
public static ResourceLocation createResourceLocation(String name) {
|
|
if (name.contains(":")) {
|
|
throw new IllegalArgumentException("Name contains namespace");
|
|
}
|
|
return ResourceLocation.fromNamespaceAndPath(MOD_ID, name);
|
|
}
|
|
|
|
public static String getVersion() {
|
|
Optional<? extends ModContainer> optional = ModList.get().getModContainerById(MOD_ID);
|
|
if (optional.isPresent()) {
|
|
return optional.get().getModInfo().getVersion().toString();
|
|
}
|
|
return "0.0.0";
|
|
}
|
|
|
|
public static IProxy getProxy() {
|
|
return proxy;
|
|
}
|
|
}
|