27 lines
973 B
Java
27 lines
973 B
Java
package io.gitlab.jfronny.libjf.test;
|
|
|
|
import io.gitlab.jfronny.libjf.data.UserResourceEvents;
|
|
import net.fabricmc.api.ModInitializer;
|
|
import net.minecraft.resource.AbstractFileResourcePack;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
public class Entrypoint implements ModInitializer {
|
|
@Override
|
|
public void onInitialize() {
|
|
// This should prevent resource packs from doing anything if my hooks are working and
|
|
UserResourceEvents.OPEN.register((type, id, previous, pack) -> {
|
|
if (TestMod.disablePacks && pack.getUnderlying() instanceof AbstractFileResourcePack) {
|
|
throw new FileNotFoundException();
|
|
}
|
|
return previous;
|
|
});
|
|
UserResourceEvents.CONTAINS.register((type, id, previous, pack) -> {
|
|
if (TestMod.disablePacks && pack.getUnderlying() instanceof AbstractFileResourcePack) {
|
|
return false;
|
|
}
|
|
return previous;
|
|
});
|
|
}
|
|
}
|