Skip to content

Commit

Permalink
Update to 1.19.3 and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
IotaBread committed Dec 15, 2022
1 parent bd428b8 commit 1321c03
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 49 deletions.
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ modrinth {
token = project.hasProperty('modrinth_token') ? project.property('modrinth_token') : System.getenv('MODRINTH_TOKEN')
projectId = '1E2sq1cp'
versionNumber = project.version
versionName = "VTDownloader ${project.mod_version} for Minecraft 1.19.1/2"
versionName = "VTDownloader ${project.mod_version} for Minecraft 1.19.3"
uploadFile = remapJar
changelog = "A changelog can be found at https://github.com/ByMartrixx/VTDownloader/releases/tag/${project.mod_version}"
gameVersions = ['1.19.1', '1.19.2']
gameVersions = ['1.19.3']
loaders = ['fabric', 'quilt']
}

Expand All @@ -92,13 +92,12 @@ curseforge {
id = '432425'
changelog = "A changelog can be found at https://github.com/ByMartrixx/VTDownloader/releases/tag/${project.mod_version}"
releaseType = 'release'
addGameVersion '1.19.1'
addGameVersion '1.19.2'
addGameVersion '1.19.3'
addGameVersion '1.19-Snapshot'
addGameVersion 'Fabric'
addGameVersion 'Quilt'
mainArtifact(remapJar) {
displayName = "VTDownloader ${project.mod_version} for Minecraft 1.19.1/2"
displayName = "VTDownloader ${project.mod_version} for Minecraft 1.19.3"
}
afterEvaluate {
uploadTask.dependsOn('remapJar')
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs = -Xmx1G

minecraft_version = 1.19.2
quilt_mappings_build = 16
loader_version = 0.14.9
minecraft_version = 1.19.3
quilt_mappings_build = 3
loader_version = 0.14.11

# Which version of vanilla tweaks to use
# TODO: Add ingame selection
vt_version = 1.19

mod_version = 2.0.0
mod_version = 2.0.1
maven_group = me.bymartrixx
archives_base_name = vt-downloader

fabric_version = 0.59.0+1.19.2
fabric_version = 0.69.1+1.19.3
15 changes: 9 additions & 6 deletions src/main/java/me/bymartrixx/vtd/VTDMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.resource.ResourceIoSupplier;
import net.minecraft.resource.pack.ResourcePack;
import net.minecraft.resource.pack.ResourcePackProfile;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -269,12 +270,14 @@ public static Identifier getIconId(Pack pack) {

public static CompletableFuture<List<String>> readResourcePackData(ResourcePackProfile profile) {
return CompletableFuture.supplyAsync(() -> {
try (ResourcePack resourcePack = profile.createResourcePack();
InputStream stream = resourcePack.openRoot(Constants.SELECTED_PACKS_FILE)) {
if (stream != null) {
return readSelectedPacks(new BufferedReader(new InputStreamReader(stream)));
} else {
return Collections.emptyList();
try (ResourcePack resourcePack = profile.createResourcePack()) {
ResourceIoSupplier<InputStream> fileStream = resourcePack.openRoot(Constants.SELECTED_PACKS_FILE);
try (InputStream stream = fileStream != null ? fileStream.get() : null){
if (stream != null) {
return readSelectedPacks(new BufferedReader(new InputStreamReader(stream)));
} else {
return Collections.emptyList();
}
}
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ protected UnsavedPackWarningScreen(VTDownloadScreen parent, Screen next) {

@Override
protected void initButtons(int textHeight) {
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, 100 + textHeight, 150, 20,
ScreenTexts.PROCEED, button -> this.client.setScreen(this.next)));
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 160, 100 + textHeight, 150, 20,
ScreenTexts.BACK, button -> this.client.setScreen(this.parent)));
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.PROCEED, button -> this.client.setScreen(this.next))
.positionAndSize(this.width / 2 - 155, 100 + textHeight, 150, 20).build());
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.BACK, button -> this.client.setScreen(this.parent))
.positionAndSize(this.width / 2 - 155 + 160, 100 + textHeight, 150, 20).build());
}
}
25 changes: 12 additions & 13 deletions src/main/java/me/bymartrixx/vtd/gui/VTDownloadScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void download() {

// noinspection ConstantConditions
CompletableFuture<Boolean> download = VTDMod.executePackDownload(data, f -> this.downloadProgress = f,
this.client.getResourcePackDir().toPath(),
this.client.getResourcePackDir(),
this.packNameField.isBlank() ? null : this.packNameField.getText());

download.whenCompleteAsync((success, throwable) -> {
Expand Down Expand Up @@ -320,18 +320,18 @@ protected void init() {
this.addSelectableChild(this.packSelector);
this.addSelectableChild(this.selectedPacksList);

this.shareButton = this.addDrawableChild(new ButtonWidget(
this.leftWidth + SELECTED_PACKS_CENTER_X - SHARE_BUTTON_CENTER_X,
this.height - SELECTED_PACKS_BOTTOM_HEIGHT + WIDGET_MARGIN,
SHARE_BUTTON_WIDTH, WIDGET_HEIGHT, SHARE_TEXT, button -> this.share()
));
this.shareButton = this.addDrawableChild(ButtonWidget.builder(SHARE_TEXT, button -> this.share())
.position(this.leftWidth + SELECTED_PACKS_CENTER_X - SHARE_BUTTON_CENTER_X,
this.height - SELECTED_PACKS_BOTTOM_HEIGHT + WIDGET_MARGIN)
.size(SHARE_BUTTON_WIDTH, WIDGET_HEIGHT)
.build());

// noinspection ConstantConditions
this.packNameField = this.addDrawableChild(new PackNameTextFieldWidget(this.textRenderer,
this.width - DONE_BUTTON_WIDTH - WIDGET_MARGIN * 2 - DOWNLOAD_BUTTON_WIDTH - WIDGET_MARGIN - PACK_NAME_FIELD_WIDTH,
this.height - WIDGET_HEIGHT - WIDGET_MARGIN, PACK_NAME_FIELD_WIDTH,
WIDGET_HEIGHT, this.getPackName(), PACK_NAME_FIELD_TEXT,
this.client.getResourcePackDir().toPath(), this.defaultPackName));
this.client.getResourcePackDir(), this.defaultPackName));
this.packNameField.setChangedListener(s -> this.updateButtons());
this.packName = null; // Pack name should only be used once

Expand All @@ -340,11 +340,10 @@ protected void init() {
this.height - WIDGET_HEIGHT - WIDGET_MARGIN, DOWNLOAD_BUTTON_WIDTH, WIDGET_HEIGHT, DOWNLOAD_TEXT,
button -> this.download()));

this.doneButton = this.addDrawableChild(new ButtonWidget(
this.width - DONE_BUTTON_WIDTH - WIDGET_MARGIN, this.height - WIDGET_HEIGHT - WIDGET_MARGIN,
DONE_BUTTON_WIDTH, WIDGET_HEIGHT,
ScreenTexts.DONE, button -> this.closeScreen()
));
this.doneButton = this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, button -> this.closeScreen())
.position(this.width - DONE_BUTTON_WIDTH - WIDGET_MARGIN, this.height - WIDGET_HEIGHT - WIDGET_MARGIN)
.size(DONE_BUTTON_WIDTH, WIDGET_HEIGHT)
.build());

// Render over everything else
this.progressBar = this.addDrawable(new ProgressBarScreenPopup(this.client, this.width / 2, this.height / 2,
Expand Down Expand Up @@ -373,7 +372,7 @@ private void toggleSelectedPacksListExtended() {
this.packSelector.updateScreenWidth();

this.shareButton.visible = extended;
this.shareButton.x = this.leftWidth + SELECTED_PACKS_CENTER_X - SHARE_BUTTON_CENTER_X;
this.shareButton.setX(this.leftWidth + SELECTED_PACKS_CENTER_X - SHARE_BUTTON_CENTER_X);
}

public boolean isCoveredByPopup(int mouseX, int mouseY) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
}

private void playDownSound(SoundManager soundManager) {
soundManager.play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F));
soundManager.play(PositionedSoundInstance.m_ozjrizqc(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class MutableMessageButtonWidget extends ButtonWidget {
private Text currentMessage;

public MutableMessageButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress) {
super(x, y, width, height, message, onPress);
super(x, y, width, height, message, onPress, ButtonWidget.DEFAULT_NARRATION);
this.defaultMessage = message;
this.currentMessage = message;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float del
super.renderButton(matrices, mouseX, mouseY, delta);
if (this.isVisible()) {
if (this.getText().isEmpty()) {
int x = this.x + 4;
int y = this.y + (this.height - 8) / 2;
int x = this.getX() + 4;
int y = this.getY() + (this.height - 8) / 2;
this.textRenderer.drawWithShadow(matrices, this.getMessage(), x, y, 0x707070);
}

Expand All @@ -116,7 +116,7 @@ private void renderOutline(MatrixStack matrices) {
}

if (color != -1) {
RenderUtil.drawOutline(matrices, this.x, this.y, this.width, this.height, 1, color);
RenderUtil.drawOutline(matrices, this.getX(), this.getY(), this.width, this.height, 1, color);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (button == GLFW.GLFW_MOUSE_BUTTON_1 && this.children().isEmpty()) {
// Handle clicks when the error is shown
int x = this.getCenterX();
int textWidth = this.errorText.m_crhihbev();
int textWidth = this.errorText.getMaxWidth();
int startX = x - textWidth / 2;
int endX = x + textWidth / 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ReloadButtonWidget extends ButtonWidget {
private static final int BUTTON_SIZE = 20;

public ReloadButtonWidget(int x, int y, Text message, PressAction onPress) {
super(x, y, BUTTON_SIZE, BUTTON_SIZE, message, onPress);
super(x, y, BUTTON_SIZE, BUTTON_SIZE, message, onPress, ButtonWidget.DEFAULT_NARRATION);
}

@Override
Expand All @@ -36,15 +36,15 @@ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float del
RenderSystem.enableDepthTest();

int imageY = this.getYImage(this.isHoveredOrFocused());
this.drawTexture(matrices, this.x, this.y,
this.drawTexture(matrices, this.getX(), this.getY(),
0, TEXTURE_V_OFFSET + imageY * TEXTURE_HEIGHT, this.width / 2, this.height);
this.drawTexture(matrices, this.x + this.width / 2, this.y,
this.drawTexture(matrices, this.getX() + this.width / 2, this.getY(),
TEXTURE_WIDTH - this.width / 2, TEXTURE_V_OFFSET + imageY * TEXTURE_HEIGHT, this.width / 2, this.height);

this.renderBackground(matrices, client, mouseX, mouseY);

int color = this.active ? 0xFFFFFF : 0xA0A0A0;
RenderUtil.drawCenteredScaledText(matrices, textRenderer, ICON, this.x + this.width / 2, this.y + (this.height - 16) / 2,
RenderUtil.drawCenteredScaledText(matrices, textRenderer, ICON, this.getX() + this.width / 2, this.getY() + (this.height - 16) / 2,
color | MathHelper.ceil(this.alpha * 255.0F) << 24, 2.0F);
}
}
12 changes: 6 additions & 6 deletions src/main/java/me/bymartrixx/vtd/mixin/PackScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.io.File;
import java.nio.file.Path;

@Mixin(PackScreen.class)
public class PackScreenMixin extends Screen implements PackScreenAccess {
@Shadow
@Final
private File file;
private Path file;

protected PackScreenMixin(Text title) {
super(title);
Expand All @@ -31,12 +31,12 @@ protected PackScreenMixin(Text title) {
private void addVTDButton(CallbackInfo info) {
// Checks if it is the resource pack screen and not the data pack screen
if (this.vtdownloader$isResourcePackScreen()) {
this.addDrawableChild(new ButtonWidget(this.width / 2 - Util.VTD_BUTTON_CENTER_X,
this.height - Util.VTD_BUTTON_BOTTOM_MARGIN, Util.VTD_BUTTON_WIDTH, Util.VTD_BUTTON_HEIGHT,
Constants.RESOURCE_PACK_BUTTON_TEXT, button -> {
ButtonWidget.Builder button = ButtonWidget.builder(Constants.RESOURCE_PACK_BUTTON_TEXT, btn -> {
// noinspection ConstantConditions
this.client.setScreen(new VTDownloadScreen(this, Constants.RESOURCE_PACK_SCREEN_SUBTITLE));
}));
}).position(this.width / 2 - Util.VTD_BUTTON_CENTER_X, this.height - Util.VTD_BUTTON_BOTTOM_MARGIN)
.size(Util.VTD_BUTTON_WIDTH, Util.VTD_BUTTON_HEIGHT);
this.addDrawableChild(button.build());
}
}

Expand Down

0 comments on commit 1321c03

Please sign in to comment.