45 lines
1.9 KiB
Java
45 lines
1.9 KiB
Java
package com.r3944realms.modernlifepatch;
|
|
|
|
import net.minecraft.server.packs.repository.Pack;
|
|
import net.minecraft.server.packs.repository.PackSource;
|
|
import net.minecraftforge.event.AddPackFindersEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.ModList;
|
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
|
import net.minecraftforge.forgespi.locating.IModFile;
|
|
import net.minecraftforge.resource.PathResourcePack;
|
|
|
|
import java.nio.file.Path;
|
|
|
|
public abstract class CommonEventHandler {
|
|
// @net.minecraftforge.fml.common.Mod.EventBusSubscriber(bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.FORGE, modid = ModernLifePatch.MOD_ID)
|
|
public static class Game extends CommonEventHandler {
|
|
|
|
}
|
|
@net.minecraftforge.fml.common.Mod.EventBusSubscriber(bus = net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus.MOD, modid = ModernLifePatch.MOD_ID)
|
|
public static class Mod extends CommonEventHandler {
|
|
@SubscribeEvent
|
|
public static void onCommonSetup(FMLCommonSetupEvent event) {
|
|
event.enqueueWork(() -> {
|
|
|
|
});
|
|
}
|
|
@SubscribeEvent
|
|
public static void onRegisterResourcePack(AddPackFindersEvent event) {
|
|
IModFile modFile = ModList.get().getModFileById(ModernLifePatch.MOD_ID).getFile();
|
|
Path modFilePath = modFile.findResource("resourcepacks/modernlifepatch");
|
|
event.addRepositorySource((consumer, packConstructor) -> {
|
|
Pack pack = Pack.create(
|
|
"Modern Life Patch",
|
|
true,
|
|
() -> new PathResourcePack(ModernLifePatch.MOD_ID, modFilePath),
|
|
packConstructor,
|
|
Pack.Position.TOP,
|
|
PackSource.BUILT_IN
|
|
);
|
|
if(pack != null) consumer.accept(pack);
|
|
});
|
|
}
|
|
}
|
|
}
|