Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
IotaBread committed Apr 5, 2024
1 parent 3493de7 commit 89f83bd
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ org.gradle.jvmargs = -Xmx1G
vt_version = 1.20

# Remember to also update on VTDMod.java
mod_version = 2.1.0
mod_version = 2.2.0
maven_group = dev.iotabread
archives_base_name = vt-downloader
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[versions]
minecraft = "1.20.2"
quilt_mappings = "1.20.2+build.3"
fabric_loader = "0.14.22"
minecraft = "1.20.4"
quilt_mappings = "1.20.4+build.3"
fabric_loader = "0.15.1"

fabric_api = "0.89.3+1.20.2"
fabric_api = "0.96.11+1.20.4"

# Other mods
recursive_resources = "2.5.2+1.20"
recursive_resources = "2.5.2+1.20.4"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/bymartrixx/vtd/VTDMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class VTDMod implements ClientModInitializer {
public static RpCategories rpCategories;

static {
String version = "2.0.7";
String version = "2.2.0";
String vtVersion = "1.20";

Optional<ModContainer> container = FabricLoader.getInstance().getModContainer(MOD_ID);
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/me/bymartrixx/vtd/gui/VTDownloadScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public VTDownloadScreen(Screen parent, Text subtitle) {
this.subtitle = subtitle;

this.categories = VTDMod.rpCategories.getCategories();
this.currentCategory = this.categories.size() > 0 ? this.categories.get(0) : null;
this.currentCategory = !this.categories.isEmpty() ? this.categories.get(0) : null;

this.selectionHelper.addCallback((pack, category, selected) -> {
this.changed = true;
Expand Down Expand Up @@ -154,7 +154,7 @@ private void updateCategories(RpCategories data) {
this.selectionHelper.cleanUpSelection();
this.selectedPacksList.update();

this.currentCategory = this.categories.size() > 0 ? this.categories.get(0) : null;
this.currentCategory = !this.categories.isEmpty() ? this.categories.get(0) : null;
this.categorySelector.setSelectedCategory(this.currentCategory);
this.packSelector.setCategory(this.currentCategory);
}
Expand Down Expand Up @@ -304,14 +304,15 @@ protected void init() {

// Draw before everything else
this.packSelector = this.addDrawable(new PackSelectionListWidget(this.client, this, this.width,
this.height, PACK_SELECTOR_TOP_HEIGHT, this.height - PACK_SELECTOR_BOTTOM_HEIGHT,
this.height - PACK_SELECTOR_TOP_HEIGHT - PACK_SELECTOR_BOTTOM_HEIGHT,
PACK_SELECTOR_TOP_HEIGHT,
this.currentCategory, this.selectionHelper));
this.packSelector.updateCategories(this.categories);

this.selectedPacksList = this.addDrawable(new SelectedPacksListWidget(this, this.client,
SELECTED_PACKS_WIDTH, SELECTED_PACKS_TOP_HEIGHT,
this.height - SELECTED_PACKS_BOTTOM_HEIGHT,
this.width - SELECTED_PACKS_WIDTH, this.selectionHelper));
SELECTED_PACKS_WIDTH, this.height - SELECTED_PACKS_TOP_HEIGHT - SELECTED_PACKS_BOTTOM_HEIGHT,
this.width - SELECTED_PACKS_WIDTH, SELECTED_PACKS_TOP_HEIGHT,
this.selectionHelper));

// Reload button
this.addDrawableSelectableElement(new ReloadButtonWidget(WIDGET_MARGIN, WIDGET_MARGIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.list.EntryListWidget;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.sound.SoundManager;
Expand Down Expand Up @@ -64,15 +63,15 @@ public class PackSelectionListWidget extends EntryListWidget<PackSelectionListWi

private final PackSelectionHelper selectionHelper;

public PackSelectionListWidget(MinecraftClient client, VTDownloadScreen screen, int width, int height, int top, int bottom,
public PackSelectionListWidget(MinecraftClient client, VTDownloadScreen screen, int width, int height, int y,
Category category, PackSelectionHelper selectionHelper) {
super(client, width, height, top, bottom, ITEM_HEIGHT);
super(client, width, height, y, ITEM_HEIGHT);
this.screen = screen;
this.category = category;
this.selectionHelper = selectionHelper;

this.errorLines = Util.getMultilineTextLines(client.textRenderer, ERROR_TEXT, 8, (int) (width / 1.5));
this.errorText = Util.createMultilineText(client.textRenderer, ERROR_TEXT, 8, (int) (width / 1.5));
this.errorLines = Util.getMultilineTextLines(client.textRenderer, ERROR_TEXT, 8, (int) (y / 1.5));
this.errorText = Util.createMultilineText(client.textRenderer, ERROR_TEXT, 8, (int) (y / 1.5));

this.children().addAll(getPackEntries(category));
}
Expand Down Expand Up @@ -164,7 +163,7 @@ private int getEntrySelectionColor(AbstractEntry entry) {
}

private int getCenterX() {
return this.left + this.width / 2;
return this.getX() + this.width / 2;
}

private int getCenterY() {
Expand All @@ -176,7 +175,7 @@ private static int getLineHeight(TextRenderer textRenderer) {
}

public void updateScreenWidth() {
this.updateSize(this.screen.getLeftWidth(), this.height, this.top, this.bottom);
this.setWidth(this.screen.getLeftWidth());
}

public void focusPack(Pack pack) {
Expand All @@ -200,7 +199,7 @@ public int getRowWidth() {

@Override
protected int getScrollbarPositionX() {
return this.left + getRowWidth() + ROW_LEFT_RIGHT_MARGIN + SCROLLBAR_LEFT_MARGIN;
return this.getX() + getRowWidth() + ROW_LEFT_RIGHT_MARGIN + SCROLLBAR_LEFT_MARGIN;
}

@Override
Expand Down Expand Up @@ -311,8 +310,8 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

// region render
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
super.render(graphics, mouseX, mouseY, delta);
public void drawWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
super.drawWidget(graphics, mouseX, mouseY, delta);

if (this.children().isEmpty()) {
this.renderError(graphics);
Expand Down Expand Up @@ -363,12 +362,12 @@ public void renderDebugInfo(GuiGraphics graphics, int mouseX, int mouseY) {
"MX/MY = " + mouseX + "/" + mouseY
);

RenderUtil.renderDebugInfo(graphics, textRenderer, this.left, this.height, debugInfo);
RenderUtil.renderDebugInfo(graphics, textRenderer, this.getX(), this.getYEnd(), debugInfo);
}

public void renderTooltips(GuiGraphics graphics, int mouseX, int mouseY) {
if (mouseY >= this.top && mouseY < this.bottom
&& mouseX >= this.left && mouseX < this.right
if (mouseY >= this.getY() && mouseY < this.getYEnd()
&& mouseX >= this.getX() && mouseX < this.getXEnd()
&& !this.screen.isCoveredByPopup(mouseX, mouseY)) {
int width = this.getTooltipWidth();
for (AbstractEntry entry : this.children()) {
Expand All @@ -381,7 +380,7 @@ public void renderTooltips(GuiGraphics graphics, int mouseX, int mouseY) {
// endregion

@Override
public void appendNarrations(NarrationMessageBuilder builder) {
public void updateNarration(NarrationMessageBuilder builder) {
builder.put(NarrationPart.TITLE, Constants.RESOURCE_PACK_SCREEN_SUBTITLE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import me.bymartrixx.vtd.gui.VTDownloadScreen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.list.EntryListWidget;
Expand All @@ -32,13 +31,13 @@ public class SelectedPacksListWidget extends EntryListWidget<SelectedPacksListWi
private final PackSelectionHelper selectionHelper;
private boolean extended = false;

public SelectedPacksListWidget(VTDownloadScreen screen, MinecraftClient client, int width, int top,
int bottom, int left, PackSelectionHelper selectionHelper) {
super(client, width, screen.height, top, bottom, ITEM_HEIGHT);
public SelectedPacksListWidget(VTDownloadScreen screen, MinecraftClient client, int width, int height, int x, int y,
PackSelectionHelper selectionHelper) {
super(client, width, height, y, ITEM_HEIGHT);
this.screen = screen;
this.selectionHelper = selectionHelper;

this.setLeftPos(left);
this.setX(x);
this.setRenderBackground(false); // Rendered at #renderBackground
this.setRenderHeader(true, HEADER_HEIGHT);

Expand Down Expand Up @@ -223,7 +222,7 @@ public int getRowWidth() {

@Override
protected int getScrollbarPositionX() {
return this.left + this.getRowWidth() + SCROLLBAR_LEFT_MARGIN;
return this.getX() + this.getRowWidth() + SCROLLBAR_LEFT_MARGIN;
}

// private void moveFocus(MoveDirection direction) {
Expand Down Expand Up @@ -286,12 +285,12 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

// region render
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
public void drawWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
if (!this.extended) {
return;
}

super.render(graphics, mouseX, mouseY, delta);
super.drawWidget(graphics, mouseX, mouseY, delta);
}

@Override
Expand All @@ -307,15 +306,15 @@ protected void renderList(GuiGraphics graphics, int x, int y, float delta) {
}

private void renderBackground(GuiGraphics graphics) {
// @see EntryListWidget#render -> if (this.renderBackground)
// @see EntryListWidget#drawWidget -> if (this.renderBackground)[1]
int size = HORIZONTAL_SHADOWS_SIZE;
graphics.fillGradient(RenderLayer.getGuiOverlay(), this.left, this.top, this.right, this.top + size, 0xFF000000, 0x00000000, 0);
graphics.fillGradient(RenderLayer.getGuiOverlay(), this.left, this.bottom - size, this.right, this.bottom, 0x00000000, 0xFF000000, 0);
graphics.fillGradient(RenderLayer.getGuiOverlay(), this.getX(), this.getY(), this.getXEnd(), this.getY() + size, 0xFF000000, 0x00000000, 0);
graphics.fillGradient(RenderLayer.getGuiOverlay(), this.getX(), this.getYEnd() - size, this.getXEnd(), this.getYEnd(), 0x00000000, 0xFF000000, 0);
}
// endregion

@Override
public void appendNarrations(NarrationMessageBuilder builder) {
public void updateNarration(NarrationMessageBuilder builder) {
builder.put(NarrationPart.TITLE, HEADER);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public abstract class PackEntryListWidgetMixin extends AlwaysSelectedEntryListWi
@Shadow @Final
PackScreen screen;

private PackEntryListWidgetMixin(MinecraftClient minecraftClient, int i, int j, int k, int l, int m) {
super(minecraftClient, i, j, k, l, m);
private PackEntryListWidgetMixin(MinecraftClient client, int width, int height, int y, int itemHeight) {
super(client, width, height, y, itemHeight);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],

"depends": {
"minecraft": "~1.20.2"
"minecraft": "~1.20.4"
},

"custom": {
Expand Down

0 comments on commit 89f83bd

Please sign in to comment.