55 lines
1.5 KiB
Java
55 lines
1.5 KiB
Java
package dev.micle.totemofreviving;
|
|
|
|
import dev.micle.totemofreviving.proxy.IProxy;
|
|
import dev.micle.totemofreviving.proxy.IProxy;
|
|
import dev.micle.totemofreviving.proxy.Proxy;
|
|
import dev.micle.totemofreviving.setup.ModItems;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.world.item.CreativeModeTab;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraftforge.fml.DistExecutor;
|
|
import net.minecraftforge.fml.ModContainer;
|
|
import net.minecraftforge.fml.ModList;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import java.util.Optional;
|
|
|
|
@Mod(TotemOfReviving.MOD_ID)
|
|
public final class TotemOfReviving {
|
|
public static final String MOD_ID = "totemofreviving";
|
|
public static final CreativeModeTab ITEM_GROUP = new CreativeModeTab(MOD_ID) {
|
|
@Override
|
|
public ItemStack makeIcon() {
|
|
return new ItemStack(ModItems.STRAW_TOTEM.get());
|
|
}
|
|
};
|
|
|
|
private static IProxy proxy;
|
|
|
|
public TotemOfReviving() {
|
|
proxy = DistExecutor.safeRunForDist(
|
|
() -> Proxy.Client::new,
|
|
() -> Proxy.Server::new
|
|
);
|
|
}
|
|
|
|
public static ResourceLocation createResourceLocation(String name) {
|
|
if (name.contains(":")) {
|
|
throw new IllegalArgumentException("Name contains namespace");
|
|
}
|
|
return new ResourceLocation(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;
|
|
}
|
|
}
|