panorama and small fixes

This commit is contained in:
2026-02-18 09:14:52 +01:00
parent f06a3d6a99
commit 372212847f
50 changed files with 144 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10 yarn_mappings=1.20.1+build.10
loader_version=0.18.3 loader_version=0.18.3
# Mod Properties # Mod Properties
mod_version=26.2.17 mod_version=26.2.18
maven_group=dev.tggamesyt maven_group=dev.tggamesyt
archives_base_name=szar archives_base_name=szar
# Dependencies # Dependencies

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 KiB

View File

@@ -0,0 +1,83 @@
package dev.tggamesyt.szar.client;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext;
import dev.tggamesyt.szar.Szar;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import java.io.File;
import java.nio.file.Files;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
public class PanoramaClientCommand {
static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
dispatcher.register(literal("takepanorama")
.executes(PanoramaClientCommand::execute));
}
private static int execute(CommandContext<FabricClientCommandSource> context) {
MinecraftClient client = MinecraftClient.getInstance();
if (client.world == null) {
context.getSource().sendError(Text.literal("Not in world."));
return 0;
}
client.execute(() -> {
try {
createPanorama(client, context);
} catch (Exception e) {
context.getSource().sendError(Text.literal("Failed: " + e.getMessage()));
e.printStackTrace();
}
});
return 1;
}
private static void createPanorama(MinecraftClient client,
CommandContext<FabricClientCommandSource> context) throws Exception {
String timestamp = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
File screenshotDir = new File(client.runDirectory, "screenshots");
File panoramaDir = new File(screenshotDir, "panorama-" + timestamp);
Files.createDirectories(panoramaDir.toPath());
// This creates: panoramaDir/screenshots/
Text result = client.takePanorama(panoramaDir, 1024, 1024);
// Move files up one folder
File innerScreenshotDir = new File(panoramaDir, "screenshots");
if (innerScreenshotDir.exists()) {
for (int i = 0; i < 6; i++) {
File src = new File(innerScreenshotDir, "panorama_" + i + ".png");
File dst = new File(panoramaDir, "panorama_" + i + ".png");
if (src.exists()) {
Files.move(src.toPath(), dst.toPath());
}
}
// Delete the now-empty inner screenshots folder
innerScreenshotDir.delete();
}
context.getSource().sendFeedback(result);
}
}

View File

@@ -7,6 +7,7 @@ import dev.tggamesyt.szar.Szar;
import dev.tggamesyt.szar.PlaneAnimation; import dev.tggamesyt.szar.PlaneAnimation;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
@@ -36,6 +37,10 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.*; import java.util.*;
import static dev.tggamesyt.szar.Szar.*; import static dev.tggamesyt.szar.Szar.*;
@@ -324,8 +329,35 @@ public class SzarClient implements ClientModInitializer {
(stack, world, entity, seed) -> { (stack, world, entity, seed) -> {
return entity != null && entity.getMainHandStack() == stack ? 1.0f : 0.0f; return entity != null && entity.getMainHandStack() == stack ? 1.0f : 0.0f;
}); });
if (isDebugEnabled()) {
ClientCommandRegistrationCallback.EVENT.register(
(dispatcher, registryAccess) -> PanoramaClientCommand.register(dispatcher)
);
}
} }
private boolean isDebugEnabled() {
MinecraftClient client = MinecraftClient.getInstance();
File configDir = new File(client.runDirectory, "config");
File debugFile = new File(configDir, "panodebugmode.txt");
if (!debugFile.exists()) {
return false;
}
try {
String content = Files.readString(debugFile.toPath(), StandardCharsets.UTF_8)
.trim();
return content.equals("true");
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
private static void scrambleMovement(MinecraftClient client, float chance) { private static void scrambleMovement(MinecraftClient client, float chance) {
var options = client.options; var options = client.options;
long window = client.getWindow().getHandle(); long window = client.getWindow().getHandle();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"szar:niggerite_block"
]
}

View File

@@ -1,6 +1,7 @@
{ {
"replace": false, "replace": false,
"values": [ "values": [
"szar:uranium_ore" "szar:uranium_ore",
"szar:niggerite_block"
] ]
} }

View File

@@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "szar:niggerite_block"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}