Compare commits
3 Commits
1.16.2-fab
...
1.16.4-for
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b367e81569 | ||
|
|
bc89d27b85 | ||
|
|
4e8d9aaf3b |
11
README.md
11
README.md
@@ -9,3 +9,14 @@ Simply run the "gradle build" (or "./gradlew build" on OSX and Linux) to create
|
|||||||
|
|
||||||
# Licensing
|
# Licensing
|
||||||
This mod is licensed under the GNU General Public License version 3.0. In short, you are allowed to use and modify this mod for whatever you wish (including commercial use), but all distributions (modified or otherwise) must be under the same license, contain the source code (with changes highlighted), and preserve the copyright notices.
|
This mod is licensed under the GNU General Public License version 3.0. In short, you are allowed to use and modify this mod for whatever you wish (including commercial use), but all distributions (modified or otherwise) must be under the same license, contain the source code (with changes highlighted), and preserve the copyright notices.
|
||||||
|
|
||||||
|
# A Message on the Future of this Application.
|
||||||
|
*To anyone who finds this useful.*
|
||||||
|
|
||||||
|
*I've recently taken on a new job, and, due to the demands of a full-time developer job, I will no longer be able to finish this project. I've had a lot of fun with it, but continuing it for the future is simply unfeasible.*
|
||||||
|
|
||||||
|
*With that said, this application is fully open-source, and anyone is available to freely use it, modify it, or maintain their own copy. The only thing I require is that the copyright and license is preserved. I hope that you find this useful.
|
||||||
|
|
||||||
|
*May God bless you all,*
|
||||||
|
|
||||||
|
*Markil 3*
|
||||||
|
|||||||
@@ -3,21 +3,15 @@ package markil3.panorama;
|
|||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
|
||||||
import net.minecraft.client.renderer.texture.NativeImage;
|
import net.minecraft.client.renderer.texture.NativeImage;
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.ScreenShotHelper;
|
import net.minecraft.util.ScreenShotHelper;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.InterModComms;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
@@ -33,7 +27,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.stream.Collectors;
|
import java.util.Optional;
|
||||||
|
|
||||||
// The value here should match an entry in the META-INF/mods.toml file
|
// The value here should match an entry in the META-INF/mods.toml file
|
||||||
@Mod("panorama")
|
@Mod("panorama")
|
||||||
@@ -84,7 +78,7 @@ public class Main
|
|||||||
File panoramas = new File(mc.gameDir, "panoramas");
|
File panoramas = new File(mc.gameDir, "panoramas");
|
||||||
if (panoramas.isDirectory())
|
if (panoramas.isDirectory())
|
||||||
{
|
{
|
||||||
for (File panorama : panoramas.listFiles())
|
for (File panorama : Optional.ofNullable(panoramas.listFiles()).orElse(new File[0]))
|
||||||
{
|
{
|
||||||
if (panorama.isDirectory())
|
if (panorama.isDirectory())
|
||||||
{
|
{
|
||||||
@@ -129,41 +123,51 @@ public class Main
|
|||||||
|
|
||||||
static void renderPanorama(Minecraft mc)
|
static void renderPanorama(Minecraft mc)
|
||||||
{
|
{
|
||||||
|
final SimpleDateFormat FORMATTER =
|
||||||
|
new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
|
||||||
|
|
||||||
final int SCREENSHOT_WIDTH = 2048;
|
final int SCREENSHOT_WIDTH = 2048;
|
||||||
final int SCREENSHOT_HEIGHT = 2048;
|
final int SCREENSHOT_HEIGHT = 2048;
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
RenderSystem.viewport(0, 0, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
|
RenderSystem.viewport(0, 0, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
|
||||||
|
|
||||||
if (mc.world != null)
|
if (mc.world != null)
|
||||||
{
|
{
|
||||||
|
name = FORMATTER.format(new Date());
|
||||||
// We need to render an extra frame at the beginning, or
|
// We need to render an extra frame at the beginning, or
|
||||||
// otherwise it won't render correctly.
|
// otherwise it won't render correctly.
|
||||||
for (int i = -1; i < 6; i++)
|
for (int i = -1; i < 6; i++)
|
||||||
{
|
{
|
||||||
mc.gameRenderer.renderWorld(mc.getRenderPartialTicks(),
|
mc.gameRenderer.renderWorld(mc.getRenderPartialTicks(),
|
||||||
Util.nanoTime(), new MatrixStack());
|
Util.nanoTime(), new MatrixStack());
|
||||||
saveScreenshot(mc, 0, i);
|
saveScreenshot(mc, name, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void saveScreenshot(Minecraft mc, int panoramaNum, int panoramaSide)
|
static void saveScreenshot(Minecraft mc, String name, int panoramaSide)
|
||||||
{
|
{
|
||||||
final SimpleDateFormat FORMATTER =
|
|
||||||
new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss");
|
|
||||||
final int FRAMEBUFFER_WIDTH = mc.getMainWindow().getFramebufferWidth();
|
final int FRAMEBUFFER_WIDTH = mc.getMainWindow().getFramebufferWidth();
|
||||||
final int FRAMEBUFFER_HEIGHT =
|
final int FRAMEBUFFER_HEIGHT =
|
||||||
mc.getMainWindow().getFramebufferHeight();
|
mc.getMainWindow().getFramebufferHeight();
|
||||||
final int SCREENSHOT_WIDTH = 2048;
|
final int SCREENSHOT_WIDTH = 1024;
|
||||||
final int SCREENSHOT_HEIGHT = 2048;
|
final int SCREENSHOT_HEIGHT = 1024;
|
||||||
|
|
||||||
File file = new File(mc.gameDir,
|
File file = new File(mc.gameDir,
|
||||||
"panoramas/" + FORMATTER.format(new Date()) + "/panorama_" + panoramaSide +
|
"panoramas/" + name + "/panorama_" + panoramaSide +
|
||||||
".png");
|
".png");
|
||||||
file.getParentFile().mkdirs();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
file.createNewFile();
|
if (!file.getParentFile().mkdirs())
|
||||||
|
{
|
||||||
|
throw new IOException("Could not create panorama directory " + file.getParent());
|
||||||
|
}
|
||||||
|
if (!file.createNewFile())
|
||||||
|
{
|
||||||
|
throw new IOException("Could not create file " + file.getAbsolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user