Skip to content

Commit

Permalink
Merge pull request #27 from gniftygnome/1.19
Browse files Browse the repository at this point in the history
Updates and fixes for Minecraft 1.19.
  • Loading branch information
gniftygnome authored Aug 13, 2022
2 parents 9af1051 + c343327 commit 6afab1e
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
run: ./gradlew generateChangelog build publish curseforge github publishModrinth --stacktrace --parallel -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}"
run: ./gradlew generateChangelog build publish curseforge github modrinth --stacktrace --parallel -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}"
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.1/ferry.gradle'
apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.5/ferry.gradle'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G
maven_group=com.terraformersmc
archive_name=vistas

minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.6
fabric_version=0.43.1+1.18
modmenu_version=3.0.0
clothconfig_version=6.0.42
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.3
loader_version=0.14.9
fabric_version=0.59.0+1.19.2
modmenu_version=4.0.6
clothconfig_version=8.0.75

# Project Metadata
project_name=Vistas
Expand All @@ -21,14 +21,14 @@ default_release_type=beta
# CurseForge Metadata
curseforge_slug=vistas
curseforge_id=423659
curseforge_game_versions=1.18, Fabric
curseforge_game_versions=1.19, 1.19.1, 1.19.2, Fabric
curseforge_required_dependencies=
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=vistas
modrinth_id=itzZXRxq
modrinth_game_versions=1.18
modrinth_game_versions=1.19, 1.19.1, 1.19.2
modrinth_mod_loaders=fabric

# Mod Loader Metadata
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.file.Path;
import java.util.Optional;

import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -34,8 +35,6 @@
import net.minecraft.client.util.ScreenshotRecorder;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Util;
import net.minecraft.util.math.Direction;
Expand Down Expand Up @@ -69,7 +68,7 @@ public abstract class GameRendererMixin {
client.player.setYaw(PanoramicScreenshots.startingRotation.get().getSecond());
}
if (client.player != null) {
client.player.sendMessage(new TranslatableText("vistas.panoramic_screenshot.broke"), false);
client.player.sendMessage(Text.translatable("vistas.panoramic_screenshot.broke"), false);
}
PanoramicScreenshots.onShot = -1;
PanoramicScreenshots.startingRotation = Optional.empty();
Expand Down Expand Up @@ -126,7 +125,7 @@ public abstract class GameRendererMixin {
framebuffer.delete();

if (client.player != null && VistasConfig.getInstance().screenshotIndividually) {
client.player.sendMessage(new TranslatableText("vistas.panoramic_screenshot.taken", new LiteralText(String.valueOf(PanoramicScreenshots.onShot)), new LiteralText(file.getName()).formatted(Formatting.UNDERLINE).styled((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file.getAbsolutePath())))), false);
client.player.sendMessage(Text.translatable("vistas.panoramic_screenshot.taken", Text.literal(String.valueOf(PanoramicScreenshots.onShot)), Text.literal(file.getName()).formatted(Formatting.UNDERLINE).styled((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file.getAbsolutePath())))), false);
}

if (PanoramicScreenshots.onShot == 5) {
Expand All @@ -138,7 +137,7 @@ public abstract class GameRendererMixin {
PanoramicScreenshots.time = 0.0D;
PanoramicScreenshots.timeSinceLastKeyPress = 10.0D;
if (client.player != null) {
client.player.sendMessage(new TranslatableText("vistas.panoramic_screenshot.saved", new LiteralText(root.toAbsolutePath().toString()).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, root.toAbsolutePath().toString())).withUnderline(true))), false);
client.player.sendMessage(Text.translatable("vistas.panoramic_screenshot.saved", Text.literal(root.toAbsolutePath().toString()).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, root.toAbsolutePath().toString())).withUnderline(true))), false);
}
} else {
// push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.resource.ReloadableResourceManager;
import net.minecraft.resource.ReloadableResourceManagerImpl;
import net.minecraft.sound.MusicSound;

@Environment(EnvType.CLIENT)
Expand All @@ -32,13 +32,13 @@ public class MinecraftClientMixin implements MinecraftClientAccess {

@Shadow
@Final
private ReloadableResourceManager resourceManager;
private ReloadableResourceManagerImpl resourceManager;

@Nullable
@Shadow
public ClientPlayerEntity player;

@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;registerReloader(Lnet/minecraft/resource/ResourceReloader;)V", ordinal = 2, shift = Shift.AFTER))
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManagerImpl;registerReloader(Lnet/minecraft/resource/ResourceReloader;)V", ordinal = 2, shift = Shift.AFTER))
private void vistas$init$registerPanoramaReloader(RunArgs args, CallbackInfo ci) {
this.panoramaResourceReloader = new PanoramaResourceReloader();
this.resourceManager.registerReloader(panoramaResourceReloader);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terraformersmc.vistas.mixin;

import com.terraformersmc.vistas.title.VistasTitle;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -30,7 +32,9 @@ public class SplashTextResourceSupplierMixin {
private void vistas$get(CallbackInfoReturnable<String> ci) {
MinecraftClient client = MinecraftClient.getInstance();
PanoramaResourceReloader resourceReloader = ((MinecraftClientAccess) client).getPanoramaResourceReloader();
if (resourceReloader != null) {
Identifier panoramaId = VistasTitle.PANORAMAS_INVERT.get(VistasTitle.CURRENT.getValue());

if (resourceReloader != null && panoramaId != null) {
ci.setReturnValue(resourceReloader.get());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected TitleScreenMixin(Text title) {
PanoramaRenderer panoramaRenderer = new PanoramaRenderer(cubemap);
panoramaRenderer.render(delta, MathHelper.clamp(f, 0.0F, 1.0F));
Identifier overlayId = new Identifier(panoramaRenderer.getCubemap().getCubemapId() + "_overlay.png");
if (this.client.getResourceManager().containsResource(overlayId)) {
if (this.client.getResourceManager().getResource(overlayId).isPresent()) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, overlayId);
RenderSystem.enableBlend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,50 +120,35 @@ protected Pair<List<String>, List<Identifier>> prepare(Identifier splashId, Reso
profiler.push(splashId.toString());
try {
profiler.push("parse");
Resource resource = MinecraftClient.getInstance().getResourceManager().getResource(splashId);
Resource resource = MinecraftClient.getInstance().getResourceManager().getResource(splashId).get();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));
try {
splashTexts = Lists.newArrayList(bufferedReader.lines().map(String::trim).map((splash) -> {
if (splash.startsWith("$vistas$import$")) {
try {
imports.add(new Identifier(splash.substring(15)));
} catch (InvalidIdentifierException badId) {
Vistas.LOGGER.error("Splash: '{}' imports invalid Identifier: '{}'", splashId, splash.substring(15));
}
splashTexts = Lists.newArrayList(bufferedReader.lines().map(String::trim).map((splash) -> {
if (splash.startsWith("$vistas$import$")) {
try {
imports.add(new Identifier(splash.substring(15)));
} catch (InvalidIdentifierException badId) {
Vistas.LOGGER.error("Splash: '{}' imports invalid Identifier: '{}'", splashId, splash.substring(15));
}
Session session = MinecraftClient.getInstance().getSession();
splash = splash.replace("$vistas$name$", session.getUsername().toLowerCase(Locale.ROOT));
splash = splash.replace("$vistas$Name$", session.getUsername());
splash = splash.replace("$vistas$NAME$", session.getUsername().toUpperCase(Locale.ROOT));
return splash;
}).filter((splash) -> splash.hashCode() != 125780783 && !splash.startsWith("$vistas$import$")).toList());
} catch (Throwable throwable) {
try {
bufferedReader.close();
} catch (Throwable closeable) {
throwable.addSuppressed(closeable);
}

throw throwable;
}

bufferedReader.close();
Session session = MinecraftClient.getInstance().getSession();
splash = splash.replace("$vistas$name$", session.getUsername().toLowerCase(Locale.ROOT));
splash = splash.replace("$vistas$Name$", session.getUsername());
splash = splash.replace("$vistas$NAME$", session.getUsername().toUpperCase(Locale.ROOT));
return splash;
}).filter((splash) -> splash.hashCode() != 125780783 && !splash.startsWith("$vistas$import$")).toList());
} catch (Throwable throwable) {
if (resource != null) {
try {
resource.close();
} catch (Throwable closeable) {
throwable.addSuppressed(closeable);
}
try {
bufferedReader.close();
} catch (Throwable closeable) {
throwable.addSuppressed(closeable);
}

throw throwable;
}

if (resource != null) {
resource.close();
}
bufferedReader.close();

profiler.pop();
} catch (IOException exception) {
Vistas.LOGGER.error("Splash: '{}' doesn't exist!", splashId);
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 @@ -29,7 +29,7 @@
"vistas.mixins.json"
],
"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": ">=0.12.12",
"fabric": "*"
}
}
2 changes: 1 addition & 1 deletion src/main/resources/vistas.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.terraformersmc.vistas.mixin",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_17",
"client": [
"GameRendererMixin",
"MinecraftClientMixin",
Expand Down

0 comments on commit 6afab1e

Please sign in to comment.