Skip to content

Commit

Permalink
Set rotation to 0 when taking a panoramic screenshot #change "By defa…
Browse files Browse the repository at this point in the history
…ult, panoramic screenshots are taken with a rotation of 0 for proper alignment" #release
  • Loading branch information
Prospector committed Dec 20, 2020
1 parent acebb74 commit 6ba3046
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx1G

mod_version=1.2.0
mod_version=1.2.1
maven_group=com.terraformersmc
archive_name=vistas

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class PanoramaConfig implements ConfigData {
public boolean forcePanorama = false;
public boolean randomPerScreen = false;
public boolean hectic = false;
public boolean lockPanoramicScreenshotRotation = true;

public static void init() {
AutoConfig.register(PanoramaConfig.class, GsonConfigSerializer::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.terraformersmc.vistas.mixin;

import com.terraformersmc.vistas.config.PanoramaConfig;
import com.terraformersmc.vistas.screenshot.PanoramicScreenshots;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GameRenderer;
Expand Down Expand Up @@ -59,6 +60,12 @@ public abstract class GameRendererMixin {

// setup
boolean oldFov90 = renderingPanorama;
float oldPitch = client.player.pitch;
float oldYaw = client.player.yaw;
if (PanoramaConfig.getInstance().lockPanoramicScreenshotRotation) {
client.player.pitch = 0;
client.player.yaw = 0;
}
boolean oldCulling = client.chunkCullingEnabled;
client.chunkCullingEnabled = false;
renderingPanorama = true;
Expand All @@ -73,6 +80,8 @@ public abstract class GameRendererMixin {
// restore
renderingPanorama = oldFov90;
client.chunkCullingEnabled = oldCulling;
client.player.pitch = oldPitch;
client.player.yaw = 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 Down
1 change: 1 addition & 0 deletions src/main/resources/assets/vistas/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"text.autoconfig.vistas.option.forcePanorama": "Force Panorama",
"text.autoconfig.vistas.option.randomPerScreen": "Random Per Screen",
"text.autoconfig.vistas.option.hectic": "Hectic (Warning, Flashing Colors)",
"text.autoconfig.vistas.option.lockPanoramicScreenshotRotation": "Lock Panoramic Screenshot Rotation to (0 / 0)",
"vistas.panoramic_screenshot.saved": "Panorama taken and saved at %s directory",
"key.vistas.panoramic_screenshot": "Take Panoramic Screenshot"
}

0 comments on commit 6ba3046

Please sign in to comment.