Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kessoku runtime resources #19

Draft
wants to merge 2 commits into
base: dev/1.21
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions runtime-resources/common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apply from: rootProject.file("gradle/scripts/klib-common.gradle")

group = "band.kessoku.lib.resources"
base.archivesName = rootProject.name + "-package"

dependencies {
moduleImplementation(project(":platform-common"))
moduleImplementation(project(":base-common"))
moduleImplementation(project(":event-base-common"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package band.kessoku.lib.resources;

import band.kessoku.lib.resources.api.provider.IProvider;
import com.google.common.collect.ImmutableList;

import java.util.ArrayList;
import java.util.List;

public class KessokuResourcesManager {

private final String modid;

private final List<IProvider> providers = new ArrayList<>();

private KessokuResourcesManager(String modid) {
this.modid = modid;
}

public static KessokuResourcesManager create(String modid) {
return new KessokuResourcesManager(modid);
}

public void addProvider(IProvider provider) {
providers.add(provider);
}

public String getModid() {
return modid;
}

public List<IProvider> getProviders() {
return ImmutableList.copyOf(providers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package band.kessoku.lib.resources;

import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

public class KessokuRuntimeResources {
public static final String MOD_ID = "kessoku_runtime_resources";
public static final Marker MARKER = MarkerFactory.getMarker("[KessokuRuntimeResources]");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package band.kessoku.lib.resources.api.lifecycle;

public enum Lifecycle {

BEFORE_USER,
BEFORE_VANILLA,
AFTER_VANILLA;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package band.kessoku.lib.resources.api.lifecycle;

import band.kessoku.lib.event.api.Event;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;

import java.util.List;

public interface PackRegistryEvent {

Event<BeforeUser> BEFORE_USER = Event.of((beforeUsers -> ((type, packs) -> {
for (BeforeUser beforeUser : beforeUsers) {
beforeUser.registry(type, packs);
}
})));

Event<BeforeVanilla> BEFORE_VANILLA = Event.of((beforeVanillas -> ((type, packs) -> {
for (BeforeVanilla beforeVanilla : beforeVanillas) {
beforeVanilla.registry(type, packs);
}
})));

Event<AfterVanilla> AFTER_VANILLA = Event.of((afterVanillas -> ((type, packs) -> {
for (AfterVanilla afterVanilla : afterVanillas) {
afterVanilla.registry(type, packs);
}
})));

interface BeforeUser extends PackRegistryEvent { }
interface BeforeVanilla extends PackRegistryEvent { }
interface AfterVanilla extends PackRegistryEvent { }

void registry(ResourceType type, List<ResourcePack> packs);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package band.kessoku.lib.resources.api.provider;

import band.kessoku.lib.platform.api.Env;
import net.minecraft.util.Identifier;

public interface IProvider {

Env[] getEnv();

Identifier getId();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package band.kessoku.lib.resources.api.resourcepack;

import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourcePackInfo;
import net.minecraft.text.Text;

public interface DummyResourcePack extends ResourcePack {

Text getDisplayName();

Text getDescription();

@Override
ResourcePackInfo getInfo();

}
9 changes: 9 additions & 0 deletions runtime-resources/fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: rootProject.file("gradle/scripts/klib-fabric.gradle")

group = "band.kessoku.lib.resources"
base.archivesName = rootProject.name + "-package"

dependencies {
common(project(path: ':runtime-resources-common', configuration: 'namedElements')) { transitive false }
shadowBundle(project(path: ':runtime-resources-common', configuration: 'transformProductionFabric'))
}
9 changes: 9 additions & 0 deletions runtime-resources/neo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: rootProject.file("gradle/scripts/klib-neo.gradle")

group = "band.kessoku.lib.resources"
base.archivesName = rootProject.name + "-package"

dependencies {
common(project(path: ':runtime-resources-common', configuration: 'namedElements')) { transitive false }
shadowBundle(project(path: ':runtime-resources-common', configuration: 'transformProductionNeoForge'))
}
1 change: 1 addition & 0 deletions runtime-resources/neo/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform=neoforge
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ includeModule("keybind") // Keybind API
includeModule("config") // Config API
includeModule("entrypoint") // Entrypoint API
includeModule("entity-events") // Entity Events
includeModule("runtime-resources") // Runtime Resources


void includeWrapper(String platform) {
Expand All @@ -38,4 +39,6 @@ void includeModule(String moduleName) {
void includePlatform(String moduleName, String platform) {
include("$moduleName/$platform")
project(":$moduleName/$platform").name = "$moduleName-$platform"
}
}
include 'runtime-resources'

Loading