Skip to content

Commit

Permalink
Update to 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
LudoCrypt committed Jun 4, 2021
1 parent 393beb8 commit 91c7f72
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 51 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/check_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
1.8, # Minimum
11, # LTS
15 # Latest
16
]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
Expand All @@ -35,7 +33,7 @@ jobs:
- name: Build
run: ./gradlew build --stacktrace --parallel
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
# Use these Java versions
java: [11]
java: [16]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
DISCORD_ANNOUNCEMENT_WEBHOOK: ${{ secrets.DISCORD_ANNOUNCEMENT_WEBHOOK }}
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
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.5-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.0/ferry.gradle'
apply from: 'https://raw.githubusercontent.com/shedaniel/GradleScripts/2.0/ferry.gradle'

dependencies {
minecraft "com.mojang:minecraft:$project.minecraft_version"
Expand Down
14 changes: 7 additions & 7 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.16.5
yarn_mappings=1.16.5+build.9
minecraft_version=1.17-rc1
yarn_mappings=1.17-rc1+build.1
loader_version=0.11.3
fabric_version=0.34.2+1.16
modmenu_version=1.16.8
clothconfig_version=4.11.26
fabric_version=0.34.8+1.17
modmenu_version=2.0.0-beta.7
clothconfig_version=5.0.34

# 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.16.5, Fabric
curseforge_game_versions=1.17, Fabric
curseforge_required_dependencies=
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=vistas
modrinth_id=itzZXRxq
modrinth_game_versions=1.16.5
modrinth_game_versions=1.17
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-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.ScreenshotUtils;
import net.minecraft.client.util.ScreenshotRecorder;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.LiteralText;
Expand Down Expand Up @@ -60,13 +60,13 @@ public abstract class GameRendererMixin {

// setup
boolean oldFov90 = renderingPanorama;
float oldPitch = client.player.pitch;
float oldYaw = client.player.yaw;
float oldPitch = client.player.getPitch();
float oldYaw = client.player.getYaw();
if (PanoramaConfig.getInstance().lockScreenshotPitch) {
client.player.pitch = 0;
client.player.setPitch(0);
}
if (PanoramaConfig.getInstance().lockScreenshotYaw) {
client.player.yaw = 0;
client.player.setYaw(0);
}
boolean oldCulling = client.chunkCullingEnabled;
client.chunkCullingEnabled = false;
Expand All @@ -82,8 +82,8 @@ public abstract class GameRendererMixin {
// restore
renderingPanorama = oldFov90;
client.chunkCullingEnabled = oldCulling;
client.player.pitch = oldPitch;
client.player.yaw = oldYaw;
client.player.setPitch(oldPitch);
client.player.setYaw(oldYaw);
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);
}
Expand All @@ -97,7 +97,7 @@ private void doRender(float tickDelta, long startTime, MatrixStack matrixStack)

@Unique
private void takeScreenshot(Path folder, int id) {
NativeImage shot = ScreenshotUtils.takeScreenshot(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight(),
NativeImage shot = ScreenshotRecorder.takeScreenshot(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight(),
client.getFramebuffer());
PanoramicScreenshots.saveScreenshot(shot, folder, id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void VISTAS_modifyMusic(CallbackInfoReturnable<MusicSound> ci) {
@Inject(method = "<init>", at = @At(value = "NEW", target = "Lnet/minecraft/client/sound/MusicTracker;", shift = Shift.BEFORE))
private void VISTAS_appendPanoramaManager(CallbackInfo ci) {
this.panoramaManager = new PanoramaManager();
this.resourceManager.registerListener(panoramaManager);
this.resourceManager.registerReloader(panoramaManager);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private Resource VISTAS_redirectSplashReading(Resource in) {
}
}

@ModifyVariable(method = "Lnet/minecraft/client/resource/SplashTextResourceSupplier;prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Ljava/util/List;", at = @At(value = "RETURN", ordinal = 0, shift = Shift.BEFORE), name = "var7")
@ModifyVariable(method = "Lnet/minecraft/client/resource/SplashTextResourceSupplier;prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Ljava/util/List;", at = @At(value = "RETURN", ordinal = 0, shift = Shift.BEFORE), name = "var5")
private List<String> VISTAS_setList(List<String> in) {
this.storedSplashList = new ArrayList<String>(in);
return in;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.terraformersmc.vistas.mixin;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
Expand All @@ -27,6 +28,8 @@
public abstract class TitleScreenBackgroundMixin extends Screen {

@Shadow
@Final
@Mutable
private RotatingCubeMapRenderer backgroundRenderer;

@Shadow
Expand All @@ -42,10 +45,14 @@ private void VISTAS_updateScreen(CallbackInfo ci) {
Panoramas.setRandom();
PanoramasInternals.shouldRedoSplash = true;
}
updateScreen();
if (Panoramas.getCurrent() != null) {
this.backgroundRenderer = TimeAccess.newWithTime(Panoramas.getCurrent().getBackgroundId(), TimeAccess.getTime(backgroundRenderer));
} else {
this.backgroundRenderer = TimeAccess.newWithTime(TitleScreen.PANORAMA_CUBE_MAP, TimeAccess.getTime(backgroundRenderer));
}
}

@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/TextureManager;bindTexture(Lnet/minecraft/util/Identifier;)V", ordinal = 0), index = 0)
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/util/Identifier;)V", ordinal = 0), index = 1)
private Identifier VISTAS_modifyOverlay(Identifier defaultOverlay) {
if (Panoramas.getCurrent() != null) {
Identifier overlayId = new Identifier(Panoramas.getCurrent().getBackgroundId().toString() + "_overlay.png");
Expand All @@ -64,13 +71,4 @@ private void VISTAS_modifySplashOnRender(MatrixStack matrices, int mouseX, int m
}
}

@Unique
private void updateScreen() {
if (Panoramas.getCurrent() != null) {
this.backgroundRenderer = TimeAccess.newWithTime(Panoramas.getCurrent().getBackgroundId(), TimeAccess.getTime(backgroundRenderer));
} else {
this.backgroundRenderer = TimeAccess.newWithTime(TitleScreen.PANORAMA_CUBE_MAP, TimeAccess.getTime(backgroundRenderer));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.SinglePreparationResourceReloadListener;
import net.minecraft.resource.SinglePreparationResourceReloader;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.profiler.Profiler;

public class PanoramaManager extends SinglePreparationResourceReloadListener<HashMap<String, Panorama>> {
public class PanoramaManager extends SinglePreparationResourceReloader<HashMap<String, Panorama>> {

private static final Logger LOGGER = LogManager.getLogger();
private static final Gson PANORAMA_GSON = new GsonBuilder().registerTypeHierarchyAdapter(Text.class, new Text.Serializer()).registerTypeAdapter(Panorama.class, new PanoramaDeserializer()).create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.Util;
import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec3f;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -36,12 +37,12 @@ public final class PanoramicScreenshots {
* The rotations for the 6 sides of the rendered panorama.
*/
public static final List<Quaternion> ROTATIONS = ImmutableList.of(
Vector3f.POSITIVE_Y.getDegreesQuaternion(0),
Vector3f.POSITIVE_Y.getDegreesQuaternion(90),
Vector3f.POSITIVE_Y.getDegreesQuaternion(180),
Vector3f.POSITIVE_Y.getDegreesQuaternion(270),
Vector3f.POSITIVE_X.getDegreesQuaternion(-90),
Vector3f.POSITIVE_X.getDegreesQuaternion(90)
Vec3f.POSITIVE_Y.getDegreesQuaternion(0),
Vec3f.POSITIVE_Y.getDegreesQuaternion(90),
Vec3f.POSITIVE_Y.getDegreesQuaternion(180),
Vec3f.POSITIVE_Y.getDegreesQuaternion(270),
Vec3f.POSITIVE_X.getDegreesQuaternion(-90),
Vec3f.POSITIVE_X.getDegreesQuaternion(90)
);
/**
* Whether to take a screenshot the next time a frame is rendered.
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
"vistas.mixins.json"
],
"depends": {
"fabricloader": ">=0.7.4",
"fabricloader": ">=0.11.3",
"fabric": "*",
"minecraft": ">=1.16.4"
"minecraft": ">=1.16.5",
"java": ">=16"
}
}
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_8",
"compatibilityLevel": "JAVA_16",
"client": [
"GameRendererMixin",
"MinecraftClientMixin",
Expand Down

0 comments on commit 91c7f72

Please sign in to comment.