Compare commits

..

8 commits

12 changed files with 79 additions and 73 deletions

View file

@ -1,7 +1,7 @@
plugins {
id 'dev.architectury.loom' version '1.10-SNAPSHOT' apply false
id 'dev.architectury.loom' version '1.11-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.gradleup.shadow' version '8.3.6' apply false
}
architectury {
@ -31,6 +31,10 @@ subprojects {
// for more information about repositories.
}
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.officialMojangMappings()

View file

@ -26,9 +26,9 @@ dependencies {
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version"
// Mod implementations
modImplementation "maven.modrinth:sodium:mc1.21.8-0.7.2-fabric" // Sodium
modImplementation "maven.modrinth:sodium-extra:mc1.21.8-0.7.0+fabric" // Sodium Extra
modImplementation "maven.modrinth:sodium:mc1.21.10-0.7.2-fabric" // Sodium
modImplementation "maven.modrinth:sodium-extra:mc1.21.9-0.7.0+fabric" // Sodium Extra
modImplementation "maven.modrinth:iris:1.9.6+1.21.10-fabric" // Iris
modImplementation "maven.modrinth:distanthorizons:2.3.6-b-1.21.8" // Distant Horizons
modImplementation "maven.modrinth:controlify:2.4.2-fabric,1.21.6" // Controlify
modImplementation "maven.modrinth:distanthorizons:2.3.6-b-1.21.10" // Distant Horizons
modImplementation "maven.modrinth:controlify:2.4.2-fabric,1.21.9" // Controlify
}

View file

@ -5,6 +5,7 @@ import dev.architectury.event.events.client.ClientTickEvent;
import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
import net.trafficlunar.optionsprofiles.profiles.Profiles;
@ -17,12 +18,14 @@ public class Keybinds {
private static final KeyMapping[] PROFILE_KEYMAPPINGS = new KeyMapping[3];
public static void init() {
KeyMapping.Category category = KeyMapping.Category.register(ResourceLocation.fromNamespaceAndPath(OptionsProfilesMod.MOD_ID, "keys"));
for (int i = 0; i < PROFILE_KEYMAPPINGS.length; i++) {
PROFILE_KEYMAPPINGS[i] = new KeyMapping(
"key.optionsprofiles.profile_" + (i + 1),
InputConstants.Type.KEYSYM,
-1,
"category.optionsprofiles.keys"
category
);
KeyMappingRegistry.register(PROFILE_KEYMAPPINGS[i]);
}

View file

@ -1,5 +1,8 @@
package net.trafficlunar.optionsprofiles.gui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screens.options.controls.KeyBindsList;
import net.trafficlunar.optionsprofiles.OptionsProfilesMod;
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
import net.trafficlunar.optionsprofiles.profiles.Profiles;
@ -23,7 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggleList.Entry> {
public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggleList.OptionEntry> {
private final String profileName;
private final ProfileConfiguration profileConfiguration;
private final EditBox searchBox;
@ -100,7 +103,7 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
return 340;
}
public class OptionEntry extends Entry {
public class OptionEntry extends ContainerObjectSelectionList.Entry<OptionEntry> {
private final String key;
private final Component optionKey;
private final CycleButton<Boolean> toggleButton;
@ -134,17 +137,14 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
}
}
public void render(GuiGraphics guiGraphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
Font fontRenderer = OptionsToggleList.this.minecraft.font;
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovered, float tickDelta) {
int posX = OptionsToggleList.this.scrollBarX() - this.toggleButton.getWidth() - 10;
int posY = y - 2;
int textY = y + entryHeight / 2;
guiGraphics.drawString(fontRenderer, this.optionKey, x, textY - 9 / 2, -1);
int posY = this.getContentY() - 2;
this.toggleButton.setPosition(posX, posY);
this.toggleButton.render(guiGraphics, mouseX, mouseY, tickDelta);
guiGraphics.drawString(OptionsToggleList.this.minecraft.font, this.optionKey, this.getContentX(), this.getContentYMiddle() - 4, -1);
}
public List<? extends GuiEventListener> children() {
@ -155,9 +155,4 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
return ImmutableList.of(this.toggleButton);
}
}
public abstract static class Entry extends ContainerObjectSelectionList.Entry<OptionsToggleList.Entry> {
public Entry() {
}
}
}

View file

@ -50,8 +50,14 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
} catch (Exception e) {
OptionsProfilesMod.LOGGER.error("An error occurred when listing profiles", e);
}
// checkEntriesLoaded();
}
// public void checkEntriesLoaded() {
// this.children().forEach(ProfileEntry::checkLoaded);
// }
protected int scrollBarX() {
return super.scrollBarX() + 15;
}
@ -79,25 +85,25 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
(button) -> {
Profiles.loadProfile(profileName.getString());
OptionsProfilesMod.LOGGER.warn("[Profile '{}']: Loaded through button", profileName);
// ProfilesList.this.checkEntriesLoaded();
// button.active = false;
})
.size(75, 20)
.build();
}
public void render(GuiGraphics guiGraphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
Font fontRenderer = ProfilesList.this.minecraft.font;
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovered, float tickDelta) {
int posX = ProfilesList.this.scrollBarX() - this.loadButton.getWidth() - 10;
int posY = y - 2;
int textY = y + entryHeight / 2;
guiGraphics.drawString(fontRenderer, this.profileName, x, textY - 9 / 2, -1);
int posY = this.getContentY() - 2;
this.editButton.setPosition(posX - this.editButton.getWidth(), posY);
this.editButton.render(guiGraphics, mouseX, mouseY, tickDelta);
this.loadButton.setPosition(posX, posY);
this.loadButton.render(guiGraphics, mouseX, mouseY, tickDelta);
guiGraphics.drawString(ProfilesList.this.minecraft.font, this.profileName, this.getContentX(), this.getContentYMiddle() - 4, -1);
}
public List<? extends GuiEventListener> children() {
@ -107,5 +113,9 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
public List<? extends NarratableEntry> narratables() {
return ImmutableList.of(this.editButton, this.loadButton);
}
// protected void checkLoaded() {
// this.loadButton.active = !Profiles.isProfileLoaded(profileName.getString());
// }
}
}

View file

@ -29,7 +29,7 @@
"gui.optionsprofiles.show-profiles-button": "Show Profiles Button",
"gui.optionsprofiles.show-profiles-button.tooltip": "Toggle to remove the profiles button in Options. Access profiles through /optionsprofiles.",
"category.optionsprofiles.keys": "Options Profiles",
"key.category.optionsprofiles.keys": "Options Profiles",
"key.optionsprofiles.profile_1": "Profile 1",
"key.optionsprofiles.profile_2": "Profile 2",
"key.optionsprofiles.profile_3": "Profile 3"

View file

@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow'
id 'com.gradleup.shadow'
}
architectury {
@ -41,7 +41,7 @@ dependencies {
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
// Mod Menu API
modImplementation("com.terraformersmc:modmenu:13.0.2")
modImplementation("com.terraformersmc:modmenu:16.0.0-rc.1")
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')

View file

@ -1,34 +1,28 @@
{
"schemaVersion": 1,
"id": "optionsprofiles",
"version": "${version}",
"name": "Options Profiles",
"description": "Load and save your options from in-game.",
"authors": [
"trafficlunar"
],
"contact": {
"homepage": "https://github.com/trafficlunar/options-profiles",
"sources": "https://github.com/trafficlunar/options-profiles",
"issues": "https://github.com/trafficlunar/options-profiles/issues"
},
"license": "GNU GPL 3.0",
"icon": "assets/optionsprofiles/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"net.trafficlunar.optionsprofiles.fabric.OptionsProfilesModFabric"
],
"modmenu": [ "net.trafficlunar.optionsprofiles.fabric.ModMenuApiImpl" ]
},
"mixins": [
"optionsprofiles.mixins.json"
],
"depends": {
"fabricloader": ">=0.16.14",
"minecraft": "~1.21",
"java": ">=21",
"architectury": ">=17.0.6",
"fabric-api": "*"
}
"schemaVersion": 1,
"id": "optionsprofiles",
"version": "${version}",
"name": "Options Profiles",
"description": "Load and save your options from in-game.",
"authors": ["trafficlunar"],
"contact": {
"homepage": "https://github.com/trafficlunar/options-profiles",
"sources": "https://github.com/trafficlunar/options-profiles",
"issues": "https://github.com/trafficlunar/options-profiles/issues"
},
"license": "GNU GPL 3.0",
"icon": "assets/optionsprofiles/icon.png",
"environment": "*",
"entrypoints": {
"main": ["net.trafficlunar.optionsprofiles.fabric.OptionsProfilesModFabric"],
"modmenu": ["net.trafficlunar.optionsprofiles.fabric.ModMenuApiImpl"]
},
"mixins": ["optionsprofiles.mixins.json"],
"depends": {
"fabricloader": ">=0.17.2",
"minecraft": "~1.21",
"java": ">=21",
"architectury": ">=18.0.3",
"fabric-api": "*"
}
}

View file

@ -11,10 +11,10 @@ archives_name=optionsprofiles
enabled_platforms=fabric,neoforge
# Minecraft properties
minecraft_version=1.21.6
minecraft_version=1.21.9
# Dependencies
architectury_api_version = 17.0.6
fabric_loader_version=0.16.14
fabric_api_version=0.128.2+1.21.6
neoforge_version=21.6.20-beta
architectury_api_version = 18.0.3
fabric_loader_version=0.17.2
fabric_api_version=0.134.0+1.21.9
neoforge_version=21.9.0-beta

View file

@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow'
id 'com.gradleup.shadow'
}
architectury {

View file

@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[2,)"
loaderVersion = "[10,)"
issueTrackerURL = "https://github.com/trafficlunar/options-profiles/issues"
license = "GNU GPL 3.0"
@ -16,7 +16,7 @@ logoFile = "icon.png"
[[dependencies.optionsprofiles]]
modId = "neoforge"
type = "required"
versionRange = "[21.6,)"
versionRange = "[21.9.0-beta,)"
ordering = "NONE"
side = "BOTH"
@ -30,7 +30,7 @@ side = "BOTH"
[[dependencies.optionsprofiles]]
modId = "architectury"
type = "required"
versionRange = "[17.0.6,)"
versionRange = "[18.0.3,)"
ordering = "AFTER"
side = "BOTH"

View file

@ -11,4 +11,4 @@ include("common")
include("fabric")
include("neoforge")
rootProject.name = "optionsprofiles-v1.4.4-1.21.6"
rootProject.name = "optionsprofiles-v1.4.4-1.21.9"