Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8aed964fa4 | |||
| e5223a5aeb | |||
| 226a43c8dd | |||
| c5e5bb46e4 | |||
| e5859062c6 | |||
| fbd7e633d0 | |||
| 8ced5a56c7 |
12 changed files with 73 additions and 79 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'dev.architectury.loom' version '1.11-SNAPSHOT' apply false
|
id 'dev.architectury.loom' version '1.10-SNAPSHOT' apply false
|
||||||
id 'architectury-plugin' version '3.4-SNAPSHOT'
|
id 'architectury-plugin' version '3.4-SNAPSHOT'
|
||||||
id 'com.gradleup.shadow' version '8.3.6' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
|
|
@ -31,10 +31,6 @@ subprojects {
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
|
||||||
silentMojangMappingsLicense()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.officialMojangMappings()
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ dependencies {
|
||||||
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version"
|
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version"
|
||||||
|
|
||||||
// Mod implementations
|
// Mod implementations
|
||||||
modImplementation "maven.modrinth:sodium:mc1.21.10-0.7.2-fabric" // Sodium
|
modImplementation "maven.modrinth:sodium:mc1.21.8-0.7.2-fabric" // Sodium
|
||||||
modImplementation "maven.modrinth:sodium-extra:mc1.21.9-0.7.0+fabric" // Sodium Extra
|
modImplementation "maven.modrinth:sodium-extra:mc1.21.8-0.7.0+fabric" // Sodium Extra
|
||||||
modImplementation "maven.modrinth:iris:1.9.6+1.21.10-fabric" // Iris
|
modImplementation "maven.modrinth:iris:1.9.6+1.21.10-fabric" // Iris
|
||||||
modImplementation "maven.modrinth:distanthorizons:2.3.6-b-1.21.10" // Distant Horizons
|
modImplementation "maven.modrinth:distanthorizons:2.3.6-b-1.21.8" // Distant Horizons
|
||||||
modImplementation "maven.modrinth:controlify:2.4.2-fabric,1.21.9" // Controlify
|
modImplementation "maven.modrinth:controlify:2.4.2-fabric,1.21.6" // Controlify
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import dev.architectury.event.events.client.ClientTickEvent;
|
||||||
import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
|
import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
|
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
|
||||||
import net.trafficlunar.optionsprofiles.profiles.Profiles;
|
import net.trafficlunar.optionsprofiles.profiles.Profiles;
|
||||||
|
|
||||||
|
|
@ -18,14 +17,12 @@ public class Keybinds {
|
||||||
private static final KeyMapping[] PROFILE_KEYMAPPINGS = new KeyMapping[3];
|
private static final KeyMapping[] PROFILE_KEYMAPPINGS = new KeyMapping[3];
|
||||||
|
|
||||||
public static void init() {
|
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++) {
|
for (int i = 0; i < PROFILE_KEYMAPPINGS.length; i++) {
|
||||||
PROFILE_KEYMAPPINGS[i] = new KeyMapping(
|
PROFILE_KEYMAPPINGS[i] = new KeyMapping(
|
||||||
"key.optionsprofiles.profile_" + (i + 1),
|
"key.optionsprofiles.profile_" + (i + 1),
|
||||||
InputConstants.Type.KEYSYM,
|
InputConstants.Type.KEYSYM,
|
||||||
-1,
|
-1,
|
||||||
category
|
"category.optionsprofiles.keys"
|
||||||
);
|
);
|
||||||
KeyMappingRegistry.register(PROFILE_KEYMAPPINGS[i]);
|
KeyMappingRegistry.register(PROFILE_KEYMAPPINGS[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
package net.trafficlunar.optionsprofiles.gui;
|
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.OptionsProfilesMod;
|
||||||
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
|
import net.trafficlunar.optionsprofiles.profiles.ProfileConfiguration;
|
||||||
import net.trafficlunar.optionsprofiles.profiles.Profiles;
|
import net.trafficlunar.optionsprofiles.profiles.Profiles;
|
||||||
|
|
@ -26,7 +23,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggleList.OptionEntry> {
|
public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggleList.Entry> {
|
||||||
private final String profileName;
|
private final String profileName;
|
||||||
private final ProfileConfiguration profileConfiguration;
|
private final ProfileConfiguration profileConfiguration;
|
||||||
private final EditBox searchBox;
|
private final EditBox searchBox;
|
||||||
|
|
@ -103,7 +100,7 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
|
||||||
return 340;
|
return 340;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OptionEntry extends ContainerObjectSelectionList.Entry<OptionEntry> {
|
public class OptionEntry extends Entry {
|
||||||
private final String key;
|
private final String key;
|
||||||
private final Component optionKey;
|
private final Component optionKey;
|
||||||
private final CycleButton<Boolean> toggleButton;
|
private final CycleButton<Boolean> toggleButton;
|
||||||
|
|
@ -137,14 +134,17 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
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;
|
||||||
|
|
||||||
int posX = OptionsToggleList.this.scrollBarX() - this.toggleButton.getWidth() - 10;
|
int posX = OptionsToggleList.this.scrollBarX() - this.toggleButton.getWidth() - 10;
|
||||||
int posY = this.getContentY() - 2;
|
int posY = y - 2;
|
||||||
|
int textY = y + entryHeight / 2;
|
||||||
|
|
||||||
|
guiGraphics.drawString(fontRenderer, this.optionKey, x, textY - 9 / 2, -1);
|
||||||
|
|
||||||
this.toggleButton.setPosition(posX, posY);
|
this.toggleButton.setPosition(posX, posY);
|
||||||
this.toggleButton.render(guiGraphics, mouseX, mouseY, tickDelta);
|
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() {
|
public List<? extends GuiEventListener> children() {
|
||||||
|
|
@ -155,4 +155,9 @@ public class OptionsToggleList extends ContainerObjectSelectionList<OptionsToggl
|
||||||
return ImmutableList.of(this.toggleButton);
|
return ImmutableList.of(this.toggleButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract static class Entry extends ContainerObjectSelectionList.Entry<OptionsToggleList.Entry> {
|
||||||
|
public Entry() {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -50,14 +50,8 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
OptionsProfilesMod.LOGGER.error("An error occurred when listing profiles", e);
|
OptionsProfilesMod.LOGGER.error("An error occurred when listing profiles", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkEntriesLoaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void checkEntriesLoaded() {
|
|
||||||
// this.children().forEach(ProfileEntry::checkLoaded);
|
|
||||||
// }
|
|
||||||
|
|
||||||
protected int scrollBarX() {
|
protected int scrollBarX() {
|
||||||
return super.scrollBarX() + 15;
|
return super.scrollBarX() + 15;
|
||||||
}
|
}
|
||||||
|
|
@ -85,25 +79,25 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
|
||||||
(button) -> {
|
(button) -> {
|
||||||
Profiles.loadProfile(profileName.getString());
|
Profiles.loadProfile(profileName.getString());
|
||||||
OptionsProfilesMod.LOGGER.warn("[Profile '{}']: Loaded through button", profileName);
|
OptionsProfilesMod.LOGGER.warn("[Profile '{}']: Loaded through button", profileName);
|
||||||
|
|
||||||
// ProfilesList.this.checkEntriesLoaded();
|
|
||||||
// button.active = false;
|
|
||||||
})
|
})
|
||||||
.size(75, 20)
|
.size(75, 20)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
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;
|
||||||
|
|
||||||
int posX = ProfilesList.this.scrollBarX() - this.loadButton.getWidth() - 10;
|
int posX = ProfilesList.this.scrollBarX() - this.loadButton.getWidth() - 10;
|
||||||
int posY = this.getContentY() - 2;
|
int posY = y - 2;
|
||||||
|
int textY = y + entryHeight / 2;
|
||||||
|
|
||||||
|
guiGraphics.drawString(fontRenderer, this.profileName, x, textY - 9 / 2, -1);
|
||||||
|
|
||||||
this.editButton.setPosition(posX - this.editButton.getWidth(), posY);
|
this.editButton.setPosition(posX - this.editButton.getWidth(), posY);
|
||||||
this.editButton.render(guiGraphics, mouseX, mouseY, tickDelta);
|
this.editButton.render(guiGraphics, mouseX, mouseY, tickDelta);
|
||||||
|
|
||||||
this.loadButton.setPosition(posX, posY);
|
this.loadButton.setPosition(posX, posY);
|
||||||
this.loadButton.render(guiGraphics, mouseX, mouseY, tickDelta);
|
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() {
|
public List<? extends GuiEventListener> children() {
|
||||||
|
|
@ -113,9 +107,5 @@ public class ProfilesList extends ContainerObjectSelectionList<ProfilesList.Prof
|
||||||
public List<? extends NarratableEntry> narratables() {
|
public List<? extends NarratableEntry> narratables() {
|
||||||
return ImmutableList.of(this.editButton, this.loadButton);
|
return ImmutableList.of(this.editButton, this.loadButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected void checkLoaded() {
|
|
||||||
// this.loadButton.active = !Profiles.isProfileLoaded(profileName.getString());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
"gui.optionsprofiles.show-profiles-button": "Show Profiles Button",
|
"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.",
|
"gui.optionsprofiles.show-profiles-button.tooltip": "Toggle to remove the profiles button in Options. Access profiles through /optionsprofiles.",
|
||||||
|
|
||||||
"key.category.optionsprofiles.keys": "Options Profiles",
|
"category.optionsprofiles.keys": "Options Profiles",
|
||||||
"key.optionsprofiles.profile_1": "Profile 1",
|
"key.optionsprofiles.profile_1": "Profile 1",
|
||||||
"key.optionsprofiles.profile_2": "Profile 2",
|
"key.optionsprofiles.profile_2": "Profile 2",
|
||||||
"key.optionsprofiles.profile_3": "Profile 3"
|
"key.optionsprofiles.profile_3": "Profile 3"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gradleup.shadow'
|
id 'com.github.johnrengelman.shadow'
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
|
|
@ -41,7 +41,7 @@ dependencies {
|
||||||
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
|
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
|
||||||
|
|
||||||
// Mod Menu API
|
// Mod Menu API
|
||||||
modImplementation("com.terraformersmc:modmenu:16.0.0-rc.1")
|
modImplementation("com.terraformersmc:modmenu:13.0.2")
|
||||||
|
|
||||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Options Profiles",
|
"name": "Options Profiles",
|
||||||
"description": "Load and save your options from in-game.",
|
"description": "Load and save your options from in-game.",
|
||||||
"authors": ["trafficlunar"],
|
"authors": [
|
||||||
|
"trafficlunar"
|
||||||
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://github.com/trafficlunar/options-profiles",
|
"homepage": "https://github.com/trafficlunar/options-profiles",
|
||||||
"sources": "https://github.com/trafficlunar/options-profiles",
|
"sources": "https://github.com/trafficlunar/options-profiles",
|
||||||
|
|
@ -14,15 +16,19 @@
|
||||||
"icon": "assets/optionsprofiles/icon.png",
|
"icon": "assets/optionsprofiles/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": ["net.trafficlunar.optionsprofiles.fabric.OptionsProfilesModFabric"],
|
"main": [
|
||||||
|
"net.trafficlunar.optionsprofiles.fabric.OptionsProfilesModFabric"
|
||||||
|
],
|
||||||
"modmenu": [ "net.trafficlunar.optionsprofiles.fabric.ModMenuApiImpl" ]
|
"modmenu": [ "net.trafficlunar.optionsprofiles.fabric.ModMenuApiImpl" ]
|
||||||
},
|
},
|
||||||
"mixins": ["optionsprofiles.mixins.json"],
|
"mixins": [
|
||||||
|
"optionsprofiles.mixins.json"
|
||||||
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.17.2",
|
"fabricloader": ">=0.16.14",
|
||||||
"minecraft": "~1.21",
|
"minecraft": "~1.21",
|
||||||
"java": ">=21",
|
"java": ">=21",
|
||||||
"architectury": ">=18.0.3",
|
"architectury": ">=17.0.6",
|
||||||
"fabric-api": "*"
|
"fabric-api": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ archives_name=optionsprofiles
|
||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
# Minecraft properties
|
# Minecraft properties
|
||||||
minecraft_version=1.21.9
|
minecraft_version=1.21.6
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
architectury_api_version = 18.0.3
|
architectury_api_version = 17.0.6
|
||||||
fabric_loader_version=0.17.2
|
fabric_loader_version=0.16.14
|
||||||
fabric_api_version=0.134.0+1.21.9
|
fabric_api_version=0.128.2+1.21.6
|
||||||
neoforge_version=21.9.0-beta
|
neoforge_version=21.6.20-beta
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gradleup.shadow'
|
id 'com.github.johnrengelman.shadow'
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[10,)"
|
loaderVersion = "[2,)"
|
||||||
issueTrackerURL = "https://github.com/trafficlunar/options-profiles/issues"
|
issueTrackerURL = "https://github.com/trafficlunar/options-profiles/issues"
|
||||||
license = "GNU GPL 3.0"
|
license = "GNU GPL 3.0"
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ logoFile = "icon.png"
|
||||||
[[dependencies.optionsprofiles]]
|
[[dependencies.optionsprofiles]]
|
||||||
modId = "neoforge"
|
modId = "neoforge"
|
||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[21.9.0-beta,)"
|
versionRange = "[21.6,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ side = "BOTH"
|
||||||
[[dependencies.optionsprofiles]]
|
[[dependencies.optionsprofiles]]
|
||||||
modId = "architectury"
|
modId = "architectury"
|
||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[18.0.3,)"
|
versionRange = "[17.0.6,)"
|
||||||
ordering = "AFTER"
|
ordering = "AFTER"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ include("common")
|
||||||
include("fabric")
|
include("fabric")
|
||||||
include("neoforge")
|
include("neoforge")
|
||||||
|
|
||||||
rootProject.name = "optionsprofiles-v1.4.4-1.21.9"
|
rootProject.name = "optionsprofiles-v1.4.4-1.21.6"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue