59 lines
1.8 KiB
Java
Executable File
59 lines
1.8 KiB
Java
Executable File
package dev.micle.totemofreviving;
|
|
|
|
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 org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
import java.util.Optional;
|
|
import java.util.Random;
|
|
|
|
@Mod(TotemOfReviving.MOD_ID)
|
|
public final class TotemOfReviving {
|
|
public static final String MOD_ID = "totemofreviving";
|
|
public static final String MOD_NAME = "Micle's Totem of Reviving";
|
|
public static final CreativeModeTab ITEM_GROUP = new CreativeModeTab(MOD_ID) {
|
|
@Override
|
|
public ItemStack makeIcon() {
|
|
return new ItemStack(ModItems.STRAW_TOTEM.get());
|
|
}
|
|
};
|
|
|
|
public static final String RESOURCE_PREFIX = MOD_ID + ':';
|
|
|
|
public static final Random RANDOM = new Random();
|
|
public static final Logger LOGGER = LogManager.getLogger(MOD_NAME);
|
|
|
|
public static TotemOfReviving INSTANCE;
|
|
public static ISideProxy PROXY;
|
|
|
|
public TotemOfReviving() {
|
|
INSTANCE = this;
|
|
PROXY = DistExecutor.safeRunForDist(
|
|
() -> SideProxy.Client::new,
|
|
() -> SideProxy.Server::new
|
|
);
|
|
}
|
|
|
|
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 ResourceLocation createResourceLocation(String name) {
|
|
if (name.contains(":")) {
|
|
throw new IllegalArgumentException("name containes namespace");
|
|
}
|
|
return new ResourceLocation(MOD_ID, name);
|
|
}
|
|
}
|