Skip to content

Commit

Permalink
Updated api's and configs
Browse files Browse the repository at this point in the history
- Updated config API's
- Removed Awful 'Hectic' config option
- Separated pitch and yaw in config for locking screenshots
  • Loading branch information
LudoCrypt committed Feb 24, 2021
1 parent 68cea82 commit 0771694
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 41 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ dependencies {
mod "fabric-loader", "net.fabricmc:fabric-loader:$project.loader_version"
mod "modmenu", "com.terraformersmc:modmenu:$project.modmenu_version"
includeMod "fabric-api", "net.fabricmc.fabric-api:fabric-api:$project.fabric_version"
includeMod "cloth-config-2", "me.shedaniel.cloth:config-2:$project.clothconfig_version"
includeMod "autoconfig", "me.sargunvohra.mcmods:autoconfig1u:$project.autoconfig_version"
includeMod "cloth-config-2", "me.shedaniel.cloth:cloth-config-fabric:$project.clothconfig_version"
}

repositories {
Expand All @@ -23,6 +22,9 @@ repositories {
name = 'TerraformersMC'
url = 'https://maven.terraformersmc.com/'
}
maven {
url "https://maven.shedaniel.me/"
}
}

jar {
Expand Down
11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ maven_group=com.terraformersmc
archive_name=vistas

minecraft_version=1.16.5
yarn_mappings=1.16.5+build.3
loader_version=0.11.1
fabric_version=0.30.0+1.16
modmenu_version=1.16.1
clothconfig_version=4.8.3
autoconfig_version=3.3.1
yarn_mappings=1.16.5+build.5
loader_version=0.11.2
fabric_version=0.31.0+1.16
modmenu_version=1.16.8
clothconfig_version=4.11.14

# Project Metadata
project_name=Vistas
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/com/terraformersmc/vistas/config/PanoramaConfig.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package com.terraformersmc.vistas.config;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;

@Config(name = "vistas")
public class PanoramaConfig implements ConfigData {

public String panorama = "minecraft";
public boolean forcePanorama = false;
public boolean randomPerScreen = false;
public boolean hectic = false;
public boolean lockPanoramicScreenshotRotation = true;
public String panorama = "minecraft";
public boolean forcePanorama = false;
public boolean randomPerScreen = false;
public boolean lockScreenshotPitch = true;
public boolean lockScreenshotYaw = false;

public static void init() {
AutoConfig.register(PanoramaConfig.class, GsonConfigSerializer::new);
}
public static void init() {
AutoConfig.register(PanoramaConfig.class, GsonConfigSerializer::new);
}

public static PanoramaConfig getInstance() {
return AutoConfig.getConfigHolder(PanoramaConfig.class).getConfig();
}
public static PanoramaConfig getInstance() {
return AutoConfig.getConfigHolder(PanoramaConfig.class).getConfig();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;

import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class VistasModMenuCompat implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(PanoramaConfig.class, parent).get();
}
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(PanoramaConfig.class, parent).get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public abstract class GameRendererMixin {
boolean oldFov90 = renderingPanorama;
float oldPitch = client.player.pitch;
float oldYaw = client.player.yaw;
if (PanoramaConfig.getInstance().lockPanoramicScreenshotRotation) {
if (PanoramaConfig.getInstance().lockScreenshotPitch) {
client.player.pitch = 0;
}
if (PanoramaConfig.getInstance().lockScreenshotYaw) {
client.player.yaw = 0;
}
boolean oldCulling = client.chunkCullingEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ private void VISTAS_initPanoramaChange(CallbackInfo ci) {
updateScreen();
}

@Inject(method = "tick", at = @At("TAIL"))
private void VISTAS_tickPanoramaChange(CallbackInfo ci) {

if (PanoramaConfig.getInstance().hectic) {
Panoramas.setRandom();

updateScreen();
}
}

@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/TextureManager;bindTexture(Lnet/minecraft/util/Identifier;)V", ordinal = 0), index = 0)
private Identifier VISTAS_overlayMixin(Identifier defaultOverlay) {
if (Panoramas.getCurrent() != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/vistas/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"text.autoconfig.vistas.option.panorama": "Panorama",
"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)",
"text.autoconfig.vistas.option.lockScreenshotPitch": "Lock Panoramic Screenshot Pitch (U,D) to 0",
"text.autoconfig.vistas.option.lockScreenshotYaw": "Lock Panoramic Screenshot Yaw (L,R) to 0",
"vistas.panoramic_screenshot.saved": "Panorama taken and saved at %s directory",
"key.vistas.panoramic_screenshot": "Take Panoramic Screenshot"
}

0 comments on commit 0771694

Please sign in to comment.