feat: update to 1.20.2 snapshots
This commit is contained in:
parent
a759d20064
commit
f03f1c306d
|
@ -6,8 +6,8 @@ allprojects {
|
|||
group = "io.gitlab.jfronny.libjf"
|
||||
}
|
||||
|
||||
val fabricVersion by extra("0.86.1+1.20.1")
|
||||
val commonsVersion by extra("1.3-SNAPSHOT")
|
||||
val fabricVersion by extra("0.87.1+1.20.2")
|
||||
val commonsVersion by extra("1.4-SNAPSHOT")
|
||||
val gsonCompileVersion by extra("1.3-SNAPSHOT")
|
||||
val modmenuVersion by extra("7.2.1")
|
||||
|
||||
|
@ -15,8 +15,8 @@ val annotationsVersion by extra("24.0.1")
|
|||
val javapoetVersion by extra("1.13.0")
|
||||
|
||||
jfMod {
|
||||
minecraftVersion = "1.20.1"
|
||||
yarn("build.10")
|
||||
minecraftVersion = "23w33a"
|
||||
yarn("build.3")
|
||||
loaderVersion = "0.14.22"
|
||||
|
||||
modrinth {
|
||||
|
@ -37,11 +37,18 @@ allprojects {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion") {
|
||||
exclude("net.fabricmc") // required to work around duplicate fabric loaders
|
||||
}
|
||||
// Temporarily disabled since modmenu doesn't support snapshots
|
||||
// modLocalRuntime("com.terraformersmc:modmenu:$modmenuVersion") {
|
||||
// exclude("net.fabricmc") // required to work around duplicate fabric loaders
|
||||
// }
|
||||
modLocalRuntime(fabricApi.module("fabric-command-api-v2", fabricVersion))
|
||||
compileOnly("io.gitlab.jfronny:commons:$commonsVersion")
|
||||
compileOnly("io.gitlab.jfronny:commons-gson:$commonsVersion")
|
||||
|
||||
// temporary workaround for snapshot versions since these were previously provided by modmenu. Remove once out of use!
|
||||
modLocalRuntime(fabricApi.module("fabric-resource-loader-v0", fabricVersion))
|
||||
modLocalRuntime(fabricApi.module("fabric-lifecycle-events-v1", fabricVersion))
|
||||
modLocalRuntime(fabricApi.module("fabric-screen-api-v1", fabricVersion))
|
||||
modLocalRuntime(fabricApi.module("fabric-key-binding-api-v1", fabricVersion))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.gitlab.jfronny.libjf.config.impl.ui;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
@ -13,13 +12,9 @@ public class PlaceholderScreen extends Screen {
|
|||
protected PlaceholderScreen(Screen parent) {
|
||||
super(Text.translatable("libjf-config-core-v1.no-screen"));
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context);
|
||||
context.drawCenteredTextWithShadow(textRenderer, description, width / 2, (height - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
addDrawable((context, mouseX, mouseY, delta) -> {
|
||||
context.drawCenteredTextWithShadow(textRenderer, description, width / 2, (height - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"libjf-config-core-v1.jfconfig.title": "LibJF Config",
|
||||
"libjf-config-core-v1.jfconfig.watchForChanges": "Watch for changes",
|
||||
"libjf-config-core-v1.jfconfig.watchForChanges.tooltip": "Automatically reload configs when they are changed",
|
||||
"libjf-config-v1.presets": "Presets",
|
||||
"libjf-config-v1.default": "Default",
|
||||
"libjf-config-v1.see-also": "See also: %s",
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"libjf-config-core-v1.jfconfig.title": "LibJF Config",
|
||||
"libjf-config-core-v1.jfconfig.watchForChanges": "Watch for changes",
|
||||
"libjf-config-core-v1.jfconfig.watchForChanges.tooltip": "Automatically reload configs when they are changed"
|
||||
}
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.font.TextRenderer;
|
|||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.util.NarratorManager;
|
||||
import net.minecraft.client.util.SelectionManager;
|
||||
import net.minecraft.client.util.math.Rect2i;
|
||||
|
@ -283,7 +284,7 @@ public class EditorScreen extends ScreenWithSaveHook {
|
|||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
if (subtitle == null) {
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, (HEADER_SIZE - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
} else {
|
||||
|
@ -292,9 +293,12 @@ public class EditorScreen extends ScreenWithSaveHook {
|
|||
}
|
||||
this.setFocused(null);
|
||||
|
||||
final int maxScroll = this.getMaxScroll();
|
||||
final boolean showScrollbar = maxScroll > 0;
|
||||
|
||||
if (client.world == null) {
|
||||
RenderSystem.setShaderColor(0.125f, 0.125f, 0.125f, 1.0f);
|
||||
context.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, 0, HEADER_SIZE, width - SCROLLBAR_SIZE, height - FOOTER_SIZE + (int)scrollAmount, width - SCROLLBAR_SIZE, height - HEADER_SIZE - FOOTER_SIZE, 32, 32);
|
||||
context.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, 0, HEADER_SIZE, showScrollbar ? width - SCROLLBAR_SIZE : width, height - FOOTER_SIZE + (int)scrollAmount, width - SCROLLBAR_SIZE, height - HEADER_SIZE - FOOTER_SIZE, 32, 32);
|
||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -307,20 +311,17 @@ public class EditorScreen extends ScreenWithSaveHook {
|
|||
this.drawCursor(context, pageContent.position);
|
||||
context.disableScissor();
|
||||
|
||||
int i = this.getScrollbarPositionX();
|
||||
int j = i + 6;
|
||||
int m;
|
||||
if ((m = this.getMaxScroll()) > 0) {
|
||||
int scrollbarX = this.getScrollbarPositionX();
|
||||
int scrollbarXEnd = scrollbarX + 6;
|
||||
if (showScrollbar) {
|
||||
int n = (getViewportHeight() * getViewportHeight()) / getMaxPosition();
|
||||
n = MathHelper.clamp(n, 32, getViewportHeight() - 8);
|
||||
int o = (int)scrollAmount * (getViewportHeight() - n) / m + HEADER_SIZE;
|
||||
int o = (int)scrollAmount * (getViewportHeight() - n) / maxScroll + HEADER_SIZE;
|
||||
if (o < HEADER_SIZE) o = HEADER_SIZE;
|
||||
context.fill(i, HEADER_SIZE, j, height - FOOTER_SIZE, 0xFF000000);
|
||||
context.fill(i, o, j, o + n, 0xFF808080);
|
||||
context.fill(i, o, j - 1, o + n - 1, 0xFFC0C0C0);
|
||||
context.fill(scrollbarX, HEADER_SIZE, scrollbarXEnd, height - FOOTER_SIZE, 0xFF000000);
|
||||
context.fill(scrollbarX, o, scrollbarXEnd, o + n, 0xFF808080);
|
||||
context.fill(scrollbarX, o, scrollbarXEnd - 1, o + n - 1, 0xFFC0C0C0);
|
||||
}
|
||||
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
private void drawCursor(DrawContext context, Position position) {
|
||||
|
@ -331,16 +332,13 @@ public class EditorScreen extends ScreenWithSaveHook {
|
|||
}
|
||||
|
||||
private void drawSelection(DrawContext context, Rect2i[] selectionRectangles) {
|
||||
RenderSystem.enableColorLogicOp();
|
||||
RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
|
||||
for (Rect2i rect2i : selectionRectangles) {
|
||||
int i = rect2i.getX();
|
||||
int j = rect2i.getY();
|
||||
int k = i + rect2i.getWidth();
|
||||
int l = j + rect2i.getHeight();
|
||||
context.fill(i, j, k, l, 0xFF0000FF);
|
||||
context.fill(RenderLayer.getGuiTextHighlight(), i, j, k, l, 0xFF0000FF);
|
||||
}
|
||||
RenderSystem.disableColorLogicOp();
|
||||
}
|
||||
|
||||
private Position screenPositionToAbsolutePosition(Position position) {
|
||||
|
@ -409,8 +407,8 @@ public class EditorScreen extends ScreenWithSaveHook {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
|
||||
setScrollAmount(scrollAmount - amount * textRenderer.fontHeight * 2);
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
|
||||
setScrollAmount(scrollAmount - verticalAmount * textRenderer.fontHeight * 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.client.gui.*;
|
|||
import net.minecraft.client.gui.navigation.GuiNavigation;
|
||||
import net.minecraft.client.gui.navigation.GuiNavigationPath;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class Placeholder<T extends Element & Selectable & Drawable> implements Element, Selectable, Drawable {
|
||||
|
@ -63,8 +62,8 @@ public final class Placeholder<T extends Element & Selectable & Drawable> implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
|
||||
return child.mouseScrolled(mouseX, mouseY, amount);
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
|
||||
return child.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,12 +63,6 @@ public class TinyConfigScreen extends ScreenWithSaveHook {
|
|||
&& JfConfigSafe.TRANSLATION_SUPPLIER.apply(config.getTranslationPrefix() + "tooltip") == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
tabManager.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
@ -110,7 +104,7 @@ public class TinyConfigScreen extends ScreenWithSaveHook {
|
|||
.build());
|
||||
}
|
||||
|
||||
this.addSelectableChild(this.placeholder);
|
||||
this.addDrawableChild(this.placeholder);
|
||||
|
||||
// Sizing is also done in TinyConfigTab. Keep these in sync!
|
||||
tabManager.setTabArea(new ScreenRect(0, 32, width, height - 68));
|
||||
|
@ -159,8 +153,7 @@ public class TinyConfigScreen extends ScreenWithSaveHook {
|
|||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.placeholder.render(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
if (tabs.size() == 1) context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 16 - textRenderer.fontHeight, 0xFFFFFF);
|
||||
|
||||
|
@ -184,7 +177,6 @@ public class TinyConfigScreen extends ScreenWithSaveHook {
|
|||
}
|
||||
}
|
||||
}
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -91,11 +91,6 @@ public class TinyConfigTab implements Tab {
|
|||
list.refreshGrid(tabArea);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
Tab.super.tick();
|
||||
}
|
||||
|
||||
public EntryListWidget getList() {
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ public class EntryListWidget extends ElementListWidget<EntryListWidget.ConfigEnt
|
|||
textRenderer = tr;
|
||||
background = client.world == null;
|
||||
setRenderBackground(background);
|
||||
setRenderHorizontalShadows(background);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.fabricmc.api.Environment;
|
|||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -18,7 +17,6 @@ public class PresetsScreen extends Screen {
|
|||
private final Screen parent;
|
||||
private final ConfigCategory config;
|
||||
private final Runnable afterSelect;
|
||||
private PresetListWidget list;
|
||||
|
||||
public PresetsScreen(Screen parent, ConfigCategory config, Runnable afterSelect) {
|
||||
super(Text.translatable("libjf-config-v1.presets"));
|
||||
|
@ -30,9 +28,9 @@ public class PresetsScreen extends Screen {
|
|||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
this.list = new PresetListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
|
||||
PresetListWidget list = new PresetListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
|
||||
for (Map.Entry<String, Runnable> entry : config.getPresets().entrySet()) {
|
||||
this.list.addButton(ButtonWidget.builder(Text.translatable(entry.getKey()),
|
||||
list.addButton(ButtonWidget.builder(Text.translatable(entry.getKey()),
|
||||
button -> {
|
||||
LibJf.LOGGER.info("Preset selected: " + entry.getKey());
|
||||
entry.getValue().run();
|
||||
|
@ -43,7 +41,7 @@ public class PresetsScreen extends Screen {
|
|||
.dimensions(width / 2 - 100, 0, 200, 20)
|
||||
.build());
|
||||
}
|
||||
this.addSelectableChild(this.list);
|
||||
this.addDrawableChild(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,11 +51,7 @@ public class PresetsScreen extends Screen {
|
|||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.list.render(context, mouseX, mouseY, delta);
|
||||
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 16 - textRenderer.fontHeight / 2, 0xFFFFFF);
|
||||
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 16 - textRenderer.fontHeight / 2, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package io.gitlab.jfronny.libjf.config.test.tiny.mixin;
|
||||
|
||||
import io.gitlab.jfronny.libjf.config.api.v1.ConfigHolder;
|
||||
import io.gitlab.jfronny.libjf.config.api.v2.ui.ConfigScreenFactory;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
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.LocalCapture;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public abstract class OptionsScreenMixin extends Screen {
|
||||
@Shadow @Final private Screen parent;
|
||||
|
||||
@Shadow protected abstract ButtonWidget createButton(Text message, Supplier<Screen> screenSupplier);
|
||||
|
||||
protected OptionsScreenMixin(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "init()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget;refreshPositions()V"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
void injectButton(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||
ConfigHolder.getInstance().getRegistered().forEach((key, config) -> {
|
||||
adder.add(
|
||||
createButton(Text.translatable(key + ".jfconfig.title"), () -> ConfigScreenFactory.getInstance()
|
||||
.create(config, this)
|
||||
.get())
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
"name": "LibJF Config UI: Tiny",
|
||||
"version": "1.0",
|
||||
"environment": "*",
|
||||
"mixins": ["libjf-config-ui-tiny-v1-testmod.mixins.json"],
|
||||
"entrypoints": {
|
||||
"libjf:config": [
|
||||
"io.gitlab.jfronny.libjf.config.test.tiny.TestConfig"
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "io.gitlab.jfronny.libjf.config.test.tiny.mixin",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"OptionsScreenMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue