Skip to content

Commit

Permalink
Update mod to Minecraft snapshot 23w03a (#522)
Browse files Browse the repository at this point in the history
- Updated to Snapshot 23w03a
  • Loading branch information
haykam821 authored Jan 19, 2023
1 parent 85b4c3f commit d6cbce8
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=modmenu

minecraft_version=1.19.3
yarn_mappings=1.19.3+build.2
loader_version=0.14.11
fabric_version=0.68.1+1.19.3
minecraft_version=23w03a
yarn_mappings=23w03a+build.1
loader_version=0.14.13
fabric_version=0.72.1+1.19.4
quilt_loader_version=0.17.7

# Project Metadata
Expand All @@ -20,14 +20,14 @@ default_release_type=stable
# CurseForge Metadata
curseforge_slug=modmenu
curseforge_id=308702
curseforge_game_versions=1.19.3, 1.20-Snapshot, Fabric, Quilt
curseforge_game_versions=1.20-Snapshot, Fabric, Quilt
curseforge_required_dependencies=
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=modmenu
modrinth_id=mOgUt4GM
modrinth_game_versions=1.19.3
modrinth_game_versions=23w03a
modrinth_mod_loaders=fabric, quilt

# Mod Loader Metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
Expand Down Expand Up @@ -92,9 +93,19 @@ private static void afterTitleScreenInit(Screen screen) {
}
}

private static GridWidget getFirstGridWidget(Screen screen) {
for (Element element : screen.children()) {
if (element instanceof GridWidget widget) {
return widget;
}
}

return null;
}

private static void afterGameMenuScreenInit(Screen screen) {
ClickableWidget widget = Screens.getButtons(screen).get(0);
if (widget instanceof GridWidget) {
GridWidget widget = getFirstGridWidget(screen);
if (widget != null) {
final List<ClickableWidget> buttons = ((IGridWidgetAccessor) widget).getChildren();
if (ModMenuConfig.MODIFY_GAME_MENU.getValue()) {
int modsButtonIndex = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
.size(150, 20)
.narrationSupplier(Supplier::get)
.build());
this.setInitialFocus(this.searchBox);
this.searchBox.setFocused(true);

init = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
import com.terraformersmc.modmenu.gui.ModsScreen;
import com.terraformersmc.modmenu.gui.widget.entries.ModListEntry;
import com.terraformersmc.modmenu.util.mod.Mod;
import net.minecraft.class_8020;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.Selectable;
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
import net.minecraft.client.gui.screen.CreditsScreen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.ElementListWidget;
import net.minecraft.client.gui.widget.EntryListWidget;
import net.minecraft.client.render.*;
import net.minecraft.client.resource.language.I18n;
Expand All @@ -24,6 +28,7 @@
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -197,7 +202,6 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderList(matrices, mouseX, mouseY, delta);
this.renderScrollBar(bufferBuilder, tessellator);

RenderSystem.enableTexture();
RenderSystem.disableBlend();
}

Expand All @@ -206,7 +210,6 @@ public void renderScrollBar(BufferBuilder bufferBuilder, Tessellator tessellator
int scrollbarEndX = scrollbarStartX + 6;
int maxScroll = this.getMaxScroll();
if (maxScroll > 0) {
RenderSystem.disableTexture();
int p = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top)) / (float) this.getMaxPosition());
p = MathHelper.clamp(p, 32, this.bottom - this.top - 8);
int q = (int) this.getScrollAmount() * (this.bottom - this.top - p) / maxScroll + this.top;
Expand All @@ -232,7 +235,7 @@ public void renderScrollBar(BufferBuilder bufferBuilder, Tessellator tessellator
}
}

protected class DescriptionEntry extends EntryListWidget.Entry<DescriptionEntry> {
protected class DescriptionEntry extends ElementListWidget.Entry<DescriptionEntry> {
private final DescriptionListWidget widget;
protected OrderedText text;
protected int indent;
Expand All @@ -254,6 +257,16 @@ public void render(MatrixStack matrices, int index, int y, int x, int itemWidth,
}
textRenderer.drawWithShadow(matrices, text, x + indent, y, 0xAAAAAA);
}

@Override
public List<? extends Element> children() {
return Collections.emptyList();
}

@Override
public List<? extends Selectable> selectableChildren() {
return Collections.emptyList();
}
}

protected class MojangCreditsEntry extends DescriptionEntry {
Expand All @@ -271,7 +284,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {

class MinecraftCredits extends CreditsScreen {
public MinecraftCredits(boolean endCredits) {
super(endCredits, Runnables.doNothing());
super(endCredits, new class_8020(false), Runnables.doNothing());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setScrollAmount(double amount) {
}

@Override
protected boolean isFocused() {
public boolean isFocused() {
return parent.getFocused() == this;
}

Expand Down Expand Up @@ -200,7 +200,6 @@ protected void renderList(MatrixStack matrices, int mouseX, int mouseY, float de
if (this.isSelectedEntry(index)) {
entryLeft = getRowLeft() - 2 + entry.getXOffset();
int selectionRight = this.getRowLeft() + rowWidth + 2;
RenderSystem.disableTexture();
float float_2 = this.isFocused() ? 1.0F : 0.5F;
RenderSystem.setShader(GameRenderer::getPositionProgram);
RenderSystem.setShaderColor(float_2, float_2, float_2, 1.0F);
Expand All @@ -219,7 +218,6 @@ protected void renderList(MatrixStack matrices, int mouseX, int mouseY, float de
buffer.vertex(matrix, selectionRight - 1, entryTop - 1, 0.0F).next();
buffer.vertex(matrix, entryLeft + 1, entryTop - 1, 0.0F).next();
tessellator.draw();
RenderSystem.enableTexture();
}

entryLeft = this.getRowLeft();
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"fabric-screen-api-v1": ">=1.0.4",
"fabric-key-binding-api-v1": "*",
"fabric-lifecycle-events-v1": "*",
"fabricloader": ">=0.12.6",
"minecraft": ">=1.19.3-"
"fabricloader": ">=0.12.13",
"minecraft": ">=1.19.4-"
},
"breaks" : {
"better_mod_button": "*"
Expand Down

0 comments on commit d6cbce8

Please sign in to comment.