Update to 1.17 and remove LibCD support
This commit is contained in:
parent
40804d4a00
commit
37d74294b1
|
@ -1,6 +1,6 @@
|
||||||
# Respackopts
|
# Respackopts
|
||||||
Respackopts provides resource packs with config menus\
|
Respackopts provides resource packs with config menus\
|
||||||
By default it integrates with frex (canvas shaders, currently requires the latest development release) and libcd (use this as reference)\
|
By default it integrates with frex (canvas shaders, currently requires the latest development release) and provides a custom system for conditional resources\
|
||||||
An example for the frex/canvas integration can be found [here](https://gitlab.com/jfmods/respackopts/-/tree/master/run/resourcepacks/lumi)
|
An example for the frex/canvas integration can be found [here](https://gitlab.com/jfmods/respackopts/-/tree/master/run/resourcepacks/lumi)
|
||||||
|
|
||||||
# Using Respackopts
|
# Using Respackopts
|
||||||
|
@ -38,10 +38,6 @@ You can always check whether it was properly loaded by checking if `respackopts_
|
||||||
Values can be accessed with `{packId}_{entryId}` for basic elements.\
|
Values can be accessed with `{packId}_{entryId}` for basic elements.\
|
||||||
Enum values can be accessed with `{packId}_{entryId}_{enumKey}`.\
|
Enum values can be accessed with `{packId}_{entryId}_{enumKey}`.\
|
||||||
Examples of using these are available [here](https://gitlab.com/jfmods/respackopts/-/tree/master/run/resourcepacks/lumi)
|
Examples of using these are available [here](https://gitlab.com/jfmods/respackopts/-/tree/master/run/resourcepacks/lumi)
|
||||||
### LibCD
|
|
||||||
The LibCD integration defines a condition named `respackopts:cfg` that takes a string describing the location of a bool as `{packId}:{entryId}`
|
|
||||||
|
|
||||||
There have been issues with LibCD in development, so it might be smart not to use it.
|
|
||||||
### Conditional resources
|
### Conditional resources
|
||||||
Respackopts allows creating conditional resources by creating a file named `{targetFile}.rpo`.\
|
Respackopts allows creating conditional resources by creating a file named `{targetFile}.rpo`.\
|
||||||
This file is a json file that contains an array named "conditions". The resource will be ignored if any of the conditions are not met.\
|
This file is a json file that contains an array named "conditions". The resource will be ignored if any of the conditions are not met.\
|
||||||
|
|
12
build.gradle
12
build.gradle
|
@ -16,16 +16,12 @@ dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.34.2+1.16"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:0.34.8+1.17"
|
||||||
|
|
||||||
modImplementation "com.terraformersmc:modmenu:1.16.9"
|
modImplementation "com.terraformersmc:modmenu:2.0.0-beta.5"
|
||||||
|
|
||||||
modApi("me.shedaniel.cloth:cloth-config-fabric:4.+")
|
modApi("me.shedaniel.cloth:cloth-config-fabric:5.+")
|
||||||
|
modImplementation("grondag:canvas-mc117-1.17:+") {
|
||||||
modApi "io.github.cottonmc:LibCD:3.0.3+1.16.3"
|
|
||||||
|
|
||||||
modImplementation("grondag:canvas-mc116:+") {
|
|
||||||
exclude(group: "io.github.prospector")
|
|
||||||
exclude(group: "me.shedaniel.cloth")
|
exclude(group: "me.shedaniel.cloth")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,8 +2,8 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.16.5
|
minecraft_version=1.17-pre1
|
||||||
yarn_mappings=1.16.5+build.6
|
yarn_mappings=1.17-pre1+build.6
|
||||||
loader_version=0.11.3
|
loader_version=0.11.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.4.2
|
mod_version=1.4.2
|
||||||
|
@ -11,7 +11,7 @@ maven_group=io.gitlab.jfronny
|
||||||
archives_base_name=respackopts
|
archives_base_name=respackopts
|
||||||
|
|
||||||
modrinth_id=TiF5QWZY
|
modrinth_id=TiF5QWZY
|
||||||
modrinth_required_dependencies=Gz5wa6j2
|
modrinth_required_dependencies=EDbIonje
|
||||||
modrinth_optional_dependencies=
|
modrinth_optional_dependencies=
|
||||||
curseforge_id=430090
|
curseforge_id=430090
|
||||||
curseforge_required_dependencies=cloth-config, modmenu
|
curseforge_required_dependencies=cloth-config, modmenu
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package io.gitlab.jfronny.respackopts.integration;
|
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import io.github.cottonmc.libcd.api.CDSyntaxError;
|
|
||||||
import io.github.cottonmc.libcd.api.condition.ConditionManager;
|
|
||||||
import io.github.cottonmc.libcd.api.init.ConditionInitializer;
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
|
||||||
import io.gitlab.jfronny.respackopts.filters.conditions.ConditionEvaluator;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
public class LibCDCompat implements ConditionInitializer {
|
|
||||||
@Override
|
|
||||||
public void initConditions(ConditionManager conditionManager) {
|
|
||||||
conditionManager.registerCondition(new Identifier(Respackopts.ID, "cfg"), q -> {
|
|
||||||
if (q instanceof String) {
|
|
||||||
try {
|
|
||||||
return ConditionEvaluator.evaluate((String) q);
|
|
||||||
} catch (Throwable error) {
|
|
||||||
throw new CDSyntaxError(error.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (q instanceof JsonElement) {
|
|
||||||
try {
|
|
||||||
return ConditionEvaluator.evaluate((JsonElement) q);
|
|
||||||
} catch (Throwable error) {
|
|
||||||
throw new CDSyntaxError(error.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new CDSyntaxError("Expected Json element or string for rpo libcd conditions");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
package io.gitlab.jfronny.respackopts.mixin;
|
package io.gitlab.jfronny.respackopts.mixin;
|
||||||
|
|
||||||
import io.gitlab.jfronny.respackopts.Respackopts;
|
import io.gitlab.jfronny.respackopts.Respackopts;
|
||||||
import net.minecraft.client.gui.screen.options.OptionsScreen;
|
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||||
import net.minecraft.client.options.GameOptions;
|
import net.minecraft.client.option.GameOptions;
|
||||||
import net.minecraft.resource.ResourcePackManager;
|
import net.minecraft.resource.ResourcePackManager;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
|
@ -17,9 +17,10 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(PackListWidget.ResourcePackEntry.class)
|
@Mixin(PackListWidget.ResourcePackEntry.class)
|
||||||
public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidget.Entry<PackListWidget.ResourcePackEntry> {
|
public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidget.Entry<PackListWidget.ResourcePackEntry> {
|
||||||
@Shadow private PackListWidget widget;
|
@Final @Shadow private PackListWidget widget;
|
||||||
|
|
||||||
@Shadow protected abstract boolean isSelectable();
|
@Shadow protected abstract boolean isSelectable();
|
||||||
|
|
||||||
|
@ -54,15 +55,15 @@ public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidg
|
||||||
}
|
}
|
||||||
|
|
||||||
private void respackopts$renderButton(MatrixStack matrices, boolean hovered, Identifier texture, int x, int y, int width, int height, int u, int v, int uWidth, int vHeight) {
|
private void respackopts$renderButton(MatrixStack matrices, boolean hovered, Identifier texture, int x, int y, int width, int height, int u, int v, int uWidth, int vHeight) {
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
RenderSystem.setShaderColor(1, 1, 1, 1f);
|
||||||
client.getTextureManager().bindTexture(texture);
|
RenderSystem.setShaderTexture(0, texture);
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
int adjustedV = v;
|
int adjustedV = v;
|
||||||
if (hovered) {
|
if (hovered) {
|
||||||
adjustedV += height;
|
adjustedV += height;
|
||||||
}
|
}
|
||||||
DrawableHelper.drawTexture(matrices, x, y, u, (float)adjustedV, width, height, uWidth, vHeight);
|
|
||||||
|
DrawableHelper.drawTexture(matrices, x, y, u, adjustedV, width, height, uWidth, vHeight);
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"io.gitlab.jfronny.respackopts.integration.ModMenuCompat"
|
"io.gitlab.jfronny.respackopts.integration.ModMenuCompat"
|
||||||
],
|
],
|
||||||
"libcd:conditions": [
|
|
||||||
"io.gitlab.jfronny.respackopts.integration.LibCDCompat"
|
|
||||||
],
|
|
||||||
"frex": [
|
"frex": [
|
||||||
"io.gitlab.jfronny.respackopts.integration.FrexCompat"
|
"io.gitlab.jfronny.respackopts.integration.FrexCompat"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user