Compare commits
3 Commits
1.16.2-fab
...
1.16.4-for
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b367e81569 | ||
|
|
bc89d27b85 | ||
|
|
4e8d9aaf3b |
201
build.gradle
201
build.gradle
@@ -1,90 +1,165 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version + "-" + project.minecraft_version + "-fabric"
|
||||
group = project.maven_group
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
repositories {
|
||||
maven { url "https://maven.shedaniel.me/" }
|
||||
maven { url "https://maven.terraformersmc.com/" }
|
||||
}
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version + "-" + project.minecraft_version + "-forge"
|
||||
group = project.maven_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
minecraft {
|
||||
// The mappings can be changed at any time, and must be in the following format.
|
||||
// snapshot_YYYYMMDD Snapshot are built nightly.
|
||||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'snapshot', version: project.mappings
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
|
||||
mods {
|
||||
examplemod {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
dependencies {
|
||||
// To change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
modApi "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}"
|
||||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
compile(fg.deobf("me.shedaniel.cloth:cloth-config-forge:${project.cloth_version}"))
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
// compile "some.group:artifact:version"
|
||||
|
||||
// Real examples
|
||||
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
||||
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
||||
|
||||
// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// These dependencies get remapped to your current MCP mappings
|
||||
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
|
||||
|
||||
// For more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
||||
// You may need to force-disable transitiveness on them.
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
// If Javadoc is generated, this must be specified in that task too.
|
||||
it.options.encoding = "UTF-8"
|
||||
|
||||
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
||||
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
||||
// We'll use that if it's available, but otherwise we'll use the older option.
|
||||
def targetVersion = 8
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
it.options.release = targetVersion
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading by the runtime..
|
||||
jar {
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.archivesBaseName}"}
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title": project.archivesBaseName,
|
||||
"Specification-Vendor": "Markil 3",
|
||||
"Specification-Version": project.version,
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${version}",
|
||||
"Implementation-Vendor" :"Markil 3",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
// Example configuration to allow publishing using the maven-publish task
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
jar.finalizedBy('reobfJar')
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
|
||||
//publish.dependsOn('reobfJar')
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// add all the jars that should be included when publishing to maven
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
artifact jar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
maven {
|
||||
url "file:///${project.projectDir}/mcmodsrepo"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
# Forge Properties
|
||||
minecraft_version=1.16.2
|
||||
yarn_mappings=1.16.2+build.47
|
||||
loader_version=0.11.1
|
||||
minecraft_version=1.16.4
|
||||
mappings=20201028-1.16.3
|
||||
forge_version=35.1.37
|
||||
|
||||
fabric_version=0.31.0+1.16
|
||||
cloth_version=4.11.14
|
||||
modmenu_version=1.16.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
|
||||
|
||||
53
gradlew
vendored
53
gradlew
vendored
@@ -1,21 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
@@ -44,7 +28,7 @@ APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
@@ -82,7 +66,6 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -126,11 +109,10 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -156,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -177,9 +159,14 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
43
gradlew.bat
vendored
43
gradlew.bat
vendored
@@ -1,19 +1,3 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@@ -29,18 +13,15 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -54,7 +35,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -64,14 +45,28 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,119 @@
|
||||
package markil3.panorama;
|
||||
|
||||
import net.minecraft.client.render.Camera;
|
||||
|
||||
import markil3.panorama.mixins.CameraAccessor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.MainMenuScreen;
|
||||
import net.minecraft.client.renderer.RenderSkybox;
|
||||
import net.minecraft.client.renderer.RenderSkyboxCube;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.ScreenshotEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(Dist.CLIENT)
|
||||
public class EventBus
|
||||
{
|
||||
public static void onCamera(Camera event)
|
||||
static int screenshotState = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onScreenshot(ScreenshotEvent event)
|
||||
{
|
||||
if (Main.isRenderingPanorama())
|
||||
// event.setCanceled(true);
|
||||
screenshotState = 1;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRender(TickEvent.RenderTickEvent event)
|
||||
{
|
||||
switch (Main.getPanoramaStage() - 2)
|
||||
if (event.phase == TickEvent.Phase.START && screenshotState > 0)
|
||||
{
|
||||
Main.renderPanorama(Minecraft.getInstance());
|
||||
screenshotState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderHand(RenderHandEvent event)
|
||||
{
|
||||
if (screenshotState > 0)
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onFov(EntityViewRenderEvent.FOVModifier event)
|
||||
{
|
||||
if (screenshotState > 0)
|
||||
{
|
||||
event.setFOV(90);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onCamera(EntityViewRenderEvent.CameraSetup event)
|
||||
{
|
||||
if (screenshotState > 0)
|
||||
{
|
||||
event.setRoll(0);
|
||||
switch (screenshotState - 2)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
((CameraAccessor) event).setView(0, 0);
|
||||
event.setYaw(0F);
|
||||
event.setPitch(0);
|
||||
break;
|
||||
case 1:
|
||||
((CameraAccessor) event).setView(90, 0);
|
||||
event.setYaw(90);
|
||||
event.setPitch(0);
|
||||
break;
|
||||
case 2:
|
||||
((CameraAccessor) event).setView(180, 0);
|
||||
event.setYaw(180);
|
||||
event.setPitch(0);
|
||||
break;
|
||||
case 3:
|
||||
((CameraAccessor) event).setView(270, 0);
|
||||
event.setYaw(270);
|
||||
event.setPitch(0);
|
||||
break;
|
||||
case 4:
|
||||
((CameraAccessor) event).setView(0, -90);
|
||||
event.setYaw(0);
|
||||
event.setPitch(-90);
|
||||
break;
|
||||
case 5:
|
||||
((CameraAccessor) event).setView(0, 90);
|
||||
event.setYaw(0);
|
||||
event.setPitch(90);
|
||||
break;
|
||||
}
|
||||
screenshotState++;
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void onShowScreen(GuiScreenEvent.InitGuiEvent event)
|
||||
{
|
||||
if (event instanceof GuiScreenEvent.InitGuiEvent.Pre)
|
||||
{
|
||||
if (Main.numPanoramas > 0)
|
||||
{
|
||||
int panorama =
|
||||
MathHelper.floor(Math.random() * Main.numPanoramas);
|
||||
MainMenuScreen screen;
|
||||
if (event.getGui() instanceof MainMenuScreen)
|
||||
{
|
||||
// Main.loadPanoramas(Minecraft.getInstance());
|
||||
screen = (MainMenuScreen) event.getGui();
|
||||
screen.panorama =
|
||||
new RenderSkybox(new RenderSkyboxCube(new ResourceLocation(
|
||||
"panorama:textures/gui/title/background/" + panorama + "/panorama")));
|
||||
System.out.printf("Displaying panorama %d\n", panorama);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
package markil3.panorama;
|
||||
|
||||
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.ResourceTexture;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
||||
import net.minecraft.client.resources.data.TextureMetadataSection;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class FileTexture extends ResourceTexture
|
||||
public class FileTexture extends SimpleTexture
|
||||
{
|
||||
private final File file;
|
||||
|
||||
public FileTexture(Identifier p_i1275_1_, File file)
|
||||
public FileTexture(ResourceLocation p_i1275_1_, File file)
|
||||
{
|
||||
super(p_i1275_1_);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceTexture.TextureData loadTextureData(ResourceManager p_215246_1_)
|
||||
protected TextureData getTextureData(IResourceManager p_215246_1_)
|
||||
{
|
||||
return getTextureData(p_215246_1_, this.file);
|
||||
}
|
||||
|
||||
public static ResourceTexture.TextureData getTextureData(ResourceManager resourceManagerIn,
|
||||
public static SimpleTexture.TextureData getTextureData(IResourceManager resourceManagerIn,
|
||||
File locationIn)
|
||||
{
|
||||
NativeImage image;
|
||||
TextureResourceMetadata meta;
|
||||
TextureMetadataSection meta;
|
||||
try (FileInputStream stream = new FileInputStream(locationIn))
|
||||
{
|
||||
image =
|
||||
NativeImage.read(stream);
|
||||
meta = null;
|
||||
|
||||
return new ResourceTexture.TextureData(null,
|
||||
return new SimpleTexture.TextureData(null,
|
||||
image);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return new ResourceTexture.TextureData(e);
|
||||
return new SimpleTexture.TextureData(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
package markil3.panorama;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.CubeMapRenderer;
|
||||
import net.minecraft.client.gui.RotatingCubeMapRenderer;
|
||||
import net.minecraft.client.texture.NativeImage;
|
||||
import net.minecraft.client.texture.TextureManager;
|
||||
import net.minecraft.client.util.ScreenshotUtils;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.resource.ResourceType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.ScreenShotHelper;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -26,56 +27,69 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Main implements ModInitializer, IdentifiableResourceReloadListener
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
@Mod("panorama")
|
||||
public class Main
|
||||
{
|
||||
// Directly reference a log4j logger.
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
static int numPanoramas = 0;
|
||||
|
||||
private static int screenshotState = 0;
|
||||
|
||||
@Override
|
||||
public void onInitialize()
|
||||
{
|
||||
// ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES)
|
||||
// .registerReloadListener(this);
|
||||
}
|
||||
|
||||
public Main()
|
||||
{
|
||||
// Register the setup method for modloading
|
||||
FMLJavaModLoadingContext.get()
|
||||
.getModEventBus()
|
||||
.addListener(this::setup);
|
||||
// Register the enqueueIMC method for modloading
|
||||
FMLJavaModLoadingContext.get()
|
||||
.getModEventBus()
|
||||
.addListener(this::enqueueIMC);
|
||||
// Register the processIMC method for modloading
|
||||
FMLJavaModLoadingContext.get()
|
||||
.getModEventBus()
|
||||
.addListener(this::processIMC);
|
||||
// Register the doClientStuff method for modloading
|
||||
FMLJavaModLoadingContext.get()
|
||||
.getModEventBus()
|
||||
.addListener(this::doClientStuff);
|
||||
FMLJavaModLoadingContext.get()
|
||||
.getModEventBus()
|
||||
.addListener(this::onStitch);
|
||||
|
||||
// Register ourselves for server and other game events we are
|
||||
// interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
static void loadPanoramas(MinecraftClient mc,
|
||||
ResourceManager manager,
|
||||
Executor prepareExecutor,
|
||||
Executor applyExecutor)
|
||||
public void onStitch(ModelBakeEvent event)
|
||||
{
|
||||
Main.loadPanoramas(Minecraft.getInstance());
|
||||
}
|
||||
|
||||
static void loadPanoramas(Minecraft mc)
|
||||
{
|
||||
int i = 0;
|
||||
int j;
|
||||
TextureManager textureManager = mc.getTextureManager();
|
||||
File panoramas = new File(mc.runDirectory, "panoramas");
|
||||
TextureManager textureManager = mc.textureManager;
|
||||
ResourceLocation loc;
|
||||
File panoramas = new File(mc.gameDir, "panoramas");
|
||||
if (panoramas.isDirectory())
|
||||
{
|
||||
for (File panorama : panoramas.listFiles())
|
||||
for (File panorama : Optional.ofNullable(panoramas.listFiles()).orElse(new File[0]))
|
||||
{
|
||||
if (panorama.isDirectory())
|
||||
{
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
int finalI = i;
|
||||
int finalJ = j;
|
||||
Identifier loc = new Identifier(
|
||||
"panorama:textures/gui/title" +
|
||||
"/background/" + finalI +
|
||||
"/panorama_" + finalJ + ".png");
|
||||
textureManager.registerTexture(loc,
|
||||
loc = new ResourceLocation(
|
||||
"panorama:textures/gui/title/background/" + i + "/panorama_" + j + ".png");
|
||||
textureManager.loadTexture(loc,
|
||||
new FileTexture(loc,
|
||||
new File(panorama,
|
||||
"panorama_" + finalJ +
|
||||
".png")));
|
||||
"panorama_" + j + ".png")));
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -84,50 +98,37 @@ public class Main implements ModInitializer, IdentifiableResourceReloadListener
|
||||
numPanoramas = i;
|
||||
}
|
||||
|
||||
public static boolean isRenderingPanorama()
|
||||
private void setup(final FMLCommonSetupEvent event)
|
||||
{
|
||||
return screenshotState > 0;
|
||||
}
|
||||
|
||||
public static int getPanoramaStage()
|
||||
private void doClientStuff(final FMLClientSetupEvent event)
|
||||
{
|
||||
return screenshotState;
|
||||
// loadPanoramas(event.getMinecraftSupplier().get());
|
||||
}
|
||||
|
||||
public static int nextStage()
|
||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
||||
{
|
||||
return ++screenshotState;
|
||||
}
|
||||
|
||||
public static void startRenderingPanorama()
|
||||
private void processIMC(final InterModProcessEvent event)
|
||||
{
|
||||
screenshotState = 1;
|
||||
}
|
||||
|
||||
public static void finishRenderingPanorama()
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(FMLServerStartingEvent event)
|
||||
{
|
||||
screenshotState = 0;
|
||||
}
|
||||
|
||||
public static RotatingCubeMapRenderer getPanorama()
|
||||
{
|
||||
if (numPanoramas > 0)
|
||||
{
|
||||
int panorama =
|
||||
MathHelper.floor(Math.random() * Main.numPanoramas);
|
||||
return new RotatingCubeMapRenderer(new CubeMapRenderer(new Identifier(
|
||||
"panorama:textures/gui/title/background/" + panorama +
|
||||
"/panorama")));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void renderPanorama(MinecraftClient 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_HEIGHT = 2048;
|
||||
|
||||
String name;
|
||||
|
||||
RenderSystem.viewport(0, 0, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
|
||||
@@ -139,39 +140,44 @@ public class Main implements ModInitializer, IdentifiableResourceReloadListener
|
||||
// otherwise it won't render correctly.
|
||||
for (int i = -1; i < 6; i++)
|
||||
{
|
||||
mc.gameRenderer.renderWorld(mc.getTickDelta(),
|
||||
Util.getMeasuringTimeNano(), new MatrixStack());
|
||||
mc.gameRenderer.renderWorld(mc.getRenderPartialTicks(),
|
||||
Util.nanoTime(), new MatrixStack());
|
||||
saveScreenshot(mc, name, i);
|
||||
nextStage();
|
||||
}
|
||||
finishRenderingPanorama();
|
||||
}
|
||||
}
|
||||
|
||||
static void saveScreenshot(MinecraftClient mc,
|
||||
String panoramaNum,
|
||||
int panoramaSide)
|
||||
static void saveScreenshot(Minecraft mc, String name, int panoramaSide)
|
||||
{
|
||||
final int SCREENSHOT_WIDTH = 2048;
|
||||
final int SCREENSHOT_HEIGHT = 2048;
|
||||
final int FRAMEBUFFER_WIDTH = mc.getMainWindow().getFramebufferWidth();
|
||||
final int FRAMEBUFFER_HEIGHT =
|
||||
mc.getMainWindow().getFramebufferHeight();
|
||||
final int SCREENSHOT_WIDTH = 1024;
|
||||
final int SCREENSHOT_HEIGHT = 1024;
|
||||
|
||||
File file = new File(mc.runDirectory,
|
||||
"panoramas/" + panoramaNum + "/panorama_" + panoramaSide +
|
||||
File file = new File(mc.gameDir,
|
||||
"panoramas/" + name + "/panorama_" + panoramaSide +
|
||||
".png");
|
||||
file.getParentFile().mkdirs();
|
||||
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)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
NativeImage nativeimage = ScreenshotUtils.takeScreenshot(
|
||||
NativeImage nativeimage = ScreenShotHelper.createScreenshot(
|
||||
SCREENSHOT_WIDTH,
|
||||
SCREENSHOT_HEIGHT,
|
||||
mc.getFramebuffer());
|
||||
Util.getIoWorkerExecutor().execute(() -> {
|
||||
Util.getRenderingService().execute(() -> {
|
||||
int i = nativeimage.getWidth();
|
||||
int j = nativeimage.getHeight();
|
||||
int k = 0;
|
||||
@@ -192,7 +198,7 @@ public class Main implements ModInitializer, IdentifiableResourceReloadListener
|
||||
false))
|
||||
{
|
||||
nativeimage.resizeSubRectTo(k, l, i, j, nativeimage1);
|
||||
nativeimage1.writeFile(file);
|
||||
nativeimage1.write(file);
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
@@ -206,25 +212,4 @@ public class Main implements ModInitializer, IdentifiableResourceReloadListener
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getFabricId()
|
||||
{
|
||||
return new Identifier("panorama", "backgrounds");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> reload(Synchronizer synchronizer,
|
||||
ResourceManager manager,
|
||||
Profiler prepareProfiler,
|
||||
Profiler applyProfiler,
|
||||
Executor prepareExecutor,
|
||||
Executor applyExecutor)
|
||||
{
|
||||
loadPanoramas(MinecraftClient.getInstance(),
|
||||
manager,
|
||||
prepareExecutor,
|
||||
applyExecutor);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.render.Camera;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Camera.class)
|
||||
public interface CameraAccessor
|
||||
{
|
||||
@Invoker("setRotation")
|
||||
public void setView(float yaw, float pitch);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public interface GameRenderAccessor
|
||||
{
|
||||
@Accessor("renderingPanorama")
|
||||
public void setPanoramic(boolean panoramic);
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import markil3.panorama.EventBus;
|
||||
import markil3.panorama.Main;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public class GameRenderHook
|
||||
{
|
||||
@Inject(method = "render", at = @At(value = "HEAD"))
|
||||
public void startPanora(float tickDelta, long startTime, boolean tick,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (Main.isRenderingPanorama())
|
||||
{
|
||||
Main.renderPanorama(MinecraftClient.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderWorld", at = @At(value = "HEAD"))
|
||||
public void startPanora(float tickDelta,
|
||||
long limitTime,
|
||||
MatrixStack matrix,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (Main.isRenderingPanorama())
|
||||
{
|
||||
((GameRenderAccessor) MinecraftClient.getInstance().gameRenderer).setPanoramic(
|
||||
true);
|
||||
}
|
||||
}
|
||||
@Inject(method = "renderWorld", at = @At(value = "TAIL"))
|
||||
public void finishPanora(float tickDelta,
|
||||
long limitTime,
|
||||
MatrixStack matrix,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (Main.isRenderingPanorama())
|
||||
{
|
||||
((GameRenderAccessor) MinecraftClient.getInstance().gameRenderer).setPanoramic(
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderWorld", at = @At(value = "INVOKE", target = "Lnet" +
|
||||
"/minecraft/client/render/Camera;update" +
|
||||
"(Lnet/minecraft/world/BlockView;Lnet/minecraft/entity/Entity;" +
|
||||
"ZZF)V", shift = At.Shift.AFTER))
|
||||
public void adjustCamera(float tickDelta,
|
||||
long limitTime,
|
||||
MatrixStack matrix,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
if (Main.isRenderingPanorama())
|
||||
{
|
||||
EventBus.onCamera(MinecraftClient.getInstance().gameRenderer.getCamera());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.Keyboard;
|
||||
import net.minecraft.client.gl.Framebuffer;
|
||||
import net.minecraft.client.util.ScreenshotUtils;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import markil3.panorama.Main;
|
||||
|
||||
@Mixin(ScreenshotUtils.class)
|
||||
public class ScreenshotHook
|
||||
{
|
||||
@Inject(method = "saveScreenshot", at = @At(value = "HEAD"))
|
||||
private static void takeScreenshot(File gameDirectory,
|
||||
int framebufferWidth,
|
||||
int framebufferHeight,
|
||||
Framebuffer framebuffer,
|
||||
Consumer<Text> messageReceiver,
|
||||
CallbackInfo callbackInfo)
|
||||
{
|
||||
Main.startRenderingPanorama();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.gui.RotatingCubeMapRenderer;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public interface TitleAccessor
|
||||
{
|
||||
@Accessor("backgroundRenderer")
|
||||
public void setPanoramic(RotatingCubeMapRenderer panoramic);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package markil3.panorama.mixins;
|
||||
|
||||
import net.minecraft.client.gui.RotatingCubeMapRenderer;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import markil3.panorama.Main;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public class TitleHook
|
||||
{
|
||||
@Redirect(method = "<init>(Z)V", at = @At(value = "FIELD", target = "Lnet" +
|
||||
"/minecraft/client/gui/screen/TitleScreen;" +
|
||||
"backgroundRenderer:Lnet/minecraft/client/gui" +
|
||||
"/RotatingCubeMapRenderer;", opcode = Opcodes.PUTFIELD))
|
||||
private void injected(TitleScreen screen,
|
||||
RotatingCubeMapRenderer defaultPan)
|
||||
{
|
||||
RotatingCubeMapRenderer pan = Main.getPanorama();
|
||||
if (pan != null)
|
||||
{
|
||||
((TitleAccessor) screen).setPanoramic(pan);
|
||||
}
|
||||
else
|
||||
{
|
||||
((TitleAccessor) screen).setPanoramic(defaultPan);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
src/main/resources/META-INF/accesstransformer.cfg
Normal file
1
src/main/resources/META-INF/accesstransformer.cfg
Normal file
@@ -0,0 +1 @@
|
||||
public-f net.minecraft.client.gui.screen.MainMenuScreen field_209101_K #panorama
|
||||
29
src/main/resources/META-INF/mods.toml
Normal file
29
src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,29 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[34,)"
|
||||
license="GPL-3.0-only"
|
||||
issueTrackerURL="https://github.com/Markil3/MinecraftPanorama/issues"
|
||||
[[mods]]
|
||||
modId="panorama"
|
||||
version="${file.jarVersion}"
|
||||
displayName="Panorama Mod"
|
||||
updateJSONURL="https://raw.githubusercontent.com/Markil3/MinecraftPanorama/master/update-forge.json"
|
||||
displayURL="https://markil3.github.io/MinecraftPanorama"
|
||||
#logoFile="examplemod.png"
|
||||
credits="Mojang Studios for the original screenshot code."
|
||||
# A text field displayed in the mod UI
|
||||
authors="Markil 3"
|
||||
description='''
|
||||
This Minecraft mod provides the ability to take panoramic screenshots at any time with the Screenshot key (default to F2 on most Minecraft installations). On top of that, these screenshots will occupy the main menu background, allowing you to relive your adventures every time you boot up the game.
|
||||
'''
|
||||
[[dependencies.panorama]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[34,)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
[[dependencies.panorama]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.16.3]"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "panorama",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Panorama Mod",
|
||||
"description": "This Minecraft mod provides the ability to take panoramic screenshots at any time with the Screenshot key (default to F2 on most Minecraft installations). On top of that, these screenshots will occupy the main menu background, allowing you to relive your adventures every time you boot up the game.",
|
||||
"authors": [
|
||||
"Markil 3"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://www.planetminecraft.com/mod/panorama/",
|
||||
"sources": "https://github.com/Markil3/MinecraftPanorama",
|
||||
"issues": "https://github.com/Markil3/MinecraftPanorama/issues"
|
||||
},
|
||||
|
||||
"license": "GPL-3.0-only",
|
||||
"icon": "assets/panorama/icon.png",
|
||||
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"markil3.panorama.Main"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
{
|
||||
"config": "modid.mixins.json",
|
||||
"environment": "client"
|
||||
}
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.7.4",
|
||||
"minecraft": "1.16.x"
|
||||
},
|
||||
"suggests": {
|
||||
"modmenu": "*",
|
||||
"cloth-config2": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "markil3.panorama.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ScreenshotHook",
|
||||
"GameRenderHook",
|
||||
"TitleHook",
|
||||
"GameRenderAccessor",
|
||||
"TitleAccessor",
|
||||
"CameraAccessor"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user