panorama and small fixes
@@ -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
|
||||||
|
|||||||
0
run/config/panodebugmode.txt
Normal file
BIN
run/screenshots/2026-02-11_08.41.35.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
run/screenshots/2026-02-11_08.41.36.png
Normal file
|
After Width: | Height: | Size: 2.0 MiB |
BIN
run/screenshots/2026-02-16_10.40.11.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
run/screenshots/2026-02-16_10.44.15.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
run/screenshots/2026-02-16_10.50.05.png
Normal file
|
After Width: | Height: | Size: 796 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 197 KiB |
|
After Width: | Height: | Size: 443 KiB |
|
After Width: | Height: | Size: 868 KiB |
|
After Width: | Height: | Size: 907 KiB |
|
After Width: | Height: | Size: 913 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 169 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 740 KiB |
|
After Width: | Height: | Size: 600 KiB |
|
After Width: | Height: | Size: 1014 KiB |
|
After Width: | Height: | Size: 933 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 946 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_0.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_1.png
Normal file
|
After Width: | Height: | Size: 738 KiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_2.png
Normal file
|
After Width: | Height: | Size: 701 KiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_3.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_4.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
BIN
run/screenshots/panorama-2026-02-18_09-00-41/panorama_5.png
Normal file
|
After Width: | Height: | Size: 576 KiB |
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 879 KiB |
|
After Width: | Height: | Size: 946 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"szar:niggerite_block"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"replace": false,
|
"replace": false,
|
||||||
"values": [
|
"values": [
|
||||||
"szar:uranium_ore"
|
"szar:uranium_ore",
|
||||||
|
"szar:niggerite_block"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "szar:niggerite_block"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||