Initial port of 1.18.2-2.0.2 to 1.19.2.
This commit is contained in:
54
src/main/java/dev/micle/totemofreviving/TotemOfReviving.java
Normal file
54
src/main/java/dev/micle/totemofreviving/TotemOfReviving.java
Normal file
@ -0,0 +1,54 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user