Skip to content

Commit

Permalink
Prepare for 1.19.4 release.
Browse files Browse the repository at this point in the history
* Address various code quality warnings
- Move Fabric API from inclusion to dependency
- Add Quilt to the supported environments
  • Loading branch information
gniftygnome committed Jun 24, 2023
1 parent 995a5c1 commit 23176d2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 20 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.1.+'
}

apply from: 'https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.5/ferry.gradle'
Expand All @@ -12,9 +12,10 @@ dependencies {
mappings "net.fabricmc:yarn:$project.yarn_mappings:v2"

mod "fabric-loader", "net.fabricmc:fabric-loader:$project.loader_version"
mod "fabric-api", "net.fabricmc.fabric-api:fabric-api:$project.fabric_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:cloth-config-fabric:$project.clothconfig_version"
includeMod "cloth-config", "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}"
}

repositories {
Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ default_release_type=beta
# CurseForge Metadata
curseforge_slug=vistas
curseforge_id=423659
curseforge_game_versions=1.19, 1.19.1, 1.19.2, Fabric
curseforge_required_dependencies=
curseforge_game_versions=1.19.4, Fabric, Quilt
curseforge_required_dependencies=fabric-api
curseforge_optional_dependencies=

# Modrinth Metadata
modrinth_slug=vistas
modrinth_id=itzZXRxq
modrinth_game_versions=1.19, 1.19.1, 1.19.2
modrinth_mod_loaders=fabric
modrinth_game_versions=1.19.4
modrinth_mod_loaders=fabric, quilt
modrinth_required_dependencies=fabric-api

# Mod Loader Metadata
loader_icon=https://fabricmc.net/assets/logo.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.Framebuffer;
import net.minecraft.client.gl.SimpleFramebuffer;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.util.ScreenshotRecorder;
Expand All @@ -45,25 +44,22 @@ public abstract class GameRendererMixin {

@Shadow
@Final
private MinecraftClient client;
MinecraftClient client;

@Shadow
private boolean renderingPanorama;

@Shadow
@Final
private Camera camera;

@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V", shift = Shift.BEFORE))
public void vistas$render(float delta, long startTime, boolean tick, CallbackInfo ci) {
assert client.player != null;
if (PanoramicScreenshots.timeSinceLastKeyPress >= 0.0D) {
PanoramicScreenshots.timeSinceLastKeyPress -= delta;
}
if (PanoramicScreenshots.onShot != -1) {
PanoramicScreenshots.time += delta;
}
if (PanoramicScreenshots.time > 375.0D) {
if (!PanoramicScreenshots.startingRotation.isEmpty()) {
if (PanoramicScreenshots.startingRotation.isPresent()) {
client.player.setPitch(PanoramicScreenshots.startingRotation.get().getFirst());
client.player.setYaw(PanoramicScreenshots.startingRotation.get().getSecond());
}
Expand All @@ -88,6 +84,7 @@ public abstract class GameRendererMixin {
}
File rootFile = root.toFile();
if (!rootFile.exists()) {
//noinspection ResultOfMethodCallIgnored
rootFile.mkdirs();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ protected TitleScreenMixin(Text title) {

@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/RotatingCubeMapRenderer;render(FF)V", shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD)
private void vistas$render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci, float f) {
assert this.client != null;
PanoramaRenderer.time += delta;
VistasTitle.CURRENT.getValue().getCubemaps().forEach((cubemap) -> {
PanoramaRenderer panoramaRenderer = new PanoramaRenderer(cubemap);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/terraformersmc/vistas/panorama/Cubemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import net.minecraft.util.Identifier;

@SuppressWarnings("unused")
public class Cubemap {

public static final Cubemap DEFAULT = new Cubemap();
Expand Down Expand Up @@ -39,6 +40,7 @@ public Cubemap(Identifier cubemapId, RotationControl rotationControl, VisualCont
this.visualControl = visualControl;
}

@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public Cubemap(Optional<Identifier> cubemapId, Optional<RotationControl> rotationControl, Optional<VisualControl> visualControl) {
this.cubemapId = cubemapId.orElse(new Identifier("textures/gui/title/background/panorama"));
this.rotationControl = rotationControl.orElse(RotationControl.DEFAULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.joml.Quaternionf;

//TODO: rewrite; i dont know what im doing!
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public class PanoramicScreenshots {

private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
Expand Down Expand Up @@ -60,25 +61,25 @@ public static void registerKeyBinding() {

public static void saveScreenshot(NativeImage screenshot, Path folder, int i) {
Util.getIoWorkerExecutor().execute(() -> {
try {
try (screenshot) {
int width = screenshot.getWidth();
int height = screenshot.getHeight();
int x = 0;
int y = 0;
if (width > height) {
x = (width - height) / 2;
//noinspection SuspiciousNameCombination
width = height;
} else {
y = (height - width) / 2;
//noinspection SuspiciousNameCombination
height = width;
}
NativeImage saved = new NativeImage(width, height, false);
screenshot.resizeSubRectTo(x, y, width, height, saved);
saved.writeTo(folder.resolve("panorama_" + i + ".png"));
} catch (IOException exception) {
Vistas.LOGGER.warn("Couldn't save screenshot", exception);
} finally {
screenshot.close();
}
});
}
Expand All @@ -89,6 +90,7 @@ public static Path getPanoramicScreenshotFolder() {
}
File rootFile = FabricLoader.getInstance().getGameDir().resolve("screenshots/panoramas/").toFile();
if (!rootFile.exists()) {
//noinspection ResultOfMethodCallIgnored
rootFile.mkdirs();
}
String string = DATE_FORMAT.format(new Date());
Expand All @@ -97,6 +99,7 @@ public static Path getPanoramicScreenshotFolder() {
while (true) {
File file = new File(rootFile, string + (i == 1 ? "" : "_" + i));
if (!file.exists()) {
//noinspection ResultOfMethodCallIgnored
file.mkdir();
return file.toPath();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public PanoramaRenderer(Cubemap cubemap) {
this.client = MinecraftClient.getInstance();
}

@SuppressWarnings("unused")
public void render(float delta, float alpha) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
import net.minecraft.util.InvalidIdentifierException;
import net.minecraft.util.profiler.Profiler;

@SuppressWarnings("unused")
public class VistasTitle {

public static final ConcurrentMap<Identifier, Panorama> BUILTIN_PANORAMAS = Maps.newConcurrentMap();
public static final ConcurrentMap<Identifier, Panorama> PANORAMAS = Maps.newConcurrentMap();
public static final ConcurrentMap<Panorama, Identifier> PANORAMAS_INVERT = Maps.newConcurrentMap();
public static final List<Panorama> DISTRIBUTION = Lists.newArrayList();
public static final MutableObject<Panorama> CURRENT = new MutableObject<Panorama>(Panorama.DEFAULT);
public static final MutableObject<Panorama> CURRENT = new MutableObject<>(Panorama.DEFAULT);

public static void choose() {
choose(MinecraftClient.getInstance().getProfiler());
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"vistas.mixins.json"
],
"depends": {
"fabricloader": ">=0.12.12",
"fabric": "*"
"fabricloader": ">=0.13.3",
"fabric": "*",
"minecraft": ">=1.19.4 <1.20"
}
}

0 comments on commit 23176d2

Please sign in to comment.