updated to 1.20.4 and took possession of the code
This commit is contained in:
parent
b95e006770
commit
3c9ca3f179
16
LICENSE
Executable file → Normal file
16
LICENSE
Executable file → Normal file
@ -1,14 +1,2 @@
|
||||
Copyright 2019 B0undarybreaker (Meredith Espinosa)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Copyright (c) 2024
|
||||
All rights reserved.
|
||||
|
138
build.gradle
138
build.gradle
@ -1,64 +1,114 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Fabric"
|
||||
url = "https://maven.fabricmc.net/"
|
||||
content {
|
||||
includeGroup "net.fabricmc"
|
||||
includeGroup "fabric-loom"
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "fabric-loom:fabric-loom.gradle.plugin:1.1.14"
|
||||
}
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.5-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
apply plugin: "fabric-loom"
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
java.withSourcesJar()
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
base {
|
||||
archivesName = project.archives_base_name
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = "https://maven.terraformersmc.com/releases/"
|
||||
content {
|
||||
includeGroup "com.terraformersmc"
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDirs += {
|
||||
'src/generated'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:1.20.1"
|
||||
mappings "net.fabricmc:yarn:1.20.1+build.2"
|
||||
modApi "net.fabricmc:fabric-loader:0.14.21"
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:0.83.1+1.20.1"
|
||||
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
|
||||
//modRuntimeOnly "com.terraformersmc:modmenu:7.2.1" //REMAP FAILURES?????
|
||||
}
|
||||
|
||||
loom {
|
||||
mixin {
|
||||
defaultRefmapName = "templates.refmap.json" //see templates.mixins.json. I just like to always specify the name
|
||||
runs {
|
||||
// This adds a new gradle task that runs the datagen API: "gradlew runDatagen"
|
||||
datagen {
|
||||
inherit server
|
||||
name "Data Generation"
|
||||
vmArg "-Dfabric-api.datagen"
|
||||
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated")}"
|
||||
vmArg "-Dfabric-api.datagen.modid=${mod_id}"
|
||||
|
||||
runDir "build/datagen"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
// You should only use this when depending on other mods because
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
}
|
||||
|
||||
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}"
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
filesMatching("**/fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
inputs.property "minecraft_version", project.minecraft_version
|
||||
inputs.property "loader_version", project.loader_version
|
||||
filteringCharset "UTF-8"
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version,
|
||||
"mod_id": mod_id,
|
||||
"minecraft_version": project.minecraft_version,
|
||||
"loader_version": project.loader_version
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
def targetJavaVersion = 17
|
||||
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"
|
||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||
it.options.release.set(targetJavaVersion)
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||
if (JavaVersion.current() < javaVersion) {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||
}
|
||||
// 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()
|
||||
}
|
||||
|
||||
jar {
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.archivesBaseName}"}
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,18 @@
|
||||
# dedodated wam
|
||||
org.gradle.jvmargs=-Xmx6G
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
archivesBaseName=templates
|
||||
group=io.github.cottonmc
|
||||
version=2.2.0+1.20.1
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.20.4
|
||||
yarn_mappings=1.20.4+build.3
|
||||
loader_version=0.15.6
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0-SNAPSHOT
|
||||
maven_group = fr.adrien1106
|
||||
archives_base_name = ReFramedTemplates
|
||||
mod_id = reframedtemplates
|
||||
|
||||
# Dependencies
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_version=0.95.4+1.20.4
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
309
gradlew
vendored
Executable file → Normal file
309
gradlew
vendored
Executable file → Normal file
@ -1,78 +1,127 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
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=""
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
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
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# 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
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
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" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# 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"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# 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")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# 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"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
52
gradlew.bat
vendored
Executable file → Normal file
52
gradlew.bat
vendored
Executable file → Normal file
@ -1,3 +1,19 @@
|
||||
@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
|
||||
@ -10,18 +26,22 @@ if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
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=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@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 init
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@ -35,7 +55,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@ -45,38 +65,26 @@ 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 %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
9
settings.gradle
Normal file
9
settings.gradle
Normal file
@ -0,0 +1,9 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
package io.github.cottonmc.templates;
|
||||
package fr.adrien1106.reframedtemplates;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.block.TemplateBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateButtonBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateCandleBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateCarpetBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateDoorBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateEntity;
|
||||
import io.github.cottonmc.templates.block.TemplateFenceBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateFenceGateBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateLeverBlock;
|
||||
import io.github.cottonmc.templates.block.TemplatePaneBlock;
|
||||
import io.github.cottonmc.templates.block.TemplatePostBlock;
|
||||
import io.github.cottonmc.templates.block.TemplatePressurePlateBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateSlabBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateSlopeBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateStairsBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateTrapdoorBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateVerticalSlabBlock;
|
||||
import io.github.cottonmc.templates.block.TemplateWallBlock;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateButtonBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateCandleBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateCarpetBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateDoorBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateEntity;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateFenceBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateFenceGateBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateLeverBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplatePaneBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplatePostBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplatePressurePlateBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateSlabBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateSlopeBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateStairsBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateTrapdoorBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateVerticalSlabBlock;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateWallBlock;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
||||
@ -48,6 +48,9 @@ import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* TODO handle random textures, handle grass side, multiple camos
|
||||
*/
|
||||
public class Templates implements ModInitializer {
|
||||
public static final String MODID = "templates";
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates;
|
||||
package fr.adrien1106.reframedtemplates;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import io.github.cottonmc.templates.model.SlopeBaseMesh;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.model.SlopeBaseMesh;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
@ -1,10 +1,10 @@
|
||||
package io.github.cottonmc.templates;
|
||||
package fr.adrien1106.reframedtemplates;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import io.github.cottonmc.templates.model.TemplateAppearanceManager;
|
||||
import io.github.cottonmc.templates.model.UnbakedAutoRetexturedModel;
|
||||
import io.github.cottonmc.templates.model.UnbakedJsonRetexturedModel;
|
||||
import io.github.cottonmc.templates.model.UnbakedMeshRetexturedModel;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.model.TemplateAppearanceManager;
|
||||
import fr.adrien1106.reframedtemplates.model.UnbakedAutoRetexturedModel;
|
||||
import fr.adrien1106.reframedtemplates.model.UnbakedJsonRetexturedModel;
|
||||
import fr.adrien1106.reframedtemplates.model.UnbakedMeshRetexturedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates;
|
||||
package fr.adrien1106.reframedtemplates;
|
||||
|
||||
import io.github.cottonmc.templates.model.TemplateAppearanceManager;
|
||||
import fr.adrien1106.reframedtemplates.model.TemplateAppearanceManager;
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
||||
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
|
||||
import net.fabricmc.fabric.api.client.model.ModelVariantProvider;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.api;
|
||||
package fr.adrien1106.reframedtemplates.api;
|
||||
|
||||
import io.github.cottonmc.templates.block.TemplateEntity;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateEntity;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
@ -113,7 +113,7 @@ public class TemplateInteractionUtil {
|
||||
if(held.getItem() instanceof BlockItem bi && be.getThemeState().getBlock() == Blocks.AIR) {
|
||||
Block block = bi.getBlock();
|
||||
ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hit));
|
||||
BlockState placementState = block.getPlacementState(ctx);
|
||||
BlockState placementState = block.getPlacementState(ctx); // TODO Smart
|
||||
if(placementState != null && Block.isShapeFullCube(placementState.getCollisionShape(world, pos)) && !(block instanceof BlockEntityProvider)) {
|
||||
if(!world.isClient) be.setRenderedState(placementState);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.api;
|
||||
package fr.adrien1106.reframedtemplates.api;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates.api;
|
||||
package fr.adrien1106.reframedtemplates.api;
|
||||
|
||||
import io.github.cottonmc.templates.TemplatesClient;
|
||||
import io.github.cottonmc.templates.model.TemplateAppearanceManager;
|
||||
import fr.adrien1106.reframedtemplates.model.TemplateAppearanceManager;
|
||||
import fr.adrien1106.reframedtemplates.TemplatesClient;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.api;
|
||||
package fr.adrien1106.reframedtemplates.api;
|
||||
|
||||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockSetType;
|
||||
@ -27,11 +27,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateButtonBlock extends ButtonBlock implements BlockEntityProvider {
|
||||
public TemplateButtonBlock(Settings settings) {
|
||||
this(settings, BlockSetType.OAK, 30, true);
|
||||
this(settings, BlockSetType.OAK, 30);
|
||||
}
|
||||
|
||||
public TemplateButtonBlock(Settings settings, BlockSetType blockSetType, int i, boolean bl) {
|
||||
super(settings, blockSetType, i, bl);
|
||||
public TemplateButtonBlock(Settings settings, BlockSetType blockSetType, int i) {
|
||||
super(blockSetType, i, settings);
|
||||
setDefaultState(TemplateInteractionUtil.setDefaultStates(getDefaultState()));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockSetType;
|
||||
@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateDoorBlock extends DoorBlock implements BlockEntityProvider {
|
||||
public TemplateDoorBlock(Settings settings, BlockSetType blockSetType) {
|
||||
super(settings, blockSetType);
|
||||
super(blockSetType, settings);
|
||||
setDefaultState(TemplateInteractionUtil.setDefaultStates(getDefaultState()));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.api.ThemeableBlockEntity;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.api.ThemeableBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
@ -18,9 +18,9 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
//Keeping the weight of this block entity down, both in terms of memory consumption and NBT sync traffic,
|
||||
@ -80,7 +80,7 @@ public class TemplateEntity extends BlockEntity implements ThemeableBlockEntity
|
||||
if(bitfield != DEFAULT_BITFIELD) tag.putByte(BITFIELD_KEY, bitfield);
|
||||
}
|
||||
|
||||
public static @Nonnull BlockState readStateFromItem(ItemStack stack) {
|
||||
public static @NotNull BlockState readStateFromItem(ItemStack stack) {
|
||||
NbtCompound blockEntityTag = BlockItem.getBlockEntityNbt(stack);
|
||||
if(blockEntityTag == null) return Blocks.AIR.getDefaultState();
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,9 +1,9 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtilExt;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtilExt;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
||||
@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateFenceGateBlock extends FenceGateBlock implements BlockEntityProvider, TemplateInteractionUtilExt {
|
||||
public TemplateFenceGateBlock(Settings settings, WoodType woodType) {
|
||||
super(settings, woodType);
|
||||
super(woodType, settings);
|
||||
setDefaultState(TemplateInteractionUtil.setDefaultStates(getDefaultState()));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
@ -1,14 +1,9 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockSetType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -26,13 +21,13 @@ import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplatePressurePlateBlock extends PressurePlateBlock implements BlockEntityProvider {
|
||||
public TemplatePressurePlateBlock(ActivationRule activationRule, Settings settings, BlockSetType blockSetType) {
|
||||
super(activationRule, settings, blockSetType);
|
||||
public TemplatePressurePlateBlock(Settings settings, BlockSetType blockSetType) {
|
||||
super(blockSetType, settings);
|
||||
setDefaultState(TemplateInteractionUtil.setDefaultStates(getDefaultState()));
|
||||
}
|
||||
|
||||
public TemplatePressurePlateBlock(Settings settings) {
|
||||
this(ActivationRule.EVERYTHING, settings, BlockSetType.OAK);
|
||||
this(settings, BlockSetType.OAK);
|
||||
}
|
||||
|
||||
@Override
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,9 +1,9 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.util.Edge;
|
||||
import io.github.cottonmc.templates.util.StairShapeMaker;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.util.Edge;
|
||||
import fr.adrien1106.reframedtemplates.util.StairShapeMaker;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
@ -13,8 +13,7 @@ import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateSlopeBlock extends WaterloggableTemplateBlock {
|
||||
public static final EnumProperty<Edge> EDGE = EnumProperty.of("edge", Edge.class);
|
@ -1,8 +1,8 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,9 +1,9 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtilExt;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtilExt;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockSetType;
|
||||
@ -27,8 +27,8 @@ import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateTrapdoorBlock extends TrapdoorBlock implements BlockEntityProvider, TemplateInteractionUtilExt {
|
||||
public TemplateTrapdoorBlock(Settings settings, BlockSetType blah) {
|
||||
super(settings, blah);
|
||||
public TemplateTrapdoorBlock(Settings settings, BlockSetType woodType) {
|
||||
super(woodType, settings);
|
||||
setDefaultState(TemplateInteractionUtil.setDefaultStates(getDefaultState()));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ShapeContext;
|
@ -1,9 +1,9 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
|
||||
import io.github.cottonmc.templates.mixin.WallBlockAccessor;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
|
||||
import fr.adrien1106.reframedtemplates.mixin.WallBlockAccessor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.block;
|
||||
package fr.adrien1106.reframedtemplates.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.mixin;
|
||||
package fr.adrien1106.reframedtemplates.mixin;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.color.item.ItemColors;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.mixin;
|
||||
package fr.adrien1106.reframedtemplates.mixin;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.WallBlock;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.mixin.particles;
|
||||
package fr.adrien1106.reframedtemplates.mixin.particles;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.util.math.random.Random;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.mixin.particles;
|
||||
package fr.adrien1106.reframedtemplates.mixin.particles;
|
||||
|
||||
import net.minecraft.client.particle.SpriteBillboardParticle;
|
||||
import net.minecraft.client.texture.Sprite;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.mixin.particles;
|
||||
package fr.adrien1106.reframedtemplates.mixin.particles;
|
||||
|
||||
import io.github.cottonmc.templates.api.ThemeableBlockEntity;
|
||||
import fr.adrien1106.reframedtemplates.api.ThemeableBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.particle.BlockDustParticle;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.mixin.particles;
|
||||
package fr.adrien1106.reframedtemplates.mixin.particles;
|
||||
|
||||
import io.github.cottonmc.templates.api.ThemeableBlockEntity;
|
||||
import fr.adrien1106.reframedtemplates.api.ThemeableBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.mixin.particles;
|
||||
package fr.adrien1106.reframedtemplates.mixin.particles;
|
||||
|
||||
import io.github.cottonmc.templates.api.ThemeableBlockEntity;
|
||||
import fr.adrien1106.reframedtemplates.api.ThemeableBlockEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MeshBuilder;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView;
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.block.TemplateEntity;
|
||||
import io.github.cottonmc.templates.mixin.MinecraftAccessor;
|
||||
import fr.adrien1106.reframedtemplates.block.TemplateEntity;
|
||||
import fr.adrien1106.reframedtemplates.mixin.MinecraftAccessor;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
@ -26,7 +26,7 @@ import java.util.function.Supplier;
|
||||
|
||||
public abstract class RetexturingBakedModel extends ForwardingBakedModel {
|
||||
public RetexturingBakedModel(BakedModel baseModel, TemplateAppearanceManager tam, ModelBakeSettings settings, BlockState itemModelState, boolean ao) {
|
||||
this.wrapped = baseModel; //field from the superclass; vanilla getQuads etc will delegate through to this
|
||||
this.wrapped = baseModel; //field from the superclass; vanilla getQuads etc. will delegate through to this
|
||||
|
||||
this.tam = tam;
|
||||
this.facePermutation = MeshTransformUtil.facePermutation(settings);
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MeshBuilder;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial;
|
||||
import net.minecraft.client.texture.Sprite;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.MaterialFinder;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
@ -1,7 +1,7 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.Templates;
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.Templates;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
@ -1,6 +1,6 @@
|
||||
package io.github.cottonmc.templates.model;
|
||||
package fr.adrien1106.reframedtemplates.model;
|
||||
|
||||
import io.github.cottonmc.templates.api.TemplatesClientApi;
|
||||
import fr.adrien1106.reframedtemplates.api.TemplatesClientApi;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.util;
|
||||
package fr.adrien1106.reframedtemplates.util;
|
||||
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.util.StringIdentifiable;
|
@ -1,4 +1,4 @@
|
||||
package io.github.cottonmc.templates.util;
|
||||
package fr.adrien1106.reframedtemplates.util;
|
||||
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
BIN
src/main/resources/assets/framed-templates-icon.png
Normal file
BIN
src/main/resources/assets/framed-templates-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
@ -1,37 +1,30 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "templates",
|
||||
"version": "$version",
|
||||
"name": "Templates 2",
|
||||
"id": "${mod_id}",
|
||||
"version": "${version}",
|
||||
"name": "ReFramedBlocks",
|
||||
"description": "An API for templated blocks",
|
||||
"authors": [
|
||||
"quaternary",
|
||||
"LemmaEOF",
|
||||
"Grondag",
|
||||
"mevvern"
|
||||
"Adrien1106"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://highlysuspect.agency/",
|
||||
"sources": "https://github.com/quat1024/templates-mod",
|
||||
"issues": "https://github.com/quat1024/templates-mod/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "templates-icon.png",
|
||||
"contact": {},
|
||||
"license": "All-Rights-Reserved",
|
||||
"icon": "assets/framed-templates-icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"io.github.cottonmc.templates.Templates"
|
||||
"fr.adrien1106.reframedtemplates.Templates"
|
||||
],
|
||||
"client": [
|
||||
"io.github.cottonmc.templates.TemplatesClient"
|
||||
"fr.adrien1106.reframedtemplates.TemplatesClient"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"templates.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"minecraft": ">=1.20.1",
|
||||
"fabricloader": "*",
|
||||
"minecraft": ">=${minecraft_version}",
|
||||
"fabricloader": "${loader_version}",
|
||||
"fabric-api": "*"
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "io.github.cottonmc.templates.mixin",
|
||||
"package": "fr.adrien1106.reframedtemplates.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"MinecraftAccessor",
|
||||
|
@ -1,67 +0,0 @@
|
||||
package io.github.cottonmc.templates.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//i probalby shouldnt ship this in the mod lol
|
||||
public class BbModelepic {
|
||||
static class Model {
|
||||
List<Elem> elements;
|
||||
}
|
||||
|
||||
static class Elem {
|
||||
Map<String, List<Integer>> vertices;
|
||||
Map<String, Face> faces;
|
||||
}
|
||||
|
||||
static class Face {
|
||||
Map<String, List<Integer>> uv;
|
||||
List<String> vertices;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Model m = new Gson().fromJson(model, Model.class);
|
||||
|
||||
Map<String, List<Integer>> verts = m.elements.get(0).vertices;
|
||||
List<Face> faces = m.elements.get(0).faces.values().stream().toList();
|
||||
|
||||
List<String> classifications = List.of("TAG_LEFT", "TAG_RIGHT", "TAG_BOTTOM", "TAG_BACK", "TAG_SLOPE");
|
||||
Iterator<String> asd = classifications.iterator();
|
||||
|
||||
for(Face face : faces) {
|
||||
System.out.printf(".tag(%s)%n", asd.next());
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
String vertId = face.vertices.get(permute(i));
|
||||
List<Integer> coords = verts.get(vertId);
|
||||
System.out.printf(".pos(%s, %sf, %sf, %sf)", i, p(coords.get(0)/16f), p(coords.get(1)/16f), p(coords.get(2)/16f));
|
||||
|
||||
List<Integer> uv = face.uv.get(vertId);
|
||||
System.out.printf(".uv(%s, %sf, %sf)%n", i, p(uv.get(0)/16f), p(uv.get(1)/16f));
|
||||
}
|
||||
|
||||
System.out.println(".color(-1, -1, -1, -1)\n.emit()");
|
||||
}
|
||||
System.out.println(';');
|
||||
}
|
||||
|
||||
//i don't like "16.0f" i'd rather "16f"
|
||||
private static String p(float f) {
|
||||
if(f == (long) f) return Long.toString((long) f);
|
||||
else return Float.toString(f);
|
||||
}
|
||||
|
||||
private static int permute(int i) {
|
||||
if(i == 0) return 2;
|
||||
if(i == 1) return 0;
|
||||
if(i == 2) return 1;
|
||||
if(i == 3) return 3;
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private static final String model = """
|
||||
{"meta":{"format_version":"4.5","model_format":"free","box_uv":false},"name":"","model_identifier":"","visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"timeline_setups":[],"unhandled_root_fields":{},"resolution":{"width":16,"height":16},"elements":[{"name":"cuboid","color":4,"origin":[-8,0,-8],"rotation":[0,0,0],"visibility":true,"locked":false,"vertices":{"Iy48":[16,8,16],"dg4s":[16,4,12],"ezd5":[16,0,16],"txzT":[16,0,8],"ZcIz":[0,8,16],"tgTW":[0,0,16],"Q2eV":[0,0,8],"8xsY":[0,4,12]},"faces":{"JSoJzuHO":{"uv":{"Iy48":[0,8],"ezd5":[0,16],"dg4s":[4,12],"txzT":[8,16]},"vertices":["Iy48","ezd5","dg4s","txzT"]},"0I6IF0zk":{"uv":{"ZcIz":[16,8],"tgTW":[16,16],"Q2eV":[8,16],"8xsY":[12,12]},"vertices":["ZcIz","8xsY","tgTW","Q2eV"]},"d7iH7DqS":{"uv":{"ezd5":[16,0],"tgTW":[0,0],"txzT":[16,8],"Q2eV":[0,8]},"vertices":["ezd5","tgTW","txzT","Q2eV"]},"OQ809wKZ":{"uv":{"Iy48":[16,8],"ZcIz":[0,8],"ezd5":[16,16],"tgTW":[0,16]},"vertices":["Iy48","ZcIz","ezd5","tgTW"]},"TSyHMrco":{"uv":{"txzT":[0,16],"Q2eV":[16,16],"Iy48":[0,8],"ZcIz":[16,8]},"vertices":["txzT","Q2eV","Iy48","ZcIz"]}},"type":"mesh","uuid":"3152a30a-ea8e-4ceb-57eb-58319c89815a"}],"outliner":["3152a30a-ea8e-4ceb-57eb-58319c89815a"],"textures":[]}""";
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package io.github.cottonmc.templates.util;
|
||||
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.math.random.RandomSplitter;
|
||||
|
||||
public class TattletaleRandom implements Random {
|
||||
public TattletaleRandom(Random delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
private final Random delegate;
|
||||
public boolean wasUsed = false;
|
||||
|
||||
public Random split() {
|
||||
wasUsed = true;
|
||||
return delegate.split();
|
||||
}
|
||||
|
||||
public RandomSplitter nextSplitter() {
|
||||
wasUsed = true;
|
||||
return delegate.nextSplitter();
|
||||
}
|
||||
|
||||
public void setSeed(long l) {
|
||||
wasUsed = true;
|
||||
delegate.setSeed(l);
|
||||
}
|
||||
|
||||
public int nextInt() {
|
||||
wasUsed = true;
|
||||
return delegate.nextInt();
|
||||
}
|
||||
|
||||
public int nextInt(int i) {
|
||||
wasUsed = true;
|
||||
return delegate.nextInt(i);
|
||||
}
|
||||
|
||||
public int nextBetween(int i, int j) {
|
||||
wasUsed = true;
|
||||
return delegate.nextBetween(i, j);
|
||||
}
|
||||
|
||||
public long nextLong() {
|
||||
wasUsed = true;
|
||||
return delegate.nextLong();
|
||||
}
|
||||
|
||||
public boolean nextBoolean() {
|
||||
wasUsed = true;
|
||||
return delegate.nextBoolean();
|
||||
}
|
||||
|
||||
public float nextFloat() {
|
||||
wasUsed = true;
|
||||
return delegate.nextFloat();
|
||||
}
|
||||
|
||||
public double nextDouble() {
|
||||
wasUsed = true;
|
||||
return delegate.nextDouble();
|
||||
}
|
||||
|
||||
public double nextGaussian() {
|
||||
wasUsed = true;
|
||||
return delegate.nextGaussian();
|
||||
}
|
||||
|
||||
public double nextTriangular(double d, double e) {
|
||||
wasUsed = true;
|
||||
return delegate.nextTriangular(d, e);
|
||||
}
|
||||
|
||||
public void skip(int i) {
|
||||
wasUsed = true;
|
||||
delegate.skip(i);
|
||||
}
|
||||
|
||||
public int nextBetweenExclusive(int i, int j) {
|
||||
wasUsed = true;
|
||||
return delegate.nextBetweenExclusive(i, j);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user