Update to 1.20
This commit is contained in:
parent
a8283ba02e
commit
a1a6d22510
|
@ -1,7 +1,7 @@
|
|||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.19.4
|
||||
minecraft_version=1.20
|
||||
yarn_mappings=build.1
|
||||
loader_version=0.14.17
|
||||
loader_version=0.14.21
|
||||
|
||||
maven_group=io.gitlab.jfronny.libjf
|
||||
archive_base_name=libjf
|
||||
|
@ -14,12 +14,14 @@ modrinth_optional_dependencies=fabric-api
|
|||
curseforge_id=482600
|
||||
curseforge_optional_dependencies=fabric-api
|
||||
|
||||
fabric_version=0.75.3+1.19.4
|
||||
commons_version=1.2-SNAPSHOT
|
||||
gson_compile_version=1.2-SNAPSHOT
|
||||
modmenu_version=6.1.0-rc.1
|
||||
fabric_version=0.83.0+1.20
|
||||
commons_version=1.3-SNAPSHOT
|
||||
gson_compile_version=1.3-SNAPSHOT
|
||||
modmenu_version=7.0.1
|
||||
|
||||
asm_version=9.4
|
||||
ant_version=1.10.12
|
||||
asm_version=9.5
|
||||
ant_version=1.10.13
|
||||
annotations_version=24.0.1
|
||||
javapoet_version=1.13.0
|
||||
|
||||
fabric.loom.multiProjectOptimisation=true
|
|
@ -29,15 +29,15 @@ public class JfConfigCommand implements ModInitializer {
|
|||
LiteralArgumentBuilder<ServerCommandSource> c_config = literal("config")
|
||||
.requires((serverCommandSource) -> serverCommandSource.hasPermissionLevel(4))
|
||||
.executes(context -> {
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Loaded configs for:"), false);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Loaded configs for:"), false);
|
||||
ConfigHolder.getInstance().getRegistered().forEach((s, config) -> {
|
||||
context.getSource().sendFeedback(Text.literal("- " + s), false);
|
||||
context.getSource().sendFeedback(() -> Text.literal("- " + s), false);
|
||||
});
|
||||
return Command.SINGLE_SUCCESS;
|
||||
});
|
||||
LiteralArgumentBuilder<ServerCommandSource> c_reload = literal("reload").executes(context -> {
|
||||
ConfigHolder.getInstance().getRegistered().forEach((mod, config) -> config.load());
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Reloaded configs"), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Reloaded configs"), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
});
|
||||
LiteralArgumentBuilder<ServerCommandSource> c_reset = literal("reset").executes(context -> {
|
||||
|
@ -47,7 +47,7 @@ public class JfConfigCommand implements ModInitializer {
|
|||
ConfigHolder.getInstance().getRegistered().forEach((id, config) -> {
|
||||
c_reload.then(literal(id).executes(context -> {
|
||||
config.load();
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Reloaded config for " + id), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Reloaded config for " + id), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}));
|
||||
registerEntries(config, id, c_config, c_reset, cns -> {
|
||||
|
@ -63,7 +63,7 @@ public class JfConfigCommand implements ModInitializer {
|
|||
private void registerEntries(ConfigCategory config, String subpath, LiteralArgumentBuilder<ServerCommandSource> c_config, LiteralArgumentBuilder<ServerCommandSource> c_reset, Function<Consumer<LiteralArgumentBuilder<ServerCommandSource>>, LiteralArgumentBuilder<ServerCommandSource>> pathGen) {
|
||||
c_config.then(pathGen.apply(cns -> {
|
||||
cns.executes(context -> {
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] " + subpath + " is a category"), false);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] " + subpath + " is a category"), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
});
|
||||
for (EntryInfo<?> entry : config.getEntries()) {
|
||||
|
@ -73,13 +73,13 @@ public class JfConfigCommand implements ModInitializer {
|
|||
c_reset.then(pathGen.apply(cns -> {
|
||||
cns.executes(context -> {
|
||||
config.reset();
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Reset config for " + subpath), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Reset config for " + subpath), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
});
|
||||
config.getPresets().forEach((id2, preset) -> {
|
||||
cns.then(literal(id2).executes(context -> {
|
||||
preset.run();
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Loaded preset " + id2 + " for " + subpath), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Loaded preset " + id2 + " for " + subpath), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}));
|
||||
});
|
||||
|
@ -103,7 +103,8 @@ public class JfConfigCommand implements ModInitializer {
|
|||
|
||||
private <T> void registerEntry(ConfigCategory config, String subpath, LiteralArgumentBuilder<ServerCommandSource> cns, EntryInfo<T> entry) {
|
||||
LiteralArgumentBuilder<ServerCommandSource> c_entry = literal(entry.getName()).executes(context -> {
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] The value of " + subpath + "." + entry.getName() + " is " + tryRun(entry::getValue)), false);
|
||||
String msg = "[libjf-config-v1] The value of " + subpath + "." + entry.getName() + " is " + tryRun(entry::getValue);
|
||||
context.getSource().sendFeedback(() -> Text.literal(msg), false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
});
|
||||
ArgumentType<?> type = getType(entry);
|
||||
|
@ -111,7 +112,7 @@ public class JfConfigCommand implements ModInitializer {
|
|||
c_entry.then(argument("value", type).executes(context -> {
|
||||
@SuppressWarnings("unchecked") T value = context.getArgument("value", (Class<T>) entry.getValueType().asClass());
|
||||
tryRun(() -> entry.setValue(value));
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Set " + subpath + "." + entry.getName() + " to " + value), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Set " + subpath + "." + entry.getName() + " to " + value), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ public class JfConfigCommand implements ModInitializer {
|
|||
for (T enumConstant : ((Type.TEnum<T>)entry.getValueType()).options()) {
|
||||
c_entry.then(literal(enumConstant.toString()).executes(context -> {
|
||||
tryRun(() -> entry.setValue(enumConstant));
|
||||
context.getSource().sendFeedback(Text.literal("[libjf-config-v1] Set " + subpath + "." + entry.getName() + " to " + enumConstant), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("[libjf-config-v1] Set " + subpath + "." + entry.getName() + " to " + enumConstant), true);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ repositories {
|
|||
dependencies {
|
||||
implementation("io.gitlab.jfronny.gson:gson-compile-processor-core:${prop("gson_compile_version")}")
|
||||
implementation(devProject(":libjf-config-core-v1"))
|
||||
implementation("org.jetbrains:annotations:23.0.0")
|
||||
implementation("org.jetbrains:annotations:${prop("annotations_version")}")
|
||||
implementation("io.gitlab.jfronny:commons:${prop("commons_version")}")
|
||||
implementation("io.gitlab.jfronny:commons-gson:${prop("commons_version")}")
|
||||
implementation("com.squareup:javapoet:1.13.0")
|
||||
implementation("com.squareup:javapoet:${prop("javapoet_version")}")
|
||||
testAnnotationProcessor(sourceSets.main.get().output)
|
||||
configurations.testAnnotationProcessor.get().extendsFrom(configurations.implementation.get())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.gitlab.jfronny.libjf.config.impl.ui;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.Objects;
|
||||
|
@ -16,10 +16,10 @@ public class PlaceholderScreen extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, description, width / 2, (height - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,9 +8,12 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
|
|||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.font.TextHandler;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.OptionListWidget;
|
||||
import net.minecraft.client.util.NarratorManager;
|
||||
import net.minecraft.client.util.SelectionManager;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -280,31 +283,30 @@ public class EditorScreen extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(matrices);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context);
|
||||
if (subtitle == null) {
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, (HEADER_SIZE - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, (HEADER_SIZE - textRenderer.fontHeight) / 2, 0xFFFFFF);
|
||||
} else {
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, HEADER_SIZE / 2 - textRenderer.fontHeight, 0xFFFFFF);
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, subtitle, width / 2, HEADER_SIZE / 2, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, HEADER_SIZE / 2 - textRenderer.fontHeight, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(textRenderer, subtitle, width / 2, HEADER_SIZE / 2, 0xFFFFFF);
|
||||
}
|
||||
this.setFocused(null);
|
||||
|
||||
if (client.world == null) {
|
||||
RenderSystem.setShaderTexture(0, DrawableHelper.OPTIONS_BACKGROUND_TEXTURE);
|
||||
RenderSystem.setShaderColor(0.125f, 0.125f, 0.125f, 1.0f);
|
||||
drawTexture(matrices, 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, width - SCROLLBAR_SIZE, 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);
|
||||
}
|
||||
|
||||
enableScissor(0, HEADER_SIZE, width - SCROLLBAR_SIZE, height - FOOTER_SIZE);
|
||||
context.enableScissor(0, HEADER_SIZE, width - SCROLLBAR_SIZE, height - FOOTER_SIZE);
|
||||
PageContent pageContent = this.getPageContent();
|
||||
for (Line line : pageContent.lines) {
|
||||
this.textRenderer.draw(matrices, line.text, line.x, line.y, 0xFFFFFFFF);
|
||||
context.drawText(textRenderer, line.text, line.x, line.y, 0xFFFFFFFF, false);
|
||||
}
|
||||
this.drawSelection(matrices, pageContent.selectionRectangles);
|
||||
this.drawCursor(matrices, pageContent.position);
|
||||
disableScissor();
|
||||
this.drawSelection(context, pageContent.selectionRectangles);
|
||||
this.drawCursor(context, pageContent.position);
|
||||
context.disableScissor();
|
||||
|
||||
int i = this.getScrollbarPositionX();
|
||||
int j = i + 6;
|
||||
|
@ -314,22 +316,22 @@ public class EditorScreen extends Screen {
|
|||
n = MathHelper.clamp(n, 32, getViewportHeight() - 8);
|
||||
int o = (int)scrollAmount * (getViewportHeight() - n) / m + HEADER_SIZE;
|
||||
if (o < HEADER_SIZE) o = HEADER_SIZE;
|
||||
fill(matrices, i, HEADER_SIZE, j, height - FOOTER_SIZE, 0xFF000000);
|
||||
fill(matrices, i, o, j, o + n, 0xFF808080);
|
||||
fill(matrices, i, o, j - 1, o + n - 1, 0xFFC0C0C0);
|
||||
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);
|
||||
}
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
private void drawCursor(MatrixStack matrices, Position position) {
|
||||
private void drawCursor(DrawContext context, Position position) {
|
||||
if (this.tickCounter / 6 % 2 == 0) {
|
||||
position = this.absolutePositionToScreenPosition(position);
|
||||
DrawableHelper.fill(matrices, position.x, position.y - 1, position.x + 1, position.y + this.textRenderer.fontHeight, 0xFFFFFFFF);
|
||||
context.fill(position.x, position.y - 1, position.x + 1, position.y + this.textRenderer.fontHeight, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSelection(MatrixStack matrices, Rect2i[] selectionRectangles) {
|
||||
private void drawSelection(DrawContext context, Rect2i[] selectionRectangles) {
|
||||
RenderSystem.enableColorLogicOp();
|
||||
RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
|
||||
for (Rect2i rect2i : selectionRectangles) {
|
||||
|
@ -337,7 +339,7 @@ public class EditorScreen extends Screen {
|
|||
int j = rect2i.getY();
|
||||
int k = i + rect2i.getWidth();
|
||||
int l = j + rect2i.getHeight();
|
||||
fill(matrices, i, j, k, l, 0xFF0000FF);
|
||||
context.fill(i, j, k, l, 0xFF0000FF);
|
||||
}
|
||||
RenderSystem.disableColorLogicOp();
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ public final class Placeholder<T extends Element & Selectable & Drawable> implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
child.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
child.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.gitlab.jfronny.libjf.config.impl.ui.tiny.presets.PresetsScreen;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.ScreenRect;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.tab.TabManager;
|
||||
|
@ -115,7 +116,7 @@ public class TinyConfigScreen extends Screen {
|
|||
this.addSelectableChild(this.placeholder);
|
||||
|
||||
// Sizing is also done in TinyConfigTab. Keep these in sync!
|
||||
tabManager.setTabArea(new ScreenRect(0, 32, width, height));
|
||||
tabManager.setTabArea(new ScreenRect(0, 32, width, height - 68));
|
||||
|
||||
reload = true;
|
||||
}
|
||||
|
@ -131,11 +132,11 @@ public class TinyConfigScreen extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
this.placeholder.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.placeholder.render(context, mouseX, mouseY, delta);
|
||||
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 16 - textRenderer.fontHeight, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 16 - textRenderer.fontHeight, 0xFFFFFF);
|
||||
|
||||
Optional<Text> hovered = placeholder.getChild().getHoveredEntryTitle(mouseY);
|
||||
if (hovered.isPresent()) {
|
||||
|
@ -146,18 +147,18 @@ public class TinyConfigScreen extends Screen {
|
|||
String tooltipKey = info.id + ".tooltip";
|
||||
if (showTooltip && info.error != null) {
|
||||
showTooltip = false;
|
||||
renderTooltip(matrices, info.error, mouseX, mouseY);
|
||||
context.drawTooltip(textRenderer, info.error, mouseX, mouseY);
|
||||
}
|
||||
if (showTooltip && I18n.hasTranslation(tooltipKey)) {
|
||||
showTooltip = false;
|
||||
List<Text> tooltip = new ArrayList<>();
|
||||
for (String str : I18n.translate(tooltipKey).split("\n"))
|
||||
tooltip.add(Text.literal(str));
|
||||
renderTooltip(matrices, tooltip, mouseX, mouseY);
|
||||
context.drawTooltip(textRenderer, tooltip, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.render(matrices,mouseX,mouseY,delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class TinyConfigTab implements Tab {
|
|||
}
|
||||
|
||||
// Sizing is also done in TinyConfigScreen. Keep these in sync!
|
||||
this.list = new EntryListWidget(screen.getClient(), textRenderer, screen.width, screen.height, 32, screen.height - 36, 25);
|
||||
this.list = new EntryListWidget(screen.getClient(), textRenderer, screen.width, screen.height - 68, 32, screen.height - 36, 25);
|
||||
|
||||
if (isRoot) {
|
||||
for (Map.Entry<String, ConfigCategory> entry : config.getCategories().entrySet()) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.gitlab.jfronny.libjf.config.impl.ui.tiny;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -16,12 +17,12 @@ public class TinyConfigTabWrapper extends ClickableWidget {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
renderButton(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderButton(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
public void renderButton(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
throw new RuntimeException("TinyConfigTabWrapper must not be rendered");
|
||||
}
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@ public class EntryListWidget extends ElementListWidget<EntryListWidget.ConfigEnt
|
|||
@Environment(EnvType.CLIENT)
|
||||
public abstract static class ConfigEntry extends Entry<ConfigEntry> implements Reflowable {
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
if (hovered) {
|
||||
fill(matrices, x, y, x + entryWidth, y + entryHeight, 0x24FFFFFF);
|
||||
context.fill(x, y, x + entryWidth, y + entryHeight, 0x24FFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,10 +103,10 @@ public class EntryListWidget extends ElementListWidget<EntryListWidget.ConfigEnt
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
button.setY(y);
|
||||
button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
button.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,14 +133,14 @@ public class EntryListWidget extends ElementListWidget<EntryListWidget.ConfigEnt
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
button.setY(y);
|
||||
button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
drawTextWithShadow(matrices,textRenderer, text,12,y+5,0xFFFFFF);
|
||||
button.render(context, mouseX, mouseY, tickDelta);
|
||||
context.drawTextWithShadow(textRenderer, text, 12, y + 5, 0xFFFFFF);
|
||||
if (resetVisible.getAsBoolean()) {
|
||||
resetButton.setY(y);
|
||||
resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
resetButton.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,12 +180,12 @@ public class EntryListWidget extends ElementListWidget<EntryListWidget.ConfigEnt
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(matrices, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
drawTextWithShadow(matrices,textRenderer, text,12,y+5,0xFFFFFF);
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
super.render(context, index, y, x, entryWidth, entryHeight, mouseX, mouseY, hovered, tickDelta);
|
||||
context.drawTextWithShadow(textRenderer, text, 12, y + 5, 0xFFFFFF);
|
||||
if (resetVisible.getAsBoolean()) {
|
||||
resetButton.setY(y);
|
||||
resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
resetButton.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.gitlab.jfronny.libjf.config.impl.ui.tiny.presets;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.ElementListWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -46,9 +45,9 @@ public class PresetListWidget extends ElementListWidget<PresetListWidget.PresetE
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||
button.setY(y);
|
||||
button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
button.render(context, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.gitlab.jfronny.libjf.LibJf;
|
|||
import io.gitlab.jfronny.libjf.config.api.v1.ConfigCategory;
|
||||
import net.fabricmc.api.EnvType;
|
||||
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;
|
||||
|
@ -51,12 +52,12 @@ public class PresetsScreen extends Screen {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(matrices);
|
||||
this.list.render(matrices, mouseX, mouseY, delta);
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context);
|
||||
this.list.render(context, mouseX, mouseY, delta);
|
||||
|
||||
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 16 - textRenderer.fontHeight / 2, 0xFFFFFF);
|
||||
context.drawCenteredTextWithShadow(textRenderer, title, width / 2, 16 - textRenderer.fontHeight / 2, 0xFFFFFF);
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.gitlab.jfronny.libjf.devutil.mixin;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.resource.ResourceReload;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -18,7 +18,7 @@ public class SplashOverlayMixin {
|
|||
* @author magistermaks
|
||||
*/
|
||||
@Inject(method="render", at=@At("HEAD"), cancellable=true)
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo info) {
|
||||
if (reload.isComplete()) {
|
||||
MinecraftClient.getInstance().setOverlay(null);
|
||||
info.cancel();
|
||||
|
|
|
@ -34,15 +34,15 @@ public class JfWeb implements CoProcess, ModInitializer {
|
|||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
|
||||
dispatcher.register(literal(LibJf.MOD_ID).then(literal("web").requires((serverCommandSource) -> serverCommandSource.hasPermissionLevel(4)).executes(context -> {
|
||||
if (SERVER.isActive()) {
|
||||
context.getSource().sendFeedback(Text.literal("LibWeb is active. Use libweb restart to reload"), false);
|
||||
context.getSource().sendFeedback(() -> Text.literal("LibWeb is active. Use libweb restart to reload"), false);
|
||||
}
|
||||
else {
|
||||
context.getSource().sendFeedback(Text.literal("LibWeb is not active. Use libweb restart to reload"), false);
|
||||
context.getSource().sendFeedback(() -> Text.literal("LibWeb is not active. Use libweb restart to reload"), false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}).then(literal("restart").executes(context -> {
|
||||
try {
|
||||
context.getSource().sendFeedback(Text.literal("Restarting LibWeb"), true);
|
||||
context.getSource().sendFeedback(() -> Text.literal("Restarting LibWeb"), true);
|
||||
SERVER.restart();
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue