diff --git a/README.md b/README.md index 66f9b75..3ab92c7 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/gradle.properties b/gradle.properties index 7b2b8d8..edc08ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/com/github/telvarost/betterscreenshots/Config.java b/src/main/java/com/github/telvarost/betterscreenshots/Config.java index 8917d7e..686c892 100644 --- a/src/main/java/com/github/telvarost/betterscreenshots/Config.java +++ b/src/main/java/com/github/telvarost/betterscreenshots/Config.java @@ -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; } } \ No newline at end of file diff --git a/src/main/java/com/github/telvarost/betterscreenshots/IsometricScreenshotRenderer.java b/src/main/java/com/github/telvarost/betterscreenshots/IsometricScreenshotRenderer.java index 5c61bd2..bdb95a5 100644 --- a/src/main/java/com/github/telvarost/betterscreenshots/IsometricScreenshotRenderer.java +++ b/src/main/java/com/github/telvarost/betterscreenshots/IsometricScreenshotRenderer.java @@ -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; diff --git a/src/main/java/com/github/telvarost/betterscreenshots/mixin/BedrockMixin.java b/src/main/java/com/github/telvarost/betterscreenshots/mixin/BedrockMixin.java new file mode 100644 index 0000000..9d49f8a --- /dev/null +++ b/src/main/java/com/github/telvarost/betterscreenshots/mixin/BedrockMixin.java @@ -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 cir) { + if (BEDROCK.id == this.id) { + PlayerBase player = PlayerHelper.getPlayerFromGame(); + + if ( (null != player) + && (-1 == player.dimensionId) + && (Config.ConfigFields.disableRenderingNetherBedrock) + ) { + cir.setReturnValue(false); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/telvarost/betterscreenshots/mixin/MinecraftMixin.java b/src/main/java/com/github/telvarost/betterscreenshots/mixin/MinecraftMixin.java index 780b6ba..1c23801 100644 --- a/src/main/java/com/github/telvarost/betterscreenshots/mixin/MinecraftMixin.java +++ b/src/main/java/com/github/telvarost/betterscreenshots/mixin/MinecraftMixin.java @@ -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; @@ -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(); } diff --git a/src/main/resources/betterscreenshots.mixins.json b/src/main/resources/betterscreenshots.mixins.json index f4a6807..40728e6 100644 --- a/src/main/resources/betterscreenshots.mixins.json +++ b/src/main/resources/betterscreenshots.mixins.json @@ -4,6 +4,7 @@ "package": "com.github.telvarost.betterscreenshots.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ + "BedrockMixin", "GameRendererInvoker", "GameRendererMixin", "MinecraftMixin",