Skip to content

Commit

Permalink
Move accessor usage to in-code classes to bypass mixin bug
Browse files Browse the repository at this point in the history
Works, version to 0.2.1

Signed-off-by: liach <liach@users.noreply.github.com>
  • Loading branch information
liach committed Sep 26, 2019
1 parent ef01674 commit 057ec7d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx2G

# Project Properties
modVersion=0.2.0
modVersion=0.2.1
mavenGroup=com.github.liachmodded
archivesBaseName=runorama
description=runemoro's panorama
Expand Down
10 changes: 10 additions & 0 deletions src/code/java/com/github/liachmodded/runorama/Runorama.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import com.github.liachmodded.runorama.client.BoundImage;
import com.github.liachmodded.runorama.client.CloseableBinder;
import com.github.liachmodded.runorama.client.VanillaPanorama;
import com.github.liachmodded.runorama.mixin.GameRendererAccessor;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.client.keybinding.KeyBindingRegistry;
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.InputUtil;
import net.minecraft.resource.ResourceImpl;
Expand Down Expand Up @@ -73,6 +75,14 @@ public static Runorama getInstance() {
return instance;
}

public static void setFov90(GameRenderer renderer, boolean value) {
((GameRendererAccessor) renderer).setFov90(value);
}

public static boolean isFov90(GameRenderer renderer) {
return ((GameRendererAccessor) renderer).isFov90();
}

@Override
public void onInitializeClient() {
instance = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public ClientMixin(String string_1) {
runorama.needsScreenshot = false;
// record
boolean oldHudHidden = options.hudHidden;
boolean oldFov90 = ((GameRendererAccessor) gameRenderer).isFov90();
boolean oldFov90 = Runorama.isFov90(gameRenderer);
Screen oldScreen = this.currentScreen;
// set
options.hudHidden = true;
((GameRendererAccessor) gameRenderer).setFov90(true);
Runorama.setFov90(gameRenderer, true);
currentScreen = null;
// take
float yaw = (cameraEntity == null ? player : cameraEntity).getYaw(this.paused ? this.pausedTickDelta : this.renderTickCounter.tickDelta);
Expand All @@ -89,7 +89,7 @@ public ClientMixin(String string_1) {
// restore
currentScreen = oldScreen;
options.hudHidden = oldHudHidden;
((GameRendererAccessor) gameRenderer).setFov90(oldFov90);
Runorama.setFov90(gameRenderer, oldFov90);

player.addChatMessage(new TranslatableText("runorama.shot", new LiteralText(root.toAbsolutePath().toString()).styled(style -> {
style.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, root.toAbsolutePath().toString()));
Expand Down

0 comments on commit 057ec7d

Please sign in to comment.