Update to 1.17 and remove LibCD support

This commit is contained in:
JFronny 2021-05-29 22:48:51 +02:00
parent 40804d4a00
commit 37d74294b1
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
7 changed files with 16 additions and 59 deletions

View File

@ -1,6 +1,6 @@
# Respackopts
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)
# 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.\
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)
### 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
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.\

View File

@ -16,16 +16,12 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// 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 "io.github.cottonmc:LibCD:3.0.3+1.16.3"
modImplementation("grondag:canvas-mc116:+") {
exclude(group: "io.github.prospector")
modApi("me.shedaniel.cloth:cloth-config-fabric:5.+")
modImplementation("grondag:canvas-mc117-1.17:+") {
exclude(group: "me.shedaniel.cloth")
}
}

View File

@ -2,8 +2,8 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.6
minecraft_version=1.17-pre1
yarn_mappings=1.17-pre1+build.6
loader_version=0.11.3
# Mod Properties
mod_version=1.4.2
@ -11,7 +11,7 @@ maven_group=io.gitlab.jfronny
archives_base_name=respackopts
modrinth_id=TiF5QWZY
modrinth_required_dependencies=Gz5wa6j2
modrinth_required_dependencies=EDbIonje
modrinth_optional_dependencies=
curseforge_id=430090
curseforge_required_dependencies=cloth-config, modmenu

View File

@ -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");
});
}
}

View File

@ -1,8 +1,8 @@
package io.gitlab.jfronny.respackopts.mixin;
import io.gitlab.jfronny.respackopts.Respackopts;
import net.minecraft.client.gui.screen.options.OptionsScreen;
import net.minecraft.client.options.GameOptions;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.option.GameOptions;
import net.minecraft.resource.ResourcePackManager;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;

View File

@ -17,9 +17,10 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PackListWidget.ResourcePackEntry.class)
public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidget.Entry<PackListWidget.ResourcePackEntry> {
@Shadow private PackListWidget widget;
@Final @Shadow private PackListWidget widget;
@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) {
MinecraftClient client = MinecraftClient.getInstance();
client.getTextureManager().bindTexture(texture);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderColor(1, 1, 1, 1f);
RenderSystem.setShaderTexture(0, texture);
RenderSystem.disableDepthTest();
int adjustedV = v;
if (hovered) {
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();
}
}

View File

@ -18,9 +18,6 @@
"modmenu": [
"io.gitlab.jfronny.respackopts.integration.ModMenuCompat"
],
"libcd:conditions": [
"io.gitlab.jfronny.respackopts.integration.LibCDCompat"
],
"frex": [
"io.gitlab.jfronny.respackopts.integration.FrexCompat"
]