Skip to content

Commit

Permalink
UDOC-0 - Allow disabling bedrock rendering in the nether for nether i…
Browse files Browse the repository at this point in the history
…sometric photos; Fix screenshot text; Change default resolution to 8
  • Loading branch information
telvarost committed Mar 5, 2024
1 parent 5eb8cac commit 9f757ad
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 18 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Special thanks to Birevan and Exalm for the original version of the mod!
## List of Changes:

* Ability to change photo key bindings using controls menu in options.
* Ability to disable rendering bedrock in the nether (for nether isometric photos).
* ISOMETRIC_PHOTO_KEYBIND (default F7) — isometric screenshot (PNG)
* Change the scale for isometric screenshots (default 16) with GlassConfigAPI.
* Change the rotation angle for Isometric screenshots (default 0°) with GlassConfigAPI.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yarn_mappings=b1.7.3-build.2
loader_version=0.14.24-babric.1

# Mod Properties
mod_version=1.2.1
mod_version=1.3.0
maven_group=com.github.telvarost
archives_base_name=BetterScreenshots

Expand Down
29 changes: 15 additions & 14 deletions src/main/java/com/github/telvarost/betterscreenshots/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,28 @@ public class Config {
public static ConfigFields config = new ConfigFields();

public static class ConfigFields {
// @ConfigName("Disable BetterScreenshots Mod")
// public static Boolean disableBetterScreenshots = true;
@ConfigName("Custom Screenshot Height In Pixels")
@MaxLength(36863)
@Comment("Default Value: 2240")
public static Integer customResolutionPhotoHeight = 2240;

@ConfigName("Custom Screenshot Width In Pixels")
@MaxLength(36863)
@Comment("Default Value: 7680")
public static Integer customResolutionPhotoWidth = 7680;

@ConfigName("Disable Rendering Nether Bedrock")
@Comment("Reload world for changes to take effect")
public static Boolean disableRenderingNetherBedrock = false;

@ConfigName("Isometric Screenshot Resolution")
@MaxLength(255)
@Comment("Default Value: 16")
public static Integer isometricPhotoScale = 16;
@Comment("Default Value: 8")
public static Integer isometricPhotoScale = 8;

@ConfigName("Isometric Screenshot Rotation")
@MaxLength(3)
@Comment("0=0deg, 1=90deg, 2=180deg, 3=270deg")
public static Integer isometricPhotoRotation = 0;

@ConfigName("Custom Screenshot Width In Pixels")
@MaxLength(36863)
@Comment("Default Value: 7680")
public static Integer customResolutionPhotoWidth = 7680;

@ConfigName("Custom Screenshot Height In Pixels")
@MaxLength(36863)
@Comment("Default Value: 2240")
public static Integer customResolutionPhotoHeight = 2240;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ private File getOutputFile() {
}

public void doRender() {
this.progressUpdate.method_1796("Grabbing large screenshot");
this.progressUpdate.notifyIgnoreGameRunning("Taking isometric screenshot");
File outputFile = this.getOutputFile();
this.progressUpdate.notifyIgnoreGameRunning("Rendering");
this.progressUpdate.method_1796("Rendering with resolution of " + Config.ConfigFields.isometricPhotoScale + " and angle of " + Config.ConfigFields.isometricPhotoRotation + " deg");
this.progressUpdate.progressStagePercentage(0);
ModHelper.ModHelperFields.isTakingIsometricScreenshot = true;
double posX = this.mc.viewEntity.prevRenderX;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.github.telvarost.betterscreenshots.mixin;

import com.github.telvarost.betterscreenshots.Config;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockBase;
import net.minecraft.entity.player.PlayerBase;
import net.minecraft.level.BlockView;
import net.modificationstation.stationapi.api.entity.player.PlayerHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(BlockBase.class)
public class BedrockMixin {
@Shadow @Final public int id;

@Shadow @Final public static BlockBase BEDROCK;

public BedrockMixin(int i, int j) {
}

@Inject(
method = "isSideRendered",
at = @At("HEAD"),
cancellable = true
)
@Environment(EnvType.CLIENT)
public void isSideRendered(BlockView arg, int i, int j, int k, int l, CallbackInfoReturnable<Boolean> cir) {
if (BEDROCK.id == this.id) {
PlayerBase player = PlayerHelper.getPlayerFromGame();

if ( (null != player)
&& (-1 == player.dimensionId)
&& (Config.ConfigFields.disableRenderingNetherBedrock)
) {
cir.setReturnValue(false);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.client.render.*;
import net.minecraft.client.sound.SoundHelper;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.*;
import net.minecraft.entity.Living;
import net.minecraft.entity.player.AbstractClientPlayer;
import net.minecraft.entity.player.PlayerBase;
Expand Down Expand Up @@ -209,6 +208,7 @@ public int betterScreenshots_tickGetEventKey() {

/** - Check for ISOMETRIC_PHOTO keybinding pressed */
if(this.level != null && eventKey == KeyBindingListener.takeIsometricScreenshot.key) {
this.progressListener.notifyWithGameRunning("Taking isometric screenshot");
IsometricScreenshotRenderer isoRenderer = (new IsometricScreenshotRenderer((Minecraft) (Object)this, this.gameDirectory));
isoRenderer.doRender();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/betterscreenshots.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "com.github.telvarost.betterscreenshots.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"BedrockMixin",
"GameRendererInvoker",
"GameRendererMixin",
"MinecraftMixin",
Expand Down

0 comments on commit 9f757ad

Please sign in to comment.