From 1778a51b44603f544986c82fde8b0c6306c91b5a Mon Sep 17 00:00:00 2001 From: Jibay Mcs Date: Tue, 20 Aug 2019 19:11:42 +0200 Subject: [PATCH 1/9] Work on 1.14.4 API Version - Need to fix packets --- build.gradle | 210 ++++----- gradle.properties | 8 +- gradle/wrapper/gradle-wrapper.jar | Bin 52271 -> 54708 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 78 ++-- .../craftstudio/CraftStudioApi.java | 60 ++- .../client/animation/CSAnimChannel.java | 67 ++- .../animation/ClientAnimationHandler.java | 415 +++++++++--------- .../client/animation/ClientChannel.java | 117 ++--- .../client/animation/EnumAnimationMode.java | 21 +- .../client/animation/KeyFrame.java | 53 +-- .../exception/CSMalformedJsonException.java | 27 +- .../CSResourceNotFoundException.java | 17 +- .../CSResourceNotRegisteredException.java | 15 +- .../craftstudio/client/json/CSJsonReader.java | 256 +++++------ .../craftstudio/client/json/CSReadedAnim.java | 25 +- .../client/json/CSReadedAnimBlock.java | 53 +-- .../client/json/CSReadedModel.java | 25 +- .../client/json/CSReadedModelBlock.java | 35 +- .../craftstudio/client/model/CSModelBox.java | 330 ++++++-------- .../client/model/CSModelRenderer.java | 208 +++++---- .../client/model/ModelCraftStudio.java | 129 +++--- .../client/registry/CSRegistryHelper.java | 137 +++--- .../client/registry/CraftStudioLoader.java | 18 +- .../client/registry/RegistryHandler.java | 45 +- .../client/util/EnumFrameType.java | 9 +- .../client/util/EnumRenderType.java | 9 +- .../client/util/EnumResourceType.java | 9 +- .../craftstudio/client/util/MathHelper.java | 34 +- .../common/animation/CustomChannel.java | 7 +- .../common/animation/IAnimated.java | 24 +- .../animation/simpleImpl/AnimatedEntity.java | 36 +- .../simpleImpl/AnimatedTileEntity.java | 33 +- .../CSTileEntitySpecialRenderer.java | 43 +- .../common/network/CSNetworkHelper.java | 65 ++- .../common/network/IAnimatedEventMessage.java | 235 +++++----- .../craftstudio/common/network/IPacket.java | 16 + .../network/ServerIAnimatedEventMessage.java | 50 ++- .../craftstudio/proxy/CSClientProxy.java | 31 +- .../craftstudio/proxy/CSCommonProxy.java | 29 +- .../craftstudio/proxy/CSServerProxy.java | 14 +- .../animation/ServerAnimationHandler.java | 55 +-- 42 files changed, 1458 insertions(+), 1593 deletions(-) create mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java diff --git a/build.gradle b/build.gradle index 6e07a2b..645c8fd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,163 +1,113 @@ buildscript { repositories { - maven { - url 'https://repo.leviathan-studio.com/libs-release/' - credentials { - username = "${artifactory_user}" - password = "${artifactory_password}" - } - } + maven { url = 'https://files.minecraftforge.net/maven' } + jcenter() + mavenCentral() } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' - classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } - -// plugins -apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'net.minecraftforge.gradle' +apply plugin: 'eclipse' apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.artifactory' - -// Maven -version = "1.0.1" -group= "com.leviathanstudio" -archivesBaseName = "CraftStudioAPI" -ext.suffix="alpha" - -// Jenkins build -ext.buildnumber = 0 -if (System.getenv().TRAVIS_BUILD_NUMBER) { - project.buildnumber = System.getenv().TRAVIS_BUILD_NUMBER -} else { - logger.lifecycle "SETTING BUILDNUMBER TO 0" -} -// Java -compileJava.options.encoding = 'UTF-8' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +version = '1.0.2' +group = 'com.leviathanstudio' // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = 'CraftStudioAPI' + +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { - version = "1.12-14.21.1.2387" - runDir = "run" - mappings = "snapshot_20170624" - replace "@VERSION@", project.version -} -//Full version -ext.fullVersion="${project.version}.${project.buildnumber}-mc${project.minecraft.version}" + mappings channel: 'snapshot', version: '20190719-1.14.3' + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') -if(ext.suffix != "") { - ext.fullVersion += "-${project.ext.suffix}" -} + runs { + client { + workingDirectory project.file('run') -repositories { - maven { - url 'https://repo.leviathan-studio.com/libs-release/' - credentials { - username = "${artifactory_user}" - password = "${artifactory_password}" - } - } -} + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' -sourceSets { - main { - java { - srcDirs 'src/main/java/' - } - resources { - srcDirs 'src/main/resources/' - } - } - dev { - java { - srcDirs 'src/dev/java/' - } - resources { - srcDirs 'src/dev/resources/' - } - } - mod { - java { - srcDirs 'src/mod/java/' + property 'forge.logging.console.level', 'info' + + mods { + examplemod { + source sourceSets.main + } + } } - resources { - srcDirs 'src/mod/resources/' + + server { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + property 'forge.logging.console.level', 'info' + + mods { + examplemod { + source sourceSets.main + } + } } - } -} -dependencies { -} + data { + workingDirectory project.file('run') -processResources { - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - // resources - from(sourceSets.main.resources.srcDirs) { - include 'com/**/**' - include 'mcmod.info' - expand 'version':project.version, 'mcversion':project.minecraft.version - } - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + + property 'forge.logging.console.level', 'info' + + args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') + + mods { + examplemod { + source sourceSets.main + } + } + } } } -jar { - manifest { - attributes 'group':project.group - } - appendix = 'universal' - version = "${project.ext.fullVersion}" +dependencies { + minecraft 'net.minecraftforge:forge:1.14.4-28.0.51' } -task devJar(type: Jar) { - from(sourceSets.main.allSource) { - include 'com/**/**' - } - from(sourceSets.dev.allSource) { - include 'com/**/**' - } - from(sourceSets.main.output) { - include '**' - } +// Example for how to get properties into the manifest for reading by the runtime.. +jar { manifest { - attributes 'group':project.group + attributes([ + "Specification-Title": "crafstudio_api", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "1", // We are version 1 of ourselves + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + ]) } - classifier = 'dev' - version = "${project.ext.fullVersion}" } -// Publish the library -artifactory { - contextUrl = "${artifactory_contextUrl}" - publish { - version = "${project.ext.fullVersion}" - repository { - repoKey = 'leviathan' - username = "${artifactory_user}" - password = "${artifactory_password}" - maven = true - } - defaults { - publications ('mavenJava') - } - } +// Example configuration to allow publishing using the maven-publish task +// we define a custom artifact that is sourced from the reobfJar output task +// and then declare that to be published +// Note you'll need to add a repository here +def reobfFile = file("$buildDir/reobfJar/output.jar") +def reobfArtifact = artifacts.add('default', reobfFile) { + type 'jar' + builtBy 'reobfJar' } - publishing { publications { mavenJava(MavenPublication) { - from components.java - artifact (devJar) { - classifier = 'dev' - } + artifact reobfArtifact } } -} - -build.dependsOn devJar -artifactoryPublish.dependsOn build + repositories { + maven { + url "file:///${project.projectDir}/mcmodsrepo" + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f6768b0..878bf1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -artifactory_user=leviathan -artifactory_password=APdsAiLd1UksNkxj2yRsKVqdMicTXhqHA2AjZ -artifactory_contextUrl=https://repo.leviathan-studio.com -org.gradle.daemon=true \ No newline at end of file +# 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=-Xmx3G +org.gradle.daemon=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 30d399d8d2bf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gradle/wrapper/gradle-wrapper.properties index 6917d27..949819d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Sep 14 12:28:28 PDT 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip diff --git a/gradlew b/gradlew index 91a7e26..cccdd3d 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# 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 +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="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# 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 -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +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 @@ -114,6 +113,7 @@ fi 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` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +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" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index 528418d..d264606 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -1,44 +1,35 @@ package com.leviathanstudio.craftstudio; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; +import com.leviathanstudio.craftstudio.proxy.CSClientProxy; import com.leviathanstudio.craftstudio.proxy.CSCommonProxy; - +import com.leviathanstudio.craftstudio.proxy.CSServerProxy; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; /** * Main class of the CraftStudioApi - * - * @since 0.3.0 * * @author ZeAmateis * @author Timmypote + * @since 0.3.0 */ -@Mod(modid = CraftStudioApi.API_ID, name = CraftStudioApi.NAME, updateJSON = "https://leviathan-studio.com/craftstudioapi/update.json", - version = "1.0.0", - acceptedMinecraftVersions = "1.12") -public class CraftStudioApi -{ - private static final Logger LOGGER = LogManager.getLogger("CraftStudio"); - public static final String API_ID = "craftstudioapi"; - static final String NAME = "CraftStudio API"; - - public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(CraftStudioApi.API_ID); - - @SidedProxy(clientSide = "com.leviathanstudio.craftstudio.proxy.CSClientProxy", serverSide = "com.leviathanstudio.craftstudio.proxy.CSServerProxy") - private static CSCommonProxy proxy; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - CraftStudioApi.proxy.preInit(event); +@Mod(CraftStudioApi.API_ID) +public class CraftStudioApi { + public static final String API_ID = "craftstudioapi"; + + private static final Logger LOGGER = LogManager.getLogger("CraftStudio"); + private static CSCommonProxy proxy = DistExecutor.runForDist(() -> CSClientProxy::new, () -> CSServerProxy::new); + + public CraftStudioApi() { + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); } public static Logger getLogger() { @@ -50,12 +41,19 @@ public static Logger getLogger() { * entity/block * * @param - * - * @param animated - * Class which implements IAnimated (Entity or TileEntity) + * @param animatedClass which implements IAnimated (Entity or TileEntity) */ public static AnimationHandler getNewAnimationHandler(Class animatedClass) { return CraftStudioApi.proxy.getNewAnimationHandler(animatedClass); } + + public void clientSetup(FMLClientSetupEvent event) { + CraftStudioApi.proxy.clientSetup(event); + } + + public void commonSetup(FMLCommonSetupEvent event) { + CraftStudioApi.proxy.commonSetup(event); + } + } \ No newline at end of file diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/animation/CSAnimChannel.java b/src/main/java/com/leviathanstudio/craftstudio/client/animation/CSAnimChannel.java index 38ebeea..c0a4371 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/animation/CSAnimChannel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/animation/CSAnimChannel.java @@ -1,50 +1,46 @@ package com.leviathanstudio.craftstudio.client.animation; -import java.util.Map.Entry; - -import javax.vecmath.Vector3f; - import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.client.exception.CSResourceNotRegisteredException; import com.leviathanstudio.craftstudio.client.json.CSReadedAnim; import com.leviathanstudio.craftstudio.client.json.CSReadedAnimBlock; import com.leviathanstudio.craftstudio.client.json.CSReadedAnimBlock.ReadedKeyFrame; -import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.client.json.CSReadedModel; import com.leviathanstudio.craftstudio.client.json.CSReadedModelBlock; +import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.client.util.MathHelper; - import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import javax.vecmath.Vector3f; +import java.util.Map.Entry; /** * Animation Channel for CraftStudio imported animation. * - * @since 0.3.0 - * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSAnimChannel extends ClientChannel -{ - /** The registered animation it represent */ - private CSReadedAnim rAnim; - /** The registered model it animate */ +@OnlyIn(Dist.CLIENT) +public class CSAnimChannel extends ClientChannel { + /** + * The registered animation it represent + */ + private CSReadedAnim rAnim; + /** + * The registered model it animate + */ private CSReadedModel rModel; /** * Create a channel with the same name as the animation. Use the 60 fps by * default. * - * @param animNameIn - * The name of the animation in the registry. - * @param modelNameIn - * The name of the model bind to this animation in the registry. - * @param looped - * If the animation is looped or not. - * @throws CSResourceNotRegisteredException - * If the animation or model if not registered + * @param animIn The name of the animation in the registry. + * @param modelIn The name of the model bind to this animation in the registry. + * @param looped If the animation is looped or not. + * @throws CSResourceNotRegisteredException If the animation or model if not registered */ public CSAnimChannel(ResourceLocation animIn, ResourceLocation modelIn, boolean looped) throws CSResourceNotRegisteredException { this(animIn, modelIn, 60.0F, looped); @@ -53,25 +49,20 @@ public CSAnimChannel(ResourceLocation animIn, ResourceLocation modelIn, boolean /** * Create a channel. * - * @param animNameIn - * The name of the animation in the registry. - * @param name - * The name of the channel - * @param modelNameIn - * The name of the model bind to this animation in the registry. - * @param fps - * Keyframes per second of the animation. - * @param looped - * If the animation is looped or not. - * @throws CSResourceNotRegisteredException - * If the animation or model if not registered + * @param animIn The name of the animation in the registry. + * @param modelIn The name of the model bind to this animation in the registry. + * @param fps Keyframes per second of the animation. + * @param looped If the animation is looped or not. + * @throws CSResourceNotRegisteredException If the animation or model if not registered */ public CSAnimChannel(ResourceLocation animIn, ResourceLocation modelIn, float fps, boolean looped) throws CSResourceNotRegisteredException { super(animIn.toString(), false); - this.rAnim = RegistryHandler.animationRegistry.getObject(animIn); + //TODO Check ifPresent() + this.rAnim = RegistryHandler.animationRegistry.getValue(animIn).get(); if (this.rAnim == null) throw new CSResourceNotRegisteredException(animIn.toString()); - this.rModel = RegistryHandler.modelRegistry.getObject(modelIn); + //TODO Check ifPresent() + this.rModel = RegistryHandler.modelRegistry.getValue(modelIn).get(); if (this.rModel == null) throw new CSResourceNotRegisteredException(modelIn.toString()); if (!this.rModel.isAnimable()) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientAnimationHandler.java b/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientAnimationHandler.java index d055e09..5e2008e 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientAnimationHandler.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientAnimationHandler.java @@ -1,52 +1,212 @@ package com.leviathanstudio.craftstudio.client.animation; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.WeakHashMap; - -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; - import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.client.model.CSModelRenderer; -import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; -import com.leviathanstudio.craftstudio.common.animation.Channel; -import com.leviathanstudio.craftstudio.common.animation.CustomChannel; -import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import com.leviathanstudio.craftstudio.common.animation.InfoChannel; - +import com.leviathanstudio.craftstudio.common.animation.*; import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.entity.model.RendererModel; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; +import javax.vecmath.Vector3f; +import java.util.*; +import java.util.Map.Entry; /** * An object that hold the informations about its animated objects and all their * animations. It also start/stop/update the animations and render the models. * This is the client side AnimationHandler. * - * @since 0.3.0 - * + * @param The class of the animated object. * @author Timmypote * @author ZeAmateis - * - * @param - * The class of the animated object. + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class ClientAnimationHandler extends AnimationHandler -{ - /** Map with all the animations. */ - private Map animChannels = new HashMap<>(); +@OnlyIn(Dist.CLIENT) +public class ClientAnimationHandler extends AnimationHandler { + /** + * Map with all the animations. + */ + private Map animChannels = new HashMap<>(); - /** Map with the info about the animations. **/ + /** + * Map with the info about the animations. + **/ private Map> currentAnimInfo = new WeakHashMap<>(); + /** + * Check if game is paused, on the exit screen. + * + * @return true, if the game is paused. + */ + public static boolean isGamePaused() { + Minecraft MC = Minecraft.getInstance(); + return MC.isSingleplayer() && MC.currentScreen != null && MC.currentScreen.isPauseScreen() && !MC.getIntegratedServer().getPublic(); + } + + /** + * Apply animations if running or apply initial values. Should be only + * called by the model class. + * + * @param parts The list of block to update. + * @param animated The object that is animated. + */ + public static void performAnimationInModel(List parts, IAnimated animated) { + for (CSModelRenderer entry : parts) + performAnimationForBlock(entry, animated); + } + + /** + * Apply animations for model block. + * + * @param block The block to update. + * @param animated The object that is animated. + */ + public static void performAnimationForBlock(CSModelRenderer block, IAnimated animated) { + String boxName = block.boxName; + RendererModel child; + + if (animated.getAnimationHandler() instanceof ClientAnimationHandler) { + ClientAnimationHandler animHandler = (ClientAnimationHandler) animated.getAnimationHandler(); + + if (block.childModels != null) + for (int i = 0; i < block.childModels.size(); i++) { + child = block.childModels.get(i); + if (child instanceof CSModelRenderer) { + CSModelRenderer childModel = (CSModelRenderer) child; + performAnimationForBlock(childModel, animated); + } + } + + block.resetRotationPoint(); + block.resetRotationMatrix(); + block.resetOffset(); + block.resetStretch(); + + Map animInfoMap = (Map) animHandler.currentAnimInfo.get(animated); + if (animInfoMap == null) + return; + + for (Entry animInfo : animInfoMap.entrySet()) + if (animInfo.getKey() instanceof ClientChannel) { + ClientChannel clientChannel = (ClientChannel) animInfo.getKey(); + float currentFrame = animInfo.getValue().currentFrame; + + // Rotations + KeyFrame prevRotationKeyFrame = clientChannel.getPreviousRotationKeyFrameForBox(boxName, currentFrame); + int prevRotationKeyFramePosition = prevRotationKeyFrame != null ? clientChannel.getKeyFramePosition(prevRotationKeyFrame) : 0; + + KeyFrame nextRotationKeyFrame = clientChannel.getNextRotationKeyFrameForBox(boxName, currentFrame); + int nextRotationKeyFramePosition = nextRotationKeyFrame != null ? clientChannel.getKeyFramePosition(nextRotationKeyFrame) : 0; + + float SLERPProgress = (currentFrame - prevRotationKeyFramePosition) + / (nextRotationKeyFramePosition - prevRotationKeyFramePosition); + if (SLERPProgress > 1F || SLERPProgress < 0F) + SLERPProgress = 1F; + + if (prevRotationKeyFramePosition == 0 && prevRotationKeyFrame == null && !(nextRotationKeyFramePosition == 0)) { + Quat4f currentQuat = new Quat4f(); + currentQuat.interpolate(block.getDefaultRotationAsQuaternion(), nextRotationKeyFrame.modelRenderersRotations.get(boxName), + SLERPProgress); + Matrix4f mat = block.getRotationMatrix(); + mat.set(currentQuat); + mat.transpose(); + } else if (nextRotationKeyFramePosition != 0) { + Quat4f currentQuat = new Quat4f(); + currentQuat.interpolate(prevRotationKeyFrame.modelRenderersRotations.get(boxName), + nextRotationKeyFrame.modelRenderersRotations.get(boxName), SLERPProgress); + Matrix4f mat = block.getRotationMatrix(); + mat.set(currentQuat); + mat.transpose(); + } + + // Translations + KeyFrame prevTranslationKeyFrame = clientChannel.getPreviousTranslationKeyFrameForBox(boxName, currentFrame); + int prevTranslationsKeyFramePosition = prevTranslationKeyFrame != null + ? clientChannel.getKeyFramePosition(prevTranslationKeyFrame) : 0; + + KeyFrame nextTranslationKeyFrame = clientChannel.getNextTranslationKeyFrameForBox(boxName, currentFrame); + int nextTranslationsKeyFramePosition = nextTranslationKeyFrame != null + ? clientChannel.getKeyFramePosition(nextTranslationKeyFrame) : 0; + + float LERPProgress = (currentFrame - prevTranslationsKeyFramePosition) + / (nextTranslationsKeyFramePosition - prevTranslationsKeyFramePosition); + if (LERPProgress > 1F || LERPProgress < 0F) + LERPProgress = 1F; + + if (prevTranslationsKeyFramePosition == 0 && prevTranslationKeyFrame == null && !(nextTranslationsKeyFramePosition == 0)) { + Vector3f startPosition = block.getPositionAsVector(); + Vector3f endPosition = nextTranslationKeyFrame.modelRenderersTranslations.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, LERPProgress); + block.setRotationPoint(currentPosition.x, currentPosition.y, currentPosition.z); + } else if (nextTranslationsKeyFramePosition != 0) { + Vector3f startPosition = prevTranslationKeyFrame.modelRenderersTranslations.get(boxName); + Vector3f endPosition = nextTranslationKeyFrame.modelRenderersTranslations.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, LERPProgress); + block.setRotationPoint(currentPosition.x, currentPosition.y, currentPosition.z); + } + + // Offsets + KeyFrame prevOffsetKeyFrame = clientChannel.getPreviousOffsetKeyFrameForBox(boxName, currentFrame); + int prevOffsetKeyFramePosition = prevOffsetKeyFrame != null ? clientChannel.getKeyFramePosition(prevOffsetKeyFrame) : 0; + + KeyFrame nextOffsetKeyFrame = clientChannel.getNextOffsetKeyFrameForBox(boxName, currentFrame); + int nextOffsetKeyFramePosition = nextOffsetKeyFrame != null ? clientChannel.getKeyFramePosition(nextOffsetKeyFrame) : 0; + + float OffProgress = (currentFrame - prevOffsetKeyFramePosition) / (nextOffsetKeyFramePosition - prevOffsetKeyFramePosition); + if (OffProgress > 1F || OffProgress < 0F) + OffProgress = 1F; + + if (prevOffsetKeyFramePosition == 0 && prevOffsetKeyFrame == null && !(nextOffsetKeyFramePosition == 0)) { + Vector3f startPosition = block.getOffsetAsVector(); + Vector3f endPosition = nextOffsetKeyFrame.modelRenderersOffsets.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, OffProgress); + block.setOffset(currentPosition.x, currentPosition.y, currentPosition.z); + } else if (nextOffsetKeyFramePosition != 0) { + Vector3f startPosition = prevOffsetKeyFrame.modelRenderersOffsets.get(boxName); + Vector3f endPosition = nextOffsetKeyFrame.modelRenderersOffsets.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, OffProgress); + block.setOffset(currentPosition.x, currentPosition.y, currentPosition.z); + } + + // Stretch + KeyFrame prevStretchKeyFrame = clientChannel.getPreviousStretchKeyFrameForBox(boxName, currentFrame); + int prevStretchKeyFramePosition = prevStretchKeyFrame != null ? clientChannel.getKeyFramePosition(prevStretchKeyFrame) : 0; + + KeyFrame nextStretchKeyFrame = clientChannel.getNextStretchKeyFrameForBox(boxName, currentFrame); + int nextStretchKeyFramePosition = nextStretchKeyFrame != null ? clientChannel.getKeyFramePosition(nextStretchKeyFrame) : 0; + + float strProgress = (currentFrame - prevStretchKeyFramePosition) / (nextStretchKeyFramePosition - prevStretchKeyFramePosition); + if (strProgress > 1F || strProgress < 0F) + strProgress = 1F; + + if (prevStretchKeyFramePosition == 0 && prevStretchKeyFrame == null && !(nextStretchKeyFramePosition == 0)) { + Vector3f startPosition = block.getStretchAsVector(); + Vector3f endPosition = nextStretchKeyFrame.modelRenderersStretchs.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, strProgress); + block.setStretch(currentPosition.x, currentPosition.y, currentPosition.z); + } else if (nextStretchKeyFramePosition != 0) { + Vector3f startPosition = prevStretchKeyFrame.modelRenderersStretchs.get(boxName); + Vector3f endPosition = nextStretchKeyFrame.modelRenderersStretchs.get(boxName); + Vector3f currentPosition = new Vector3f(startPosition); + currentPosition.interpolate(endPosition, strProgress); + block.setStretch(currentPosition.x, currentPosition.y, currentPosition.z); + } + + } else if (animInfo.getKey() instanceof CustomChannel) + ((CustomChannel) animInfo.getKey()).update(block, animated); + } + + } + @Override public void addAnim(String modid, String animNameIn, String modelNameIn, boolean looped) { super.addAnim(modid, animNameIn, modelNameIn, looped); @@ -133,7 +293,7 @@ public void animationsUpdate(T animatedElement) { if (animInfoMap == null) return; - for (Iterator> it = animInfoMap.entrySet().iterator(); it.hasNext();) { + for (Iterator> it = animInfoMap.entrySet().iterator(); it.hasNext(); ) { Entry animInfo = it.next(); animInfo.getValue(); boolean canUpdate = this.canUpdateAnimation(animInfo.getKey(), animatedElement); @@ -207,196 +367,15 @@ public boolean canUpdateAnimation(Channel channel, T animatedElement) { return true; } return false; - } - else + } else return true; - } - else { + } else { animInfo.prevTime = currentTime; return true; } } - /** - * Check if game is paused, on the exit screen. - * - * @return true, if the game is paused. - */ - public static boolean isGamePaused() { - Minecraft MC = Minecraft.getMinecraft(); - return MC.isSingleplayer() && MC.currentScreen != null && MC.currentScreen.doesGuiPauseGame() && !MC.getIntegratedServer().getPublic(); - } - - /** - * Apply animations if running or apply initial values. Should be only - * called by the model class. - * - * @param parts - * The list of block to update. - * @param animated - * The object that is animated. - */ - public static void performAnimationInModel(List parts, IAnimated animated) { - for (CSModelRenderer entry : parts) - performAnimationForBlock(entry, animated); - } - - /** - * Apply animations for model block. - * - * @param block - * The block to update. - * @param animated - * The object that is animated. - */ - public static void performAnimationForBlock(CSModelRenderer block, IAnimated animated) { - String boxName = block.boxName; - ModelRenderer child; - - if (animated.getAnimationHandler() instanceof ClientAnimationHandler) { - ClientAnimationHandler animHandler = (ClientAnimationHandler) animated.getAnimationHandler(); - - if (block.childModels != null) - for (int i = 0; i < block.childModels.size(); i++) { - child = block.childModels.get(i); - if (child instanceof CSModelRenderer) { - CSModelRenderer childModel = (CSModelRenderer) child; - performAnimationForBlock(childModel, animated); - } - } - - block.resetRotationPoint(); - block.resetRotationMatrix(); - block.resetOffset(); - block.resetStretch(); - - Map animInfoMap = (Map) animHandler.currentAnimInfo.get(animated); - if (animInfoMap == null) - return; - - for (Entry animInfo : animInfoMap.entrySet()) - if (animInfo.getKey() instanceof ClientChannel) { - ClientChannel clientChannel = (ClientChannel) animInfo.getKey(); - float currentFrame = animInfo.getValue().currentFrame; - - // Rotations - KeyFrame prevRotationKeyFrame = clientChannel.getPreviousRotationKeyFrameForBox(boxName, currentFrame); - int prevRotationKeyFramePosition = prevRotationKeyFrame != null ? clientChannel.getKeyFramePosition(prevRotationKeyFrame) : 0; - - KeyFrame nextRotationKeyFrame = clientChannel.getNextRotationKeyFrameForBox(boxName, currentFrame); - int nextRotationKeyFramePosition = nextRotationKeyFrame != null ? clientChannel.getKeyFramePosition(nextRotationKeyFrame) : 0; - - float SLERPProgress = (currentFrame - prevRotationKeyFramePosition) - / (nextRotationKeyFramePosition - prevRotationKeyFramePosition); - if (SLERPProgress > 1F || SLERPProgress < 0F) - SLERPProgress = 1F; - - if (prevRotationKeyFramePosition == 0 && prevRotationKeyFrame == null && !(nextRotationKeyFramePosition == 0)) { - Quat4f currentQuat = new Quat4f(); - currentQuat.interpolate(block.getDefaultRotationAsQuaternion(), nextRotationKeyFrame.modelRenderersRotations.get(boxName), - SLERPProgress); - Matrix4f mat = block.getRotationMatrix(); - mat.set(currentQuat); - mat.transpose(); - } - else if (nextRotationKeyFramePosition != 0) { - Quat4f currentQuat = new Quat4f(); - currentQuat.interpolate(prevRotationKeyFrame.modelRenderersRotations.get(boxName), - nextRotationKeyFrame.modelRenderersRotations.get(boxName), SLERPProgress); - Matrix4f mat = block.getRotationMatrix(); - mat.set(currentQuat); - mat.transpose(); - } - - // Translations - KeyFrame prevTranslationKeyFrame = clientChannel.getPreviousTranslationKeyFrameForBox(boxName, currentFrame); - int prevTranslationsKeyFramePosition = prevTranslationKeyFrame != null - ? clientChannel.getKeyFramePosition(prevTranslationKeyFrame) : 0; - - KeyFrame nextTranslationKeyFrame = clientChannel.getNextTranslationKeyFrameForBox(boxName, currentFrame); - int nextTranslationsKeyFramePosition = nextTranslationKeyFrame != null - ? clientChannel.getKeyFramePosition(nextTranslationKeyFrame) : 0; - - float LERPProgress = (currentFrame - prevTranslationsKeyFramePosition) - / (nextTranslationsKeyFramePosition - prevTranslationsKeyFramePosition); - if (LERPProgress > 1F || LERPProgress < 0F) - LERPProgress = 1F; - - if (prevTranslationsKeyFramePosition == 0 && prevTranslationKeyFrame == null && !(nextTranslationsKeyFramePosition == 0)) { - Vector3f startPosition = block.getPositionAsVector(); - Vector3f endPosition = nextTranslationKeyFrame.modelRenderersTranslations.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, LERPProgress); - block.setRotationPoint(currentPosition.x, currentPosition.y, currentPosition.z); - } - else if (nextTranslationsKeyFramePosition != 0) { - Vector3f startPosition = prevTranslationKeyFrame.modelRenderersTranslations.get(boxName); - Vector3f endPosition = nextTranslationKeyFrame.modelRenderersTranslations.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, LERPProgress); - block.setRotationPoint(currentPosition.x, currentPosition.y, currentPosition.z); - } - - // Offsets - KeyFrame prevOffsetKeyFrame = clientChannel.getPreviousOffsetKeyFrameForBox(boxName, currentFrame); - int prevOffsetKeyFramePosition = prevOffsetKeyFrame != null ? clientChannel.getKeyFramePosition(prevOffsetKeyFrame) : 0; - - KeyFrame nextOffsetKeyFrame = clientChannel.getNextOffsetKeyFrameForBox(boxName, currentFrame); - int nextOffsetKeyFramePosition = nextOffsetKeyFrame != null ? clientChannel.getKeyFramePosition(nextOffsetKeyFrame) : 0; - - float OffProgress = (currentFrame - prevOffsetKeyFramePosition) / (nextOffsetKeyFramePosition - prevOffsetKeyFramePosition); - if (OffProgress > 1F || OffProgress < 0F) - OffProgress = 1F; - - if (prevOffsetKeyFramePosition == 0 && prevOffsetKeyFrame == null && !(nextOffsetKeyFramePosition == 0)) { - Vector3f startPosition = block.getOffsetAsVector(); - Vector3f endPosition = nextOffsetKeyFrame.modelRenderersOffsets.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, OffProgress); - block.setOffset(currentPosition.x, currentPosition.y, currentPosition.z); - } - else if (nextOffsetKeyFramePosition != 0) { - Vector3f startPosition = prevOffsetKeyFrame.modelRenderersOffsets.get(boxName); - Vector3f endPosition = nextOffsetKeyFrame.modelRenderersOffsets.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, OffProgress); - block.setOffset(currentPosition.x, currentPosition.y, currentPosition.z); - } - - // Stretch - KeyFrame prevStretchKeyFrame = clientChannel.getPreviousStretchKeyFrameForBox(boxName, currentFrame); - int prevStretchKeyFramePosition = prevStretchKeyFrame != null ? clientChannel.getKeyFramePosition(prevStretchKeyFrame) : 0; - - KeyFrame nextStretchKeyFrame = clientChannel.getNextStretchKeyFrameForBox(boxName, currentFrame); - int nextStretchKeyFramePosition = nextStretchKeyFrame != null ? clientChannel.getKeyFramePosition(nextStretchKeyFrame) : 0; - - float strProgress = (currentFrame - prevStretchKeyFramePosition) / (nextStretchKeyFramePosition - prevStretchKeyFramePosition); - if (strProgress > 1F || strProgress < 0F) - strProgress = 1F; - - if (prevStretchKeyFramePosition == 0 && prevStretchKeyFrame == null && !(nextStretchKeyFramePosition == 0)) { - Vector3f startPosition = block.getStretchAsVector(); - Vector3f endPosition = nextStretchKeyFrame.modelRenderersStretchs.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, strProgress); - block.setStretch(currentPosition.x, currentPosition.y, currentPosition.z); - } - else if (nextStretchKeyFramePosition != 0) { - Vector3f startPosition = prevStretchKeyFrame.modelRenderersStretchs.get(boxName); - Vector3f endPosition = nextStretchKeyFrame.modelRenderersStretchs.get(boxName); - Vector3f currentPosition = new Vector3f(startPosition); - currentPosition.interpolate(endPosition, strProgress); - block.setStretch(currentPosition.x, currentPosition.y, currentPosition.z); - } - - } - else if (animInfo.getKey() instanceof CustomChannel) - ((CustomChannel) animInfo.getKey()).update(block, animated); - } - - } - /** * Getter of currentAnimInfo. * @@ -409,8 +388,7 @@ public Map> getCurrentAnimInfo() { /** * Setter of currentAnimInfo. * - * @param currentAnimInfo - * the currentAnimInfo to set. + * @param currentAnimInfo the currentAnimInfo to set. */ public void setCurrentAnimInfo(Map> currentAnimInfo) { this.currentAnimInfo = currentAnimInfo; @@ -428,8 +406,7 @@ public Map getAnimChannels() { /** * Setter of animChannels. * - * @param animChannels - * the animChannels to set. + * @param animChannels the animChannels to set. */ public void setAnimChannels(Map animChannels) { this.animChannels = animChannels; diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientChannel.java b/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientChannel.java index 1b4d3d0..86fa4ab 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientChannel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/animation/ClientChannel.java @@ -1,37 +1,36 @@ package com.leviathanstudio.craftstudio.client.animation; +import com.leviathanstudio.craftstudio.common.animation.InfoChannel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import com.leviathanstudio.craftstudio.common.animation.InfoChannel; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - /** * A InfoChannel that hold keyframes to animate a model. * - * @since 0.3.0 - * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class ClientChannel extends InfoChannel -{ - /** KeyFrames. Key is the position of that keyFrame in the frames list. */ - private Map keyFrames = new HashMap<>(); +@OnlyIn(Dist.CLIENT) +public class ClientChannel extends InfoChannel { + /** + * KeyFrames. Key is the position of that keyFrame in the frames list. + */ + private Map keyFrames = new HashMap<>(); - /** How this animation should behave. */ - private EnumAnimationMode animationMode = EnumAnimationMode.LINEAR; + /** + * How this animation should behave. + */ + private EnumAnimationMode animationMode = EnumAnimationMode.LINEAR; /** * Create an empty ClientChannel, with {@code totalFrames} = 0. * - * @param channelName - * The name of the animation channel. - * @param initialize - * If the keyFrames should be initialized in the constructor. + * @param channelName The name of the animation channel. + * @param initialize If the keyFrames should be initialized in the constructor. */ public ClientChannel(String channelName, boolean initialize) { super(channelName); @@ -42,16 +41,11 @@ public ClientChannel(String channelName, boolean initialize) { /** * Create a ClientChannel. * - * @param animationName - * The name of the animation channel. - * @param fps - * The number of frame per seconds. - * @param totalFrames - * The total number of frames. - * @param animationMode - * The animation mode. - * @param initialize - * If the keyFrames should be initialized in the constructor. + * @param animationName The name of the animation channel. + * @param fps The number of frame per seconds. + * @param totalFrames The total number of frames. + * @param animationMode The animation mode. + * @param initialize If the keyFrames should be initialized in the constructor. */ public ClientChannel(String animationName, float fps, int totalFrames, EnumAnimationMode animationMode, boolean initialize) { this(animationName, initialize); @@ -62,18 +56,19 @@ public ClientChannel(String animationName, float fps, int totalFrames, EnumAnima this.looped = true; } - /** Create all the frames and add them in the list in the correct order. */ - protected void initializeAllFrames() {} + /** + * Create all the frames and add them in the list in the correct order. + */ + protected void initializeAllFrames() { + } /** * Return the previous rotation KeyFrame before this frame that uses this * box, if it exists. If currentFrame is a keyFrame that uses this box, it * is returned. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The previous key frames. */ public KeyFrame getPreviousRotationKeyFrameForBox(String boxName, float currentFrame) { @@ -105,10 +100,8 @@ public KeyFrame getPreviousRotationKeyFrameForBox(String boxName, float currentF * if it exists. If currentFrame is a keyFrame that uses this box, it is NOT * considered. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The next key frames. */ public KeyFrame getNextRotationKeyFrameForBox(String boxName, float currentFrame) { @@ -141,10 +134,8 @@ public KeyFrame getNextRotationKeyFrameForBox(String boxName, float currentFrame * box, if it exists. If currentFrame is a keyFrame that uses this box, it * is returned. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The previous key frames. */ public KeyFrame getPreviousTranslationKeyFrameForBox(String boxName, float currentFrame) { @@ -176,10 +167,8 @@ public KeyFrame getPreviousTranslationKeyFrameForBox(String boxName, float curre * box, if it exists. If currentFrame is a keyFrame that uses this box, it * is NOT considered. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The next key frames. */ public KeyFrame getNextTranslationKeyFrameForBox(String boxName, float currentFrame) { @@ -213,10 +202,8 @@ public KeyFrame getNextTranslationKeyFrameForBox(String boxName, float currentFr * if it exists. If currentFrame is a keyFrame that uses this box, it is * returned. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The previous key frames. */ public KeyFrame getPreviousOffsetKeyFrameForBox(String boxName, float currentFrame) { @@ -248,10 +235,8 @@ public KeyFrame getPreviousOffsetKeyFrameForBox(String boxName, float currentFra * it exists. If currentFrame is a keyFrame that uses this box, it is NOT * considered. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The next key frames. */ public KeyFrame getNextOffsetKeyFrameForBox(String boxName, float currentFrame) { @@ -285,10 +270,8 @@ public KeyFrame getNextOffsetKeyFrameForBox(String boxName, float currentFrame) * box, if it exists. If curretFrame is a keyFrame that uses this box, it is * returned. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The previous key frames. */ public KeyFrame getPreviousStretchKeyFrameForBox(String boxName, float currentFrame) { @@ -320,10 +303,8 @@ public KeyFrame getPreviousStretchKeyFrameForBox(String boxName, float currentFr * if it exists. If currentFrame is a keyFrame that uses this box, it is NOT * considered. * - * @param boxName - * The name of the box. - * @param currentFrame - * The current frame. + * @param boxName The name of the box. + * @param currentFrame The current frame. * @return The next key frames. */ public KeyFrame getNextStretchKeyFrameForBox(String boxName, float currentFrame) { @@ -356,8 +337,7 @@ public KeyFrame getNextStretchKeyFrameForBox(String boxName, float currentFrame) * Get the position of the keyframe in this animation, if the keyframe * exists. * - * @param keyFrame - * The keyframe. + * @param keyFrame The keyframe. * @return The position of the keyframe, -1 if it doesn't exist. */ public int getKeyFramePosition(KeyFrame keyFrame) { @@ -375,8 +355,7 @@ public int getKeyFramePosition(KeyFrame keyFrame) { /** * Get inverted channel, for inverted animation. * - * @param name - * The name of the new Channel. + * @param name The name of the new Channel. * @return The new Channel. */ public ClientChannel getInvertedChannel(String name) { @@ -398,8 +377,7 @@ public Map getKeyFrames() { /** * Setter of keyFrames. * - * @param keyFrames - * the keyFrames to set. + * @param keyFrames the keyFrames to set. */ public void setKeyFrames(Map keyFrames) { this.keyFrames = keyFrames; @@ -417,8 +395,7 @@ public EnumAnimationMode getAnimationMode() { /** * Setter of animationMode. * - * @param animationMode - * the animationMode to set. + * @param animationMode the animationMode to set. */ public void setAnimationMode(EnumAnimationMode animationMode) { this.animationMode = animationMode; diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/animation/EnumAnimationMode.java b/src/main/java/com/leviathanstudio/craftstudio/client/animation/EnumAnimationMode.java index 907629d..3539877 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/animation/EnumAnimationMode.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/animation/EnumAnimationMode.java @@ -1,22 +1,27 @@ package com.leviathanstudio.craftstudio.client.animation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Enumeration of the possible animation mode. * - * @since 0.3.0 - * * @author Timmypote * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public enum EnumAnimationMode { - /** An animation that play just once */ + /** + * An animation that play just once + */ LINEAR, - /** An animation that play once and hold the last keyframe */ + /** + * An animation that play once and hold the last keyframe + */ HOLD, - /** An animation that restart everytime it end */ + /** + * An animation that restart everytime it end + */ LOOP; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/animation/KeyFrame.java b/src/main/java/com/leviathanstudio/craftstudio/client/animation/KeyFrame.java index 469bb88..e3de372 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/animation/KeyFrame.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/animation/KeyFrame.java @@ -1,39 +1,43 @@ package com.leviathanstudio.craftstudio.client.animation; -import java.util.HashMap; -import java.util.Map; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.HashMap; +import java.util.Map; /** * Class that store informations about a model at a specific time of an * animation. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class KeyFrame implements Cloneable -{ - /** Map of quaternions for block rotation */ - protected Map modelRenderersRotations = new HashMap<>(); - /** Map of vector for block translation */ +@OnlyIn(Dist.CLIENT) +public class KeyFrame implements Cloneable { + /** + * Map of quaternions for block rotation + */ + protected Map modelRenderersRotations = new HashMap<>(); + /** + * Map of vector for block translation + */ protected Map modelRenderersTranslations = new HashMap<>(); - /** Map of vector for block offset */ - protected Map modelRenderersOffsets = new HashMap<>(); - /** Map of vector for block stretch */ - protected Map modelRenderersStretchs = new HashMap<>(); + /** + * Map of vector for block offset + */ + protected Map modelRenderersOffsets = new HashMap<>(); + /** + * Map of vector for block stretch + */ + protected Map modelRenderersStretchs = new HashMap<>(); /** * Check if box is in rotation. * - * @param boxName - * The name of the box. + * @param boxName The name of the box. * @return True if is in rotation, false if not. */ public boolean useBoxInRotations(String boxName) { @@ -43,8 +47,7 @@ public boolean useBoxInRotations(String boxName) { /** * Check if box is in translation. * - * @param boxName - * The name of the box. + * @param boxName The name of the box. * @return True if is in translation, false if not. */ public boolean useBoxInTranslations(String boxName) { @@ -54,8 +57,7 @@ public boolean useBoxInTranslations(String boxName) { /** * Check if box has offset modification. * - * @param boxName - * The name of the box. + * @param boxName The name of the box. * @return True if has offset modification, false if not. */ public boolean useBoxInOffsets(String boxName) { @@ -65,8 +67,7 @@ public boolean useBoxInOffsets(String boxName) { /** * Check if box has stretch modification. * - * @param boxName - * The name of the box. + * @param boxName The name of the box. * @return True if has stretch modification, false if not. */ public boolean useBoxInStretchs(String boxName) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSMalformedJsonException.java b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSMalformedJsonException.java index a2bd547..32ebd3d 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSMalformedJsonException.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSMalformedJsonException.java @@ -1,30 +1,25 @@ package com.leviathanstudio.craftstudio.client.exception; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Exception raised when there is an error during json reading caused by a * malformed json. - * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSMalformedJsonException extends Exception -{ +@OnlyIn(Dist.CLIENT) +public class CSMalformedJsonException extends Exception { private static final long serialVersionUID = -3495512445212088386L; /** * Create a exception for a missing field. * - * @param field - * The name of the field. - * @param type - * The type of the field. - * @param ress - * The resource that is malformed. + * @param field The name of the field. + * @param type The type of the field. + * @param ress The resource that is malformed. */ public CSMalformedJsonException(String field, String type, String ress) { super("Missing field " + field + " of type " + type + " in " + ress); @@ -33,10 +28,8 @@ public CSMalformedJsonException(String field, String type, String ress) { /** * Create a exception for a malformed field. * - * @param element - * Element that is malformed. - * @param ress - * The resource that is malformed. + * @param element Element that is malformed. + * @param ress The resource that is malformed. */ public CSMalformedJsonException(String element, String ress) { super("Malformation of " + element + " in " + ress); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotFoundException.java b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotFoundException.java index ae471bd..0620dbb 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotFoundException.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotFoundException.java @@ -1,27 +1,24 @@ package com.leviathanstudio.craftstudio.client.exception; -import java.io.FileNotFoundException; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.io.FileNotFoundException; /** * Exception raised when opening a .csjsmodel or .csjsmodelanim file has failed. - * - * @since 0.3.0 * * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSResourceNotFoundException extends FileNotFoundException -{ +@OnlyIn(Dist.CLIENT) +public class CSResourceNotFoundException extends FileNotFoundException { private static final long serialVersionUID = -3495512420502088386L; /** * Create an exception for a resource not found. * - * @param resourceIn - * The resource that wasn't found. + * @param resourceIn The resource that wasn't found. */ public CSResourceNotFoundException(String resourceIn) { super("Resource not found: " + resourceIn); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotRegisteredException.java b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotRegisteredException.java index b634185..bef2330 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotRegisteredException.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/exception/CSResourceNotRegisteredException.java @@ -1,26 +1,23 @@ package com.leviathanstudio.craftstudio.client.exception; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Exception raised when the program try to call a resource that isn't * registered. - * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSResourceNotRegisteredException extends RuntimeException -{ +@OnlyIn(Dist.CLIENT) +public class CSResourceNotRegisteredException extends RuntimeException { private static final long serialVersionUID = -3495512420502365486L; /** * Create an exception for a resource not registered. * - * @param resourceNameIn - * The resource that isn't registered. + * @param resourceNameIn The resource that isn't registered. */ public CSResourceNotRegisteredException(String resourceNameIn) { super("You are trying to acces \"" + resourceNameIn + "\", but it's not registered"); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java index 5c6c2e4..d3c21d4 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java @@ -1,14 +1,5 @@ package com.leviathanstudio.craftstudio.client.json; -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.InputStreamReader; -import java.util.Map.Entry; - -import javax.vecmath.Vector3f; - -import org.apache.commons.io.Charsets; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -17,40 +8,45 @@ import com.leviathanstudio.craftstudio.client.exception.CSMalformedJsonException; import com.leviathanstudio.craftstudio.client.exception.CSResourceNotFoundException; import com.leviathanstudio.craftstudio.client.util.EnumFrameType; - import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResource; +import net.minecraft.resources.IResource; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.apache.commons.io.Charsets; + +import javax.vecmath.Vector3f; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.InputStreamReader; +import java.util.Map.Entry; /** * Class used to read json and extract a {@link CSReadedModel} or a * {@link CSReadedAnim}. - * - * @since 0.3.0 * * @author Timmypote * @author ZeAmateis * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSJsonReader -{ - /** The JsonObject that is the root of the file */ +@OnlyIn(Dist.CLIENT) +public class CSJsonReader { + /** + * The JsonObject that is the root of the file + */ private JsonObject root; - /** The resource location */ - private String ress; + /** + * The resource location + */ + private String ress; /** * Create a {@link CSJsonReader} link to the resource. * - * @param resourceIn - * Location of the model.csjsmodel or the - * anim.csjsmodelanim. - * @throws CraftStudioModelNotFound - * If the files doesn't exist. - * + * @param resourceIn Location of the model.csjsmodel or the + * anim.csjsmodelanim. + * @throws CSResourceNotFoundException If the files doesn't exist. * @see #readModel() * @see #readAnim() */ @@ -62,7 +58,7 @@ public CSJsonReader(ResourceLocation resourceIn) throws CSResourceNotFoundExcept this.ress = resourceIn.toString(); try { - iResource = Minecraft.getMinecraft().getResourceManager().getResource(resourceIn); + iResource = Minecraft.getInstance().getResourceManager().getResource(resourceIn); reader = new BufferedReader(new InputStreamReader(iResource.getInputStream(), Charsets.UTF_8)); String s; while ((s = reader.readLine()) != null) @@ -85,54 +81,12 @@ public CSJsonReader(ResourceLocation resourceIn) throws CSResourceNotFoundExcept } } - /** - * Extract a {@link CSReadedModel} from a .csjsmodel file. - * - * @return A new {@link CSReadedModel} containing the informations of the - * file. - * @throws CSMalformedJsonException - * If the json does match the model structure - */ - public CSReadedModel readModel() throws CSMalformedJsonException { - - CSReadedModel model = new CSReadedModel(); - CSReadedModelBlock parent; - JsonObject jsonBlock; - JsonElement jsEl; - - jsEl = this.root.get("title"); - if (jsEl == null) - throw new CSMalformedJsonException("title", "String", this.ress); - model.setName(strNormalize(jsEl.getAsString())); - - JsonArray tree = this.root.getAsJsonArray("tree"); - if (tree == null) - throw new CSMalformedJsonException("tree", "Array", this.ress); - for (JsonElement element : tree) - if (element.isJsonObject()) { - jsonBlock = element.getAsJsonObject(); - - parent = new CSReadedModelBlock(); - model.getParents().add(parent); - - try { - readModelBlock(jsonBlock, parent); - } catch (NullPointerException | ClassCastException | IllegalStateException e) { - // e.printStackTrace(); - throw new CSMalformedJsonException(parent.getName() != null ? parent.getName() : "a parent block without name", this.ress); - } - } - return model; - } - /** * Extract a block (and all its children) from a {@link JsonObject} and * place it in the {@link CSReadedModelBlock}. * - * @param jsonBlock - * The object to read the information. - * @param block - * The block to place the information. + * @param jsonBlock The object to read the information. + * @param block The block to place the information. */ private static void readModelBlock(JsonObject jsonBlock, CSReadedModelBlock block) { readModelBlock(jsonBlock, block, null); @@ -142,15 +96,12 @@ private static void readModelBlock(JsonObject jsonBlock, CSReadedModelBlock bloc * Extract a child block from a {@link JsonObject} and place it in the * {@link CSReadedModelBlock}. * - * @param jsonBlock - * The object to read the information. - * @param block - * The block to place the information. - * @param parentOffset - * The offset from pivot of the parent block. + * @param jsonBlock The object to read the information. + * @param block The block to place the information. + * @param parentOffset The offset from pivot of the parent block. */ private static void readModelBlock(JsonObject jsonBlock, CSReadedModelBlock block, Vector3f parentOffset) { - final int[] vertexOrderConvert = new int[] { 3, 2, 1, 0, 6, 7, 4, 5 }; + final int[] vertexOrderConvert = new int[]{3, 2, 1, 0, 6, 7, 4, 5}; JsonObject jsonChild; CSReadedModelBlock child; @@ -199,8 +150,7 @@ private static void readModelBlock(JsonObject jsonBlock, CSReadedModelBlock bloc } block.setStretch(new Vector3f(stretchx, stretchy, stretchz)); - } - else + } else block.setStretch(new Vector3f(1, 1, 1)); if (parentOffset == null) @@ -225,58 +175,12 @@ private static void readModelBlock(JsonObject jsonBlock, CSReadedModelBlock bloc } - /** - * Extract a {@link CSReadedAnim} from a .csjsmodelanim file. - * - * @return A new {@link CSReadedAnim} containing the informations of the - * file. - * @throws CSMalformedJsonException - * If the json does match the animation structure - */ - public CSReadedAnim readAnim() throws CSMalformedJsonException { - - CSReadedAnim anim = new CSReadedAnim(); - CSReadedAnimBlock block; - JsonElement jsEl; - - jsEl = this.root.get("title"); - if (jsEl == null) - throw new CSMalformedJsonException("title", "String", this.ress); - anim.setName(strNormalize(jsEl.getAsString())); - jsEl = this.root.get("duration"); - if (jsEl == null) - throw new CSMalformedJsonException("duration", "Integer", this.ress); - anim.setDuration(jsEl.getAsInt()); - jsEl = this.root.get("holdLastKeyframe"); - if (jsEl == null) - throw new CSMalformedJsonException("holdLastKeyframe", "Boolean", this.ress); - anim.setHoldLastK(jsEl.getAsBoolean()); - - jsEl = this.root.get("nodeAnimations"); - if (jsEl == null) - throw new CSMalformedJsonException("nodeAnimations", "Object", this.ress); - JsonObject nodeAnims = jsEl.getAsJsonObject(); - for (Entry entry : nodeAnims.entrySet()) { - block = new CSReadedAnimBlock(); - anim.getBlocks().add(block); - try { - readAnimBlock(entry, block); - } catch (Exception e) { - CraftStudioApi.getLogger().error(e.getMessage()); - throw new CSMalformedJsonException(block.getName() != null ? block.getName() : "a block without name", this.ress); - } - } - return anim; - } - /** * Extract a block's informations and place them in a * {@link CSReadedAnimBlock}. * - * @param entry - * The entry containing the informations. - * @param block - * The block to store the informations. + * @param entry The entry containing the informations. + * @param block The block to store the informations. */ private static void readAnimBlock(Entry entry, CSReadedAnimBlock block) { block.setName(strNormalize(entry.getKey())); @@ -297,12 +201,9 @@ private static void readAnimBlock(Entry entry, CSReadedAnim /** * Extract the element asked of all the keyframes. * - * @param obj - * The object with the keyframes. - * @param block - * The block to store the keyframes. - * @param type - * type of element to add. See {@link CSReadedAnimBlock}. + * @param obj The object with the keyframes. + * @param block The block to store the keyframes. + * @param type type of element to add. See {@link CSReadedAnimBlock}. */ private static void addKFElement(JsonObject obj, CSReadedAnimBlock block, EnumFrameType type) { int keyFrame; @@ -327,12 +228,93 @@ private static void addKFElement(JsonObject obj, CSReadedAnimBlock block, EnumFr /** * Normalize a String. * - * @param str - * The String to normalize. + * @param str The String to normalize. * @return The normalized String. */ private static String strNormalize(String str) { return str.replaceAll("[^\\dA-Za-z ]", "_").replaceAll("\\s+", "_").replaceAll("[^\\p{ASCII}]", "_"); } + /** + * Extract a {@link CSReadedModel} from a .csjsmodel file. + * + * @return A new {@link CSReadedModel} containing the informations of the + * file. + * @throws CSMalformedJsonException If the json does match the model structure + */ + public CSReadedModel readModel() throws CSMalformedJsonException { + + CSReadedModel model = new CSReadedModel(); + CSReadedModelBlock parent; + JsonObject jsonBlock; + JsonElement jsEl; + + jsEl = this.root.get("title"); + if (jsEl == null) + throw new CSMalformedJsonException("title", "String", this.ress); + model.setName(strNormalize(jsEl.getAsString())); + + JsonArray tree = this.root.getAsJsonArray("tree"); + if (tree == null) + throw new CSMalformedJsonException("tree", "Array", this.ress); + for (JsonElement element : tree) + if (element.isJsonObject()) { + jsonBlock = element.getAsJsonObject(); + + parent = new CSReadedModelBlock(); + model.getParents().add(parent); + + try { + readModelBlock(jsonBlock, parent); + } catch (NullPointerException | ClassCastException | IllegalStateException e) { + // e.printStackTrace(); + throw new CSMalformedJsonException(parent.getName() != null ? parent.getName() : "a parent block without name", this.ress); + } + } + return model; + } + + /** + * Extract a {@link CSReadedAnim} from a .csjsmodelanim file. + * + * @return A new {@link CSReadedAnim} containing the informations of the + * file. + * @throws CSMalformedJsonException If the json does match the animation structure + */ + public CSReadedAnim readAnim() throws CSMalformedJsonException { + + CSReadedAnim anim = new CSReadedAnim(); + CSReadedAnimBlock block; + JsonElement jsEl; + + jsEl = this.root.get("title"); + if (jsEl == null) + throw new CSMalformedJsonException("title", "String", this.ress); + anim.setName(strNormalize(jsEl.getAsString())); + jsEl = this.root.get("duration"); + if (jsEl == null) + throw new CSMalformedJsonException("duration", "Integer", this.ress); + anim.setDuration(jsEl.getAsInt()); + jsEl = this.root.get("holdLastKeyframe"); + if (jsEl == null) + throw new CSMalformedJsonException("holdLastKeyframe", "Boolean", this.ress); + anim.setHoldLastK(jsEl.getAsBoolean()); + + jsEl = this.root.get("nodeAnimations"); + if (jsEl == null) + throw new CSMalformedJsonException("nodeAnimations", "Object", this.ress); + JsonObject nodeAnims = jsEl.getAsJsonObject(); + for (Entry entry : nodeAnims.entrySet()) { + block = new CSReadedAnimBlock(); + anim.getBlocks().add(block); + try { + readAnimBlock(entry, block); + } catch (Exception e) { + CraftStudioApi.getLogger().error(e.getMessage()); + throw new CSMalformedJsonException(block.getName() != null ? block.getName() : "a block without name", this.ress); + } + } + return anim; + } + } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java index a3760f7..59f978d 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java @@ -1,31 +1,28 @@ package com.leviathanstudio.craftstudio.client.json; +import com.leviathanstudio.craftstudio.client.json.CSReadedAnimBlock.ReadedKeyFrame; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.Set; -import com.leviathanstudio.craftstudio.client.json.CSReadedAnimBlock.ReadedKeyFrame; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - /** * Class that store the informations relative to an animation. - * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSReadedAnim -{ - private String name; - private int duration; - private boolean holdLastK; +@OnlyIn(Dist.CLIENT) +public class CSReadedAnim { + private String name; + private int duration; + private boolean holdLastK; private List blocks = new ArrayList<>(); - private Integer[] keyFrames; + private Integer[] keyFrames; /** * Get the keys of keyframes used in the animation. diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnimBlock.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnimBlock.java index adb9aca..13cfad7 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnimBlock.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnimBlock.java @@ -1,37 +1,30 @@ package com.leviathanstudio.craftstudio.client.json; -import java.util.HashMap; -import java.util.Map; - -import javax.vecmath.Vector3f; - import com.leviathanstudio.craftstudio.client.util.EnumFrameType; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import javax.vecmath.Vector3f; +import java.util.HashMap; +import java.util.Map; /** * Class that store information relative to an animated block.
- * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSReadedAnimBlock -{ - private String name; +@OnlyIn(Dist.CLIENT) +public class CSReadedAnimBlock { + private String name; private Map keyFrames = new HashMap<>(); /** * Add an element to a keyframe. If the keyframe does exist it's created. * - * @param keyFrame - * Key of the keyframe. - * @param type - * Type of the element. See {@link CSReadedAnimBlock}. - * @param value - * Value of the element. + * @param keyFrame Key of the keyframe. + * @param type Type of the element. See {@link CSReadedAnimBlock}. + * @param value Value of the element. */ public void addKFElement(int keyFrame, EnumFrameType type, Vector3f value) { if (!this.keyFrames.containsKey(keyFrame)) @@ -55,18 +48,6 @@ public void addKFElement(int keyFrame, EnumFrameType type, Vector3f value) { } } - /** - * Class used to store informations relative to keyframes. - * - * @since 0.3.0 - * - * @author Timmypote - */ - public class ReadedKeyFrame - { - public Vector3f position, rotation, offset, size, stretching; - } - public String getName() { return this.name; } @@ -82,4 +63,14 @@ public Map getKeyFrames() { public void setKeyFrames(Map keyFrames) { this.keyFrames = keyFrames; } + + /** + * Class used to store informations relative to keyframes. + * + * @author Timmypote + * @since 0.3.0 + */ + public class ReadedKeyFrame { + public Vector3f position, rotation, offset, size, stretching; + } } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java index e9c07a6..24ff4a2 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java @@ -1,33 +1,30 @@ package com.leviathanstudio.craftstudio.client.json; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + import java.util.ArrayList; import java.util.List; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - /** * Class that store information relative to a model. * - * @since 0.3.0 - * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSReadedModel -{ - private String name; - private int textureWidth, textureHeight; +@OnlyIn(Dist.CLIENT) +public class CSReadedModel { + private String name; + private int textureWidth, textureHeight; private List parents = new ArrayList<>(); /** * Get a block from the model with this name. * - * @param name - * The name of the block. + * @param name The name of the block. * @return A block with this name. null, if no block with this - * name.
- * If multiple block with the same name, return one of them. + * name.
+ * If multiple block with the same name, return one of them. */ public CSReadedModelBlock getBlockFromName(String name) { CSReadedModelBlock b; diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModelBlock.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModelBlock.java index 1351404..da61448 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModelBlock.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModelBlock.java @@ -1,34 +1,30 @@ package com.leviathanstudio.craftstudio.client.json; -import java.util.ArrayList; -import java.util.List; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.vecmath.Vector3f; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; /** * Class that store information relative to a block in a model. - * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSReadedModelBlock -{ - private String name; - private Vector3f rotationPoint, rotation, size, stretch, offset; - private float vertex[][]; - private int[] texOffset = new int[2]; - private List childs = new ArrayList<>(); +@OnlyIn(Dist.CLIENT) +public class CSReadedModelBlock { + private String name; + private Vector3f rotationPoint, rotation, size, stretch, offset; + private float vertex[][]; + private int[] texOffset = new int[2]; + private List childs = new ArrayList<>(); /** * Create a new block with the specified name. * - * @param name - * The name of the block. + * @param name The name of the block. * @return The new block. */ CSReadedModelBlock getBlockFromName(String name) { @@ -47,10 +43,9 @@ CSReadedModelBlock getBlockFromName(String name) { * Check if the block or one of it's child as a name already in the list or * not and complete the list. * - * @param names - * A list of name. + * @param names A list of name. * @return null, if no block has duplicate name. One name that is - * duplicated, otherwise. + * duplicated, otherwise. */ String whyUnAnimable(List names) { String str; diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelBox.java b/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelBox.java index 60c965f..c4f8ce5 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelBox.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelBox.java @@ -1,84 +1,65 @@ package com.leviathanstudio.craftstudio.client.model; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.PositionTextureVertex; -import net.minecraft.client.model.TexturedQuad; import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.entity.model.RendererModel; +import net.minecraft.client.renderer.model.PositionTextureVertex; +import net.minecraft.client.renderer.model.TexturedQuad; import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** - * Class used to render a box in a {@link CSModelRenderer} or a - * {@link ModelRenderer}.
- * Partially based on {@link net.minecraft.client.model.ModelBox ModelBox}. - * - * @since 0.3.0 + * Class used to render a box in a {@link RendererModel} or a + * {@link RendererModel}.
+ * Partially based on {@link net.minecraft.client.renderer.model.ModelBox ModelBox}. * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSModelBox -{ - /** An array of 6 TexturedQuads, one for each face of a cube. */ +@OnlyIn(Dist.CLIENT) +public class CSModelBox { + private final static double NORM_PREC = 0.0001; + /** + * An array of 6 TexturedQuads, one for each face of a cube. + */ private final TexturedQuad[] quadList; - - /** The box name. **/ - public String boxName; - - private final static double NORM_PREC = 0.0001; + /** + * The box name. + **/ + public String boxName; /** * Create a textured rectangular box without textures mirror precision. * - * @param renderer - * The (CS)ModelRenderer to which the box will be add. - * @param texU - * The X coordinate of the texture. - * @param texV - * The Y coordinate of the texture. - * @param x - * The X coordinate of the starting point of the box. - * @param y - * The Y coordinate of the starting point of the box. - * @param z - * The Z coordinate of the starting point of the box. - * @param dx - * The length of the box on the X axis. - * @param dy - * The length of the box on the Y axis. - * @param dz - * The length of the box on the Z axis. + * @param renderer The (CS)RendererModel to which the box will be add. + * @param texU The X coordinate of the texture. + * @param texV The Y coordinate of the texture. + * @param x The X coordinate of the starting point of the box. + * @param y The Y coordinate of the starting point of the box. + * @param z The Z coordinate of the starting point of the box. + * @param dx The length of the box on the X axis. + * @param dy The length of the box on the Y axis. + * @param dz The length of the box on the Z axis. */ - public CSModelBox(ModelRenderer renderer, int texU, int texV, float x, float y, float z, float dx, float dy, float dz) { + public CSModelBox(RendererModel renderer, int texU, int texV, float x, float y, float z, float dx, float dy, float dz) { this(renderer, texU, texV, x, y, z, dx, dy, dz, renderer.mirror); } /** * Create a textured rectangular box. * - * @param renderer - * The (CS)ModelRenderer to which the box will be add. - * @param texU - * The X coordinate of the texture. - * @param texV - * The Y coordinate of the texture. - * @param x - * The X coordinate of the starting point of the box. - * @param y - * The Y coordinate of the starting point of the box. - * @param z - * The Z coordinate of the starting point of the box. - * @param dx - * The length of the box on the X axis. - * @param dy - * The length of the box on the Y axis. - * @param dz - * The length of the box on the Z axis. - * @param mirror - * True if the texture should be mirrored, False if it shouldn't. + * @param renderer The (CS)RendererModel to which the box will be add. + * @param texU The X coordinate of the texture. + * @param texV The Y coordinate of the texture. + * @param x The X coordinate of the starting point of the box. + * @param y The Y coordinate of the starting point of the box. + * @param z The Z coordinate of the starting point of the box. + * @param dx The length of the box on the X axis. + * @param dy The length of the box on the Y axis. + * @param dz The length of the box on the Z axis. + * @param mirror True if the texture should be mirrored, False if it shouldn't. */ - public CSModelBox(ModelRenderer renderer, int texU, int texV, float x, float y, float z, float dx, float dy, float dz, boolean mirror) { + public CSModelBox(RendererModel renderer, int texU, int texV, float x, float y, float z, float dx, float dy, float dz, boolean mirror) { this(renderer, getVerticesForRect(x, y, z, dx, dy, dz, mirror), getTextureUVsForRect(texU, texV, dx, dy, dz), mirror); } @@ -86,36 +67,29 @@ public CSModelBox(ModelRenderer renderer, int texU, int texV, float x, float y, * Create a box from PositionTextureVertex and texture it with textUVs * without textures mirror precision.
* See {@link #setVertex(PositionTextureVertex[]) setVertex()} and - * {@link #setTexture(ModelRenderer, int[][]) setTexture()} for orders. + * {@link #setTexture(RendererModel, int[][]) setTexture()} for orders. * - * @param renderer - * The (CS)ModelRenderer to which the box will be add. - * @param positionTextureVertex - * The 8 vertices used to create the box. - * @param textUVs - * The 6 pairs of points used to set the textures' UVs for each - * faces. + * @param renderer The (CS)RendererModel to which the box will be add. + * @param positionTextureVertex The 8 vertices used to create the box. + * @param textUVs The 6 pairs of points used to set the textures' UVs for each + * faces. */ - public CSModelBox(ModelRenderer renderer, PositionTextureVertex positionTextureVertex[], int[][] textUVs) { + public CSModelBox(RendererModel renderer, PositionTextureVertex positionTextureVertex[], int[][] textUVs) { this(renderer, positionTextureVertex, textUVs, renderer.mirror); } /** * Create a box from PositionTextureVertex and texture it with textUVs.
* See {@link #setVertex(PositionTextureVertex[]) setVertex()} and - * {@link #setTexture(ModelRenderer, int[][]) setTexture()} for orders. + * {@link #setTexture(RendererModel, int[][]) setTexture()} for orders. * - * @param renderer - * The (CS)ModelRenderer to which the box will be add. - * @param positionTextureVertex - * The 8 vertices used to create the box. - * @param textUVs - * The 6 pairs of points used to set the textures' UVs for each - * faces. - * @param mirror - * True if the texture should be mirrored, False if it shouldn't. + * @param renderer The (CS)RendererModel to which the box will be add. + * @param positionTextureVertex The 8 vertices used to create the box. + * @param textUVs The 6 pairs of points used to set the textures' UVs for each + * faces. + * @param mirror True if the texture should be mirrored, False if it shouldn't. */ - public CSModelBox(ModelRenderer renderer, PositionTextureVertex positionTextureVertex[], int[][] textUVs, boolean mirror) { + public CSModelBox(RendererModel renderer, PositionTextureVertex positionTextureVertex[], int[][] textUVs, boolean mirror) { this(positionTextureVertex); this.setTexture(renderer, textUVs); this.checkBlockForShadow(); @@ -128,8 +102,7 @@ public CSModelBox(ModelRenderer renderer, PositionTextureVertex positionTextureV * Create a box from PositionTextureVertex.
* See {@link #setVertex(PositionTextureVertex[]) setVertex()} for order. * - * @param positionTextureVertex - * The 8 vertices used to create the box. + * @param positionTextureVertex The 8 vertices used to create the box. */ public CSModelBox(PositionTextureVertex positionTextureVertex[]) { this(6); @@ -139,18 +112,77 @@ public CSModelBox(PositionTextureVertex positionTextureVertex[]) { /** * Just create a box with a list of {@link facesNumber} unset TexturedQuad. * - * @param facesNumber - * The number of faces the box will have. + * @param facesNumber The number of faces the box will have. */ public CSModelBox(int facesNumber) { this.quadList = new TexturedQuad[facesNumber]; } + /** + * Calculate the PositionTextureVertex from a rectangular box. + * + * @param x The X coordinate of the starting point of the box. + * @param y The Y coordinate of the starting point of the box. + * @param z The Z coordinate of the starting point of the box. + * @param dx The length of the box on the X axis. + * @param dy The length of the box on the Y axis. + * @param dz The length of the box on the Z axis. + * @param mirror True if the texture should be mirrored, False if it shouldn't. + * @return A 8 long array of PositionTextureVertex that can be used to + * create a rectangular box. + */ + public static PositionTextureVertex[] getVerticesForRect(float x, float y, float z, float dx, float dy, float dz, boolean mirror) { + PositionTextureVertex[] positionTextureVertex = new PositionTextureVertex[8]; + float endX = x + dx; + float endY = y + dy; + float endZ = z + dz; + + if (mirror) { + float buffer = endX; + endX = x; + x = buffer; + } + + positionTextureVertex[0] = new PositionTextureVertex(x, y, z, 0.0F, 0.0F); + positionTextureVertex[1] = new PositionTextureVertex(endX, y, z, 0.0F, 0.0F); + positionTextureVertex[2] = new PositionTextureVertex(endX, endY, z, 0.0F, 0.0F); + positionTextureVertex[3] = new PositionTextureVertex(x, endY, z, 0.0F, 0.0F); + positionTextureVertex[4] = new PositionTextureVertex(x, y, endZ, 0.0F, 0.0F); + positionTextureVertex[5] = new PositionTextureVertex(endX, y, endZ, 0.0F, 0.0F); + positionTextureVertex[6] = new PositionTextureVertex(endX, endY, endZ, 0.0F, 0.0F); + positionTextureVertex[7] = new PositionTextureVertex(x, endY, endZ, 0.0F, 0.0F); + + return positionTextureVertex; + } + + /** + * Calculate the textures' UVs for a rectangular box. + * + * @param texU The X coordinate of the texture. + * @param texV The Y coordinate of the texture. + * @param dx The length of the box on the X axis. + * @param dy The length of the box on the Y axis. + * @param dz The length of the box on the Z axis. + * @return A 6 long array of pairs of UV that can be used to texture a + * rectangular box. + */ + public static int[][] getTextureUVsForRect(int texU, int texV, float dx, float dy, float dz) { + dy = -dy; + dz = -dz; + int[][] tab = new int[][]{{(int) (texU + dz + dx + dz), (int) (texV + dz + dy), (int) (texU + dz + dx), (int) (texV + dz)}, + {(int) (texU + dz), (int) (texV + dz + dy), texU, (int) (texV + dz)}, + {(int) (texU + dz + dx), texV, (int) (texU + dz + dx + dx), (int) (texV + dz)}, + {(int) (texU + dz), texV, (int) (texU + dz + dx), (int) (texV + dz)}, + {(int) (texU + dz + dx + dz + dx), (int) (texV + dz + dy), (int) (texU + dz + dx + dz), (int) (texV + dz)}, + {(int) (texU + dz + dx), (int) (texV + dz + dy), (int) (texU + dz), (int) (texV + dz)}}; + return tab; + } + /** * Set the vertices of the box ! A - * {@link #setTexture(ModelRenderer, int[][]) setTexture()} is necessary + * {@link #setTexture(RendererModel, int[][]) setTexture()} is necessary * after that.
- * + *

* Order of the vertices:
* vertices[0] = (0, 0, 0) (bloc's origin)
* vertices[1] = (x, 0, 0)
@@ -161,23 +193,22 @@ public CSModelBox(int facesNumber) { * vertices[6] = (x, y, z) (bloc's end)
* vertices[7] = (0, y, z)
* - * @param positionTextureVertex - * The 8 vertices that will replace the old ones. + * @param positionTextureVertex The 8 vertices that will replace the old ones. */ public void setVertex(PositionTextureVertex positionTextureVertex[]) { if (positionTextureVertex.length == 8) { - this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[5], positionTextureVertex[1], - positionTextureVertex[2], positionTextureVertex[6] }); - this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[0], positionTextureVertex[4], - positionTextureVertex[7], positionTextureVertex[3] }); - this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[5], positionTextureVertex[4], - positionTextureVertex[0], positionTextureVertex[1] }); - this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[2], positionTextureVertex[3], - positionTextureVertex[7], positionTextureVertex[6] }); - this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[1], positionTextureVertex[0], - positionTextureVertex[3], positionTextureVertex[2] }); - this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[4], positionTextureVertex[5], - positionTextureVertex[6], positionTextureVertex[7] }); + this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[5], positionTextureVertex[1], + positionTextureVertex[2], positionTextureVertex[6]}); + this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[0], positionTextureVertex[4], + positionTextureVertex[7], positionTextureVertex[3]}); + this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[5], positionTextureVertex[4], + positionTextureVertex[0], positionTextureVertex[1]}); + this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[2], positionTextureVertex[3], + positionTextureVertex[7], positionTextureVertex[6]}); + this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[1], positionTextureVertex[0], + positionTextureVertex[3], positionTextureVertex[2]}); + this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{positionTextureVertex[4], positionTextureVertex[5], + positionTextureVertex[6], positionTextureVertex[7]}); } } @@ -185,9 +216,9 @@ public void setVertex(PositionTextureVertex positionTextureVertex[]) { * Check and correct the problem of dark texture. */ private void checkBlockForShadow() { - Vec3d or = this.quadList[1].vertexPositions[0].vector3D; - double x = this.quadList[0].vertexPositions[1].vector3D.x, y = this.quadList[1].vertexPositions[3].vector3D.y, - z = this.quadList[1].vertexPositions[1].vector3D.z; + Vec3d or = this.quadList[1].field_78239_a[0].vector3D; + double x = this.quadList[0].field_78239_a[1].vector3D.x, y = this.quadList[1].field_78239_a[3].vector3D.y, + z = this.quadList[1].field_78239_a[1].vector3D.z; if (x - or.x < 0) this.flipFaces(); if (y - or.y > 0) @@ -206,7 +237,7 @@ private void flipFaces() { /** * Set the textures' UVs for each faces.
- * + *

* Faces order:
* faces[0] = X1
* faces[1] = X0
@@ -220,102 +251,26 @@ private void flipFaces() { * coord[2] = U1 (x1)
* coord[3] = V1 (y1) (Bottom/Right)
* - * @param renderer - * The (CS)ModelRenderer to which the box will be add. - * @param textUVs - * The 6 pairs of points used to set the textures' UVs for each - * faces. + * @param renderer The (CS)RendererModel to which the box will be add. + * @param textUVs The 6 pairs of points used to set the textures' UVs for each + * faces. */ - public void setTexture(ModelRenderer renderer, int[][] textUVs) { + public void setTexture(RendererModel renderer, int[][] textUVs) { int[] textUV; if (textUVs.length == 6) for (int i = 0; i < 6; i++) { textUV = textUVs[i]; if (textUV.length == 4) - this.quadList[i] = new TexturedQuad(this.quadList[i].vertexPositions, textUV[0], textUV[1], textUV[2], textUV[3], + this.quadList[i] = new TexturedQuad(this.quadList[i].field_78239_a, textUV[0], textUV[1], textUV[2], textUV[3], renderer.textureWidth, renderer.textureHeight); } } - /** - * Calculate the PositionTextureVertex from a rectangular box. - * - * @param x - * The X coordinate of the starting point of the box. - * @param y - * The Y coordinate of the starting point of the box. - * @param z - * The Z coordinate of the starting point of the box. - * @param dx - * The length of the box on the X axis. - * @param dy - * The length of the box on the Y axis. - * @param dz - * The length of the box on the Z axis. - * @param mirror - * True if the texture should be mirrored, False if it shouldn't. - * @return A 8 long array of PositionTextureVertex that can be used to - * create a rectangular box. - */ - public static PositionTextureVertex[] getVerticesForRect(float x, float y, float z, float dx, float dy, float dz, boolean mirror) { - PositionTextureVertex[] positionTextureVertex = new PositionTextureVertex[8]; - float endX = x + dx; - float endY = y + dy; - float endZ = z + dz; - - if (mirror) { - float buffer = endX; - endX = x; - x = buffer; - } - - positionTextureVertex[0] = new PositionTextureVertex(x, y, z, 0.0F, 0.0F); - positionTextureVertex[1] = new PositionTextureVertex(endX, y, z, 0.0F, 0.0F); - positionTextureVertex[2] = new PositionTextureVertex(endX, endY, z, 0.0F, 0.0F); - positionTextureVertex[3] = new PositionTextureVertex(x, endY, z, 0.0F, 0.0F); - positionTextureVertex[4] = new PositionTextureVertex(x, y, endZ, 0.0F, 0.0F); - positionTextureVertex[5] = new PositionTextureVertex(endX, y, endZ, 0.0F, 0.0F); - positionTextureVertex[6] = new PositionTextureVertex(endX, endY, endZ, 0.0F, 0.0F); - positionTextureVertex[7] = new PositionTextureVertex(x, endY, endZ, 0.0F, 0.0F); - - return positionTextureVertex; - } - - /** - * Calculate the textures' UVs for a rectangular box. - * - * @param texU - * The X coordinate of the texture. - * @param texV - * The Y coordinate of the texture. - * @param dx - * The length of the box on the X axis. - * @param dy - * The length of the box on the Y axis. - * @param dz - * The length of the box on the Z axis. - * @return A 6 long array of pairs of UV that can be used to texture a - * rectangular box. - */ - public static int[][] getTextureUVsForRect(int texU, int texV, float dx, float dy, float dz) { - dy = -dy; - dz = -dz; - int[][] tab = new int[][] { { (int) (texU + dz + dx + dz), (int) (texV + dz + dy), (int) (texU + dz + dx), (int) (texV + dz) }, - { (int) (texU + dz), (int) (texV + dz + dy), texU, (int) (texV + dz) }, - { (int) (texU + dz + dx), texV, (int) (texU + dz + dx + dx), (int) (texV + dz) }, - { (int) (texU + dz), texV, (int) (texU + dz + dx), (int) (texV + dz) }, - { (int) (texU + dz + dx + dz + dx), (int) (texV + dz + dy), (int) (texU + dz + dx + dz), (int) (texV + dz) }, - { (int) (texU + dz + dx), (int) (texV + dz + dy), (int) (texU + dz), (int) (texV + dz) } }; - return tab; - } - /** * Function used to prepare the rendering of the bloc. * - * @param renderer - * VertexBuffer from the Tesselator. - * @param scale - * Scale factor. + * @param renderer VertexBuffer from the Tesselator. + * @param scale Scale factor. */ public void render(BufferBuilder renderer, float scale) { for (TexturedQuad texturedquad : this.quadList) @@ -325,8 +280,7 @@ public void render(BufferBuilder renderer, float scale) { /** * Set the box name. * - * @param name - * The name given to the box. + * @param name The name given to the box. * @return The CSModelBox. */ public CSModelBox setBoxName(String name) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelRenderer.java b/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelRenderer.java index 17546a0..3071489 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelRenderer.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelRenderer.java @@ -1,136 +1,138 @@ package com.leviathanstudio.craftstudio.client.model; -import java.nio.FloatBuffer; -import java.util.ArrayList; -import java.util.List; - -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import javax.vecmath.Vector3f; - -import org.lwjgl.opengl.GL11; - import com.leviathanstudio.craftstudio.client.util.MathHelper; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.PositionTextureVertex; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.entity.model.RendererModel; +import net.minecraft.client.renderer.model.Model; +import net.minecraft.client.renderer.model.PositionTextureVertex; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import org.lwjgl.opengl.GL11; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; +import javax.vecmath.Vector3f; +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.List; /** * Class used to render CSModelBoxs. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSModelRenderer extends ModelRenderer -{ - /** Custom version, as parent variable is PRIVATE */ - private int textureOffsetX; - - /** Custom version, as parent variable is PRIVATE */ - private int textureOffsetY; - - /** Custom version, as parent variable is PRIVATE */ - private boolean compiled; +@OnlyIn(Dist.CLIENT) +public class CSModelRenderer extends RendererModel { + private final Matrix4f rotationMatrix = new Matrix4f(); + public List cubeCSList = new ArrayList<>(); + /** + * Custom version, as parent variable is PRIVATE + */ + private int textureOffsetX; + /** + * Custom version, as parent variable is PRIVATE + */ + private int textureOffsetY; + /** + * Custom version, as parent variable is PRIVATE + */ + private boolean compiled; + /** + * Custom version, as parent variable is PRIVATE + */ + private int displayList; + /** + * Previous value of the matrix + */ + private Matrix4f prevRotationMatrix = new Matrix4f(); - /** Custom version, as parent variable is PRIVATE */ - private int displayList; + private Vector3f stretch = new Vector3f(1, 1, 1); - public List cubeCSList = new ArrayList<>(); + /** + * Default informations for un-animated models + */ + private float defaultRotationPointX; + private float defaultRotationPointY; + private float defaultRotationPointZ; + private Matrix4f defaultRotationMatrix = new Matrix4f(); + private Quat4f defaultRotationAsQuaternion; + private float defaultOffsetX = 0; + private float defaultOffsetY = 0; + private float defaultOffsetZ = 0; + private Vector3f defaultStretch = new Vector3f(1, 1, 1); + + public CSModelRenderer(Model modelbase, String partName, int xTextureOffset, int yTextureOffset) { + super(modelbase, partName); + this.setTextureSize(modelbase.textureWidth, modelbase.textureHeight); + this.setTextureOffset(xTextureOffset, yTextureOffset); + } - private final Matrix4f rotationMatrix = new Matrix4f(); - /** Previous value of the matrix */ - private Matrix4f prevRotationMatrix = new Matrix4f(); + private static CSModelRenderer getRendererModelFromNameAndBlock(String name, CSModelRenderer block) { + CSModelRenderer childModel, result; - private Vector3f stretch = new Vector3f(1, 1, 1); + if (block.boxName.equals(name)) + return block; - /** Default informations for un-animated models */ - private float defaultRotationPointX; - private float defaultRotationPointY; - private float defaultRotationPointZ; - private Matrix4f defaultRotationMatrix = new Matrix4f(); - private Quat4f defaultRotationAsQuaternion; - private float defaultOffsetX = 0; - private float defaultOffsetY = 0; - private float defaultOffsetZ = 0; - private Vector3f defaultStretch = new Vector3f(1, 1, 1); + for (RendererModel child : block.childModels) + if (child instanceof CSModelRenderer) { + childModel = (CSModelRenderer) child; + result = getRendererModelFromNameAndBlock(name, childModel); + if (result != null) + return result; + } - public CSModelRenderer(ModelBase modelbase, String partName, int xTextureOffset, int yTextureOffset) { - super(modelbase, partName); - this.setTextureSize(modelbase.textureWidth, modelbase.textureHeight); - this.setTextureOffset(xTextureOffset, yTextureOffset); + return null; } @Override - public ModelRenderer setTextureOffset(int x, int y) { + public RendererModel setTextureOffset(int x, int y) { this.textureOffsetX = x; this.textureOffsetY = y; this.cubeList.size(); return this; } - public ModelRenderer addBox(String name, CSModelBox modelBox) { + public RendererModel addBox(String name, CSModelBox modelBox) { name = this.boxName + "." + name; this.cubeCSList.add(modelBox.setBoxName(name)); return this; } - public ModelRenderer addBox(String name, float par2, float par3, float par4, float par5, float par6, float par7) { + public RendererModel addBox(String name, float par2, float par3, float par4, float par5, float par6, float par7) { name = this.boxName + "." + name; this.cubeCSList.add(new CSModelBox(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7).setBoxName(name)); return this; } - public ModelRenderer addBox(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ) { + public RendererModel addBox(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ) { this.cubeCSList.add(new CSModelBox(this, this.textureOffsetX, this.textureOffsetY, posX, posY, posZ, sizeX, sizeY, sizeZ)); return this; } - public ModelRenderer addBox(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ, boolean mirror) { + public RendererModel addBox(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ, boolean mirror) { this.cubeCSList.add(new CSModelBox(this, this.textureOffsetX, this.textureOffsetY, posX, posY, posZ, sizeX, sizeY, sizeZ, mirror)); return this; } - public ModelRenderer addBox(PositionTextureVertex positionTextureVertex[], int[][] textUVs) { + public RendererModel addBox(PositionTextureVertex positionTextureVertex[], int[][] textUVs) { this.cubeCSList.add(new CSModelBox(this, positionTextureVertex, textUVs)); return this; } - public ModelRenderer addBox(PositionTextureVertex positionTextureVertex[], int[][] textUVs, boolean mirror) { + public RendererModel addBox(PositionTextureVertex positionTextureVertex[], int[][] textUVs, boolean mirror) { this.cubeCSList.add(new CSModelBox(this, positionTextureVertex, textUVs, mirror)); return this; } - public ModelRenderer addBox(CSModelBox model) { + public RendererModel addBox(CSModelBox model) { this.cubeCSList.add(model); return this; } - private static CSModelRenderer getModelRendererFromNameAndBlock(String name, CSModelRenderer block) { - CSModelRenderer childModel, result; - - if (block.boxName.equals(name)) - return block; - - for (ModelRenderer child : block.childModels) - if (child instanceof CSModelRenderer) { - childModel = (CSModelRenderer) child; - result = getModelRendererFromNameAndBlock(name, childModel); - if (result != null) - return result; - } - - return null; - } - /** * Render model parts */ @@ -143,13 +145,13 @@ public void render(float scale) { GlStateManager.pushMatrix(); - GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GlStateManager.translated(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); FloatBuffer buf = MathHelper.makeFloatBuffer(this.rotationMatrix); GlStateManager.multMatrix(buf); - GlStateManager.translate(this.offsetX * scale, this.offsetY * scale, this.offsetZ * scale); + GlStateManager.translated(this.offsetX * scale, this.offsetY * scale, this.offsetZ * scale); GlStateManager.pushMatrix(); - GlStateManager.scale(this.stretch.x, this.stretch.y, this.stretch.z); + GlStateManager.scaled(this.stretch.x, this.stretch.y, this.stretch.z); GlStateManager.callList(this.displayList); GlStateManager.popMatrix(); @@ -167,10 +169,12 @@ public void render(float scale) { * Allows the changing of Angles after a box has been rendered */ @Override - public void postRender(float scale) {} + public void postRender(float scale) { + } @Override - public void renderWithRotation(float scale) {} + public void renderWithRotation(float scale) { + } /** * Set default rotation point (model with no animations) and set the current @@ -195,7 +199,9 @@ public float getDefaultRotationPointZ() { return this.defaultRotationPointZ; } - /** Set the rotation point */ + /** + * Set the rotation point + */ @Override public void setRotationPoint(float x, float y, float z) { this.rotationPointX = x; @@ -203,7 +209,9 @@ public void setRotationPoint(float x, float y, float z) { this.rotationPointZ = z; } - /** Reset the rotation point to the default values. */ + /** + * Reset the rotation point to the default values. + */ public void resetRotationPoint() { this.rotationPointX = this.defaultRotationPointX; this.rotationPointY = this.defaultRotationPointY; @@ -279,7 +287,20 @@ public void setInitialRotationMatrix(float x, float y, float z) { this.setInitialRotationMatrix(mat); } - /** Set the rotation matrix values based on the given matrix. */ + /** + * Reset the rotation matrix to the default one. + */ + public void resetRotationMatrix() { + this.setRotationMatrix(this.defaultRotationMatrix); + } + + public Matrix4f getRotationMatrix() { + return this.rotationMatrix; + } + + /** + * Set the rotation matrix values based on the given matrix. + */ public void setRotationMatrix(Matrix4f matrix) { this.rotationMatrix.m00 = matrix.m00; this.rotationMatrix.m01 = matrix.m01; @@ -299,15 +320,6 @@ public void setRotationMatrix(Matrix4f matrix) { this.rotationMatrix.m33 = matrix.m33; } - /** Reset the rotation matrix to the default one. */ - public void resetRotationMatrix() { - this.setRotationMatrix(this.defaultRotationMatrix); - } - - public Matrix4f getRotationMatrix() { - return this.rotationMatrix; - } - public Quat4f getDefaultRotationAsQuaternion() { return new Quat4f(this.defaultRotationAsQuaternion); } @@ -317,17 +329,19 @@ public Quat4f getDefaultRotationAsQuaternion() { */ public void compileDisplayList(float scale) { this.displayList = GLAllocation.generateDisplayLists(1); - GlStateManager.glNewList(this.displayList, GL11.GL_COMPILE); + GlStateManager.newList(this.displayList, GL11.GL_COMPILE); BufferBuilder vertexbuffer = Tessellator.getInstance().getBuffer(); for (int i = 0; i < this.cubeCSList.size(); ++i) this.cubeCSList.get(i).render(vertexbuffer, scale); - GlStateManager.glEndList(); + GlStateManager.endList(); this.compiled = true; } - /** Getter */ + /** + * Getter + */ public List getCubeCSList() { return this.cubeCSList; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java index 2f47995..9874e87 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java @@ -1,62 +1,53 @@ package com.leviathanstudio.craftstudio.client.model; -import java.util.ArrayList; -import java.util.List; - import com.leviathanstudio.craftstudio.client.animation.ClientAnimationHandler; import com.leviathanstudio.craftstudio.client.exception.CSResourceNotRegisteredException; import com.leviathanstudio.craftstudio.client.json.CSReadedModel; import com.leviathanstudio.craftstudio.client.json.CSReadedModelBlock; import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.PositionTextureVertex; +import net.minecraft.client.renderer.entity.model.EntityModel; +import net.minecraft.client.renderer.entity.model.RendererModel; +import net.minecraft.client.renderer.model.PositionTextureVertex; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.ArrayList; +import java.util.List; /** * Model to represent a CraftStudio model in Minecraft. - * - * @since 0.3.0 - * + * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class ModelCraftStudio extends ModelBase -{ +@OnlyIn(Dist.CLIENT) +public class ModelCraftStudio extends EntityModel { + private List parentBlocks = new ArrayList<>(); /** - * @param modid - * The ID of your mod - * @param modelNameIn - * The name of your craftstudio model your have registered with - * {@link com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper#register - * CraftStudioRegistry#register} - * @param textureSize - * The size of your texture if it's the same width/height + * @param modid The ID of your mod + * @param modelNameIn The name of your craftstudio model your have registered with + * {@link com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper#register + * CraftStudioRegistry#register} + * @param textureSize The size of your texture if it's the same width/height */ public ModelCraftStudio(String modid, String modelNameIn, int textureSize) { this(modid, modelNameIn, textureSize, textureSize); } /** - * @param modid - * The ID of your mod - * @param modelNameIn - * The name of your craftstudio model your have registered with - * {@link com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper#register - * CraftStudioRegistry#register} - * @param textureWidth - * The width texture of your model - * @param textureHeight - * The height texture of your model + * @param modid The ID of your mod + * @param modelNameIn The name of your craftstudio model your have registered with + * {@link com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper#register + * CraftStudioRegistry#register} + * @param textureWidth The width texture of your model + * @param textureHeight The height texture of your model */ public ModelCraftStudio(String modid, String modelNameIn, int textureWidth, int textureHeight) { this(new ResourceLocation(modid, modelNameIn), textureWidth, textureHeight); @@ -67,7 +58,8 @@ private ModelCraftStudio(ResourceLocation modelIn, int textureWidth, int texture this.textureWidth = textureWidth; this.textureHeight = textureHeight; - CSReadedModel rModel = RegistryHandler.modelRegistry.getObject(modelIn); + //TODO Check ifPresent() + CSReadedModel rModel = RegistryHandler.modelRegistry.getValue(modelIn).get(); if (rModel == null) throw new CSResourceNotRegisteredException(modelIn.toString()); CSModelRenderer modelRend; @@ -79,7 +71,29 @@ private ModelCraftStudio(ResourceLocation modelIn, int textureWidth, int texture } } - /** Generate childs part of a model */ + /** + * Return CSModelRenderer by his name and parts + */ + public static CSModelRenderer getModelRendererFromNameAndBlock(String name, CSModelRenderer block) { + CSModelRenderer childModel, result; + + if (block.boxName.equals(name)) + return block; + + for (RendererModel child : block.childModels) + if (child instanceof CSModelRenderer) { + childModel = (CSModelRenderer) child; + result = getModelRendererFromNameAndBlock(name, childModel); + if (result != null) + return result; + } + + return null; + } + + /** + * Generate childs part of a model + */ private void generateChild(CSReadedModelBlock rParent, CSModelRenderer parent) { CSModelRenderer modelRend; for (CSReadedModelBlock rBlock : rParent.getChilds()) { @@ -89,7 +103,9 @@ private void generateChild(CSReadedModelBlock rParent, CSModelRenderer parent) { } } - /** Generate CSModelRenderer from readed model block */ + /** + * Generate CSModelRenderer from readed model block + */ private CSModelRenderer generateCSModelRend(CSReadedModelBlock rBlock) { CSModelRenderer modelRend = new CSModelRenderer(this, rBlock.getName(), rBlock.getTexOffset()[0], rBlock.getTexOffset()[1]); if (rBlock.getVertex() != null) { @@ -98,8 +114,7 @@ private CSModelRenderer generateCSModelRend(CSReadedModelBlock rBlock) { vertices[i] = new PositionTextureVertex(rBlock.getVertex()[i][0], rBlock.getVertex()[i][1], rBlock.getVertex()[i][2], 0.0F, 0.0F); modelRend.addBox(vertices, CSModelBox.getTextureUVsForRect(rBlock.getTexOffset()[0], rBlock.getTexOffset()[1], rBlock.getSize().x, rBlock.getSize().y, rBlock.getSize().z)); - } - else + } else modelRend.addBox(-rBlock.getSize().x / 2, -rBlock.getSize().y / 2, -rBlock.getSize().z / 2, rBlock.getSize().x, rBlock.getSize().y, rBlock.getSize().z); modelRend.setDefaultRotationPoint(rBlock.getRotationPoint().x, rBlock.getRotationPoint().y, rBlock.getRotationPoint().z); @@ -113,11 +128,10 @@ private CSModelRenderer generateCSModelRend(CSReadedModelBlock rBlock) { /** * Render function for an animated block
* Must be called in a - * {@link net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer#renderTileEntityAt + * {@link net.minecraft.client.renderer.tileentity.TileEntityRenderer#render * renderTileEntityAt} method * - * @param tileEntityIn - * The TileEntity who implements {@link IAnimated} + * @param tileEntityIn The TileEntity who implements {@link IAnimated} */ public void render(TileEntity tileEntityIn) { float modelScale = 0.0625F; @@ -129,7 +143,7 @@ public void render(TileEntity tileEntityIn) { /** * Render function for a non-animated block
* Must be called in a - * {@link net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer#renderTileEntityAt + * {@link net.minecraft.client.renderer.tileentity.TileEntityRenderer#render * renderTileEntityAt} method */ public void render() { @@ -138,7 +152,10 @@ public void render() { this.parentBlocks.get(i).render(modelScale); } - /** Render methods for an Entity */ + + /** + * Render methods for an Entity + */ @Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); @@ -147,25 +164,9 @@ public void render(Entity entityIn, float limbSwing, float limbSwingAmount, floa this.parentBlocks.get(i).render(scale); } - /** Return CSModelRenderer by his name and parts */ - public static CSModelRenderer getModelRendererFromNameAndBlock(String name, CSModelRenderer block) { - CSModelRenderer childModel, result; - - if (block.boxName.equals(name)) - return block; - - for (ModelRenderer child : block.childModels) - if (child instanceof CSModelRenderer) { - childModel = (CSModelRenderer) child; - result = getModelRendererFromNameAndBlock(name, childModel); - if (result != null) - return result; - } - - return null; - } - - /** Return CSModelRenderer by his name */ + /** + * Return CSModelRenderer by his name + */ public CSModelRenderer getModelRendererFromName(String name) { CSModelRenderer result; for (CSModelRenderer parent : this.parentBlocks) { @@ -176,7 +177,9 @@ public CSModelRenderer getModelRendererFromName(String name) { return null; } - /** Getter */ + /** + * Getter + */ public List getParentBlocks() { return this.parentBlocks; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java index 9377eec..1c68469 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java @@ -1,41 +1,35 @@ package com.leviathanstudio.craftstudio.client.registry; -import java.util.ArrayList; -import java.util.List; - import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.client.exception.CSMalformedJsonException; import com.leviathanstudio.craftstudio.client.exception.CSResourceNotFoundException; import com.leviathanstudio.craftstudio.client.json.CSJsonReader; import com.leviathanstudio.craftstudio.client.util.EnumRenderType; import com.leviathanstudio.craftstudio.client.util.EnumResourceType; - import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.ProgressManager; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.ArrayList; +import java.util.List; /** * Class containing useful methods to register models and animations. - * - * @since 0.3.0 - * + * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class CSRegistryHelper -{ - private String modid; - +@OnlyIn(Dist.CLIENT) +public class CSRegistryHelper { private static List loadModelList = new ArrayList(); - private static List loadAnimList = new ArrayList(); + private static List loadAnimList = new ArrayList(); + private String modid; /** * Constructor for the registry * - * @param modid - * Define the ID of your mod + * @param modid Define the ID of your mod */ public CSRegistryHelper(String modid) { this.modid = modid; @@ -44,40 +38,12 @@ public CSRegistryHelper(String modid) { /** * Pre-register your resource. * - * @param resourceTypeIn - * Set your resource type,
- * {@link EnumResourceType#ANIM} for animation,
- * {@link EnumResourceType#MODELS} for models
- *
- * @param renderTypeIn - * Set your render type,
- * {@link EnumRenderType#BLOCK} for a block
- * {@link EnumRenderType#ENTITY} for an entity
- *
- * - * @param resourceNameIn - * The name of your resource in assets without extension - */ - public void register(EnumResourceType resourceTypeIn, EnumRenderType renderTypeIn, String resourceNameIn) { - capitalCheck(resourceNameIn); - CSRegistryHelper.register(resourceTypeIn, - new ResourceLocation(modid, resourceTypeIn.getPath() + renderTypeIn.getFolderName() + resourceNameIn + resourceTypeIn.getExtension()), - resourceNameIn); - } - - /** - * Pre-register your resource. - * - * @param resourceTypeIn - * Set your resource type,
- * {@link EnumResourceType#ANIM} for animation,
- * {@link EnumResourceType#MODELS} for models
- *
- * @param resourceLocationIn - * Custom location of your resource - * - * @param resourceNameIn - * The name of your resource in assets without extension + * @param resourceTypeIn Set your resource type,
+ * {@link EnumResourceType#ANIM} for animation,
+ * {@link EnumResourceType#MODELS} for models
+ *
+ * @param resourceLocationIn Custom location of your resource + * @param resourceNameIn The name of your resource in assets without extension */ public static void register(EnumResourceType resourceTypeIn, ResourceLocation resourceLocationIn, String resourceNameIn) { switch (resourceTypeIn) { @@ -101,17 +67,18 @@ public static void register(EnumResourceType resourceTypeIn, ResourceLocation re /** * Load all the pre-registered models. Used internally. */ + //TODO Rework on progress bar public static void loadModels() { if (loadModelList == null) return; - ProgressManager.ProgressBar progressBarModels; - progressBarModels = ProgressManager.push("Registry Models", CSRegistryHelper.loadModelList.size()); + //ProgressManager.ProgressBar progressBarModels; + //progressBarModels = ProgressManager.push("Registry Models", CSRegistryHelper.loadModelList.size()); for (LoadElement el : CSRegistryHelper.loadModelList) { - progressBarModels.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); + //progressBarModels.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); registry(EnumResourceType.MODEL, el.resourceLoc, el.ressourceName); } - ProgressManager.pop(progressBarModels); + //ProgressManager.pop(progressBarModels); CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s models", CSRegistryHelper.loadModelList.size())); CSRegistryHelper.loadModelList = null; @@ -120,16 +87,17 @@ public static void loadModels() { /** * Load all the pre-registered animations. Used internally. */ + //TODO Rework on progress bar public static void loadAnims() { if (loadAnimList == null) return; - ProgressManager.ProgressBar progressBarAnim; - progressBarAnim = ProgressManager.push("Registry Animations", CSRegistryHelper.loadAnimList.size()); + //ProgressManager.ProgressBar progressBarAnim; + //progressBarAnim = ProgressManager.push("Registry Animations", CSRegistryHelper.loadAnimList.size()); for (LoadElement el : CSRegistryHelper.loadAnimList) { - progressBarAnim.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); + // progressBarAnim.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); registry(EnumResourceType.ANIM, el.resourceLoc, el.ressourceName); } - ProgressManager.pop(progressBarAnim); + //ProgressManager.pop(progressBarAnim); CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s animations", CSRegistryHelper.loadAnimList.size())); CSRegistryHelper.loadAnimList = null; @@ -137,26 +105,23 @@ public static void loadAnims() { /** * Register an assets. - * - * @param resourceTypeIn - * The resource type. - * @param resourceLocationIn - * Location of the resource. - * @param resourceNameIn - * The name of your resource. + * + * @param resourceTypeIn The resource type. + * @param resourceLocationIn Location of the resource. + * @param resourceNameIn The name of your resource. */ private static void registry(EnumResourceType resourceTypeIn, ResourceLocation resourceLocationIn, String resourceNameIn) { CSJsonReader jsonReader; try { jsonReader = new CSJsonReader(resourceLocationIn); - if (resourceLocationIn.getResourceDomain() != CraftStudioApi.API_ID) + if (resourceLocationIn.getNamespace() != CraftStudioApi.API_ID) switch (resourceTypeIn) { case MODEL: - RegistryHandler.register(new ResourceLocation(resourceLocationIn.getResourceDomain(), resourceNameIn), + RegistryHandler.register(new ResourceLocation(resourceLocationIn.getNamespace(), resourceNameIn), jsonReader.readModel()); break; case ANIM: - RegistryHandler.register(new ResourceLocation(resourceLocationIn.getResourceDomain(), resourceNameIn), jsonReader.readAnim()); + RegistryHandler.register(new ResourceLocation(resourceLocationIn.getNamespace(), resourceNameIn), jsonReader.readAnim()); break; } else @@ -168,9 +133,8 @@ private static void registry(EnumResourceType resourceTypeIn, ResourceLocation r /** * Check if there is capital letter in a String, and send a warning message. - * - * @param str - * The String to test. + * + * @param str The String to test. */ private static void capitalCheck(String str) { if (!str.toLowerCase().equals(str)) { @@ -179,16 +143,35 @@ private static void capitalCheck(String str) { } } + /** + * Pre-register your resource. + * + * @param resourceTypeIn Set your resource type,
+ * {@link EnumResourceType#ANIM} for animation,
+ * {@link EnumResourceType#MODEL} for models
+ *
+ * @param renderTypeIn Set your render type,
+ * {@link EnumRenderType#BLOCK} for a block
+ * {@link EnumRenderType#ENTITY} for an entity
+ *
+ * @param resourceNameIn The name of your resource in assets without extension + */ + public void register(EnumResourceType resourceTypeIn, EnumRenderType renderTypeIn, String resourceNameIn) { + capitalCheck(resourceNameIn); + CSRegistryHelper.register(resourceTypeIn, + new ResourceLocation(modid, resourceTypeIn.getPath() + renderTypeIn.getFolderName() + resourceNameIn + resourceTypeIn.getExtension()), + resourceNameIn); + } + /** * An object containing informations about a pre-registered object to load * later. - * + * * @author Timmypote */ - private static class LoadElement - { + private static class LoadElement { ResourceLocation resourceLoc; - String ressourceName; + String ressourceName; LoadElement(ResourceLocation resourceLoc, String ressourceName) { this.resourceLoc = resourceLoc; diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java index 2dafd88..a787bac 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java @@ -1,24 +1,24 @@ package com.leviathanstudio.craftstudio.client.registry; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * Annotation to indicate that the method it is applied on should be called * during the loading of CraftStudio assets. Must be applied on a 'static' * method with no arguments. - * - * @since 1.0.0 - * + * * @author Timmypote + * @since 1.0.0 */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) @Retention(RUNTIME) @Target(METHOD) -public @interface CraftStudioLoader {} +public @interface CraftStudioLoader { +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java index ea4cc44..9ebbf9a 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java @@ -2,54 +2,47 @@ import com.leviathanstudio.craftstudio.client.json.CSReadedAnim; import com.leviathanstudio.craftstudio.client.json.CSReadedModel; - import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.RegistrySimple; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.util.registry.SimpleRegistry; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Class that handle registry for the CraftStudioApi. - * - * @since 1.0.0 - * + * * @author Timmypote + * @since 1.0.0 */ -@SideOnly(Side.CLIENT) -public class RegistryHandler -{ - public static RegistrySimple modelRegistry; - public static RegistrySimple animationRegistry; +@OnlyIn(Dist.CLIENT) +public class RegistryHandler { + public static SimpleRegistry modelRegistry; + public static SimpleRegistry animationRegistry; /** * Initialize the registries. */ public static void init() { - modelRegistry = new RegistrySimple<>(); - animationRegistry = new RegistrySimple<>(); + modelRegistry = new SimpleRegistry<>(); + animationRegistry = new SimpleRegistry<>(); } /** * Register a CSReadedModel. - * - * @param res - * The name of the model. - * @param model - * The model. + * + * @param res The name of the model. + * @param model The model. */ public static void register(ResourceLocation res, CSReadedModel model) { - modelRegistry.putObject(res, model); + modelRegistry.register(res, model); } /** * Register a CSReadedAnim. - * - * @param res - * The name of the animation. - * @param anim - * The animation. + * + * @param res The name of the animation. + * @param anim The animation. */ public static void register(ResourceLocation res, CSReadedAnim anim) { - animationRegistry.putObject(res, anim); + animationRegistry.register(res, anim); } } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumFrameType.java b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumFrameType.java index 1344579..27dd960 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumFrameType.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumFrameType.java @@ -1,17 +1,16 @@ package com.leviathanstudio.craftstudio.client.util; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Enumeration of the different type of keyframe field type. - * - * @since 0.3.0 * * @author ZeAmateis * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public enum EnumFrameType { POSITION, ROTATION, OFFSET, SIZE, STRETCH; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumRenderType.java b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumRenderType.java index 17eb2aa..9822a61 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumRenderType.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumRenderType.java @@ -1,17 +1,16 @@ package com.leviathanstudio.craftstudio.client.util; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Enumeration of the different render type. - * - * @since 0.3.0 * * @author ZeAmateis * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public enum EnumRenderType { BLOCK("blocks/"), ENTITY("entity/"); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumResourceType.java b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumResourceType.java index fb5db87..646fc62 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumResourceType.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/util/EnumResourceType.java @@ -1,17 +1,16 @@ package com.leviathanstudio.craftstudio.client.util; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Enumeration of the different resource type. - * - * @since 0.3.0 * * @author ZeAmateis * @author Phenix246 + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public enum EnumResourceType { MODEL("craftstudio/models/", ".csjsmodel"), ANIM("craftstudio/animations/", ".csjsmodelanim"); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/util/MathHelper.java b/src/main/java/com/leviathanstudio/craftstudio/client/util/MathHelper.java index c231e61..244fed1 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/util/MathHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/util/MathHelper.java @@ -1,31 +1,27 @@ package com.leviathanstudio.craftstudio.client.util; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.vecmath.Matrix4f; import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; /** * Class containing useful math methods for the api. - * - * @since 0.3.0 * * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.CLIENT) -public class MathHelper -{ +@OnlyIn(Dist.CLIENT) +public class MathHelper { /** * Create a direct FloatBuffer from a Matrix4f. * - * @param mat - * The Matrix4f. + * @param mat The Matrix4f. * @return The FloatBuffer. */ public static FloatBuffer makeFloatBuffer(Matrix4f mat) { @@ -56,8 +52,7 @@ public static FloatBuffer makeFloatBuffer(Matrix4f mat) { * Create a new Quat4f representing the yaw, pitch and roll given(applied in * that order). * - * @param rot - * The pitch, yaw and roll as a Vector3f(x=pitch, y=yaw, z=roll). + * @param rot The pitch, yaw and roll as a Vector3f(x=pitch, y=yaw, z=roll). * @return The new Quat4f. */ public static Quat4f quatFromEuler(Vector3f rot) { @@ -68,12 +63,9 @@ public static Quat4f quatFromEuler(Vector3f rot) { * Create a new Quat4f representing the yaw, pitch and roll given(applied in * that order). * - * @param pitch - * The pitch. - * @param yaw - * The yaw. - * @param roll - * The roll. + * @param pitch The pitch. + * @param yaw The yaw. + * @param roll The roll. * @return The new Quat4f. */ public static Quat4f quatFromEuler(float pitch, float yaw, float roll) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/CustomChannel.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/CustomChannel.java index 54af4ef..e350722 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/CustomChannel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/CustomChannel.java @@ -1,9 +1,8 @@ package com.leviathanstudio.craftstudio.common.animation; import com.leviathanstudio.craftstudio.client.model.CSModelRenderer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Class used to perform custom animations. For example, using in game data. @@ -29,6 +28,6 @@ public CustomChannel(String channelName) { * @param animated * The animated object. */ - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public abstract void update(CSModelRenderer part, IAnimated animated); } diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/IAnimated.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/IAnimated.java index f3d5e88..19bc88e 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/IAnimated.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/IAnimated.java @@ -1,60 +1,58 @@ package com.leviathanstudio.craftstudio.common.animation; +import net.minecraft.world.dimension.DimensionType; + /** * Implement object that must be animated with the api. * - * @since 0.3.0 - * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -public interface IAnimated -{ +public interface IAnimated { /** * Getter to call custom {@link AnimationHandler} class to call useful * methods. * + * @param The animated object class'. * @see AnimationHandler#addAnim addAnim() * @see AnimationHandler#startAnimation startAnimation() * @see AnimationHandler#stopAnimation stopAnimation() * @see AnimationHandler#isAnimationActive isAnimationActive() - * - * @param - * The animated object class'. */ public AnimationHandler getAnimationHandler(); /** * Getter for the dimension. - * + * * @return The dimension of the object as a int. */ - public int getDimension(); + public DimensionType getDimension(); /** * Getter for the x coordinate. - * + * * @return The position on the x axis of the object. */ public double getX(); /** * Getter for the y coordinate. - * + * * @return The position on the y axis of the object. */ public double getY(); /** * Getter for the z coordinate. - * + * * @return The position on the z axis of the object. */ public double getZ(); /** * Check if the world of this object is remote or not. - * + * * @return True, if the world is remote. False, otherwise. */ public boolean isWorldRemote(); diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedEntity.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedEntity.java index 76daa3d..e7a9510 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedEntity.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedEntity.java @@ -3,21 +3,22 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - -import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.CreatureEntity; +import net.minecraft.entity.EntityType; import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; /** * An abstract class that represent an animated entity. You can extends it or * use it as a model to create your own animated entity. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -public abstract class AnimatedEntity extends EntityCreature implements IAnimated -{ - /** The animation handler of this type of entity. */ +public abstract class AnimatedEntity extends CreatureEntity implements IAnimated { + /** + * The animation handler of this type of entity. + */ // It should be different for every entity class, unless child classes have // the same models. // You should declare a new one in your extended classes. @@ -28,16 +29,23 @@ public abstract class AnimatedEntity extends EntityCreature implements IAnimated //AnimatedEntity.animHandler.addAnim("yourModId", "yourAnimation", "yourModel", false); } - /** The constructor of the entity. */ - public AnimatedEntity(World worldIn) { - super(worldIn); + /** + * The constructor of the entity. + */ + public AnimatedEntity(EntityType entityTypeIn, World worldIn) { + super(entityTypeIn, worldIn); } // You must call super.onLivingUpdate(), in your entity, or call the // animationsUpdate() method like here. + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ @Override - public void onLivingUpdate() { - super.onLivingUpdate(); + public void livingTick() { + super.livingTick(); this.getAnimationHandler().animationsUpdate(this); } @@ -48,7 +56,7 @@ public AnimationHandler getAnimationHandler() { } @Override - public int getDimension() { + public DimensionType getDimension() { return this.dimension; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedTileEntity.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedTileEntity.java index 46b13a5..63e762f 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedTileEntity.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/AnimatedTileEntity.java @@ -3,22 +3,23 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - +import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ITickable; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.world.dimension.DimensionType; /** * An abstract class that represent a animated TileEntity. You should extends it * and not create your own, or be careful to implement all the methods of this * class. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -public abstract class AnimatedTileEntity extends TileEntity implements IAnimated, ITickable -{ - /** The animation handler of this type of tile entity. */ +public abstract class AnimatedTileEntity extends TileEntity implements IAnimated, ITickableTileEntity { + /** + * The animation handler of this type of tile entity. + */ // It should be different for every entity class, unless child classes have // the same models. // You should declare a new one in your extended classes. @@ -29,15 +30,19 @@ public abstract class AnimatedTileEntity extends TileEntity implements IAnimated //AnimatedTileEntity.animHandler.addAnim("yourModId", "yourAnimation", "yourModel", false); } - /** The constructor of the tile entity. */ - public AnimatedTileEntity() { - super(); + public AnimatedTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); } + /** + * The constructor of the tile entity. + */ + + // You must call super.update() at the beginning of your update() method, // or call the animationsUpdate() method like here. @Override - public void update() { + public void tick() { this.getAnimationHandler().animationsUpdate(this); } @@ -48,8 +53,8 @@ public AnimationHandler getAnimationHandler() { } @Override - public int getDimension() { - return this.world.provider.getDimension(); + public DimensionType getDimension() { + return this.world.getDimension().getType(); } @Override diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java index 1a69ab9..98ef3e3 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java @@ -1,54 +1,59 @@ package com.leviathanstudio.craftstudio.common.animation.simpleImpl; -import java.nio.FloatBuffer; - -import javax.vecmath.Matrix4f; - import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; import com.leviathanstudio.craftstudio.client.util.MathHelper; - -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import javax.vecmath.Matrix4f; +import java.nio.FloatBuffer; + /** * Renderer of animated TileEntity. If you only need one model to be render you * can directly use this class. Otherwise, or if you prefer, you can use this * class as a model to create your renderer. - * - * @since 0.3.0 - * - * @author Timmypote * * @param + * @author Timmypote + * @since 0.3.0 */ -public class CSTileEntitySpecialRenderer extends TileEntitySpecialRenderer -{ - /** Efficient rotation corrector, you can use it in your renderer. */ +public class CSTileEntitySpecialRenderer extends TileEntityRenderer { + /** + * Efficient rotation corrector, you can use it in your renderer. + */ public static final FloatBuffer ROTATION_CORRECTOR; + static { Matrix4f mat = new Matrix4f(); mat.set(MathHelper.quatFromEuler(180, 0, 0)); ROTATION_CORRECTOR = MathHelper.makeFloatBuffer(mat); } - /** The model of the block. */ + /** + * The model of the block. + */ protected ModelCraftStudio model; - /** The texture of the block */ + /** + * The texture of the block + */ protected ResourceLocation texture; - /** The constructor that initialize the model and save texture. */ + /** + * The constructor that initialize the model and save texture. + */ public CSTileEntitySpecialRenderer(String modid, String modelNameIn, int textureWidth, int textureHeigth, ResourceLocation texture) { this.model = new ModelCraftStudio(modid, modelNameIn, textureWidth, textureHeigth); this.texture = texture; } @Override - public void render(T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { + public void render(T te, double x, double y, double z, float partialTicks, int destroyStage) { + super.render(te, x, y, z, partialTicks, destroyStage); GlStateManager.pushMatrix(); // Correction of the position. - GlStateManager.translate(x + 0.5D, y + 1.5D, z + 0.5D); + GlStateManager.translated(x + 0.5D, y + 1.5D, z + 0.5D); // Correction of the rotation. GlStateManager.multMatrix(CSTileEntitySpecialRenderer.ROTATION_CORRECTOR); this.bindTexture(this.texture); // Binding the texture. diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java index d71a1f1..0bb1f9e 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java @@ -1,20 +1,22 @@ package com.leviathanstudio.craftstudio.common.network; import com.leviathanstudio.craftstudio.CraftStudioApi; - -import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.dimension.DimensionType; +import net.minecraftforge.fml.network.NetworkRegistry; +import net.minecraftforge.fml.network.PacketDistributor; +import net.minecraftforge.fml.network.simple.SimpleChannel; /** * A helper class to easily send * {@link com.leviathanstudio.craftstudio.common.animation.IAnimated IAnimated} * event on client and server. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -public class CSNetworkHelper -{ +public class CSNetworkHelper { /** * The range around the * {@link com.leviathanstudio.craftstudio.common.animation.IAnimated @@ -22,20 +24,57 @@ public class CSNetworkHelper */ public static final double EVENT_RANGE = 128; + public static final String PROTOCOL_VERSION = String.valueOf(1); + + public static final SimpleChannel CHANNEL = NetworkRegistry.ChannelBuilder + .named(new ResourceLocation(CraftStudioApi.API_ID, "channel")) + .networkProtocolVersion(() -> PROTOCOL_VERSION) + .clientAcceptedVersions(PROTOCOL_VERSION::equals) + .serverAcceptedVersions(PROTOCOL_VERSION::equals) + .simpleChannel(); + + private static int id = 0; + /** * Send the given message through the network. - * - * @param message - * The message to send. + * + * @param message The message to send. */ public static void sendIAnimatedEvent(IAnimatedEventMessage message) { if (message.animated.isWorldRemote()) // If we are on client, we send a server message to the server. - CraftStudioApi.NETWORK.sendToServer(new ServerIAnimatedEventMessage(message)); + sendPacketToServer(new ServerIAnimatedEventMessage(message)); else // If we are on server, we send a client message to the clients in // range. - CraftStudioApi.NETWORK.sendToAllAround(new ClientIAnimatedEventMessage(message), new TargetPoint(message.animated.getDimension(), - message.animated.getX(), message.animated.getY(), message.animated.getZ(), CSNetworkHelper.EVENT_RANGE)); + sendToAllAround(new ClientIAnimatedEventMessage(message), new PacketDistributor.TargetPoint( + message.animated.getX(), message.animated.getY(), message.animated.getZ(), CSNetworkHelper.EVENT_RANGE, message.animated.getDimension())); + } + + + public static SimpleChannel.MessageBuilder messageBuilder(Class packetIn) { + return CHANNEL.messageBuilder(packetIn, id++); + } + + public static void sendPacketToServer(IPacket packetIn) { + CHANNEL.sendToServer(packetIn); } + + public static void sendPacketTo(ServerPlayerEntity player, IPacket packetIn) { + CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), packetIn); + } + + public static void sendPacketToEveryone(IPacket packetIn) { + CHANNEL.send(PacketDistributor.ALL.noArg(), packetIn); + } + + public static void sendPacketToDimension(DimensionType dimension, IPacket packetIn) { + CHANNEL.send(PacketDistributor.DIMENSION.with(() -> dimension), packetIn); + } + + public static void sendToAllAround(IPacket packetIn, PacketDistributor.TargetPoint targetPoint) { + CHANNEL.send(PacketDistributor.NEAR.with(() -> targetPoint), packetIn); + + } + } diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java index d2cf245..f904c24 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java @@ -1,49 +1,67 @@ package com.leviathanstudio.craftstudio.common.network; -import java.util.UUID; - import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - -import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; +import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.network.simpleimpl.IMessage; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; +import net.minecraftforge.fml.network.NetworkEvent; + +import java.util.UUID; +import java.util.function.Supplier; /** * Base class for * {@link com.leviathanstudio.craftstudio.common.animation.IAnimated IAnimated} * event messages. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -public class IAnimatedEventMessage implements IMessage -{ - /** The id of the event. See for more info {@link EnumIAnimatedEvent}. */ - public short event; - /** The id of the primary animation. */ - public short animId; - /** The id of the secondary animation, used for stopStart message. */ - public short optAnimId = -1; - /** A float used to transmit keyframe related informations. */ - public float keyframeInfo = -1; - /** The object that is animated */ +public class IAnimatedEventMessage implements IPacket { + /** + * The id of the event. See for more info {@link EnumIAnimatedEvent}. + */ + public short event; + /** + * The id of the primary animation. + */ + public short animId; + /** + * The id of the secondary animation, used for stopStart message. + */ + public short optAnimId = -1; + /** + * A float used to transmit keyframe related informations. + */ + public float keyframeInfo = -1; + /** + * The object that is animated + */ public IAnimated animated; - /** Variable that transmit part of the UUID of an Entity. */ - public long most, least; - /** Variable that transmit the position of a TileEntity. */ - public int x, y, z; - /** True, if on message receiving the animated object is an entity. */ - public boolean hasEntity; + /** + * Variable that transmit part of the UUID of an Entity. + */ + public long most, least; + /** + * Variable that transmit the position of a TileEntity. + */ + public int x, y, z; + /** + * True, if on message receiving the animated object is an entity. + */ + public boolean hasEntity; - /** Simple empty constructor for packets system. */ - public IAnimatedEventMessage() {} + /** + * Simple empty constructor for packets system. + */ + public IAnimatedEventMessage() { + } - /** Constructor */ + /** + * Constructor + */ public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { if (event != null) this.event = event.getId(); @@ -51,108 +69,115 @@ public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short this.animId = animId; } - /** Constructor */ + /** + * Constructor + */ public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { this(event, animated, animId); this.keyframeInfo = keyframeInfo; } - /** Constructor */ + /** + * Constructor + */ public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { this(event, animated, animId, keyframeInfo); this.optAnimId = optAnimId; } - /** Constructor */ + /** + * Constructor + */ public IAnimatedEventMessage(IAnimatedEventMessage eventObj) { this(null, eventObj.animated, eventObj.animId, eventObj.keyframeInfo, eventObj.optAnimId); this.event = eventObj.event; } @Override - public void fromBytes(ByteBuf buf) { - short actualEvent = buf.readShort(); - if (actualEvent < 0 || actualEvent >= 2 * EnumIAnimatedEvent.ID_COUNT) { - this.event = -1; - CraftStudioApi.getLogger().error("Networking error : invalid packet."); - return; - } - else if (actualEvent < EnumIAnimatedEvent.ID_COUNT) { - this.most = buf.readLong(); - this.least = buf.readLong(); - this.event = actualEvent; - this.hasEntity = true; - } - else { - this.x = buf.readInt(); - this.y = buf.readInt(); - this.z = buf.readInt(); - this.event = (short) (actualEvent - EnumIAnimatedEvent.ID_COUNT); - this.hasEntity = false; - } - this.animId = buf.readShort(); - if (this.event != 2) - this.keyframeInfo = buf.readFloat(); - if (this.event > 2) - this.optAnimId = buf.readShort(); - } - - @Override - public void toBytes(ByteBuf buf) { + public void encode(IAnimatedEventMessage packet, PacketBuffer buffer) { if (this.event < 0 || this.event >= EnumIAnimatedEvent.ID_COUNT) { - buf.writeShort(-1); + buffer.writeShort(-1); CraftStudioApi.getLogger().error("Unsuported event id " + this.event + " for network message."); return; } if (this.animated instanceof Entity) { Entity e = (Entity) this.animated; - buf.writeShort(this.event); + buffer.writeShort(this.event); UUID uuid = e.getUniqueID(); - buf.writeLong(uuid.getMostSignificantBits()); - buf.writeLong(uuid.getLeastSignificantBits()); - } - else if (this.animated instanceof TileEntity) { + buffer.writeLong(uuid.getMostSignificantBits()); + buffer.writeLong(uuid.getLeastSignificantBits()); + } else if (this.animated instanceof TileEntity) { TileEntity te = (TileEntity) this.animated; - buf.writeShort(this.event + EnumIAnimatedEvent.ID_COUNT); + buffer.writeShort(this.event + EnumIAnimatedEvent.ID_COUNT); BlockPos pos = te.getPos(); - buf.writeInt(pos.getX()); - buf.writeInt(pos.getY()); - buf.writeInt(pos.getZ()); - } - else { - buf.writeShort(-1); + buffer.writeInt(pos.getX()); + buffer.writeInt(pos.getY()); + buffer.writeInt(pos.getZ()); + } else { + buffer.writeShort(-1); CraftStudioApi.getLogger().error("Unsuported class " + this.animated.getClass().getSimpleName() + " for network message."); CraftStudioApi.getLogger().error("You are trying to animate an other class than Entity or TileEntity."); return; } - buf.writeShort(this.animId); + buffer.writeShort(this.animId); if (this.event != EnumIAnimatedEvent.STOP_ANIM.getId()) - buf.writeFloat(this.keyframeInfo); + buffer.writeFloat(this.keyframeInfo); if (this.event == EnumIAnimatedEvent.STOP_START_ANIM.getId()) - buf.writeShort(this.optAnimId); + buffer.writeShort(this.optAnimId); } + @Override + public IAnimatedEventMessage decode(PacketBuffer buffer) { + short actualEvent = buffer.readShort(); + if (actualEvent < 0 || actualEvent >= 2 * EnumIAnimatedEvent.ID_COUNT) { + this.event = -1; + CraftStudioApi.getLogger().error("Networking error : invalid packet."); + return null; + } else if (actualEvent < EnumIAnimatedEvent.ID_COUNT) { + this.most = buffer.readLong(); + this.least = buffer.readLong(); + this.event = actualEvent; + this.hasEntity = true; + } else { + this.x = buffer.readInt(); + this.y = buffer.readInt(); + this.z = buffer.readInt(); + this.event = (short) (actualEvent - EnumIAnimatedEvent.ID_COUNT); + this.hasEntity = false; + } + this.animId = buffer.readShort(); + if (this.event != 2) + this.keyframeInfo = buffer.readFloat(); + if (this.event > 2) + this.optAnimId = buffer.readShort(); + + //IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { + return null; + } + + @Override + public void handle(IAnimatedEventMessage packet, Supplier ctxProvider) { + + } + + /** * Base class for the messages handler. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ - public static abstract class IAnimatedEventHandler - { + public static abstract class IAnimatedEventHandler { /** * Extract the Entity or TileEntity when a message is received. - * - * @param message - * The message received. - * @param ctx - * The context of the message. + * + * @param message The message received. + * @param ctx The context of the message. * @return True, if the Entity/TileEntity was successfully extracted. - * False, otherwise. + * False, otherwise. */ - public boolean onMessage(IAnimatedEventMessage message, MessageContext ctx) { + public boolean onMessage(IAnimatedEventMessage message, Supplier ctx) { if (message.hasEntity) { Entity e = this.getEntityByUUID(ctx, message.most, message.least); if (!(e instanceof IAnimated)) { @@ -160,8 +185,7 @@ public boolean onMessage(IAnimatedEventMessage message, MessageContext ctx) { return false; } message.animated = (IAnimated) e; - } - else { + } else { TileEntity te = this.getTileEntityByPos(ctx, message.x, message.y, message.z); if (!(te instanceof IAnimated)) { CraftStudioApi.getLogger().debug("Networking error : invalid tile entity."); @@ -174,30 +198,23 @@ public boolean onMessage(IAnimatedEventMessage message, MessageContext ctx) { /** * Get an entity by its UUID. - * - * @param ctx - * The context of the message received. - * @param most - * The most significants bits of the UUID. - * @param least - * The least significants bits of the UUID. + * + * @param ctx The context of the message received. + * @param most The most significants bits of the UUID. + * @param least The least significants bits of the UUID. * @return The Entity, null if it couldn't be found. */ - public abstract Entity getEntityByUUID(MessageContext ctx, long most, long least); + public abstract Entity getEntityByUUID(Supplier ctx, long most, long least); /** * Get a TileEntity by its position. - * - * @param ctx - * The context of the message received. - * @param x - * The position on the x axis. - * @param y - * The position on the y axis. - * @param z - * The position on the z axis. + * + * @param ctx The context of the message received. + * @param x The position on the x axis. + * @param y The position on the y axis. + * @param z The position on the z axis. * @return The TileEntity, null if it couldn't be found. */ - public abstract TileEntity getTileEntityByPos(MessageContext ctx, int x, int y, int z); + public abstract TileEntity getTileEntityByPos(Supplier ctx, int x, int y, int z); } } diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java new file mode 100644 index 0000000..0e9a6e8 --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java @@ -0,0 +1,16 @@ +package com.leviathanstudio.craftstudio.common.network; + +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.fml.network.NetworkEvent; + +import java.util.function.Supplier; + +public interface IPacket { + + void encode(T packet, PacketBuffer buffer); + + T decode(PacketBuffer buffer); + + void handle(T packet, Supplier ctxProvider); + +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java index aae825c..f9396a4 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java @@ -1,61 +1,63 @@ package com.leviathanstudio.craftstudio.common.network; -import java.util.UUID; - import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +import java.util.UUID; /** * Message to send an IAnimated event to the server. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ -public class ServerIAnimatedEventMessage extends IAnimatedEventMessage -{ - /** Constructor */ - public ServerIAnimatedEventMessage() {} +public class ServerIAnimatedEventMessage extends IAnimatedEventMessage { + /** + * Constructor + */ + public ServerIAnimatedEventMessage() { + } - /** Constructor */ + /** + * Constructor + */ public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { super(event, animated, animId); } - /** Constructor */ + /** + * Constructor + */ public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { super(event, animated, animId, keyframeInfo); } - /** Constructor */ + /** + * Constructor + */ public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { super(event, animated, animId, keyframeInfo, optAnimId); } - /** Constructor */ + /** + * Constructor + */ public ServerIAnimatedEventMessage(IAnimatedEventMessage eventObj) { super(eventObj); } /** * Handler for IAnimated event messages send to the server. - * - * @since 0.3.0 - * + * * @author Timmypote + * @since 0.3.0 */ public static class ServerIAnimatedEventHandler extends IAnimatedEventHandler - implements IMessageHandler - { + implements IMessageHandler { @Override public ClientIAnimatedEventMessage onMessage(ServerIAnimatedEventMessage message, MessageContext ctx) { FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> { @@ -67,7 +69,7 @@ public ClientIAnimatedEventMessage onMessage(ServerIAnimatedEventMessage message CraftStudioApi.NETWORK.sendTo(new ClientIAnimatedEventMessage(message), player); } }); - + return null; } diff --git a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java index 4666050..fdef192 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java +++ b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java @@ -1,33 +1,27 @@ package com.leviathanstudio.craftstudio.proxy; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Set; - -import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.client.animation.ClientAnimationHandler; import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.common.discovery.ASMDataTable; -import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import java.lang.reflect.Method; /** * Client proxy of the CraftStudioApi - * - * @since 0.3.0 - * + * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -public class CSClientProxy extends CSCommonProxy -{ +public class CSClientProxy extends CSCommonProxy { + + @Override - public void preInit(FMLPreInitializationEvent e) { - super.preInit(e); + public void clientSetup(FMLClientSetupEvent e) { + super.clientSetup(e); this.loadCraftStudioLoaders(e); } @@ -36,13 +30,14 @@ public AnimationHandler getNewAnimationHandler(Class return new ClientAnimationHandler<>(); } - private void loadCraftStudioLoaders(FMLPreInitializationEvent e) { + private void loadCraftStudioLoaders(FMLClientSetupEvent e) { String methodName, className; Method method; RegistryHandler.init(); - ASMDataTable dataTable = e.getAsmData(); + //TODO Work on annotations or other way to register models + /*ASMDataTable dataTable = e.getAsmData(); Set datas = dataTable.getAll("com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader"); for (ASMData data : datas) { className = data.getClassName(); @@ -59,7 +54,7 @@ private void loadCraftStudioLoaders(FMLPreInitializationEvent e) { CraftStudioApi.getLogger().error("Error loading craftstudio assets in class " + className + " for method " + methodName + "()."); CraftStudioApi.getLogger().error("Is that method 'static' ? Because it should."); } - } + }*/ CSRegistryHelper.loadModels(); CSRegistryHelper.loadAnims(); diff --git a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java index e66b6b8..702cede 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java +++ b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java @@ -1,29 +1,26 @@ package com.leviathanstudio.craftstudio.proxy; -import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import com.leviathanstudio.craftstudio.common.network.ClientIAnimatedEventMessage; -import com.leviathanstudio.craftstudio.common.network.ClientIAnimatedEventMessage.ClientIAnimatedEventHandler; -import com.leviathanstudio.craftstudio.common.network.ServerIAnimatedEventMessage; -import com.leviathanstudio.craftstudio.common.network.ServerIAnimatedEventMessage.ServerIAnimatedEventHandler; - -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; /** * Common base for the proxies of the CraftStudioApi - * - * @since 0.3.0 - * + * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -public abstract class CSCommonProxy -{ - public void preInit(FMLPreInitializationEvent e) { - CraftStudioApi.NETWORK.registerMessage(ClientIAnimatedEventHandler.class, ClientIAnimatedEventMessage.class, 0, Side.CLIENT); - CraftStudioApi.NETWORK.registerMessage(ServerIAnimatedEventHandler.class, ServerIAnimatedEventMessage.class, 1, Side.SERVER); +public abstract class CSCommonProxy { + + public void clientSetup(FMLClientSetupEvent event) { + } + + //TODO Register packets + public void commonSetup(FMLCommonSetupEvent event) { + //CSNetworkHelper.CHANNEL.registerMessage(ClientIAnimatedEventHandler.class, ClientIAnimatedEventMessage.class, 0, Side.CLIENT); + //CraftStudioApi.NETWORK.registerMessage(ServerIAnimatedEventHandler.class, ServerIAnimatedEventMessage.class, 1, Side.SERVER); } public abstract AnimationHandler getNewAnimationHandler(Class animatedClass); diff --git a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSServerProxy.java b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSServerProxy.java index e8a1e4b..707cfb4 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSServerProxy.java +++ b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSServerProxy.java @@ -4,22 +4,14 @@ import com.leviathanstudio.craftstudio.common.animation.IAnimated; import com.leviathanstudio.craftstudio.server.animation.ServerAnimationHandler; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; - /** * Server proxy of the CraftStudioApi - * - * @since 0.3.0 - * + * * @author Timmypote * @author ZeAmateis + * @since 0.3.0 */ -public class CSServerProxy extends CSCommonProxy -{ - @Override - public void preInit(FMLPreInitializationEvent e) { - super.preInit(e); - } +public class CSServerProxy extends CSCommonProxy { @Override public AnimationHandler getNewAnimationHandler(Class animatedClass) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/server/animation/ServerAnimationHandler.java b/src/main/java/com/leviathanstudio/craftstudio/server/animation/ServerAnimationHandler.java index 3eb31b1..45a812a 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/server/animation/ServerAnimationHandler.java +++ b/src/main/java/com/leviathanstudio/craftstudio/server/animation/ServerAnimationHandler.java @@ -1,43 +1,44 @@ package com.leviathanstudio.craftstudio.server.animation; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.WeakHashMap; - import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.Channel; import com.leviathanstudio.craftstudio.common.animation.CustomChannel; import com.leviathanstudio.craftstudio.common.animation.IAnimated; - import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.WeakHashMap; /** * An object that hold the informations about its animated objects and all their * animations. It also start/stop/update the animations. This is the server side * AnimationHandler. - * - * @since 0.3.0 - * - * @author Timmypote * - * @param - * The class of the animated object. + * @param The class of the animated object. + * @author Timmypote + * @since 0.3.0 */ -@SideOnly(Side.SERVER) -public class ServerAnimationHandler extends AnimationHandler -{ - /** Map with all the animations. */ - private Map animChannels = new HashMap<>(); - - /** Map with the informations about animations. */ - private Map> currentAnimInfo = new WeakHashMap<>(); - - /** Map with the initialized animations and their starting frames. */ - private Map> startingAnimations = new WeakHashMap<>(); +@OnlyIn(Dist.DEDICATED_SERVER) +public class ServerAnimationHandler extends AnimationHandler { + /** + * Map with all the animations. + */ + private Map animChannels = new HashMap<>(); + + /** + * Map with the informations about animations. + */ + private Map> currentAnimInfo = new WeakHashMap<>(); + + /** + * Map with the initialized animations and their starting frames. + */ + private Map> startingAnimations = new WeakHashMap<>(); @Override public void addAnim(String modid, String animNameIn, String modelNameIn, boolean looped) { @@ -121,7 +122,7 @@ public void animationsUpdate(T animatedElement) { if (animInfoMap == null) return; - for (Iterator> it = animInfoMap.entrySet().iterator(); it.hasNext();) { + for (Iterator> it = animInfoMap.entrySet().iterator(); it.hasNext(); ) { Entry animInfo = it.next(); boolean animStatus = this.canUpdateAnimation(this.animChannels.get(animInfo.getKey()), animatedElement); if (!animStatus) From 85743a2a8910dc01d12de486bb75a11a15ca0314 Mon Sep 17 00:00:00 2001 From: Phenix246 Date: Wed, 21 Aug 2019 14:32:42 +0200 Subject: [PATCH 2/9] Fix Packet - Need to fix build.gradle --- .../craftstudio/CraftStudioApi.java | 2 + .../common/animation/AnimationHandler.java | 12 +- .../common/network/AnimatedEventMessage.java | 86 +++++++ .../network/AnimatedEventMessageUtil.java | 223 ++++++++++++++++++ .../common/network/CSNetworkHelper.java | 18 +- .../network/ClientIAnimatedEventMessage.java | 92 -------- .../common/network/IAnimatedEventMessage.java | 220 ----------------- .../craftstudio/common/network/IPacket.java | 16 -- .../network/ServerIAnimatedEventMessage.java | 91 ------- .../craftstudio/proxy/CSCommonProxy.java | 5 + 10 files changed, 331 insertions(+), 434 deletions(-) create mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessage.java create mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessageUtil.java delete mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/ClientIAnimatedEventMessage.java delete mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java delete mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java delete mode 100644 src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index d264606..b44c389 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -5,11 +5,13 @@ import com.leviathanstudio.craftstudio.proxy.CSClientProxy; import com.leviathanstudio.craftstudio.proxy.CSCommonProxy; import com.leviathanstudio.craftstudio.proxy.CSServerProxy; + import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/AnimationHandler.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/AnimationHandler.java index fe75736..5206dce 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/AnimationHandler.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/AnimationHandler.java @@ -5,7 +5,7 @@ import com.leviathanstudio.craftstudio.common.network.CSNetworkHelper; import com.leviathanstudio.craftstudio.common.network.EnumIAnimatedEvent; -import com.leviathanstudio.craftstudio.common.network.IAnimatedEventMessage; +import com.leviathanstudio.craftstudio.common.network.AnimatedEventMessage; import net.minecraft.util.ResourceLocation; @@ -110,7 +110,7 @@ public void networkStartAnimation(String res, float startingFrame, T animatedEle if (animatedElement.isWorldRemote() == clientSend) { this.serverInitAnimation(res, startingFrame, animatedElement); CSNetworkHelper.sendIAnimatedEvent( - new IAnimatedEventMessage(EnumIAnimatedEvent.START_ANIM, animatedElement, this.getAnimIdFromName(res), startingFrame)); + new AnimatedEventMessage(EnumIAnimatedEvent.START_ANIM, animatedElement, this.getAnimIdFromName(res), startingFrame)); } } @@ -173,7 +173,7 @@ public void stopAnimation(String res, T animatedElement) { public void networkStopAnimation(String res, T animatedElement, boolean clientSend) { if (animatedElement.isWorldRemote() == clientSend) { this.serverStopAnimation(res, animatedElement); - CSNetworkHelper.sendIAnimatedEvent(new IAnimatedEventMessage(EnumIAnimatedEvent.STOP_ANIM, animatedElement, this.getAnimIdFromName(res))); + CSNetworkHelper.sendIAnimatedEvent(new AnimatedEventMessage(EnumIAnimatedEvent.STOP_ANIM, animatedElement, this.getAnimIdFromName(res))); } } @@ -222,7 +222,7 @@ public void stopStartAnimation(String animToStop, String animToStart, float star public void networkStopStartAnimation(String animToStop, String animToStart, float startingFrame, T animatedElement, boolean clientSend) { if (animatedElement.isWorldRemote() == clientSend) { this.serverStopStartAnimation(animToStop, animToStart, startingFrame, animatedElement); - CSNetworkHelper.sendIAnimatedEvent(new IAnimatedEventMessage(EnumIAnimatedEvent.STOP_START_ANIM, animatedElement, + CSNetworkHelper.sendIAnimatedEvent(new AnimatedEventMessage(EnumIAnimatedEvent.STOP_START_ANIM, animatedElement, this.getAnimIdFromName(animToStart), startingFrame, this.getAnimIdFromName(animToStop))); } } @@ -339,7 +339,7 @@ public short getAnimIdFromName(String name) { * @return True, if the message was correctly processed and a response * should be send if it's needed. */ - public boolean onClientIAnimatedEvent(IAnimatedEventMessage message) { + public boolean onClientIAnimatedEvent(AnimatedEventMessage message) { AnimationHandler hand = message.animated.getAnimationHandler(); switch (EnumIAnimatedEvent.getEvent(message.event)) { case START_ANIM: @@ -362,7 +362,7 @@ public boolean onClientIAnimatedEvent(IAnimatedEventMessage message) { * @return True, if the message was correctly processed and should be send * to all the clients in range. */ - public static boolean onServerIAnimatedEvent(IAnimatedEventMessage message) { + public static boolean onServerIAnimatedEvent(AnimatedEventMessage message) { AnimationHandler hand = message.animated.getAnimationHandler(); switch (EnumIAnimatedEvent.getEvent(message.event)) { case START_ANIM: diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessage.java new file mode 100644 index 0000000..761faf7 --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessage.java @@ -0,0 +1,86 @@ +package com.leviathanstudio.craftstudio.common.network; + +import com.leviathanstudio.craftstudio.common.animation.IAnimated; + +/** + * Base class for + * {@link com.leviathanstudio.craftstudio.common.animation.IAnimated IAnimated} + * event messages. + * + * @author Timmypote + * @since 0.3.0 + */ +public class AnimatedEventMessage { + /** + * The id of the event. See for more info {@link EnumIAnimatedEvent}. + */ + public short event; + /** + * The id of the primary animation. + */ + public short animId; + /** + * The id of the secondary animation, used for stopStart message. + */ + public short optAnimId = -1; + /** + * A float used to transmit keyframe related informations. + */ + public float keyframeInfo = -1; + /** + * The object that is animated + */ + public IAnimated animated; + /** + * Variable that transmit part of the UUID of an Entity. + */ + public long most, least; + /** + * Variable that transmit the position of a TileEntity. + */ + public int x, y, z; + /** + * True, if on message receiving the animated object is an entity. + */ + public boolean hasEntity; + + /** + * Simple empty constructor for packets system. + */ + public AnimatedEventMessage() { + } + + /** + * Constructor + */ + public AnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { + if (event != null) + this.event = event.getId(); + this.animated = animated; + this.animId = animId; + } + + /** + * Constructor + */ + public AnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { + this(event, animated, animId); + this.keyframeInfo = keyframeInfo; + } + + /** + * Constructor + */ + public AnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { + this(event, animated, animId, keyframeInfo); + this.optAnimId = optAnimId; + } + + /** + * Constructor + */ + public AnimatedEventMessage(AnimatedEventMessage eventObj) { + this(null, eventObj.animated, eventObj.animId, eventObj.keyframeInfo, eventObj.optAnimId); + this.event = eventObj.event; + } +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessageUtil.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessageUtil.java new file mode 100644 index 0000000..208fe29 --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/AnimatedEventMessageUtil.java @@ -0,0 +1,223 @@ +package com.leviathanstudio.craftstudio.common.network; + +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.function.Supplier; + +import com.google.common.base.Predicates; +import com.leviathanstudio.craftstudio.CraftStudioApi; +import com.leviathanstudio.craftstudio.client.animation.ClientAnimationHandler; +import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; +import com.leviathanstudio.craftstudio.common.animation.IAnimated; +import com.leviathanstudio.craftstudio.common.animation.InfoChannel; + +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.network.PacketBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.fml.network.NetworkEvent.Context; + +public class AnimatedEventMessageUtil { + + private static final CommonHandler SERVER = new ServerHandler(); + private static final CommonHandler CLIENT = new ClientHandler(); + + public static final BiConsumer ENCODER = (msg, buffer) -> { + if (msg.event < 0 || msg.event >= EnumIAnimatedEvent.ID_COUNT) { + buffer.writeShort(-1); + CraftStudioApi.getLogger().error("Unsuported event id " + msg.event + " for network message."); + return; + } + if (msg.animated instanceof Entity) { + Entity e = (Entity) msg.animated; + buffer.writeShort(msg.event); + UUID uuid = e.getUniqueID(); + buffer.writeLong(uuid.getMostSignificantBits()); + buffer.writeLong(uuid.getLeastSignificantBits()); + } else if (msg.animated instanceof TileEntity) { + TileEntity te = (TileEntity) msg.animated; + buffer.writeShort(msg.event + EnumIAnimatedEvent.ID_COUNT); + BlockPos pos = te.getPos(); + buffer.writeInt(pos.getX()); + buffer.writeInt(pos.getY()); + buffer.writeInt(pos.getZ()); + } else { + buffer.writeShort(-1); + CraftStudioApi.getLogger().error("Unsuported class " + msg.animated.getClass().getSimpleName() + " for network message."); + CraftStudioApi.getLogger().error("You are trying to animate an other class than Entity or TileEntity."); + return; + } + buffer.writeShort(msg.animId); + if (msg.event != EnumIAnimatedEvent.STOP_ANIM.getId()) + buffer.writeFloat(msg.keyframeInfo); + if (msg.event == EnumIAnimatedEvent.STOP_START_ANIM.getId()) + buffer.writeShort(msg.optAnimId); + }; + + public static final Function DECODER = (buffer) -> { + AnimatedEventMessage msg = new AnimatedEventMessage(); + + short actualEvent = buffer.readShort(); + if (actualEvent < 0 || actualEvent >= 2 * EnumIAnimatedEvent.ID_COUNT) { + msg.event = -1; + CraftStudioApi.getLogger().error("Networking error : invalid packet."); + return null; + } else if (actualEvent < EnumIAnimatedEvent.ID_COUNT) { + msg.most = buffer.readLong(); + msg.least = buffer.readLong(); + msg.event = actualEvent; + msg.hasEntity = true; + } else { + msg.x = buffer.readInt(); + msg.y = buffer.readInt(); + msg.z = buffer.readInt(); + msg.event = (short) (actualEvent - EnumIAnimatedEvent.ID_COUNT); + msg.hasEntity = false; + } + msg.animId = buffer.readShort(); + if (msg.event != 2) + msg.keyframeInfo = buffer.readFloat(); + if (msg.event > 2) + msg.optAnimId = buffer.readShort(); + return msg; + }; + + + public static BiConsumer> HANDLER = (msg, ctx) -> { + switch(ctx.get().getDirection()) { + case PLAY_TO_SERVER: + SERVER.handle(msg, ctx.get()); + break; + case PLAY_TO_CLIENT: + CLIENT.handle(msg, ctx.get()); + break; + default: + // Do nothing + break; + } + ctx.get().setPacketHandled(true); + }; + + + + private static class ServerHandler extends CommonHandler { + + @Override + public Entity getEntityByUUID(Context ctx, long most, long least) { + ServerPlayerEntity sender = ctx.getSender(); // the client that sent this packet + ServerWorld world = (ServerWorld)sender.getEntityWorld(); + UUID uuid = new UUID(most, least); + for (Entity e : world.getEntities(null, Predicates.alwaysTrue())) + if (e.getUniqueID().equals(uuid)) + return e; + + return null; + } + + @Override + public TileEntity getTileEntityByPos(Context ctx, int x, int y, int z) { + return ctx.getSender().world.getTileEntity(new BlockPos(x, y, z)); + } + + @Override + public void handle(AnimatedEventMessage message, Context ctx) { + ctx.enqueueWork(() -> { + if (handleCommonSide(message, ctx)) { + message.animated.getAnimationHandler(); + boolean succes = AnimationHandler.onServerIAnimatedEvent(message); + if (succes && message.event != EnumIAnimatedEvent.ANSWER_START_ANIM.getId()) + CSNetworkHelper.sendPacketTo(new AnimatedEventMessage(message), ctx.getSender()); + } + }); + } + + } + + private static class ClientHandler extends CommonHandler { + + @Override + public Entity getEntityByUUID(Context ctx, long most, long least) { + ServerPlayerEntity sender = ctx.getSender(); // the client that sent this packet + ClientWorld world = (ClientWorld)sender.getEntityWorld(); + UUID uuid = new UUID(most, least); + + for (Entity e : world.getAllEntities()) + if (e.getUniqueID().equals(uuid)) + return e; + + return null; + } + + @Override + public TileEntity getTileEntityByPos(Context ctx, int x, int y, int z) { + return ctx.getSender().world.getTileEntity(new BlockPos(x, y, z)); + } + + @Override + public void handle(AnimatedEventMessage message, Context ctx) { + ctx.enqueueWork(() -> { + if (handleCommonSide(message, ctx)) { + boolean succes = message.animated.getAnimationHandler().onClientIAnimatedEvent(message); + if (succes && message.animated.getAnimationHandler() instanceof ClientAnimationHandler + && (message.event == EnumIAnimatedEvent.START_ANIM.getId() || message.event == EnumIAnimatedEvent.STOP_START_ANIM.getId())) { + @SuppressWarnings("rawtypes") + ClientAnimationHandler hand = (ClientAnimationHandler) message.animated.getAnimationHandler(); + String animName = hand.getAnimNameFromId(message.animId); + InfoChannel infoC = (InfoChannel) hand.getAnimChannels().get(animName); + CSNetworkHelper.sendPacketToServer(new AnimatedEventMessage(EnumIAnimatedEvent.ANSWER_START_ANIM, message.animated, message.animId, infoC.totalFrames)); + } + } + }); + } + + } + + private static abstract class CommonHandler { + + protected boolean handleCommonSide(AnimatedEventMessage message, Context ctx) { + if (message.hasEntity) { + Entity e = this.getEntityByUUID(ctx, message.most, message.least); + if (!(e instanceof IAnimated)) { + CraftStudioApi.getLogger().debug("Networking error : invalid entity."); + return false; + } + message.animated = (IAnimated) e; + } else { + TileEntity te = this.getTileEntityByPos(ctx, message.x, message.y, message.z); + if (!(te instanceof IAnimated)) { + CraftStudioApi.getLogger().debug("Networking error : invalid tile entity."); + return false; + } + message.animated = (IAnimated) te; + } + return true; + } + + /** + * Get an entity by its UUID. + * + * @param ctx The context of the message received. + * @param most The most significants bits of the UUID. + * @param least The least significants bits of the UUID. + * @return The Entity, null if it couldn't be found. + */ + public abstract Entity getEntityByUUID(Context ctx, long most, long least); + + /** + * Get a TileEntity by its position. + * + * @param ctx The context of the message received. + * @param x The position on the x axis. + * @param y The position on the y axis. + * @param z The position on the z axis. + * @return The TileEntity, null if it couldn't be found. + */ + public abstract TileEntity getTileEntityByPos(Context ctx, int x, int y, int z); + + public abstract void handle(AnimatedEventMessage message, Context ctx); + } +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java index 0bb1f9e..da05e84 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/network/CSNetworkHelper.java @@ -1,6 +1,7 @@ package com.leviathanstudio.craftstudio.common.network; import com.leviathanstudio.craftstudio.CraftStudioApi; + import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.dimension.DimensionType; @@ -40,14 +41,14 @@ public class CSNetworkHelper { * * @param message The message to send. */ - public static void sendIAnimatedEvent(IAnimatedEventMessage message) { + public static void sendIAnimatedEvent(AnimatedEventMessage message) { if (message.animated.isWorldRemote()) // If we are on client, we send a server message to the server. - sendPacketToServer(new ServerIAnimatedEventMessage(message)); + sendPacketToServer(new AnimatedEventMessage(message)); else // If we are on server, we send a client message to the clients in // range. - sendToAllAround(new ClientIAnimatedEventMessage(message), new PacketDistributor.TargetPoint( + sendToAllAround(new AnimatedEventMessage(message), new PacketDistributor.TargetPoint( message.animated.getX(), message.animated.getY(), message.animated.getZ(), CSNetworkHelper.EVENT_RANGE, message.animated.getDimension())); } @@ -56,25 +57,24 @@ public static SimpleChannel.MessageBuilder messageBuilder(Class packet return CHANNEL.messageBuilder(packetIn, id++); } - public static void sendPacketToServer(IPacket packetIn) { + public static void sendPacketToServer(AnimatedEventMessage packetIn) { CHANNEL.sendToServer(packetIn); } - public static void sendPacketTo(ServerPlayerEntity player, IPacket packetIn) { + public static void sendPacketTo(AnimatedEventMessage packetIn, ServerPlayerEntity player) { CHANNEL.send(PacketDistributor.PLAYER.with(() -> player), packetIn); } - public static void sendPacketToEveryone(IPacket packetIn) { + public static void sendPacketToEveryone(AnimatedEventMessage packetIn) { CHANNEL.send(PacketDistributor.ALL.noArg(), packetIn); } - public static void sendPacketToDimension(DimensionType dimension, IPacket packetIn) { + public static void sendPacketToDimension(AnimatedEventMessage packetIn, DimensionType dimension) { CHANNEL.send(PacketDistributor.DIMENSION.with(() -> dimension), packetIn); } - public static void sendToAllAround(IPacket packetIn, PacketDistributor.TargetPoint targetPoint) { + public static void sendToAllAround(AnimatedEventMessage packetIn, PacketDistributor.TargetPoint targetPoint) { CHANNEL.send(PacketDistributor.NEAR.with(() -> targetPoint), packetIn); } - } diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/ClientIAnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/ClientIAnimatedEventMessage.java deleted file mode 100644 index 7400014..0000000 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/ClientIAnimatedEventMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.leviathanstudio.craftstudio.common.network; - -import java.util.UUID; - -import com.leviathanstudio.craftstudio.CraftStudioApi; -import com.leviathanstudio.craftstudio.client.animation.ClientAnimationHandler; -import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import com.leviathanstudio.craftstudio.common.animation.InfoChannel; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; - -/** - * Message to send an IAnimated event to the client. - * - * @since 0.3.0 - * - * @author Timmypote - */ -public class ClientIAnimatedEventMessage extends IAnimatedEventMessage -{ - /** Constructor */ - public ClientIAnimatedEventMessage() {} - - /** Constructor */ - public ClientIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { - super(event, animated, animId); - } - - /** Constructor */ - public ClientIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { - super(event, animated, animId, keyframeInfo); - } - - /** Constructor */ - public ClientIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { - super(event, animated, animId, keyframeInfo, optAnimId); - } - - /** Constructor */ - public ClientIAnimatedEventMessage(IAnimatedEventMessage eventObj) { - super(eventObj); - } - - /** - * Handler for IAnimated event messages send to the client. - * - * @since 0.3.0 - * - * @author Timmypote - */ - public static class ClientIAnimatedEventHandler extends IAnimatedEventHandler - implements IMessageHandler - { - @Override - public ServerIAnimatedEventMessage onMessage(ClientIAnimatedEventMessage message, MessageContext ctx) { - Minecraft.getMinecraft().addScheduledTask(() -> { - if (super.onMessage(message, ctx)) { - boolean succes = message.animated.getAnimationHandler().onClientIAnimatedEvent(message); - if (succes && message.animated.getAnimationHandler() instanceof ClientAnimationHandler - && (message.event == EnumIAnimatedEvent.START_ANIM.getId() || message.event == EnumIAnimatedEvent.STOP_START_ANIM.getId())) { - ClientAnimationHandler hand = (ClientAnimationHandler) message.animated.getAnimationHandler(); - String animName = hand.getAnimNameFromId(message.animId); - InfoChannel infoC = (InfoChannel) hand.getAnimChannels().get(animName); - CraftStudioApi.NETWORK.sendToServer(new ServerIAnimatedEventMessage(EnumIAnimatedEvent.ANSWER_START_ANIM, message.animated, message.animId, infoC.totalFrames)); - } - } - }); - - return null; - } - - @Override - public Entity getEntityByUUID(MessageContext ctx, long most, long least) { - UUID uuid = new UUID(most, least); - for (Entity e : Minecraft.getMinecraft().world.loadedEntityList) - if (e.getPersistentID().equals(uuid)) - return e; - return null; - } - - @Override - public TileEntity getTileEntityByPos(MessageContext ctx, int x, int y, int z) { - BlockPos pos = new BlockPos(x, y, z); - return Minecraft.getMinecraft().world.getTileEntity(pos); - } - } -} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java deleted file mode 100644 index f904c24..0000000 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/IAnimatedEventMessage.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.leviathanstudio.craftstudio.common.network; - -import com.leviathanstudio.craftstudio.CraftStudioApi; -import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import net.minecraft.entity.Entity; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.UUID; -import java.util.function.Supplier; - -/** - * Base class for - * {@link com.leviathanstudio.craftstudio.common.animation.IAnimated IAnimated} - * event messages. - * - * @author Timmypote - * @since 0.3.0 - */ -public class IAnimatedEventMessage implements IPacket { - /** - * The id of the event. See for more info {@link EnumIAnimatedEvent}. - */ - public short event; - /** - * The id of the primary animation. - */ - public short animId; - /** - * The id of the secondary animation, used for stopStart message. - */ - public short optAnimId = -1; - /** - * A float used to transmit keyframe related informations. - */ - public float keyframeInfo = -1; - /** - * The object that is animated - */ - public IAnimated animated; - /** - * Variable that transmit part of the UUID of an Entity. - */ - public long most, least; - /** - * Variable that transmit the position of a TileEntity. - */ - public int x, y, z; - /** - * True, if on message receiving the animated object is an entity. - */ - public boolean hasEntity; - - /** - * Simple empty constructor for packets system. - */ - public IAnimatedEventMessage() { - } - - /** - * Constructor - */ - public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { - if (event != null) - this.event = event.getId(); - this.animated = animated; - this.animId = animId; - } - - /** - * Constructor - */ - public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { - this(event, animated, animId); - this.keyframeInfo = keyframeInfo; - } - - /** - * Constructor - */ - public IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { - this(event, animated, animId, keyframeInfo); - this.optAnimId = optAnimId; - } - - /** - * Constructor - */ - public IAnimatedEventMessage(IAnimatedEventMessage eventObj) { - this(null, eventObj.animated, eventObj.animId, eventObj.keyframeInfo, eventObj.optAnimId); - this.event = eventObj.event; - } - - @Override - public void encode(IAnimatedEventMessage packet, PacketBuffer buffer) { - if (this.event < 0 || this.event >= EnumIAnimatedEvent.ID_COUNT) { - buffer.writeShort(-1); - CraftStudioApi.getLogger().error("Unsuported event id " + this.event + " for network message."); - return; - } - if (this.animated instanceof Entity) { - Entity e = (Entity) this.animated; - buffer.writeShort(this.event); - UUID uuid = e.getUniqueID(); - buffer.writeLong(uuid.getMostSignificantBits()); - buffer.writeLong(uuid.getLeastSignificantBits()); - } else if (this.animated instanceof TileEntity) { - TileEntity te = (TileEntity) this.animated; - buffer.writeShort(this.event + EnumIAnimatedEvent.ID_COUNT); - BlockPos pos = te.getPos(); - buffer.writeInt(pos.getX()); - buffer.writeInt(pos.getY()); - buffer.writeInt(pos.getZ()); - } else { - buffer.writeShort(-1); - CraftStudioApi.getLogger().error("Unsuported class " + this.animated.getClass().getSimpleName() + " for network message."); - CraftStudioApi.getLogger().error("You are trying to animate an other class than Entity or TileEntity."); - return; - } - buffer.writeShort(this.animId); - if (this.event != EnumIAnimatedEvent.STOP_ANIM.getId()) - buffer.writeFloat(this.keyframeInfo); - if (this.event == EnumIAnimatedEvent.STOP_START_ANIM.getId()) - buffer.writeShort(this.optAnimId); - } - - @Override - public IAnimatedEventMessage decode(PacketBuffer buffer) { - short actualEvent = buffer.readShort(); - if (actualEvent < 0 || actualEvent >= 2 * EnumIAnimatedEvent.ID_COUNT) { - this.event = -1; - CraftStudioApi.getLogger().error("Networking error : invalid packet."); - return null; - } else if (actualEvent < EnumIAnimatedEvent.ID_COUNT) { - this.most = buffer.readLong(); - this.least = buffer.readLong(); - this.event = actualEvent; - this.hasEntity = true; - } else { - this.x = buffer.readInt(); - this.y = buffer.readInt(); - this.z = buffer.readInt(); - this.event = (short) (actualEvent - EnumIAnimatedEvent.ID_COUNT); - this.hasEntity = false; - } - this.animId = buffer.readShort(); - if (this.event != 2) - this.keyframeInfo = buffer.readFloat(); - if (this.event > 2) - this.optAnimId = buffer.readShort(); - - //IAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { - return null; - } - - @Override - public void handle(IAnimatedEventMessage packet, Supplier ctxProvider) { - - } - - - /** - * Base class for the messages handler. - * - * @author Timmypote - * @since 0.3.0 - */ - public static abstract class IAnimatedEventHandler { - - /** - * Extract the Entity or TileEntity when a message is received. - * - * @param message The message received. - * @param ctx The context of the message. - * @return True, if the Entity/TileEntity was successfully extracted. - * False, otherwise. - */ - public boolean onMessage(IAnimatedEventMessage message, Supplier ctx) { - if (message.hasEntity) { - Entity e = this.getEntityByUUID(ctx, message.most, message.least); - if (!(e instanceof IAnimated)) { - CraftStudioApi.getLogger().debug("Networking error : invalid entity."); - return false; - } - message.animated = (IAnimated) e; - } else { - TileEntity te = this.getTileEntityByPos(ctx, message.x, message.y, message.z); - if (!(te instanceof IAnimated)) { - CraftStudioApi.getLogger().debug("Networking error : invalid tile entity."); - return false; - } - message.animated = (IAnimated) te; - } - return true; - } - - /** - * Get an entity by its UUID. - * - * @param ctx The context of the message received. - * @param most The most significants bits of the UUID. - * @param least The least significants bits of the UUID. - * @return The Entity, null if it couldn't be found. - */ - public abstract Entity getEntityByUUID(Supplier ctx, long most, long least); - - /** - * Get a TileEntity by its position. - * - * @param ctx The context of the message received. - * @param x The position on the x axis. - * @param y The position on the y axis. - * @param z The position on the z axis. - * @return The TileEntity, null if it couldn't be found. - */ - public abstract TileEntity getTileEntityByPos(Supplier ctx, int x, int y, int z); - } -} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java deleted file mode 100644 index 0e9a6e8..0000000 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/IPacket.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.leviathanstudio.craftstudio.common.network; - -import net.minecraft.network.PacketBuffer; -import net.minecraftforge.fml.network.NetworkEvent; - -import java.util.function.Supplier; - -public interface IPacket { - - void encode(T packet, PacketBuffer buffer); - - T decode(PacketBuffer buffer); - - void handle(T packet, Supplier ctxProvider); - -} diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java b/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java deleted file mode 100644 index f9396a4..0000000 --- a/src/main/java/com/leviathanstudio/craftstudio/common/network/ServerIAnimatedEventMessage.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.leviathanstudio.craftstudio.common.network; - -import com.leviathanstudio.craftstudio.CraftStudioApi; -import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; -import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; - -import java.util.UUID; - -/** - * Message to send an IAnimated event to the server. - * - * @author Timmypote - * @since 0.3.0 - */ -public class ServerIAnimatedEventMessage extends IAnimatedEventMessage { - /** - * Constructor - */ - public ServerIAnimatedEventMessage() { - } - - /** - * Constructor - */ - public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId) { - super(event, animated, animId); - } - - /** - * Constructor - */ - public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo) { - super(event, animated, animId, keyframeInfo); - } - - /** - * Constructor - */ - public ServerIAnimatedEventMessage(EnumIAnimatedEvent event, IAnimated animated, short animId, float keyframeInfo, short optAnimId) { - super(event, animated, animId, keyframeInfo, optAnimId); - } - - /** - * Constructor - */ - public ServerIAnimatedEventMessage(IAnimatedEventMessage eventObj) { - super(eventObj); - } - - /** - * Handler for IAnimated event messages send to the server. - * - * @author Timmypote - * @since 0.3.0 - */ - public static class ServerIAnimatedEventHandler extends IAnimatedEventHandler - implements IMessageHandler { - @Override - public ClientIAnimatedEventMessage onMessage(ServerIAnimatedEventMessage message, MessageContext ctx) { - FMLCommonHandler.instance().getMinecraftServerInstance().addScheduledTask(() -> { - if (super.onMessage(message, ctx)) { - EntityPlayerMP player = ctx.getServerHandler().player; - message.animated.getAnimationHandler(); - boolean succes = AnimationHandler.onServerIAnimatedEvent(message); - if (succes && message.event != EnumIAnimatedEvent.ANSWER_START_ANIM.getId()) - CraftStudioApi.NETWORK.sendTo(new ClientIAnimatedEventMessage(message), player); - } - }); - - return null; - } - - @Override - public Entity getEntityByUUID(MessageContext ctx, long most, long least) { - UUID uuid = new UUID(most, least); - for (Entity e : ctx.getServerHandler().player.world.loadedEntityList) - if (e.getPersistentID().equals(uuid)) - return e; - return null; - } - - @Override - public TileEntity getTileEntityByPos(MessageContext ctx, int x, int y, int z) { - BlockPos pos = new BlockPos(x, y, z); - return ctx.getServerHandler().player.world.getTileEntity(pos); - } - } -} diff --git a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java index 702cede..da1175a 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java +++ b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSCommonProxy.java @@ -2,6 +2,10 @@ import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; +import com.leviathanstudio.craftstudio.common.network.AnimatedEventMessage; +import com.leviathanstudio.craftstudio.common.network.AnimatedEventMessageUtil; +import com.leviathanstudio.craftstudio.common.network.CSNetworkHelper; + import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @@ -19,6 +23,7 @@ public void clientSetup(FMLClientSetupEvent event) { //TODO Register packets public void commonSetup(FMLCommonSetupEvent event) { + CSNetworkHelper.CHANNEL.registerMessage(1, AnimatedEventMessage.class, AnimatedEventMessageUtil.ENCODER, AnimatedEventMessageUtil.DECODER, AnimatedEventMessageUtil.HANDLER); //CSNetworkHelper.CHANNEL.registerMessage(ClientIAnimatedEventHandler.class, ClientIAnimatedEventMessage.class, 0, Side.CLIENT); //CraftStudioApi.NETWORK.registerMessage(ServerIAnimatedEventHandler.class, ServerIAnimatedEventMessage.class, 1, Side.SERVER); } From b011997131a4f6701b7c3d85fb131800e312ea33 Mon Sep 17 00:00:00 2001 From: ZeAmateis Date: Wed, 21 Aug 2019 16:46:05 +0200 Subject: [PATCH 3/9] + Added mods.toml ~ Try to implements dev test mod, but need to edit build.gradle --- .../craftstudio/CraftStudioApi.java | 40 ++++++++++++++++++- .../craftstudio/proxy/CSClientProxy.java | 35 ---------------- src/main/resources/META-INF/mods.toml | 27 +++++++++++++ src/main/resources/mcmod.info | 16 -------- 4 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 src/main/resources/META-INF/mods.toml delete mode 100644 src/main/resources/mcmod.info diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index b44c389..11d2ed5 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -1,20 +1,23 @@ package com.leviathanstudio.craftstudio; +import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; +import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; import com.leviathanstudio.craftstudio.proxy.CSClientProxy; import com.leviathanstudio.craftstudio.proxy.CSCommonProxy; import com.leviathanstudio.craftstudio.proxy.CSServerProxy; - +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.lang.reflect.Method; + /** * Main class of the CraftStudioApi * @@ -32,6 +35,7 @@ public class CraftStudioApi { public CraftStudioApi() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); + MinecraftForge.EVENT_BUS.register(this); } public static Logger getLogger() { @@ -52,10 +56,42 @@ public static AnimationHandler getNewAnimationHandler(C public void clientSetup(FMLClientSetupEvent event) { CraftStudioApi.proxy.clientSetup(event); + loadCraftStudioLoaders(event); } public void commonSetup(FMLCommonSetupEvent event) { CraftStudioApi.proxy.commonSetup(event); } + public void loadCraftStudioLoaders(FMLClientSetupEvent event) { + String methodName, className; + Method method; + + RegistryHandler.init(); + + + //TODO Work on annotations or other way to register models + /*ASMDataTable dataTable = event + Set datas = dataTable.getAll("com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader"); + for (ASMData data : datas) { + className = data.getClassName(); + methodName = data.getObjectName().substring(0, data.getObjectName().indexOf("(")); + try { + method = Class.forName(className).getMethod(methodName); + method.invoke(null); + } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e1) { + e1.printStackTrace(); + CraftStudioApi.getLogger().error("Error loading @CraftStudioLoader in class " + className + " for method " + methodName + "()."); + CraftStudioApi.getLogger().error("Does that method has arguments ? Because it should have none."); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException e1) { + e1.printStackTrace(); + CraftStudioApi.getLogger().error("Error loading craftstudio assets in class " + className + " for method " + methodName + "()."); + CraftStudioApi.getLogger().error("Is that method 'static' ? Because it should."); + } + }*/ + + CSRegistryHelper.loadModels(); + CSRegistryHelper.loadAnims(); + } + } \ No newline at end of file diff --git a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java index fdef192..bfeb168 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java +++ b/src/main/java/com/leviathanstudio/craftstudio/proxy/CSClientProxy.java @@ -1,14 +1,10 @@ package com.leviathanstudio.craftstudio.proxy; import com.leviathanstudio.craftstudio.client.animation.ClientAnimationHandler; -import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; -import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import java.lang.reflect.Method; - /** * Client proxy of the CraftStudioApi * @@ -22,7 +18,6 @@ public class CSClientProxy extends CSCommonProxy { @Override public void clientSetup(FMLClientSetupEvent e) { super.clientSetup(e); - this.loadCraftStudioLoaders(e); } @Override @@ -30,34 +25,4 @@ public AnimationHandler getNewAnimationHandler(Class return new ClientAnimationHandler<>(); } - private void loadCraftStudioLoaders(FMLClientSetupEvent e) { - String methodName, className; - Method method; - - RegistryHandler.init(); - - //TODO Work on annotations or other way to register models - /*ASMDataTable dataTable = e.getAsmData(); - Set datas = dataTable.getAll("com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader"); - for (ASMData data : datas) { - className = data.getClassName(); - methodName = data.getObjectName().substring(0, data.getObjectName().indexOf("(")); - try { - method = Class.forName(className).getMethod(methodName); - method.invoke(null); - } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e1) { - e1.printStackTrace(); - CraftStudioApi.getLogger().error("Error loading @CraftStudioLoader in class " + className + " for method " + methodName + "()."); - CraftStudioApi.getLogger().error("Does that method has arguments ? Because it should have none."); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException e1) { - e1.printStackTrace(); - CraftStudioApi.getLogger().error("Error loading craftstudio assets in class " + className + " for method " + methodName + "()."); - CraftStudioApi.getLogger().error("Is that method 'static' ? Because it should."); - } - }*/ - - CSRegistryHelper.loadModels(); - CSRegistryHelper.loadAnims(); - } - } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..0896a68 --- /dev/null +++ b/src/main/resources/META-INF/mods.toml @@ -0,0 +1,27 @@ + +modLoader="javafml" #mandatory +loaderVersion="[28,)" #mandatory (26 is current forge version) +issueTrackerURL="https://github.com/Leviathan-Studio/CraftStudioAPI" #optional +[[mods]] #mandatory +modId="craftstudioapi" #mandatory +version="${file.jarVersion}" #mandatory +displayName="CraftStudio API" #mandatory +updateJSONURL="https://leviathan-studio.com/craftstudioapi/update.json" #optional +#displayURL="http://example.com/" #optional +#logoFile="examplemod.png" #optional +credits="See https://github.com/Leviathan-Studio/CraftStudioAPI/blob/master/CREDITS.md" #optional +authors="ZeAmateis, Timmypote, Elisee, IncubeSupreme, Phenix246" #optional +description='''A CraftStudio API for models/animations support in Minecraft''' + +[[dependencies.craftstudioapi]] #optional + modId="forge" #mandatory + mandatory=true #mandatory + versionRange="[28,)" #mandatory + ordering="NONE" + side="BOTH" +[[dependencies.craftstudioapi]] + modId="minecraft" + mandatory=true + versionRange="[1.14.4]" + ordering="NONE" + side="BOTH" diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info deleted file mode 100644 index 604590d..0000000 --- a/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "craftstudioapi", - "name": "CraftStudio API", - "description": "A CraftStudio API for models/animations support in Minecraft", - "version": "${version}", - "mcversion": "${mcversion}", - "url": "", - "updateJSON": "https://leviathan-studio.com/craftstudioapi/update.json", - "authorList": ["ZeAmateis", "Timmypote", "Elisee", "IncubeSupreme", "Phenix246"], - "credits": "See https://github.com/Leviathan-Studio/CraftStudioAPI/blob/master/CREDITS.md", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} -] From 9a4afdb50f6155214dca76d65f30c13302bd1c83 Mon Sep 17 00:00:00 2001 From: ZeAmateis Date: Wed, 21 Aug 2019 18:32:58 +0200 Subject: [PATCH 4/9] + Start rework on Registries --- .../craftstudio/CraftStudioApi.java | 58 +- .../craftstudio/client/json/CSJsonReader.java | 7 + .../craftstudio/client/json/CSReadedAnim.java | 1 + .../client/json/CSReadedModel.java | 2 + .../client/registry/AssetAnimation.java | 93 + .../client/registry/AssetModel.java | 92 + .../client/registry/CSRegistryHelper.java | 12 +- .../registry/CraftStudioAssetsEvent.java | 20 + .../client/registry/CraftStudioLoader.java | 24 - .../animations/blocks/offset.csjsmodelanim | 28 + .../animations/blocks/position.csjsmodelanim | 24 + .../animations/blocks/rotation.csjsmodelanim | 26 + .../animations/blocks/size.csjsmodelanim | 21 + .../animations/blocks/streching.csjsmodelanim | 22 + .../animations/entity/fly.csjsmodelanim | 250 +++ .../animations/entity/idle.csjsmodelanim | 542 +++++ .../blocks/craftstudio_api_test.csjsmodel | 14 + .../blocks/craftstudio_api_test2.csjsmodel | 24 + .../models/entity/dragon_brun.csjsmodel | 1933 +++++++++++++++++ .../models/entity/model_dead_corpse.csjsmodel | 129 ++ .../textures/block/block_test.png | Bin 0 -> 480 bytes .../textures/entity/craftstudio_api_test.png | Bin 0 -> 494 bytes .../textures/entity/deadmau5.png | Bin 0 -> 3781 bytes .../textures/entity/dragon_brun.png | Bin 0 -> 18475 bytes src/main/resources/pack.mcmeta | 7 + .../leviathanstudio/test/common/Mod_Test.java | 2 +- .../test/common/RegistryHandler.java | 8 +- 27 files changed, 3277 insertions(+), 62 deletions(-) create mode 100644 src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetAnimation.java create mode 100644 src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java create mode 100644 src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioAssetsEvent.java delete mode 100644 src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/offset.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/position.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/rotation.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/size.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/streching.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/fly.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/idle.csjsmodelanim create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test.csjsmodel create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test2.csjsmodel create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/models/entity/dragon_brun.csjsmodel create mode 100644 src/main/resources/assets/craftstudioapi/craftstudio/models/entity/model_dead_corpse.csjsmodel create mode 100644 src/main/resources/assets/craftstudioapi/textures/block/block_test.png create mode 100644 src/main/resources/assets/craftstudioapi/textures/entity/craftstudio_api_test.png create mode 100644 src/main/resources/assets/craftstudioapi/textures/entity/deadmau5.png create mode 100644 src/main/resources/assets/craftstudioapi/textures/entity/dragon_brun.png create mode 100644 src/main/resources/pack.mcmeta diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index 11d2ed5..7d31c6b 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -1,23 +1,30 @@ package com.leviathanstudio.craftstudio; +import com.leviathanstudio.craftstudio.client.registry.AssetAnimation; +import com.leviathanstudio.craftstudio.client.registry.AssetModel; import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; +import com.leviathanstudio.craftstudio.client.util.EnumRenderType; +import com.leviathanstudio.craftstudio.client.util.EnumResourceType; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; import com.leviathanstudio.craftstudio.proxy.CSClientProxy; import com.leviathanstudio.craftstudio.proxy.CSCommonProxy; import com.leviathanstudio.craftstudio.proxy.CSServerProxy; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.IForgeRegistry; +import net.minecraftforge.registries.RegistryBuilder; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.lang.reflect.Method; - /** * Main class of the CraftStudioApi * @@ -32,6 +39,10 @@ public class CraftStudioApi { private static final Logger LOGGER = LogManager.getLogger("CraftStudio"); private static CSCommonProxy proxy = DistExecutor.runForDist(() -> CSClientProxy::new, () -> CSServerProxy::new); + private static IForgeRegistry modelRegistry = null; + private static IForgeRegistry animationRegistry = null; + AssetModel testModel = new AssetModel(EnumResourceType.MODEL, EnumRenderType.BLOCK, new ResourceLocation(API_ID, "craftstudio_api_test")); + public CraftStudioApi() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); @@ -63,35 +74,32 @@ public void commonSetup(FMLCommonSetupEvent event) { CraftStudioApi.proxy.commonSetup(event); } - public void loadCraftStudioLoaders(FMLClientSetupEvent event) { - String methodName, className; - Method method; + @SubscribeEvent + public void onRegisterModel(RegistryEvent.Register event) { + event.getRegistry().register(testModel.setRegistryName("test", "test_model")); + } - RegistryHandler.init(); + @SubscribeEvent + public void onCreateRegistry(RegistryEvent.NewRegistry event) { + RegistryBuilder modelBuilder = new RegistryBuilder<>(); + RegistryBuilder animationBuilder = new RegistryBuilder<>(); + modelBuilder.setName(new ResourceLocation(API_ID, "models")); + modelBuilder.setType(AssetModel.class); + modelBuilder.setIDRange(0, 10_000); + modelRegistry = modelBuilder.create(); - //TODO Work on annotations or other way to register models - /*ASMDataTable dataTable = event - Set datas = dataTable.getAll("com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader"); - for (ASMData data : datas) { - className = data.getClassName(); - methodName = data.getObjectName().substring(0, data.getObjectName().indexOf("(")); - try { - method = Class.forName(className).getMethod(methodName); - method.invoke(null); - } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e1) { - e1.printStackTrace(); - CraftStudioApi.getLogger().error("Error loading @CraftStudioLoader in class " + className + " for method " + methodName + "()."); - CraftStudioApi.getLogger().error("Does that method has arguments ? Because it should have none."); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException e1) { - e1.printStackTrace(); - CraftStudioApi.getLogger().error("Error loading craftstudio assets in class " + className + " for method " + methodName + "()."); - CraftStudioApi.getLogger().error("Is that method 'static' ? Because it should."); - } - }*/ + animationBuilder.setName(new ResourceLocation(API_ID, "animations")); + animationBuilder.setType(AssetAnimation.class); + animationBuilder.setIDRange(0, 10_000); + animationRegistry = animationBuilder.create(); + } + public void loadCraftStudioLoaders(FMLClientSetupEvent event) { + RegistryHandler.init(); CSRegistryHelper.loadModels(); CSRegistryHelper.loadAnims(); } + } \ No newline at end of file diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java index d3c21d4..75c2439 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSJsonReader.java @@ -18,6 +18,7 @@ import javax.vecmath.Vector3f; import java.io.BufferedReader; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStreamReader; import java.util.Map.Entry; @@ -57,6 +58,12 @@ public CSJsonReader(ResourceLocation resourceIn) throws CSResourceNotFoundExcept StringBuilder strBuilder = new StringBuilder(); this.ress = resourceIn.toString(); + try { + System.out.println(Minecraft.getInstance().getResourceManager().getResource(resourceIn).getLocation()); + } catch (IOException ex) { + ex.printStackTrace(); + } + try { iResource = Minecraft.getInstance().getResourceManager().getResource(resourceIn); reader = new BufferedReader(new InputStreamReader(iResource.getInputStream(), Charsets.UTF_8)); diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java index 59f978d..3ee243c 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedAnim.java @@ -75,4 +75,5 @@ public void setBlocks(List blocks) { this.blocks = blocks; } + } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java index 24ff4a2..810ec3d 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/json/CSReadedModel.java @@ -14,6 +14,7 @@ */ @OnlyIn(Dist.CLIENT) public class CSReadedModel { + private String name; private int textureWidth, textureHeight; private List parents = new ArrayList<>(); @@ -95,4 +96,5 @@ public List getParents() { public void setParents(List parents) { this.parents = parents; } + } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetAnimation.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetAnimation.java new file mode 100644 index 0000000..4d3697b --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetAnimation.java @@ -0,0 +1,93 @@ +package com.leviathanstudio.craftstudio.client.registry; + +import com.google.common.reflect.TypeToken; +import com.leviathanstudio.craftstudio.CraftStudioApi; +import com.leviathanstudio.craftstudio.client.exception.CSMalformedJsonException; +import com.leviathanstudio.craftstudio.client.exception.CSResourceNotFoundException; +import com.leviathanstudio.craftstudio.client.json.CSJsonReader; +import com.leviathanstudio.craftstudio.client.json.CSReadedAnim; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.registries.GameData; +import net.minecraftforge.registries.IForgeRegistryEntry; + +import javax.annotation.Nullable; + +public class AssetAnimation extends CSReadedAnim implements IForgeRegistryEntry { + private final TypeToken token = new TypeToken(getClass()) { + }; + private ResourceLocation registryName = null; + + + public AssetAnimation(ResourceLocation assetIn) { + CSJsonReader jsonReader; + try { + jsonReader = new CSJsonReader(assetIn); + if (assetIn.getNamespace() != CraftStudioApi.API_ID) { + RegistryHandler.register(assetIn, jsonReader.readAnim()); + } else + CraftStudioApi.getLogger().fatal("You're not allowed to use the \"craftstudioapi\" to register CraftStudio resources."); + } catch (CSResourceNotFoundException | CSMalformedJsonException e) { + e.printStackTrace(); + } + } + + + /** + * A unique identifier for this entry, if this entry is registered already it will return it's official registry name. + * Otherwise it will return the name set in setRegistryName(). + * If neither are valid null is returned. + * + * @return Unique identifier or null. + */ + @Nullable + @Override + public ResourceLocation getRegistryName() { + return registryName != null ? registryName : null; + } + + /** + * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. + * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. + * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. + *

+ * The supplied name will be prefixed with the currently active mod's modId. + * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. + *

+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. + *

+ * Returns 'this' to allow for chaining. + * + * @param name Unique registry name + * @return This instance + */ + @Override + public final AssetAnimation setRegistryName(ResourceLocation name) { + return setRegistryName(name.toString()); + } + + + public final AssetAnimation setRegistryName(String name) { + if (getRegistryName() != null) + throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); + + this.registryName = GameData.checkPrefix(name, true); + return (AssetAnimation) this; + } + + + public final AssetAnimation setRegistryName(String modID, String name) { + return setRegistryName(modID + ":" + name); + } + + + /** + * Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one + * registry per concrete class. + * + * @return Root registry type. + */ + @Override + public Class getRegistryType() { + return (Class) token.getRawType(); + } +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java new file mode 100644 index 0000000..604aa45 --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java @@ -0,0 +1,92 @@ +package com.leviathanstudio.craftstudio.client.registry; + +import com.google.common.reflect.TypeToken; +import com.leviathanstudio.craftstudio.client.exception.CSMalformedJsonException; +import com.leviathanstudio.craftstudio.client.exception.CSResourceNotFoundException; +import com.leviathanstudio.craftstudio.client.json.CSJsonReader; +import com.leviathanstudio.craftstudio.client.json.CSReadedModel; +import com.leviathanstudio.craftstudio.client.util.EnumRenderType; +import com.leviathanstudio.craftstudio.client.util.EnumResourceType; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.registries.GameData; +import net.minecraftforge.registries.IForgeRegistryEntry; + +import javax.annotation.Nullable; + +public class AssetModel extends CSReadedModel implements IForgeRegistryEntry { + private final TypeToken token = new TypeToken(getClass()) { + }; + private ResourceLocation registryName = null; + + + public AssetModel(EnumResourceType resourceType, EnumRenderType renderType, ResourceLocation assetIn) { + CSJsonReader jsonReader; + try { + ResourceLocation parsedPath = new ResourceLocation(assetIn.getNamespace(), resourceType.getPath() + renderType.getFolderName() + assetIn.getPath() + resourceType.getExtension()); + jsonReader = new CSJsonReader(parsedPath); + //if (assetIn.getNamespace() != CraftStudioApi.API_ID) { + jsonReader.readModel(); + //} else + // CraftStudioApi.getLogger().fatal("You're not allowed to use the \"craftstudioapi\" to register CraftStudio resources."); + } catch (CSResourceNotFoundException | CSMalformedJsonException e) { + e.printStackTrace(); + } + } + + + /** + * A unique identifier for this entry, if this entry is registered already it will return it's official registry name. + * Otherwise it will return the name set in setRegistryName(). + * If neither are valid null is returned. + * + * @return Unique identifier or null. + */ + @Nullable + @Override + public ResourceLocation getRegistryName() { + return registryName != null ? registryName : null; + } + + /** + * Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. + * This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. + * Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. + *

+ * The supplied name will be prefixed with the currently active mod's modId. + * If the supplied name already has a prefix that is different, it will be used and a warning will be logged. + *

+ * If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. + *

+ * Returns 'this' to allow for chaining. + * + * @param name Unique registry name + * @return This instance + */ + public final AssetModel setRegistryName(String name) { + if (getRegistryName() != null) + throw new IllegalStateException("Attempted to set registry name with existing registry name! New: " + name + " Old: " + getRegistryName()); + + this.registryName = GameData.checkPrefix(name, true); + return (AssetModel) this; + } + + @Override + public final AssetModel setRegistryName(ResourceLocation name) { + return setRegistryName(name.toString()); + } + + public final AssetModel setRegistryName(String modID, String name) { + return setRegistryName(modID + ":" + name); + } + + /** + * Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one + * registry per concrete class. + * + * @return Root registry type. + */ + @Override + public Class getRegistryType() { + return (Class) token.getRawType(); + } +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java index 1c68469..950008a 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java @@ -26,13 +26,8 @@ public class CSRegistryHelper { private static List loadAnimList = new ArrayList(); private String modid; - /** - * Constructor for the registry - * - * @param modid Define the ID of your mod - */ - public CSRegistryHelper(String modid) { - this.modid = modid; + + public CSRegistryHelper() { } /** @@ -40,7 +35,7 @@ public CSRegistryHelper(String modid) { * * @param resourceTypeIn Set your resource type,
* {@link EnumResourceType#ANIM} for animation,
- * {@link EnumResourceType#MODELS} for models
+ * {@link EnumResourceType#MODEL} for models
*
* @param resourceLocationIn Custom location of your resource * @param resourceNameIn The name of your resource in assets without extension @@ -143,6 +138,7 @@ private static void capitalCheck(String str) { } } + /** * Pre-register your resource. * diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioAssetsEvent.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioAssetsEvent.java new file mode 100644 index 0000000..6a95439 --- /dev/null +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioAssetsEvent.java @@ -0,0 +1,20 @@ +package com.leviathanstudio.craftstudio.client.registry; + +import net.minecraftforge.eventbus.api.Event; + +public class CraftStudioAssetsEvent extends Event { + + + /** + * Determine if this function is cancelable at all. + * + * @return If access to setCanceled should be allowed + *

+ * Note: + * Events with the Cancelable annotation will have this method automatically added to return true. + */ + @Override + public boolean isCancelable() { + return false; + } +} diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java deleted file mode 100644 index a787bac..0000000 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CraftStudioLoader.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.leviathanstudio.craftstudio.client.registry; - -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Annotation to indicate that the method it is applied on should be called - * during the loading of CraftStudio assets. Must be applied on a 'static' - * method with no arguments. - * - * @author Timmypote - * @since 1.0.0 - */ -@OnlyIn(Dist.CLIENT) -@Retention(RUNTIME) -@Target(METHOD) -public @interface CraftStudioLoader { -} diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/offset.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/offset.csjsmodelanim new file mode 100644 index 0000000..315fac1 --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/offset.csjsmodelanim @@ -0,0 +1,28 @@ +{ + "title": "Offset", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Block": { + "position": { + }, + "offsetFromPivot": { + "0": [ 0, 0, 0 ], + "4": [ -15, 0, 0 ], + "16": [ -30, 0, 0 ], + "30": [ -50, 0, 0 ], + "44": [ -30, 0, 0 ], + "56": [ -15, 0, 0 ] + }, + "size": { + }, + "rotation": { + "0": [ 0, 0, 0 ], + "20": [ 0, 120, 0 ], + "40": [ -360, -120, 0 ] + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/position.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/position.csjsmodelanim new file mode 100644 index 0000000..1585c6e --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/position.csjsmodelanim @@ -0,0 +1,24 @@ +{ + "title": "Position", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Block": { + "position": { + "0": [ 0, 0, 0 ], + "10": [ 0, 15, 0 ], + "30": [ 0, 15, 15 ], + "50": [ 0, 0, 15 ], + "60": [ 0, 0, 0 ] + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/rotation.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/rotation.csjsmodelanim new file mode 100644 index 0000000..617f512 --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/rotation.csjsmodelanim @@ -0,0 +1,26 @@ +{ + "title": "Rotation", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Block": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 0, 0, 0 ], + "10": [ 90, 0, 0 ], + "20": [ 90, 90, 0 ], + "30": [ 45, 89.99999, 0 ], + "40": [ 45, 45, 6.74449E-07 ], + "50": [ 0, 45, 0 ], + "60": [ 0, 0, 0 ] + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/size.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/size.csjsmodelanim new file mode 100644 index 0000000..308846f --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/size.csjsmodelanim @@ -0,0 +1,21 @@ +{ + "title": "Size", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Block": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + "0": [ 0, 0, 0 ], + "30": [ 512, 512, 512 ] + }, + "rotation": { + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/streching.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/streching.csjsmodelanim new file mode 100644 index 0000000..74c717c --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/blocks/streching.csjsmodelanim @@ -0,0 +1,22 @@ +{ + "title": "Streching", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Block": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + }, + "stretch": { + "0": [ 0, 1, -0.5 ], + "20": [ 1, -0.5, 0 ], + "40": [ -0.5, 0, 1 ] + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/fly.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/fly.csjsmodelanim new file mode 100644 index 0000000..1b782b3 --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/fly.csjsmodelanim @@ -0,0 +1,250 @@ +{ + "title": "Fly", + "duration": 120, + "holdLastKeyframe": false, + "nodeAnimations": { + "Aile13": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 3.291526E-07, -3.761236E-07, 30 ], + "60": [ -4.808296E-07, -1.222556E-06, -30 ] + }, + "stretch": { + } + }, + "Aile2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 7.642279E-07, 7.395585E-07, -30 ], + "60": [ -5.275069E-08, 1.601725E-06, 30 ] + }, + "stretch": { + } + }, + "Aile 1_23": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -40.33549, 13.12927, -39.47359 ], + "30": [ -0.003967197, -0.0002578979, -0.001361898 ], + "60": [ 19.73745, 3.63261, 10.48193 ], + "90": [ -25.29968, 8.267124, -19.52541 ] + }, + "stretch": { + } + }, + "Aile 2.2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -40.33549, -13.12927, 39.47359 ], + "30": [ -0.003967197, 0.0002578979, 0.001361898 ], + "60": [ 19.73745, -3.63261, -10.48193 ], + "90": [ -25.29968, -8.267124, 19.52541 ] + }, + "stretch": { + } + }, + "AileBranche116": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 45.00003, -13.72258, -30.00002 ], + "30": [ 1.716233E-05, -0.002573994, 2.260436E-07 ], + "60": [ 7.00002, -0.7225692, -3.000001 ] + }, + "stretch": { + } + }, + "AileBranche1.25616": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 45.00003, 13.72258, 30.00002 ], + "30": [ 1.716233E-05, 0.002573994, -2.260436E-07 ], + "60": [ 7.00002, 0.7225692, 3.000001 ] + }, + "stretch": { + } + }, + "Queue2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -2.910305, 13.26382, 0.5369502 ], + "60": [ -2.905939, -13.26874, -0.0001595522 ] + }, + "stretch": { + } + }, + "Queue3": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -3.848111, 3.938147, 0.4985428 ], + "60": [ -3.848873, -3.091373, 0.0005935003 ] + }, + "stretch": { + } + }, + "Queue4": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 2.624762, 4.204419, 0.1928858 ], + "60": [ 0.001829665, -4.184887, -0.0001338744 ] + }, + "stretch": { + } + }, + "Queue5": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 0.0004375024, -5.629999, -0.003000514 ], + "60": [ 0.0005822151, 5.632043, 5.741543E-05 ] + }, + "stretch": { + } + }, + "Queue6": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -0.002708734, 8.376065, 0.5173528 ], + "60": [ -0.003822795, -8.37129, 0.0005625481 ] + }, + "stretch": { + } + }, + "Queue7": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 0.002702838, 10.52605, 1.435099 ], + "60": [ -0.001400483, -10.52523, 0.0002601927 ] + }, + "stretch": { + } + }, + "Coup128": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -5.565439, 0, 0 ], + "60": [ 0.003037606, 0, 0 ] + }, + "stretch": { + } + }, + "Coup229": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -6.341984, 0, 0 ], + "60": [ 0.002954404, 0, 0 ] + }, + "stretch": { + } + }, + "Coup330": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 3.725061, 0, 0 ], + "60": [ 0.003234291, 0, 0 ] + }, + "stretch": { + } + }, + "Tete31": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 4.102807, 0, 0 ], + "60": [ -6.402161E-07, 0, 0 ] + }, + "stretch": { + } + }, + "Corp1": { + "position": { + "2": [ 0, 13, 0 ] + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/idle.csjsmodelanim b/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/idle.csjsmodelanim new file mode 100644 index 0000000..4de653c --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/animations/entity/idle.csjsmodelanim @@ -0,0 +1,542 @@ +{ + "title": "Idle", + "duration": 60, + "holdLastKeyframe": false, + "nodeAnimations": { + "Corp": { + "position": { + "0": [ 0, -7, 0 ] + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -6.95448, 0, 0 ] + }, + "stretch": { + } + }, + "Jambe G 2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 88.4198, 0, 0 ] + }, + "stretch": { + } + }, + "Patte G": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -31.88758, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 31": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -62.55437, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 11": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -62.5258, 0, 0 ] + }, + "stretch": { + } + }, + "Patte GDansTonCulMonGars": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -76.10495, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 21": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -62.56549, 0, 0 ] + }, + "stretch": { + } + }, + "Jambe G 24": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 86.37075, 0, 0 ] + }, + "stretch": { + } + }, + "Patte GToiAussiEncule": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -75.88501, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 115": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -62.39467, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 218": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -62.56549, 0, 0 ] + }, + "stretch": { + } + }, + "Doigt 315": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 297.4959, 0, 0 ] + }, + "stretch": { + } + }, + "Corp1": { + "position": { + "0": [ 0, -2, 0 ] + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + }, + "stretch": { + } + }, + "Doigt 124": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.69234, -0.00093032, 0.0009806722 ] + }, + "stretch": { + } + }, + "Doigt 229": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.8, 3.426467E-08, -2.645391E-08 ] + }, + "stretch": { + } + }, + "Doigt 326": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.85166, -9.335115E-08, 1.032376E-06 ] + }, + "stretch": { + } + }, + "Doigt 325624": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.85166, 9.335115E-08, -1.032376E-06 ] + }, + "stretch": { + } + }, + "Doigt 22": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.8, -3.426467E-08, 2.645391E-08 ] + }, + "stretch": { + } + }, + "Doigt 12": { + "position": { + "0": [ 0, -0.0008046627, 1.587085E-06 ] + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -13.68662, -0.2860991, 0.03135122 ] + }, + "stretch": { + } + }, + "Queue1": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -7.605498, 0, 0 ] + }, + "stretch": { + } + }, + "Queue2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -9.66692, 0, 0 ] + }, + "stretch": { + } + }, + "Queue3": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -3.591036, 0.004510937, 0.0005610722 ], + "30": [ -3.561704, 7.298983, -0.4549873 ] + }, + "stretch": { + } + }, + "Queue4": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -8.872405, -11.33216, 1.7704 ], + "30": [ 8.492069, 9.083971, -1.488779 ] + }, + "stretch": { + } + }, + "Queue5": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -11.06903, -14.00055, 2.740704 ], + "30": [ -11.15722, 12.02902, -2.35928 ] + }, + "stretch": { + } + }, + "Queue6": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 11.04499, -23.07582, -4.666147 ], + "30": [ 11.46751, 16.99657, 3.481989 ] + }, + "stretch": { + } + }, + "Queue7": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -7.741637, -23.45368, 3.344707 ], + "30": [ -7.882482, 20.82449, -2.985341 ] + }, + "stretch": { + } + }, + "Aile2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 29.65776, -15.23403, 14.90397 ], + "30": [ 36.75339, -11.90225, 8.362887 ] + }, + "stretch": { + } + }, + "Aile13": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 29.67346, 14.85071, -14.08584 ], + "4": [ 30.83915, 14.32192, -13.13631 ], + "30": [ 36.75338, 11.90225, -8.362885 ] + }, + "stretch": { + } + }, + "Aile 2.2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -0.004115467, 30.0765, -0.0008094828 ] + }, + "stretch": { + } + }, + "AileBranche2.2": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 7.013703E-06, -36.69177, -1.641257E-05 ] + }, + "stretch": { + } + }, + "AileBranche1.25616": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 1.413958E-05, -33.77565, -9.729792E-06 ] + }, + "stretch": { + } + }, + "AileBranche24": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 1.042858E-05, 24.07793, 1.448479E-05 ] + }, + "stretch": { + } + }, + "AileBranche116": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 1.562372E-05, 23.70007, 7.106058E-06 ] + }, + "stretch": { + } + }, + "Coup128": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 14.78527, 0, 0 ], + "30": [ 22.67531, 0, 0 ] + }, + "stretch": { + } + }, + "Coup229": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -2.317662, 0, 0 ], + "30": [ -8.312517, 0, 0 ] + }, + "stretch": { + } + }, + "Coup330": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -19.79341, 0, 0 ], + "30": [ -25.85116, 0, 0 ] + }, + "stretch": { + } + }, + "Tete31": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 15.24, 0, 0 ], + "30": [ 15.24027, 0, 0 ] + }, + "stretch": { + } + }, + "Bouche": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ -0.5519297, 0, 0 ], + "30": [ -6.551931, 0, 0 ] + }, + "stretch": { + } + }, + "Jambe G 1": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 0.00483182, 0.000353878, -0.002519864 ] + }, + "stretch": { + } + }, + "Jambe D 1": { + "position": { + }, + "offsetFromPivot": { + }, + "size": { + }, + "rotation": { + "0": [ 0.00483182, -0.000353878, 0.002519864 ] + }, + "stretch": { + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test.csjsmodel b/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test.csjsmodel new file mode 100644 index 0000000..956351e --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test.csjsmodel @@ -0,0 +1,14 @@ +{ + "title": "CraftStudioAPITest", + "tree": [ + { + "name": "Block", + "position": [ 0, 8, 0 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 16, 16, 16 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 0, 0 ], + "children": [] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test2.csjsmodel b/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test2.csjsmodel new file mode 100644 index 0000000..dbb1b8a --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/models/blocks/craftstudio_api_test2.csjsmodel @@ -0,0 +1,24 @@ +{ + "title": "CraftStudioAPITest", + "tree": [ + { + "name": "Block", + "position": [ 0, 8, 0 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 16, 16, 16 ], + "rotation": [ 0, 0, 0 ], + "vertexCoords": [ + [ -8, 16, -8 ], + [ 8, 16, -8 ], + [ 8, -16, -8 ], + [ -8, -16, -8 ], + [ 8, 16, 8 ], + [ -8, 16, 8 ], + [ -8, -16, 8 ], + [ 8, -16, 8 ] + ], + "texOffset": [ 0, 0 ], + "children": [] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/dragon_brun.csjsmodel b/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/dragon_brun.csjsmodel new file mode 100644 index 0000000..ab9b564 --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/dragon_brun.csjsmodel @@ -0,0 +1,1933 @@ +{ + "title": "Dragon Brun", + "tree": [ + { + "name": "Corp1", + "position": [ 0, 37, 30 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 21, 16, 16 ], + "rotation": [ 1.954482, 0, 0 ], + "texOffset": [ 0, 0 ], + "children": [ + { + "name": "Epaules2", + "position": [ 0, -5.960464E-07, -7.152557E-07 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 35, 12, 12 ], + "rotation": [ -1.82036E-07, 0, 0 ], + "texOffset": [ 0, 74 ], + "children": [] + }, + { + "name": "Aile13", + "position": [ 15, 8.469357E-08, -1.488686E-06 ], + "offsetFromPivot": [ 24, 0, 0 ], + "size": [ 50, 5, 8 ], + "rotation": [ -6.89, 22, -2.168892E-09 ], + "texOffset": [ 58, 0 ], + "children": [ + { + "name": "Aile 1_23", + "position": [ 21.31004, 0.0002365663, -0.0255119 ], + "offsetFromPivot": [ 24, 0, 0 ], + "size": [ 50, 5, 7 ], + "rotation": [ 0.2339692, -63.46978, -0.4686372 ], + "texOffset": [ 74, 13 ], + "children": [ + { + "name": "AileBranche24", + "position": [ 23.84916, 0.09999574, 2.215488 ], + "offsetFromPivot": [ 44, 0, 0 ], + "size": [ 86, 5, 3 ], + "rotation": [ -1.543068E-05, 110.841, -8.969847E-06 ], + "texOffset": [ 74, 25 ], + "children": [ + { + "name": "AileToile25", + "position": [ -34.94409, -0.1125191, -8.335443 ], + "offsetFromPivot": [ 38, 0, -16 ], + "size": [ 86, 0, 46 ], + "rotation": [ -1.080418E-05, 1.636025E-05, -9.369185E-06 ], + "texOffset": [ -46, 140 ], + "children": [] + }, + { + "name": "griffes bout ailes26", + "position": [ 39.18649, 0.2161948, -0.09094638 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 0.5044933, 99.31251, 91.96687 ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout7", + "position": [ 0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, 1.555225E-05, 9.53466E-06 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou28", + "position": [ 0.02169422, 0.2021261, 0.5993456 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 9.424067, 5.280378E-06, -5.510787E-06 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou39", + "position": [ 0, 0.2, 0.5 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, -5.684132E-06, 6.632725E-07 ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "AileBranche310", + "position": [ 23.84916, 0.0999957, 2.215488 ], + "offsetFromPivot": [ 44, 0, 0 ], + "size": [ 86, 5, 3 ], + "rotation": [ -5.683263E-06, 141.5232, -2.130234E-05 ], + "texOffset": [ 74, 25 ], + "children": [ + { + "name": "griffes bout ailes211", + "position": [ 39.18649, 0.2161948, -0.09094638 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 0.5044933, 99.31251, 91.96687 ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout12", + "position": [ 0.4, 0, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 2.648026, 1.073253, -0.0176872 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou213", + "position": [ 0.02169422, 0.2021261, 0.5993456 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 9.424067, 5.280378E-06, -5.510787E-06 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou314", + "position": [ 0, 0.2, 0.5 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, -5.684132E-06, 6.632725E-07 ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + }, + { + "name": "AileToile 1.315", + "position": [ -46.37394, 1.574688E-06, -11.22091 ], + "offsetFromPivot": [ 55, 0, -5 ], + "size": [ 82, 0, 30 ], + "rotation": [ -5.072849E-06, 3.746575E-07, -1.22216E-05 ], + "texOffset": [ -30, 186 ], + "children": [] + } + ] + }, + { + "name": "AileBranche116", + "position": [ 23.84916, 0.1499978, 2.215489 ], + "offsetFromPivot": [ 29, 0, 0 ], + "size": [ 57, 5, 3 ], + "rotation": [ -1.716231E-05, 83.72255, -2.268148E-07 ], + "texOffset": [ 86, 25 ], + "children": [ + { + "name": "AileToilebranche 117", + "position": [ -26.12369, -0.07595771, -7.794971 ], + "offsetFromPivot": [ 36, 0, -13 ], + "size": [ 84, 0, 42 ], + "rotation": [ -1.325583E-05, 1.158159E-05, -2.358795E-06 ], + "texOffset": [ -42, 98 ], + "children": [] + }, + { + "name": "griffes bout ailes18", + "position": [ 26.23009, 0.166191, -0.02326208 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 1.228018, 103.6092, 91.61719 ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout19", + "position": [ 0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, 1.555225E-05, 9.53466E-06 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou220", + "position": [ 0, 0.3, 0 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 12.42268, -6.004402E-06, -4.675526E-08 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou321", + "position": [ -4.170682E-06, -1.131516E-06, 1 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, -5.684132E-06, 6.632725E-07 ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "griffes bout ailes_centre22", + "position": [ 18.87914, 0.3161923, 1.668774 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 1.389455, 87.70204, 88.51917 ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout23", + "position": [ 0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, 1.555225E-05, 9.53466E-06 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou224", + "position": [ 0, 0.3, 0 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 12.42268, -6.004402E-06, -4.675526E-08 ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou326", + "position": [ -4.170682E-06, -1.131516E-06, 1 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, -5.684132E-06, 6.632725E-07 ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "AileToile1.127", + "position": [ -24, -3.476012E-06, 1.473967E-06 ], + "offsetFromPivot": [ 23, 0, -23 ], + "size": [ 53, 0, 42 ], + "rotation": [ -1.219527E-05, 1.112748E-05, 3.504153E-06 ], + "texOffset": [ 52, 56 ], + "children": [] + } + ] + }, + { + "name": "Coup128", + "position": [ 0, 1, 3 ], + "offsetFromPivot": [ 0, 0, 8 ], + "size": [ 15, 12, 17 ], + "rotation": [ -3.133037, 0, 0 ], + "texOffset": [ 183, 81 ], + "children": [ + { + "name": "Coup229", + "position": [ 0, 1, 4 ], + "offsetFromPivot": [ 0, 0, 11 ], + "size": [ 12, 10, 16 ], + "rotation": [ -0.3229544, 0, 0 ], + "texOffset": [ 200, 55 ], + "children": [ + { + "name": "Coup330", + "position": [ 0, 0.5093571, 5 ], + "offsetFromPivot": [ 0, 0, 7 ], + "size": [ 10, 8, 13 ], + "rotation": [ -0.6632345, 0, 0 ], + "texOffset": [ 154, 225 ], + "children": [ + { + "name": "Tete31", + "position": [ 0, -0.1389045, 4.999196 ], + "offsetFromPivot": [ 0, 0, 4 ], + "size": [ 11, 10, 9 ], + "rotation": [ 6.402159E-07, 0, 0 ], + "texOffset": [ 119, 216 ], + "children": [ + { + "name": "Museau32", + "position": [ 0, -0.09259965, 3.999468 ], + "offsetFromPivot": [ 0, 0, 4 ], + "size": [ 8, 6, 11 ], + "rotation": [ 2.977895E-07, 0, 0 ], + "texOffset": [ 218, 120 ], + "children": [ + { + "name": "Nez33", + "position": [ 0, -0.1041771, 4.999396 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 9, 6, 4 ], + "rotation": [ -3.424265E-07, 0, 0 ], + "texOffset": [ 207, 110 ], + "children": [ + { + "name": "Dent34", + "position": [ 3.5, -3.5, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.742231, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent2", + "position": [ -3.5, -3.5, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 1.960055, -4.100175, -0.1404768 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent3", + "position": [ -1.75, -3.3, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.218437E-06, 7.798511E-16, -2.026353 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent4", + "position": [ 1.75, -3.3, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ -2.960325, 0, 0 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 240, 111 ], + "children": [] + }, + { + "name": "Dent5", + "position": [ 0, -3, 1.000001 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.218437E-06, -8.897605E-16, 2.308754 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent6", + "position": [ 3.5, -3.3, -1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.218437E-06, 9.00719E-16, 1.37728 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent7", + "position": [ -3.5, -3.3, -1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 3.034465, -3.354562, -0.1777819 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + } + ] + }, + { + "name": "Dent8", + "position": [ -3, -3.104179, 2 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.858654E-06, 1.255225E-15, 2.301986 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent9", + "position": [ 3, -3.104179, 2 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 1.596566, 0, 0 ], + "texOffset": [ 240, 111 ], + "children": [] + }, + { + "name": "Dent10", + "position": [ 3, -2.5, 0 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.858653E-06, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent11", + "position": [ 3, -2.5, -2 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.858653E-06, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent12", + "position": [ -3, -2.500001, -1.999999 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.858654E-06, -5.222579E-15, -3.430224 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent13", + "position": [ -3, -2.5, -6.412849E-06 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 3, 1 ], + "rotation": [ 2.858653E-06, 3.088479E-16, -3.774049 ], + "vertexCoords": [ + [ 0.5, 1.5, -0.5 ], + [ -0.5, 1.5, -0.5 ], + [ -0.5, -1.5, -0.5 ], + [ 0.5, -1.5, -0.5 ], + [ -0.5, 1.5, 0.5 ], + [ 0.5, 1.5, 0.5 ], + [ 0.5, -1.5, 0.5 ], + [ -0.5, -1.5, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + } + ] + }, + { + "name": "Bouche", + "position": [ 0, -3, 0 ], + "offsetFromPivot": [ 0, 0, 7 ], + "size": [ 7, 2, 12 ], + "rotation": [ 23.55193, 0, 0 ], + "texOffset": [ 128, 235 ], + "children": [ + { + "name": "Dent14", + "position": [ -2.5, 0.5, -1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 0, 0, -4.128194 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent15", + "position": [ 2.5, 0.5000039, -0.9999986 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 1.627058, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent16", + "position": [ 2.5, 0.7, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 3.383539, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent17", + "position": [ -2.5, 0.7, 1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 4.623174E-06, -5.483579E-15, 5.149386 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent18", + "position": [ -2.5, 1, 3 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 6.325756, 0, 0 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 240, 111 ], + "children": [] + }, + { + "name": "Dent19", + "position": [ 2.5, 1.000002, 3.000001 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ -6.821664, 0, 0 ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent20", + "position": [ 2.5, 1.000006, 5 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 9.656855E-06, -1.583781E-15, 1.198872 ], + "texOffset": [ 240, 111 ], + "children": [] + }, + { + "name": "Dent21", + "position": [ -2.5, 1.000007, 4.999999 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ -4.163713, 0, 0 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent22", + "position": [ -1, 1.00001, 4.999997 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 1.301264E-05, 1.453839E-14, -2.817426 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + }, + { + "name": "Dent23", + "position": [ 1, 1.000014, 4.999996 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 2, 1 ], + "rotation": [ 1.297294E-05, -4.47666, -1.015675E-06 ], + "vertexCoords": [ + [ 0.5, 1, -0.5 ], + [ -0.5, 1, -0.5 ], + [ -0.5, -1, -0.5 ], + [ 0.5, -1, -0.5 ], + [ -0.5, 1, 0.5 ], + [ 0.5, 1, 0.5 ], + [ 0.5, -1, 0.5 ], + [ -0.5, -1, 0.5 ] + ], + "texOffset": [ 235, 112 ], + "children": [] + } + ] + }, + { + "name": "Crette ", + "position": [ 0, 4.478767, -2.948088 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -51.8001, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + }, + { + "name": "Corne G1", + "position": [ 4, 3.138902, -0.9991918 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 4, 4, 10 ], + "rotation": [ 28.29965, -30.2206, -15.43754 ], + "texOffset": [ 174, 116 ], + "children": [ + { + "name": "Corne G2", + "position": [ 3.832608E-07, -6.300802E-07, -4 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 3, 4, 7 ], + "rotation": [ -28.6929, 9.380481E-07, -2.480848E-07 ], + "texOffset": [ 168, 105 ], + "children": [ + { + "name": "Corne G3", + "position": [ 4.397035E-07, -1.773457E-06, -2 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 2, 4, 7 ], + "rotation": [ -40.35846, 2.112802E-06, 1.951212E-06 ], + "texOffset": [ 196, 113 ], + "children": [ + { + "name": "Corne G4", + "position": [ 1.169115E-06, -2.845276E-06, -2 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 2, 3, 7 ], + "rotation": [ -35.89212, 2.418688, -1.418534 ], + "texOffset": [ 195, 124 ], + "children": [ + { + "name": "Corne G5", + "position": [ -5.707215E-07, -5.288481E-07, -2 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 2, 3, 5 ], + "rotation": [ -34.60033, -2.794594, 1.587758 ], + "texOffset": [ 168, 131 ], + "children": [ + { + "name": "Corne G6", + "position": [ -1.84081E-07, 2.999791E-07, -1 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 2, 2, 5 ], + "rotation": [ -34.24986, 0.9201069, -0.5178673 ], + "texOffset": [ 168, 117 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Corne D1", + "position": [ -4, 3.138902, -0.9991918 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 4, 4, 10 ], + "rotation": [ 28.29965, 30.2206, 15.43754 ], + "vertexCoords": [ + [ 2, 2, -5 ], + [ -2, 2, -5 ], + [ -2, -2, -5 ], + [ 2, -2, -5 ], + [ -2, 2, 5 ], + [ 2, 2, 5 ], + [ 2, -2, 5 ], + [ -2, -2, 5 ] + ], + "texOffset": [ 174, 116 ], + "children": [ + { + "name": "Corne D2", + "position": [ -3.832608E-07, -6.300802E-07, -4 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 3, 4, 7 ], + "rotation": [ -28.6929, -9.380481E-07, 2.480848E-07 ], + "vertexCoords": [ + [ 1.5, 2, -3.5 ], + [ -1.5, 2, -3.5 ], + [ -1.5, -2, -3.5 ], + [ 1.5, -2, -3.5 ], + [ -1.5, 2, 3.5 ], + [ 1.5, 2, 3.5 ], + [ 1.5, -2, 3.5 ], + [ -1.5, -2, 3.5 ] + ], + "texOffset": [ 168, 105 ], + "children": [ + { + "name": "Corne D3", + "position": [ -4.397035E-07, -1.773457E-06, -2 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 2, 4, 7 ], + "rotation": [ -40.35846, -2.112802E-06, -1.951212E-06 ], + "vertexCoords": [ + [ 1, 2, -3.5 ], + [ -1, 2, -3.5 ], + [ -1, -2, -3.5 ], + [ 1, -2, -3.5 ], + [ -1, 2, 3.5 ], + [ 1, 2, 3.5 ], + [ 1, -2, 3.5 ], + [ -1, -2, 3.5 ] + ], + "texOffset": [ 196, 113 ], + "children": [ + { + "name": "Corne D4", + "position": [ -1.169115E-06, -2.845276E-06, -2 ], + "offsetFromPivot": [ 0, 0, -3 ], + "size": [ 2, 3, 7 ], + "rotation": [ -35.8863, -2.693072, 1.579384 ], + "vertexCoords": [ + [ 1, 1.5, -3.5 ], + [ -1, 1.5, -3.5 ], + [ -1, -1.5, -3.5 ], + [ 1, -1.5, -3.5 ], + [ -1, 1.5, 3.5 ], + [ 1, 1.5, 3.5 ], + [ 1, -1.5, 3.5 ], + [ -1, -1.5, 3.5 ] + ], + "texOffset": [ 195, 124 ], + "children": [ + { + "name": "Corne D5", + "position": [ 5.707215E-07, -5.288481E-07, -2 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 2, 3, 5 ], + "rotation": [ -34.62206, 1.57671, -0.8959765 ], + "vertexCoords": [ + [ 1, 1.5, -2.5 ], + [ -1, 1.5, -2.5 ], + [ -1, -1.5, -2.5 ], + [ 1, -1.5, -2.5 ], + [ -1, 1.5, 2.5 ], + [ 1, 1.5, 2.5 ], + [ 1, -1.5, 2.5 ], + [ -1, -1.5, 2.5 ] + ], + "texOffset": [ 168, 131 ], + "children": [ + { + "name": "Corne D6", + "position": [ 1.84081E-07, 2.999791E-07, -1 ], + "offsetFromPivot": [ 0, 0, -2 ], + "size": [ 2, 2, 5 ], + "rotation": [ -34.24011, 1.802034, -1.014167 ], + "vertexCoords": [ + [ 1, 1, -2.5 ], + [ -1, 1, -2.5 ], + [ -1, -1, -2.5 ], + [ 1, -1, -2.5 ], + [ -1, 1, 2.5 ], + [ 1, 1, 2.5 ], + [ 1, -1, 2.5 ], + [ -1, -1, 2.5 ] + ], + "texOffset": [ 168, 117 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Crette 1", + "position": [ 0, 4.568107, 0.08014464 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -63.77876, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + }, + { + "name": "Crette 2", + "position": [ 0, 5.966101, -1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -56.65558, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + }, + { + "name": "Corp3", + "position": [ 0, -2, -31 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 18, 18, 19 ], + "rotation": [ -2.281355, 0, 0 ], + "texOffset": [ 172, 140 ], + "children": [ + { + "name": "Queue1", + "position": [ 0, 2, -8 ], + "offsetFromPivot": [ 0, 0, -5 ], + "size": [ 13, 14, 8 ], + "rotation": [ 0.6659851, 0, 0 ], + "texOffset": [ 164, 178 ], + "children": [ + { + "name": "Queue2", + "position": [ 0, 2, -4 ], + "offsetFromPivot": [ 0, -1, -5 ], + "size": [ 10, 12, 14 ], + "rotation": [ -1.160694, 0, 0 ], + "texOffset": [ 206, 177 ], + "children": [ + { + "name": "Queue3", + "position": [ 0, 2, -6 ], + "offsetFromPivot": [ 0, -1, -8 ], + "size": [ 8, 9, 14 ], + "rotation": [ -4.019387, -0.4245569, 0.02975945 ], + "texOffset": [ 150, 202 ], + "children": [ + { + "name": "Queue4", + "position": [ 0, 2.000002, -5 ], + "offsetFromPivot": [ 0, -1, -8 ], + "size": [ 6, 7, 14 ], + "rotation": [ -2.631835, 0, 0 ], + "texOffset": [ 194, 203 ], + "children": [ + { + "name": "Queue5", + "position": [ 0, 1.999995, -5 ], + "offsetFromPivot": [ 0, -1, -8 ], + "size": [ 4, 5, 14 ], + "rotation": [ -0.03058504, 0, 0 ], + "texOffset": [ 220, 210 ], + "children": [ + { + "name": "Queue6", + "position": [ 0, 1.500005, -6 ], + "offsetFromPivot": [ 0, -1, -8 ], + "size": [ 4, 4, 14 ], + "rotation": [ -1.766136, 0, 0 ], + "texOffset": [ 220, 229 ], + "children": [ + { + "name": "Queue7", + "position": [ 0, 1.000001, -5 ], + "offsetFromPivot": [ 0, -1, -9 ], + "size": [ 3, 3, 14 ], + "rotation": [ -3.908575, 0, 0 ], + "texOffset": [ 200, 224 ], + "children": [ + { + "name": "Crette 12", + "position": [ -0.08999997, 1.087998, -4.024301 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 5 ], + "rotation": [ -67.97205, 0.2672611, 0.1637284 ], + "texOffset": [ 241, 36 ], + "children": [] + } + ] + }, + { + "name": "Crette 11", + "position": [ -0.08730779, 1.348922, -2.994474 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 5 ], + "rotation": [ -59.55628, 0.3666071, 0.06453957 ], + "texOffset": [ 241, 36 ], + "children": [] + } + ] + }, + { + "name": "Crette 10", + "position": [ -0.08730782, 1.509915, -2.999726 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 5 ], + "rotation": [ -61.32237, 0.3870896, 0.0409947 ], + "texOffset": [ 241, 36 ], + "children": [] + } + ] + }, + { + "name": "Crette 9", + "position": [ -0.08730784, 2.504039, -2.942479 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 5 ], + "rotation": [ -61.35294, 0.3874678, 0.04056361 ], + "texOffset": [ 241, 36 ], + "children": [] + } + ] + }, + { + "name": "Crette 8", + "position": [ -0.08730784, 4.1004, -3.811406 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -63.98471, 0.4235127, -1.502742E-09 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + }, + { + "name": "Crette 7", + "position": [ 0, 4.264826, -1 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -68.00421, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + } + ] + }, + { + "name": "Jambe G 1", + "position": [ -8, 1.941249, 0.0612529 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 6, 20, 13 ], + "rotation": [ 12.40515, -5.766162E-08, -4.187479 ], + "texOffset": [ 0, 216 ], + "children": [ + { + "name": "Jambe G 24", + "position": [ 0, -8, 1 ], + "offsetFromPivot": [ 0, -4, 1 ], + "size": [ 5, 22, 8 ], + "rotation": [ -81.37072, 0, 0 ], + "texOffset": [ 38, 217 ], + "children": [ + { + "name": "Patte GDansTonCulMonGars", + "position": [ -9.536743E-07, -9, 2 ], + "offsetFromPivot": [ 0, -5, 0 ], + "size": [ 8, 10, 5 ], + "rotation": [ 49.82677, 0, 0 ], + "texOffset": [ 64, 216 ], + "children": [ + { + "name": "Doigt 115", + "position": [ -3.3, -3, 0 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43449, -7.633441E-08, -3.192671 ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 124", + "position": [ 0, -1.799195, -1.587085E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.68956, 2.52309, 1.187656 ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 136", + "position": [ -9.386601E-07, -2, 2.893723E-06 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.39338, 3.221526E-07, 1.761976E-07 ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + }, + { + "name": "Doigt 218", + "position": [ 0, -2.999999, 1.565276E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43449, 0, 0 ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 229", + "position": [ 0, -1.989176, -1.749227E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.8, 1.44, -1.274122E-08 ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 238", + "position": [ 0.3343311, -1.992396, -0.1466559 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.35126, -2.210411, -3.105502 ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + }, + { + "name": "Doigt 315", + "position": [ 3.3, -3, 0 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43, -3.799124E-08, 1.981351 ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 326", + "position": [ -1.042691E-07, -2, -1.239786E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.85166, -1.625271E-07, -1.054869E-06 ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 337", + "position": [ 0, -1.882363, -0.1897153 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.20541, -3.845515, -6.424582 ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Jambe D 1", + "position": [ 8, 1.941249, 0.0612529 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 6, 20, 13 ], + "rotation": [ 12.40515, 5.766162E-08, 4.187479 ], + "vertexCoords": [ + [ 3, 10, -6.5 ], + [ -3, 10, -6.5 ], + [ -3, -10, -6.5 ], + [ 3, -10, -6.5 ], + [ -3, 10, 6.5 ], + [ 3, 10, 6.5 ], + [ 3, -10, 6.5 ], + [ -3, -10, 6.5 ] + ], + "texOffset": [ 0, 216 ], + "children": [ + { + "name": "Jambe G 2", + "position": [ 0, -8, 1 ], + "offsetFromPivot": [ 0, -4, 1 ], + "size": [ 5, 22, 8 ], + "rotation": [ -81.37072, 0, 0 ], + "vertexCoords": [ + [ 2.5, 11, -4 ], + [ -2.5, 11, -4 ], + [ -2.5, -11, -4 ], + [ 2.5, -11, -4 ], + [ -2.5, 11, 4 ], + [ 2.5, 11, 4 ], + [ 2.5, -11, 4 ], + [ -2.5, -11, 4 ] + ], + "texOffset": [ 38, 217 ], + "children": [ + { + "name": "Patte GToiAussiEncule", + "position": [ 9.536743E-07, -9, 2 ], + "offsetFromPivot": [ 0, -5, 0 ], + "size": [ 8, 10, 5 ], + "rotation": [ 49.82677, 0, 0 ], + "vertexCoords": [ + [ 4, 5, -2.5 ], + [ -4, 5, -2.5 ], + [ -4, -5, -2.5 ], + [ 4, -5, -2.5 ], + [ -4, 5, 2.5 ], + [ 4, 5, 2.5 ], + [ 4, -5, 2.5 ], + [ -4, -5, 2.5 ] + ], + "texOffset": [ 64, 216 ], + "children": [ + { + "name": "Doigt 11", + "position": [ 3.3, -3, 0 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43449, 7.633441E-08, 3.192671 ], + "vertexCoords": [ + [ 1.5, 3.5, -2 ], + [ -1.5, 3.5, -2 ], + [ -1.5, -3.5, -2 ], + [ 1.5, -3.5, -2 ], + [ -1.5, 3.5, 2 ], + [ 1.5, 3.5, 2 ], + [ 1.5, -3.5, 2 ], + [ -1.5, -3.5, 2 ] + ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 12", + "position": [ 0, -1.799195, -1.587085E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.68956, -2.52309, -1.187656 ], + "vertexCoords": [ + [ 1.5, 2.5, -1.5 ], + [ -1.5, 2.5, -1.5 ], + [ -1.5, -2.5, -1.5 ], + [ 1.5, -2.5, -1.5 ], + [ -1.5, 2.5, 1.5 ], + [ 1.5, 2.5, 1.5 ], + [ 1.5, -2.5, 1.5 ], + [ -1.5, -2.5, 1.5 ] + ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 13", + "position": [ 9.386601E-07, -2, 2.893723E-06 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.39338, -3.221526E-07, -1.761976E-07 ], + "vertexCoords": [ + [ 0.5, 2, -1 ], + [ -0.5, 2, -1 ], + [ -0.5, -2, -1 ], + [ 0.5, -2, -1 ], + [ -0.5, 2, 1 ], + [ 0.5, 2, 1 ], + [ 0.5, -2, 1 ], + [ -0.5, -2, 1 ] + ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + }, + { + "name": "Doigt 21", + "position": [ 0, -2.999999, 1.565276E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43449, 0, 0 ], + "vertexCoords": [ + [ 1.5, 3.5, -2 ], + [ -1.5, 3.5, -2 ], + [ -1.5, -3.5, -2 ], + [ 1.5, -3.5, -2 ], + [ -1.5, 3.5, 2 ], + [ 1.5, 3.5, 2 ], + [ 1.5, -3.5, 2 ], + [ -1.5, -3.5, 2 ] + ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 22", + "position": [ 0, -1.989176, -1.749227E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.8, -1.44, 1.274122E-08 ], + "vertexCoords": [ + [ 1.5, 2.5, -1.5 ], + [ -1.5, 2.5, -1.5 ], + [ -1.5, -2.5, -1.5 ], + [ 1.5, -2.5, -1.5 ], + [ -1.5, 2.5, 1.5 ], + [ 1.5, 2.5, 1.5 ], + [ 1.5, -2.5, 1.5 ], + [ -1.5, -2.5, 1.5 ] + ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 23", + "position": [ -0.3343311, -1.992396, -0.1466559 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.35126, 2.210411, 3.105502 ], + "vertexCoords": [ + [ 0.5, 2, -1 ], + [ -0.5, 2, -1 ], + [ -0.5, -2, -1 ], + [ 0.5, -2, -1 ], + [ -0.5, 2, 1 ], + [ 0.5, 2, 1 ], + [ 0.5, -2, 1 ], + [ -0.5, -2, 1 ] + ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + }, + { + "name": "Doigt 31", + "position": [ -3.3, -3, 0 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 7, 4 ], + "rotation": [ 69.43, 3.799124E-08, -1.981351 ], + "vertexCoords": [ + [ 1.5, 3.5, -2 ], + [ -1.5, 3.5, -2 ], + [ -1.5, -3.5, -2 ], + [ 1.5, -3.5, -2 ], + [ -1.5, 3.5, 2 ], + [ 1.5, 3.5, 2 ], + [ 1.5, -3.5, 2 ], + [ -1.5, -3.5, 2 ] + ], + "texOffset": [ 65, 217 ], + "children": [ + { + "name": "Doigt 325624", + "position": [ 1.042691E-07, -2, -1.239786E-06 ], + "offsetFromPivot": [ 0, -2, 0 ], + "size": [ 3, 5, 3 ], + "rotation": [ 18.85166, 1.625271E-07, 1.054869E-06 ], + "vertexCoords": [ + [ 1.5, 2.5, -1.5 ], + [ -1.5, 2.5, -1.5 ], + [ -1.5, -2.5, -1.5 ], + [ 1.5, -2.5, -1.5 ], + [ -1.5, 2.5, 1.5 ], + [ 1.5, 2.5, 1.5 ], + [ 1.5, -2.5, 1.5 ], + [ -1.5, -2.5, 1.5 ] + ], + "texOffset": [ 78, 223 ], + "children": [ + { + "name": "Doigt 335623", + "position": [ 0, -1.882363, -0.1897153 ], + "offsetFromPivot": [ 0, -1, 0 ], + "size": [ 1, 4, 2 ], + "rotation": [ 45.20541, 3.845515, 6.424582 ], + "vertexCoords": [ + [ 0.5, 2, -1 ], + [ -0.5, 2, -1 ], + [ -0.5, -2, -1 ], + [ 0.5, -2, -1 ], + [ -0.5, 2, 1 ], + [ 0.5, 2, 1 ], + [ 0.5, -2, 1 ], + [ -0.5, -2, 1 ] + ], + "texOffset": [ 64, 239 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "Crette 6", + "position": [ 0, 7.481722, -5 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -68.49892, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + }, + { + "name": "Aile2", + "position": [ -15, 9.184255E-07, -2.546989E-06 ], + "offsetFromPivot": [ -24, 0, 0 ], + "size": [ 50, 5, 8 ], + "rotation": [ -6.89, -22, 2.168892E-09 ], + "vertexCoords": [ + [ 25, 2.5, -4 ], + [ -25, 2.5, -4 ], + [ -25, -2.5, -4 ], + [ 25, -2.5, -4 ], + [ -25, 2.5, 4 ], + [ 25, 2.5, 4 ], + [ 25, -2.5, 4 ], + [ -25, -2.5, 4 ] + ], + "texOffset": [ 58, 0 ], + "children": [ + { + "name": "Aile 2.2", + "position": [ -21.31004, 0.0002365663, -0.0255119 ], + "offsetFromPivot": [ -24, 0, 0 ], + "size": [ 50, 5, 7 ], + "rotation": [ 0.2339692, 63.46978, 0.4686372 ], + "vertexCoords": [ + [ 25, 2.5, -3.5 ], + [ -25, 2.5, -3.5 ], + [ -25, -2.5, -3.5 ], + [ 25, -2.5, -3.5 ], + [ -25, 2.5, 3.5 ], + [ 25, 2.5, 3.5 ], + [ 25, -2.5, 3.5 ], + [ -25, -2.5, 3.5 ] + ], + "texOffset": [ 74, 13 ], + "children": [ + { + "name": "AileBranche2.2", + "position": [ -23.84916, 0.09999574, 2.215488 ], + "offsetFromPivot": [ -44, 0, 0 ], + "size": [ 86, 5, 3 ], + "rotation": [ -1.543068E-05, -110.841, 8.969847E-06 ], + "vertexCoords": [ + [ 43, 2.5, -1.5 ], + [ -43, 2.5, -1.5 ], + [ -43, -2.5, -1.5 ], + [ 43, -2.5, -1.5 ], + [ -43, 2.5, 1.5 ], + [ 43, 2.5, 1.5 ], + [ 43, -2.5, 1.5 ], + [ -43, -2.5, 1.5 ] + ], + "texOffset": [ 74, 25 ], + "children": [ + { + "name": "AileToile2.2", + "position": [ 34.94409, -0.1125191, -8.335443 ], + "offsetFromPivot": [ -38, 0, -16 ], + "size": [ 86, 0, 46 ], + "rotation": [ -1.080418E-05, -1.636025E-05, 9.369185E-06 ], + "vertexCoords": [ + [ 43, 0, -23 ], + [ -43, 0, -23 ], + [ -43, 0, -23 ], + [ 43, 0, -23 ], + [ -43, 0, 23 ], + [ 43, 0, 23 ], + [ 43, 0, 23 ], + [ -43, 0, 23 ] + ], + "texOffset": [ -46, 140 ], + "children": [] + }, + { + "name": "griffes bout ailes2.2", + "position": [ -39.18649, 0.2161948, -0.09094638 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 0.5044933, -99.31251, -91.96687 ], + "vertexCoords": [ + [ 1.5, 1.5, -4.5 ], + [ -1.5, 1.5, -4.5 ], + [ -1.5, -1.5, -4.5 ], + [ 1.5, -1.5, -4.5 ], + [ -1.5, 1.5, 4.5 ], + [ 1.5, 1.5, 4.5 ], + [ 1.5, -1.5, 4.5 ], + [ -1.5, -1.5, 4.5 ] + ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout.2", + "position": [ -0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, -1.555225E-05, -9.53466E-06 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou2.2", + "position": [ -0.02169422, 0.2021261, 0.5993456 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 9.424067, -5.280378E-06, 5.510787E-06 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou3.2", + "position": [ 0, 0.2, 0.5 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, 5.684132E-06, -6.632725E-07 ], + "vertexCoords": [ + [ 0.5, 1, -2 ], + [ -0.5, 1, -2 ], + [ -0.5, -1, -2 ], + [ 0.5, -1, -2 ], + [ -0.5, 1, 2 ], + [ 0.5, 1, 2 ], + [ 0.5, -1, 2 ], + [ -0.5, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "AileBranche3.25622", + "position": [ -23.84916, 0.0999957, 2.215488 ], + "offsetFromPivot": [ -44, 0, 0 ], + "size": [ 86, 5, 3 ], + "rotation": [ -5.683263E-06, -141.5232, 2.130234E-05 ], + "vertexCoords": [ + [ 43, 2.5, -1.5 ], + [ -43, 2.5, -1.5 ], + [ -43, -2.5, -1.5 ], + [ 43, -2.5, -1.5 ], + [ -43, 2.5, 1.5 ], + [ 43, 2.5, 1.5 ], + [ 43, -2.5, 1.5 ], + [ -43, -2.5, 1.5 ] + ], + "texOffset": [ 74, 25 ], + "children": [ + { + "name": "griffes bout ailes2.25621", + "position": [ -39.18649, 0.2161948, -0.09094638 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 0.5044933, -99.31251, -91.96687 ], + "vertexCoords": [ + [ 1.5, 1.5, -4.5 ], + [ -1.5, 1.5, -4.5 ], + [ -1.5, -1.5, -4.5 ], + [ 1.5, -1.5, -4.5 ], + [ -1.5, 1.5, 4.5 ], + [ 1.5, 1.5, 4.5 ], + [ 1.5, -1.5, 4.5 ], + [ -1.5, -1.5, 4.5 ] + ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout.25620", + "position": [ -0.4, 0, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 2.648026, -1.073253, 0.0176872 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou2.25619", + "position": [ -0.02169422, 0.2021261, 0.5993456 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 9.424067, -5.280378E-06, 5.510787E-06 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou3.25618", + "position": [ 0, 0.2, 0.5 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, 5.684132E-06, -6.632725E-07 ], + "vertexCoords": [ + [ 0.5, 1, -2 ], + [ -0.5, 1, -2 ], + [ -0.5, -1, -2 ], + [ 0.5, -1, -2 ], + [ -0.5, 1, 2 ], + [ 0.5, 1, 2 ], + [ 0.5, -1, 2 ], + [ -0.5, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + }, + { + "name": "AileToile 1.3.25617", + "position": [ 46.37394, 1.574688E-06, -11.22091 ], + "offsetFromPivot": [ -55, 0, -5 ], + "size": [ 82, 0, 30 ], + "rotation": [ -5.072849E-06, -3.746575E-07, 1.22216E-05 ], + "vertexCoords": [ + [ 41, 0, -15 ], + [ -41, 0, -15 ], + [ -41, 0, -15 ], + [ 41, 0, -15 ], + [ -41, 0, 15 ], + [ 41, 0, 15 ], + [ 41, 0, 15 ], + [ -41, 0, 15 ] + ], + "texOffset": [ -30, 186 ], + "children": [] + } + ] + }, + { + "name": "AileBranche1.25616", + "position": [ -23.84916, 0.1499978, 2.215489 ], + "offsetFromPivot": [ -29, 0, 0 ], + "size": [ 57, 5, 3 ], + "rotation": [ -1.716231E-05, -83.72255, 2.268148E-07 ], + "vertexCoords": [ + [ 28.5, 2.5, -1.5 ], + [ -28.5, 2.5, -1.5 ], + [ -28.5, -2.5, -1.5 ], + [ 28.5, -2.5, -1.5 ], + [ -28.5, 2.5, 1.5 ], + [ 28.5, 2.5, 1.5 ], + [ 28.5, -2.5, 1.5 ], + [ -28.5, -2.5, 1.5 ] + ], + "texOffset": [ 86, 25 ], + "children": [ + { + "name": "AileToilebranche 1.25615", + "position": [ 26.12369, -0.07595771, -7.794971 ], + "offsetFromPivot": [ -36, 0, -13 ], + "size": [ 84, 0, 42 ], + "rotation": [ -1.325583E-05, -1.158159E-05, 2.358795E-06 ], + "vertexCoords": [ + [ 42, 0, -21 ], + [ -42, 0, -21 ], + [ -42, 0, -21 ], + [ 42, 0, -21 ], + [ -42, 0, 21 ], + [ 42, 0, 21 ], + [ 42, 0, 21 ], + [ -42, 0, 21 ] + ], + "texOffset": [ -42, 98 ], + "children": [] + }, + { + "name": "griffes bout ailes.25614", + "position": [ -26.23009, 0.166191, -0.02326208 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 1.228018, -103.6092, -91.61719 ], + "vertexCoords": [ + [ 1.5, 1.5, -4.5 ], + [ -1.5, 1.5, -4.5 ], + [ -1.5, -1.5, -4.5 ], + [ 1.5, -1.5, -4.5 ], + [ -1.5, 1.5, 4.5 ], + [ 1.5, 1.5, 4.5 ], + [ 1.5, -1.5, 4.5 ], + [ -1.5, -1.5, 4.5 ] + ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout.25613", + "position": [ -0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, -1.555225E-05, -9.53466E-06 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou2.25612", + "position": [ 0, 0.3, 0 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 12.42268, 6.004402E-06, 4.675526E-08 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou3.25611", + "position": [ 4.170682E-06, -1.131516E-06, 1 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, 5.684132E-06, -6.632725E-07 ], + "vertexCoords": [ + [ 0.5, 1, -2 ], + [ -0.5, 1, -2 ], + [ -0.5, -1, -2 ], + [ 0.5, -1, -2 ], + [ -0.5, 1, 2 ], + [ 0.5, 1, 2 ], + [ 0.5, -1, 2 ], + [ -0.5, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "griffes bout ailes_centre2.25610", + "position": [ -18.87915, 0.3161964, 1.668767 ], + "offsetFromPivot": [ 0, 0, 5 ], + "size": [ 3, 3, 9 ], + "rotation": [ 1.389458, -87.70206, -88.51917 ], + "vertexCoords": [ + [ 1.5, 1.5, -4.5 ], + [ -1.5, 1.5, -4.5 ], + [ -1.5, -1.5, -4.5 ], + [ 1.5, -1.5, -4.5 ], + [ -1.5, 1.5, 4.5 ], + [ 1.5, 1.5, 4.5 ], + [ 1.5, -1.5, 4.5 ], + [ -1.5, -1.5, 4.5 ] + ], + "texOffset": [ 174, 0 ], + "children": [ + { + "name": "griffes bout.2569", + "position": [ -0.3783033, 0.1637897, 3 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 17.07758, -1.555225E-05, -9.53466E-06 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou2.2568", + "position": [ 0, 0.3, 0 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 2, 2, 4 ], + "rotation": [ 12.42268, 6.004402E-06, 4.675526E-08 ], + "vertexCoords": [ + [ 1, 1, -2 ], + [ -1, 1, -2 ], + [ -1, -1, -2 ], + [ 1, -1, -2 ], + [ -1, 1, 2 ], + [ 1, 1, 2 ], + [ 1, -1, 2 ], + [ -1, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [ + { + "name": "griffes bou3.2567", + "position": [ 4.170682E-06, -1.131516E-06, 1 ], + "offsetFromPivot": [ 0, 0, 3 ], + "size": [ 1, 2, 4 ], + "rotation": [ 8.012905, 5.684132E-06, -6.632725E-07 ], + "vertexCoords": [ + [ 0.5, 1, -2 ], + [ -0.5, 1, -2 ], + [ -0.5, -1, -2 ], + [ 0.5, -1, -2 ], + [ -0.5, 1, 2 ], + [ 0.5, 1, 2 ], + [ 0.5, -1, 2 ], + [ -0.5, -1, 2 ] + ], + "texOffset": [ 189, 0 ], + "children": [] + } + ] + } + ] + } + ] + } + ] + }, + { + "name": "AileToile1.1.2566", + "position": [ 24, -3.476012E-06, 1.473967E-06 ], + "offsetFromPivot": [ -23, 0, -23 ], + "size": [ 53, 0, 42 ], + "rotation": [ -1.219527E-05, -1.112748E-05, -3.504153E-06 ], + "vertexCoords": [ + [ 26.5, 0, -21 ], + [ -26.5, 0, -21 ], + [ -26.5, 0, -21 ], + [ 26.5, 0, -21 ], + [ -26.5, 0, 21 ], + [ 26.5, 0, 21 ], + [ 26.5, 0, 21 ], + [ -26.5, 0, 21 ] + ], + "texOffset": [ 52, 56 ], + "children": [] + } + ] + }, + { + "name": "Crette 3565", + "position": [ 6, 7.519951, -5.314118 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -60.43575, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + }, + { + "name": "Crette 4564", + "position": [ -6, 7.519951, -5.314118 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -60.43574, 0, 0 ], + "vertexCoords": [ + [ 0.5, 6.5, -4 ], + [ -0.5, 6.5, -4 ], + [ -0.5, -6.5, -4 ], + [ 0.5, -6.5, -4 ], + [ -0.5, 6.5, 4 ], + [ 0.5, 6.5, 4 ], + [ 0.5, -6.5, 4 ], + [ -0.5, -6.5, 4 ] + ], + "texOffset": [ 238, 33 ], + "children": [] + }, + { + "name": "Crette Centre563", + "position": [ 0, 8, -5.314118 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 17, 9 ], + "rotation": [ -59.58637, 0, 0 ], + "texOffset": [ 60, 32 ], + "children": [] + }, + { + "name": "Corp2562", + "position": [ 0, -0.9999974, -18 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 17, 16, 26 ], + "rotation": [ -2.281355, 0, 0 ], + "texOffset": [ 0, 32 ], + "children": [ + { + "name": "Crette 5561", + "position": [ 0, 7, -0.6600574 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 1, 13, 8 ], + "rotation": [ -68.49894, 0, 0 ], + "texOffset": [ 238, 33 ], + "children": [] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/model_dead_corpse.csjsmodel b/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/model_dead_corpse.csjsmodel new file mode 100644 index 0000000..362a4d8 --- /dev/null +++ b/src/main/resources/assets/craftstudioapi/craftstudio/models/entity/model_dead_corpse.csjsmodel @@ -0,0 +1,129 @@ +{ + "title": "ModelDeadCorpse", + "tree": [ + { + "name": "bipedBody", + "position": [ 0, 18, 0 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 8, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 16, 16 ], + "children": [ + { + "name": "bipedHead", + "position": [ 0, 6, 0 ], + "offsetFromPivot": [ 0, 4, 0 ], + "size": [ 8, 8, 8 ], + "rotation": [ 0, 0, 0 ], + "vertexCoords": [ + [ -5.016337, 4, -4 ], + [ 5.016337, 4, -4 ], + [ 5.016337, -4, -4 ], + [ -5.016337, -4, -4 ], + [ 5.016337, 4, 4 ], + [ -5.016337, 4, 4 ], + [ -5.016337, -4, 4 ], + [ 5.016337, -4, 4 ] + ], + "texOffset": [ 0, 0 ], + "children": [ + { + "name": "bipedHeadWear", + "position": [ 0, -4, 0 ], + "offsetFromPivot": [ 0, 4, 0 ], + "size": [ 8, 8, 8 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 32, 0 ], + "children": [] + } + ] + }, + { + "name": "bipedLeftArm", + "position": [ 4, 4, 0 ], + "offsetFromPivot": [ 2, -4, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 32, 48 ], + "children": [ + { + "name": "bipedLeftArmWear", + "position": [ -2, 4, 0 ], + "offsetFromPivot": [ 2, -4, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 48, 48 ], + "children": [] + } + ] + }, + { + "name": "bipedRightArm", + "position": [ -4, 4, 0 ], + "offsetFromPivot": [ -2, -4, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 40, 16 ], + "children": [ + { + "name": "bipedRightArmWear", + "position": [ 2, 4, 0 ], + "offsetFromPivot": [ -2, -4, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 40, 32 ], + "children": [] + } + ] + }, + { + "name": "bipedLeftLeg", + "position": [ 2, -6, 0 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 16, 48 ], + "children": [ + { + "name": "bipedLeftLegWear", + "position": [ 0, 6, 0 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 0, 48 ], + "children": [] + } + ] + }, + { + "name": "bipedRightLeg", + "position": [ -2, -6, 0 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 0, 16 ], + "children": [ + { + "name": "bipedRightLegWear", + "position": [ 0, 6, 0 ], + "offsetFromPivot": [ 0, -6, 0 ], + "size": [ 4, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 0, 32 ], + "children": [] + } + ] + }, + { + "name": "bipedBodyWear", + "position": [ 0, 0, 0 ], + "offsetFromPivot": [ 0, 0, 0 ], + "size": [ 8, 12, 4 ], + "rotation": [ 0, 0, 0 ], + "texOffset": [ 16, 32 ], + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/craftstudioapi/textures/block/block_test.png b/src/main/resources/assets/craftstudioapi/textures/block/block_test.png new file mode 100644 index 0000000000000000000000000000000000000000..dc3dfb77bc1710f109e70dce2c334d914f1ea0c3 GIT binary patch literal 480 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4W*tgjv*CsZzmkgJmMh0qThe|KqW_N%JBln zIGs<+4|cB<+`?9dS$tuIpJ_6m)YX+~XB-z>UG1^V2w6VM zkiGX+i1D)pfpfEt$(XDPK0Bk?t(0iRKdir8o_mJz#bdu`3||V>iy40Hm~6>Vd*`G~ zgWbCnJ_q@7BlZRT)-##^Jp1}{&$}y|C-q4w@$jj2G3O(6Vd`{KILom_@?kvhg!3|Q zqdhJwNo`p_A&tf4K;3d%yXh{XCzscDU;iB7&z*UzQg?>;BEbNWS=>{+XNj#`T-$1* zZ1cqbz^rE&HKojXUsR?_^*kFnGH9xvX2T4qP5;O&~yAw;C#V- zT2AzR1A$O6MAIB@(n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@j@vB zT3m+N-0n-7suN_CaZTc_$Pqam{2-T%UbusU!_=d@dipx|vgLg>Vb;wezkmNWu&^j~ zdcz{1v-0`H9A|5a%K9f3YN?^OHm=v7hq3pszzGyIZD+6AE*(hD6`~wZX0=)M)^uoC zgrn$Vj3BEC%NapckwZLhg%?kqFi81&6ppmCsPkgZJ!=Smd?A59KN)Aux?9}q~ z#P@IFaMx++=&-L}(~t%_J0G5%ok4_zG%uD@W9*7%bMYV$)x7v<1lLp)!+x%STMhxo zMpXlO5He6(;flvFOZc=<^`ZB!@3Dp8SO2s6sO`yAO|j3~D8j(daR1Rvsi~yP*vEHN zy%VUOBvF1vMayh>qgFBuo0J4ySXf}ENS!bcm)0VU5KvLpb$!SJ)MP7q52(61>ViPt zPT3jmvI`$G5bu*Jj06$zGzz%of#2x!J3e(W5-U2P^rnZ6#;5{e4QEEXV~K*MQG333(dkA_8YQqF@aRaI4cm@&M~gJR3ZTB=9I<7MWL*`;0c8!*V0 z(2&nt&8OGF3ZMUgXs%otsaB0-xD|K3C yUT2I-x$3uro*>_>83j-?C1wAsXygs3o->5DNL!e*b;?|NO8}v!qgs9+75*>$|2mxj literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/craftstudioapi/textures/entity/dragon_brun.png b/src/main/resources/assets/craftstudioapi/textures/entity/dragon_brun.png new file mode 100644 index 0000000000000000000000000000000000000000..c771e93f5de1e76d4849bc6154db66bca5f0ad9c GIT binary patch literal 18475 zcmYhibzGF+6E?iCbV(x(OG!ydEe%UIC`d>Mh)ToKjdXXnq)3+_4bm)~BHhi>{jUDL z&-*-o>@IxvzUP{`X6DS?bIyiosLA7EQD6Z809-`{h!y~Vg!mH)fPseiFmx>WfcQYM zlv0%f0IFlK?@dt=|6|%K=s5uZc-?gL#Y5G?U(D2HrvkYk7c`iodUDLjAtlV6==o&J(^q}PMjL@1dVUa^Zp zwA&+Ro=f#xQ|A>&6??ncyJA0S-kxV4O;2A~idmI^t4Mo*ugZB{Or|_Deq0h1zh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ZIm#%d# zHV*V*$pM(45EJ8wN%3O$xEMo_ZR*Eb03V^Xx76%%yuK_R=-UYD!z&Gth@62jD)&0nq2_dyfHQ zp)uKl)@%`*asUZJOeG0;Pn31`^Qog`E3yrl$?|tPIsV>?cfS#6pbv`mW+ZPD+HfrUt}qlqg$Y+!o571&HV8b3z?##2EYfIee$*c-NC9o455*brh{ zg@9_G>xm7;)PhVlb@Dnkp0c$J&Zi@tX0pDgaBy4k?l%G@{`N0F{qW!a)3@W(z#JAG zfW|V%)qStA_LytzZ3j3AWeIl18V^TDrhszB$n<(EO!y#w3U*{$gZyC+I0=hvq!qTC z5VuQ2^ilQ3wutl&Dyb9KuN=U}GEDk#qnaR3+yEuT(IrElz_Lh4V7ZjJSbuKn0 zh68BBk^_Lm^gBk3;bWxE`jq{V)n#NumLgwXZ-pIzY==l``wHS)_A2aQ*5lt>q&lOYZ-O|=+mA_ChNXS2cULt#d$XZ$(Z(D>m6W};d$C?9R3>goMnelP-*LX4Zm&mpj`Qmyj81H;8<$3&rco56uKGAt= zm}au{(`60d76;HfXWlZ;-g3{L(}^YLP!hj%1Os&}Isk~PzGo~=JjRAGkW=@Y9mW^~ zX8gH^Gp;2uP7vTcju}V5SV*SVTVXrWxO?nn2PO*7mLu_a z>+@9SQJ_wU+m2l}PK$7mrED#S^LC76;tI&;-3YYj6hw`ma}Fi>(*cYOU>-{jz+-_E z$GMBxjJHM3`Vt5SK?O#>wNww2tgehUd>RK7xYn zBGz@L*IVHXQe$gjtd;38-J>k*%I7CKk3u>=NNg@(kB}6b)MxXcGA$~}k8CZ+P5}LQ zLvz}VK)zm?8dwLR42c`FHU-gu&pC&IK0x$2v6H25Wn_#+rkRZIz(+U;hM0uvo0e%& zNq&=lV>yh?W$i$JpLQeAz event) { @SubscribeEvent public static void registerEntities(RegistryEvent.Register event) { - EntityRegistry.registerModEntity(new ResourceLocation("testmod", "entityTest"), EntityTest.class, "entityTest", 420, Mod_Test.getInstance(), + EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest"), EntityTest.class, "entityTest", 420, Mod_Test.getInstance(), 40, 1, true, new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("testmod", "entityTest2"), EntityTest2.class, "entityTest2", 421, + EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest2"), EntityTest2.class, "entityTest2", 421, Mod_Test.getInstance(), 40, 1, true, new Color(255, 0, 0).getRGB(), new Color(0, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("testmod", "entityTest3"), EntityTest3.class, "entityTest3", 422, + EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest3"), EntityTest3.class, "entityTest3", 422, Mod_Test.getInstance(), 40, 1, true, new Color(0, 0, 255).getRGB(), new Color(0, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("testmod", "entityTest4"), EntityTest4.class, "entityTest4", 423, + EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest4"), EntityTest4.class, "entityTest4", 423, Mod_Test.getInstance(), 40, 1, true, new Color(255, 255, 0).getRGB(), new Color(0, 0, 0).getRGB()); Mod_Test.getProxy().registerEntityRender(); Mod_Test.getProxy().bindTESR(); From 8f6c23d24779097f8067b42ab7b120429c0a00fc Mon Sep 17 00:00:00 2001 From: Phenix246 Date: Wed, 4 Sep 2019 16:34:43 +0200 Subject: [PATCH 5/9] Start working on fixing dev mod --- build.gradle | 56 ++++++++++++++--- .../craftstudio/dev/CraftStudioApiDev.java | 26 ++++---- .../dev/command/CommandCSList.java | 48 +++++--------- .../dev/command/CommandCSUVMap.java | 63 +++++-------------- .../craftstudio/dev/util/UVMapCreator.java | 12 ++-- .../client/model/ModelCraftStudio.java | 4 +- .../test/client/entityRender/RenderTest.java | 18 +++--- .../test/client/entityRender/RenderTest2.java | 18 +++--- .../test/client/entityRender/RenderTest3.java | 16 ++--- .../test/client/entityRender/RenderTest4.java | 18 +++--- .../leviathanstudio/test/common/Mod_Test.java | 4 +- .../test/common/block/BlockTest.java | 22 +++---- .../test/common/entity/EntityTest.java | 7 ++- .../test/common/entity/EntityTest2.java | 22 +++---- .../test/common/entity/EntityTest3.java | 12 ++-- .../test/common/entity/EntityTest4.java | 6 +- .../common/tileEntity/TileEntityTest.java | 6 +- .../test/pack/animation/AnimationLootAt.java | 47 +++++++------- 18 files changed, 196 insertions(+), 209 deletions(-) diff --git a/build.gradle b/build.gradle index 645c8fd..9540cd4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,12 @@ buildscript { repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() - mavenCentral() + maven { url = 'https://repo.leviathan-studio.com/libs-release' } } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } + apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' @@ -18,6 +17,33 @@ archivesBaseName = 'CraftStudioAPI' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. +sourceSets { + main { + java { + srcDirs 'src/main/java/' + } + resources { + srcDirs 'src/main/resources/' + } + } + dev { + java { + srcDirs 'src/dev/java/' + } + resources { + srcDirs 'src/dev/resources/' + } + } + mod { + java { + srcDirs 'src/mod/java/' + } + resources { + srcDirs 'src/mod/resources/' + } + } +} + minecraft { mappings channel: 'snapshot', version: '20190719-1.14.3' @@ -33,9 +59,14 @@ minecraft { property 'forge.logging.console.level', 'info' mods { - examplemod { + craftstudioapi { + ideaModule "${rootProject.name}.main" source sourceSets.main } + testmod { + ideaModule "${rootProject.name}.mod" + source sourceSets.mod + } } } @@ -47,9 +78,14 @@ minecraft { property 'forge.logging.console.level', 'info' mods { - examplemod { + craftstudioapi { + ideaModule "${rootProject.name}.main" source sourceSets.main } + testmod { + ideaModule "${rootProject.name}.mod" + source sourceSets.mod + } } } @@ -60,10 +96,10 @@ minecraft { property 'forge.logging.console.level', 'info' - args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/') + args '--mod', 'craftstudioapi', '--all', '--output', file('src/generated/resources/') mods { - examplemod { + craftstudioapi { source sourceSets.main } } @@ -75,16 +111,18 @@ dependencies { minecraft 'net.minecraftforge:forge:1.14.4-28.0.51' } + + // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { attributes([ "Specification-Title": "crafstudio_api", - "Specification-Vendor": "examplemodsareus", + "Specification-Vendor": "LeviathanStudio", "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, "Implementation-Version": "${version}", - "Implementation-Vendor" :"examplemodsareus", + "Implementation-Vendor" :"LeviathanStudio", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } diff --git a/src/dev/java/com/leviathanstudio/craftstudio/dev/CraftStudioApiDev.java b/src/dev/java/com/leviathanstudio/craftstudio/dev/CraftStudioApiDev.java index 93da371..cff6d24 100644 --- a/src/dev/java/com/leviathanstudio/craftstudio/dev/CraftStudioApiDev.java +++ b/src/dev/java/com/leviathanstudio/craftstudio/dev/CraftStudioApiDev.java @@ -1,15 +1,14 @@ package com.leviathanstudio.craftstudio.dev; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.leviathanstudio.craftstudio.dev.command.CommandCSList; import com.leviathanstudio.craftstudio.dev.command.CommandCSUVMap; -import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; +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; /** * Main class of the dev mod of the CraftStudioAPI @@ -18,9 +17,7 @@ * * @author Timmypote */ -@Mod(modid = CraftStudioApiDev.API_ID, name = CraftStudioApiDev.NAME, clientSideOnly = true, - version = "1.0.0", - acceptedMinecraftVersions = "1.12") +@Mod(CraftStudioApiDev.API_ID) public class CraftStudioApiDev { @@ -28,10 +25,13 @@ public class CraftStudioApiDev public static final String API_ID = "craftstudioapidev"; public static final String NAME = "CraftStudio API Dev"; - @EventHandler - public void init(FMLInitializationEvent event) { - ClientCommandHandler.instance.registerCommand(new CommandCSUVMap()); - ClientCommandHandler.instance.registerCommand(new CommandCSList()); + public CraftStudioApiDev() { + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverStartingEvent); + } + + private void serverStartingEvent(FMLServerStartingEvent event) { + CommandCSUVMap.register(event.getCommandDispatcher()); + CommandCSList.register(event.getCommandDispatcher()); } public static Logger getLogger() { diff --git a/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSList.java b/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSList.java index e4f175c..0008a16 100644 --- a/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSList.java +++ b/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSList.java @@ -1,26 +1,14 @@ package com.leviathanstudio.craftstudio.dev.command; import java.util.Arrays; -import java.util.Collections; import java.util.List; -import java.util.Set; -import javax.annotation.Nullable; +import com.mojang.brigadier.CommandDispatcher; -import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.SyntaxErrorException; -import net.minecraft.command.WrongUsageException; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.client.IClientCommand; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.command.CommandSource; +import net.minecraft.command.Commands; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Command to list all the models or animations. @@ -29,8 +17,8 @@ * * @author Timmypote */ -@SideOnly(Side.CLIENT) -public class CommandCSList extends CommandBase implements IClientCommand +@OnlyIn(Dist.CLIENT) +public class CommandCSList { private static String name = "cslist"; @@ -38,12 +26,14 @@ public class CommandCSList extends CommandBase implements IClientCommand private static int permLevel = 0; private static List autoC = Arrays. asList(new String[] { "models", "animations" }); - @Override - public String getName() { - return CommandCSList.name; + public static void register(CommandDispatcher dispatcher) { + dispatcher.register(Commands.literal(name) + .requires(src -> src.hasPermissionLevel(permLevel))); + } - @Override + + /*@Override public String getUsage(ICommandSender sender) { return CommandCSList.usage; } @@ -70,18 +60,8 @@ else if (args[0].equals("animations")) throw new WrongUsageException(CommandCSList.usage); } - @Override - public int getRequiredPermissionLevel() { - return CommandCSList.permLevel; - } - @Override public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { return args.length == 1 ? getListOfStringsMatchingLastWord(args, CommandCSList.autoC) : Collections. emptyList(); - } - - @Override - public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) { - return false; - } + }*/ } diff --git a/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSUVMap.java b/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSUVMap.java index c9e2856..bde00a9 100644 --- a/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSUVMap.java +++ b/src/dev/java/com/leviathanstudio/craftstudio/dev/command/CommandCSUVMap.java @@ -1,26 +1,11 @@ package com.leviathanstudio.craftstudio.dev.command; -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; - -import com.leviathanstudio.craftstudio.client.exception.CSResourceNotRegisteredException; -import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; -import com.leviathanstudio.craftstudio.dev.util.UVMapCreator; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.client.IClientCommand; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import com.mojang.brigadier.CommandDispatcher; +import net.minecraft.command.CommandSource; +import net.minecraft.command.Commands; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Command to generate a UV map for a specified model. * @@ -28,26 +13,23 @@ * * @author Timmypote */ -@SideOnly(Side.CLIENT) -public class CommandCSUVMap extends CommandBase implements IClientCommand -{ +@OnlyIn(Dist.CLIENT) +public class CommandCSUVMap { private static String name = "csuvmap"; private static String usage = "/csuvmap model"; private static int permLevel = 0; - @Override - public String getName() { - return CommandCSUVMap.name; - } - - @Override - public String getUsage(ICommandSender sender) { - return CommandCSUVMap.usage; + public static void register(CommandDispatcher dispatcher) { + //getListOfStringsMatchingLastWord(RegistryHandler.modelRegistry.keySet()); + //EntityArgument.entities() + dispatcher.register(Commands.literal(name) + .requires(src -> src.hasPermissionLevel(permLevel)) + ); + } - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + /* public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length >= 1) { boolean succes = false; try { @@ -66,20 +48,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args } else throw new WrongUsageException(CommandCSUVMap.usage); - } + }*/ - @Override - public int getRequiredPermissionLevel() { - return CommandCSUVMap.permLevel; - } - @Override - public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { - return args.length == 1 ? getListOfStringsMatchingLastWord(args, RegistryHandler.modelRegistry.getKeys()) : Collections. emptyList(); - } - - @Override - public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) { - return false; - } } diff --git a/src/dev/java/com/leviathanstudio/craftstudio/dev/util/UVMapCreator.java b/src/dev/java/com/leviathanstudio/craftstudio/dev/util/UVMapCreator.java index ea97b26..8ad6b23 100644 --- a/src/dev/java/com/leviathanstudio/craftstudio/dev/util/UVMapCreator.java +++ b/src/dev/java/com/leviathanstudio/craftstudio/dev/util/UVMapCreator.java @@ -16,8 +16,8 @@ import com.leviathanstudio.craftstudio.dev.CraftStudioApiDev; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * Object to help generate a UV Map for a model. @@ -26,7 +26,8 @@ * * @author Timmypote */ -@SideOnly(Side.CLIENT) + +@OnlyIn(Dist.CLIENT) public class UVMapCreator { @@ -35,9 +36,8 @@ public class UVMapCreator private int maxu = 0, maxv = 0; public UVMapCreator(ResourceLocation modelIn) { - this.rModel = RegistryHandler.modelRegistry.getObject(modelIn); - if (this.rModel == null) - throw new CSResourceNotRegisteredException(modelIn.toString()); + this.rModel = RegistryHandler.modelRegistry.getValue(modelIn) + .orElseThrow(() -> new CSResourceNotRegisteredException(modelIn.toString())); } public boolean createUVMap() { diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java index 9874e87..712e709 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java @@ -26,7 +26,7 @@ * @since 0.3.0 */ @OnlyIn(Dist.CLIENT) -public class ModelCraftStudio extends EntityModel { +public class ModelCraftStudio extends EntityModel { private List parentBlocks = new ArrayList<>(); @@ -157,7 +157,7 @@ public void render() { * Render methods for an Entity */ @Override - public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + public void render(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); ClientAnimationHandler.performAnimationInModel(this.parentBlocks, (IAnimated) entityIn); for (int i = 0; i < this.parentBlocks.size(); i++) diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java index 0e7b7af..c1ddcd6 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java @@ -4,18 +4,18 @@ import com.leviathanstudio.test.common.Mod_Test; import com.leviathanstudio.test.common.entity.EntityTest; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.client.renderer.entity.LivingRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; -public class RenderTest extends RenderLiving +public class RenderTest extends LivingRenderer> { - public static final Factory FACTORY = new Factory(); + public static final Factory FACTORY = new Factory<>(); - public RenderTest(RenderManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test", 64, 32), 0.5F); + public RenderTest(EntityRendererManager manager) { + super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test", 64, 32), 0.5F); } @Override @@ -26,8 +26,8 @@ protected ResourceLocation getEntityTexture(T entity) { public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderTest(manager); + public EntityRenderer createRenderFor(EntityRendererManager manager) { + return new RenderTest(manager); } } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java index 2b67830..ef84e6e 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java @@ -4,18 +4,18 @@ import com.leviathanstudio.test.common.Mod_Test; import com.leviathanstudio.test.common.entity.EntityTest2; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.client.renderer.entity.LivingRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; -public class RenderTest2 extends RenderLiving +public class RenderTest2 extends LivingRenderer> { - public static final Factory FACTORY = new Factory(); + public static final Factory FACTORY = new Factory<>(); - public RenderTest2(RenderManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "peacock", 128, 64), 0.5F); + public RenderTest2(EntityRendererManager manager) { + super(manager, new ModelCraftStudio(Mod_Test.MODID, "peacock", 128, 64), 0.5F); } @Override @@ -26,8 +26,8 @@ protected ResourceLocation getEntityTexture(T entity) { public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderTest2(manager); + public EntityRenderer createRenderFor(EntityRendererManager manager) { + return new RenderTest2(manager); } } } diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java index a51a9a1..3585805 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java @@ -4,18 +4,18 @@ import com.leviathanstudio.test.common.Mod_Test; import com.leviathanstudio.test.common.entity.EntityTest3; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.client.renderer.entity.LivingRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; -public class RenderTest3 extends RenderLiving +public class RenderTest3 extends LivingRenderer> { public static final Factory FACTORY = new Factory(); - public RenderTest3(RenderManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "dragon_brun", 256), 0.5F); + public RenderTest3(EntityRendererManager manager) { + super(manager, new ModelCraftStudio(Mod_Test.MODID, "dragon_brun", 256), 0.5F); } @Override @@ -26,8 +26,8 @@ protected ResourceLocation getEntityTexture(T entity) { public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderTest3(manager); + public EntityRenderer createRenderFor(EntityRendererManager manager) { + return new RenderTest3(manager); } } } diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java index 0e3a233..8bd100d 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java @@ -4,19 +4,19 @@ import com.leviathanstudio.test.common.Mod_Test; import com.leviathanstudio.test.common.entity.EntityTest4; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.client.renderer.entity.LivingRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; -public class RenderTest4 extends RenderLiving +public class RenderTest4 extends LivingRenderer> { - public static final Factory FACTORY = new Factory(); + public static final Factory FACTORY = new Factory<>(); - public RenderTest4(RenderManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test2", 64, 32), 0.5F); + public RenderTest4(EntityRendererManager manager) { + super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test2", 64, 32), 0.5F); } @Override @@ -27,8 +27,8 @@ protected ResourceLocation getEntityTexture(T entity) { public static class Factory implements IRenderFactory { @Override - public Render createRenderFor(RenderManager manager) { - return new RenderTest4(manager); + public EntityRenderer createRenderFor(EntityRendererManager manager) { + return new RenderTest4(manager); } } diff --git a/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java b/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java index 5a4bbf2..f9be9fe 100644 --- a/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java +++ b/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java @@ -6,10 +6,10 @@ import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; -@Mod(name = "TestMod", modid = Mod_Test.MODID) +@Mod(Mod_Test.MODID) public class Mod_Test { - public static final String MODID = "craftstudioapi"; + public static final String MODID = "testmod"; @SidedProxy(clientSide = "com.leviathanstudio.test.proxy.ClientProxy", serverSide = "com.leviathanstudio.test.proxy.CommonProxy") private static CommonProxy proxy; diff --git a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java index aa860e9..5fd6d59 100644 --- a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java @@ -3,14 +3,13 @@ import com.leviathanstudio.test.common.tileEntity.TileEntityTest; import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.world.World; +import net.minecraft.world.IBlockReader; -public class BlockTest extends Block implements ITileEntityProvider +public class BlockTest extends Block { public BlockTest() { @@ -20,23 +19,24 @@ public BlockTest() { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public EnumBlockRenderType getRenderType(IBlockState state) { - return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; + public BlockRenderType getRenderType(BlockState state) { + return BlockRenderType.ENTITYBLOCK_ANIMATED; } + @Override - public TileEntityTest createNewTileEntity(World worldIn, int meta) { - return new TileEntityTest(worldIn); + public TileEntityTest createTileEntity(BlockState state, IBlockReader world) { + return new TileEntityTest(world); } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java index 400dbf5..994709b 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java @@ -5,6 +5,7 @@ import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedEntity; import com.leviathanstudio.test.common.Mod_Test; +import net.minecraft.entity.EntityType; import net.minecraft.world.World; public class EntityTest extends AnimatedEntity @@ -18,7 +19,7 @@ public class EntityTest extends AnimatedEntity } public EntityTest(World par1World) { - super(par1World); + super(null, par1World); } @Override @@ -27,8 +28,8 @@ public AnimationHandler getAnimationHandler() { } @Override - public void onLivingUpdate() { - super.onLivingUpdate(); + public void livingTick() { + super.livingTick(); if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "streching", this)) this.getAnimationHandler().startAnimation(Mod_Test.MODID, "streching", this); diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java index f2eac0b..d4c0425 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java @@ -6,16 +6,17 @@ import com.leviathanstudio.test.common.Mod_Test; import com.leviathanstudio.test.pack.animation.AnimationLootAt; -import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.AgeableEntity; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAILookIdle; -import net.minecraft.entity.ai.EntityAIWatchClosest; -import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.ai.goal.LookAtGoal; +import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.world.World; -public class EntityTest2 extends EntityAnimal implements IAnimated +public class EntityTest2 extends AnimalEntity implements IAnimated { protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest2.class); protected boolean fanOpen = true; @@ -29,8 +30,7 @@ public class EntityTest2 extends EntityAnimal implements IAnimated public EntityTest2(World par1World) { super(par1World); this.setSize(1.0F, 1.5F); - this.tasks.addTask(1, new EntityAILookIdle(this)); - this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 10)); + this.tasks.addTask(2, new LookAtGoal(this, PlayerEntity.class, 10)); this.initEntityAI(); } @@ -47,7 +47,7 @@ public AnimationHandler getAnimationHandler() { } @Override - public boolean processInteract(EntityPlayer player, EnumHand hand) { + public boolean processInteract(PlayerEntity player, Hand hand) { if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "close_fan", this) && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "open_fan", this)) if (this.fanOpen) { @@ -62,8 +62,8 @@ public boolean processInteract(EntityPlayer player, EnumHand hand) { } @Override - public void onLivingUpdate() { - super.onLivingUpdate(); + public void livingTick() { + super.livingTick(); this.getAnimationHandler().animationsUpdate(this); if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "lookat", this)) @@ -71,7 +71,7 @@ public void onLivingUpdate() { } @Override - public EntityAgeable createChild(EntityAgeable ageable) { + public AgeableEntity createChild(AgeableEntity ageable) { return null; } diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java index fddad0e..5783957 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java @@ -5,8 +5,8 @@ import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedEntity; import com.leviathanstudio.test.common.Mod_Test; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumHand; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; import net.minecraft.world.World; public class EntityTest3 extends AnimatedEntity @@ -20,7 +20,7 @@ public class EntityTest3 extends AnimatedEntity } public EntityTest3(World par1World) { - super(par1World); + super(null, par1World); } @Override @@ -29,15 +29,15 @@ public AnimationHandler getAnimationHandler() { } @Override - public boolean processInteract(EntityPlayer player, EnumHand hand) { + public boolean processInteract(PlayerEntity player, Hand hand) { if (!this.fly) this.fly = true; return true; } @Override - public void onLivingUpdate() { - super.onLivingUpdate(); + public void livingTick() { + super.livingTick(); if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "fly", this) && this.fly) this.getAnimationHandler().networkStartAnimation(Mod_Test.MODID, "fly", this); diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java index 1116510..8c25a1a 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java @@ -16,7 +16,7 @@ public class EntityTest4 extends AnimatedEntity } public EntityTest4(World par1World) { - super(par1World); + super(null, par1World); } @Override @@ -25,8 +25,8 @@ public AnimationHandler getAnimationHandler() { } @Override - public void onLivingUpdate() { - super.onLivingUpdate(); + public void livingTick() { + super.livingTick(); if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "rotation", this)) this.getAnimationHandler().startAnimation(Mod_Test.MODID, "rotation", this); diff --git a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java index 141499e..28cebc5 100644 --- a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java @@ -16,7 +16,7 @@ public class TileEntityTest extends AnimatedTileEntity } public TileEntityTest() { - super(); + super(null); } public TileEntityTest(World worldIn) { @@ -30,8 +30,8 @@ public AnimationHandler getAnimationHandler() { } @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "position", this)) this.getAnimationHandler().startAnimation(Mod_Test.MODID, "position", this); diff --git a/src/mod/java/com/leviathanstudio/test/pack/animation/AnimationLootAt.java b/src/mod/java/com/leviathanstudio/test/pack/animation/AnimationLootAt.java index f703152..e334c3e 100644 --- a/src/mod/java/com/leviathanstudio/test/pack/animation/AnimationLootAt.java +++ b/src/mod/java/com/leviathanstudio/test/pack/animation/AnimationLootAt.java @@ -7,32 +7,31 @@ import com.leviathanstudio.craftstudio.common.animation.CustomChannel; import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import net.minecraft.entity.EntityLiving; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.entity.LivingEntity; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public class AnimationLootAt extends CustomChannel -{ - private String headPart; +public class AnimationLootAt extends CustomChannel { + private String headPart; - public AnimationLootAt(String headPartIn) { - super("lookat"); - this.headPart = headPartIn; - } + public AnimationLootAt(String headPartIn) { + super("lookat"); + this.headPart = headPartIn; + } - @Override - @SideOnly(Side.CLIENT) - public void update(CSModelRenderer parts, IAnimated animated) { - if (animated instanceof EntityLiving) - if (parts.boxName.equals(this.headPart)) { - EntityLiving entityL = (EntityLiving) animated; - float diff = entityL.getRotationYawHead() - entityL.renderYawOffset; - Quat4f quat = MathHelper.quatFromEuler(entityL.rotationPitch, 0.0F, diff); - Quat4f quat2 = new Quat4f(parts.getDefaultRotationAsQuaternion()); - quat.mul(quat2); - parts.getRotationMatrix().set(quat); - parts.getRotationMatrix().transpose(); - } - } + @Override + @OnlyIn(Dist.CLIENT) + public void update(CSModelRenderer parts, IAnimated animated) { + if (animated instanceof LivingEntity) + if (parts.boxName.equals(this.headPart)) { + LivingEntity entityL = (LivingEntity) animated; + float diff = entityL.getRotationYawHead() - entityL.renderYawOffset; + Quat4f quat = MathHelper.quatFromEuler(entityL.rotationPitch, 0.0F, diff); + Quat4f quat2 = new Quat4f(parts.getDefaultRotationAsQuaternion()); + quat.mul(quat2); + parts.getRotationMatrix().set(quat); + parts.getRotationMatrix().transpose(); + } + } } \ No newline at end of file From 1f805330ab9eb88bab5c64f7f5af911dc4252905 Mon Sep 17 00:00:00 2001 From: Phenix246 Date: Thu, 5 Sep 2019 13:21:36 +0200 Subject: [PATCH 6/9] Fix all main error need to fix @CraftStudioLoader --- .../client/registry/CSRegistryHelper.java | 7 +- .../test/client/entityRender/RenderTest.java | 6 +- .../test/client/entityRender/RenderTest2.java | 6 +- .../test/client/entityRender/RenderTest3.java | 6 +- .../test/client/entityRender/RenderTest4.java | 6 +- .../leviathanstudio/test/common/ModTest.java | 18 ++++ .../leviathanstudio/test/common/Mod_Test.java | 27 ------ .../test/common/RegistryHandler.java | 85 +++++++++++++------ .../test/common/block/BlockTest.java | 19 +---- .../test/common/entity/EntityTest.java | 19 +++-- .../test/common/entity/EntityTest2.java | 54 ++++++------ .../test/common/entity/EntityTest3.java | 22 ++--- .../test/common/entity/EntityTest4.java | 21 +++-- .../test/common/item/ItemTest.java | 10 +-- .../common/tileEntity/TileEntityTest.java | 8 +- .../test/proxy/ClientProxy.java | 8 +- 16 files changed, 171 insertions(+), 151 deletions(-) create mode 100644 src/mod/java/com/leviathanstudio/test/common/ModTest.java delete mode 100644 src/mod/java/com/leviathanstudio/test/common/Mod_Test.java diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java index 950008a..204cee7 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java @@ -22,12 +22,13 @@ */ @OnlyIn(Dist.CLIENT) public class CSRegistryHelper { - private static List loadModelList = new ArrayList(); - private static List loadAnimList = new ArrayList(); + private static List loadModelList = new ArrayList<>(); + private static List loadAnimList = new ArrayList<>(); private String modid; - public CSRegistryHelper() { + public CSRegistryHelper(String modid) { + this.modid = modid; } /** diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java index c1ddcd6..0b6c7aa 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest.java @@ -1,7 +1,7 @@ package com.leviathanstudio.test.client.entityRender; import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.common.entity.EntityTest; import net.minecraft.client.renderer.entity.EntityRenderer; @@ -15,12 +15,12 @@ public class RenderTest extends LivingRenderer FACTORY = new Factory<>(); public RenderTest(EntityRendererManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test", 64, 32), 0.5F); + super(manager, new ModelCraftStudio(ModTest.MODID, "craftstudio_api_test", 64, 32), 0.5F); } @Override protected ResourceLocation getEntityTexture(T entity) { - return new ResourceLocation(Mod_Test.MODID, "textures/entity/craftstudio_api_test.png"); + return new ResourceLocation(ModTest.MODID, "textures/entity/craftstudio_api_test.png"); } public static class Factory implements IRenderFactory diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java index ef84e6e..b9ede4e 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest2.java @@ -1,7 +1,7 @@ package com.leviathanstudio.test.client.entityRender; import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.common.entity.EntityTest2; import net.minecraft.client.renderer.entity.EntityRenderer; @@ -15,12 +15,12 @@ public class RenderTest2 extends LivingRenderer FACTORY = new Factory<>(); public RenderTest2(EntityRendererManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "peacock", 128, 64), 0.5F); + super(manager, new ModelCraftStudio(ModTest.MODID, "peacock", 128, 64), 0.5F); } @Override protected ResourceLocation getEntityTexture(T entity) { - return new ResourceLocation(Mod_Test.MODID, "textures/entity/peacock.png"); + return new ResourceLocation(ModTest.MODID, "textures/entity/peacock.png"); } public static class Factory implements IRenderFactory diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java index 3585805..9f53341 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java @@ -1,7 +1,7 @@ package com.leviathanstudio.test.client.entityRender; import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.common.entity.EntityTest3; import net.minecraft.client.renderer.entity.EntityRenderer; @@ -15,12 +15,12 @@ public class RenderTest3 extends LivingRenderer(Mod_Test.MODID, "dragon_brun", 256), 0.5F); + super(manager, new ModelCraftStudio(ModTest.MODID, "dragon_brun", 256), 0.5F); } @Override protected ResourceLocation getEntityTexture(T entity) { - return new ResourceLocation(Mod_Test.MODID, "textures/entity/dragon_brun.png"); + return new ResourceLocation(ModTest.MODID, "textures/entity/dragon_brun.png"); } public static class Factory implements IRenderFactory diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java index 8bd100d..9c4d7ba 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java @@ -1,7 +1,7 @@ package com.leviathanstudio.test.client.entityRender; import com.leviathanstudio.craftstudio.client.model.ModelCraftStudio; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.common.entity.EntityTest4; import net.minecraft.client.renderer.entity.EntityRenderer; @@ -16,12 +16,12 @@ public class RenderTest4 extends LivingRenderer(); public RenderTest4(EntityRendererManager manager) { - super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test2", 64, 32), 0.5F); + super(manager, new ModelCraftStudio(ModTest.MODID, "craftstudio_api_test2", 64, 32), 0.5F); } @Override protected ResourceLocation getEntityTexture(T entity) { - return new ResourceLocation(Mod_Test.MODID, "textures/entity/craftstudio_api_test.png"); + return new ResourceLocation(ModTest.MODID, "textures/entity/craftstudio_api_test.png"); } public static class Factory implements IRenderFactory diff --git a/src/mod/java/com/leviathanstudio/test/common/ModTest.java b/src/mod/java/com/leviathanstudio/test/common/ModTest.java new file mode 100644 index 0000000..61ad3fc --- /dev/null +++ b/src/mod/java/com/leviathanstudio/test/common/ModTest.java @@ -0,0 +1,18 @@ +package com.leviathanstudio.test.common; + +import com.leviathanstudio.test.proxy.*; + +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.common.Mod; + +@Mod(ModTest.MODID) +public class ModTest +{ + public static final String MODID = "testmod"; + + public static final CommonProxy PROXY = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); + + public ModTest( ) { + + } +} \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java b/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java deleted file mode 100644 index f9be9fe..0000000 --- a/src/mod/java/com/leviathanstudio/test/common/Mod_Test.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.leviathanstudio.test.common; - -import com.leviathanstudio.test.proxy.CommonProxy; - -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.Instance; -import net.minecraftforge.fml.common.SidedProxy; - -@Mod(Mod_Test.MODID) -public class Mod_Test -{ - public static final String MODID = "testmod"; - - @SidedProxy(clientSide = "com.leviathanstudio.test.proxy.ClientProxy", serverSide = "com.leviathanstudio.test.proxy.CommonProxy") - private static CommonProxy proxy; - - @Instance(Mod_Test.MODID) - private static Mod_Test instance; - - public static Mod_Test getInstance() { - return instance; - } - - public static CommonProxy getProxy() { - return proxy; - } -} \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java index 4cb9bb3..3ac6dee 100644 --- a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java +++ b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java @@ -1,7 +1,5 @@ package com.leviathanstudio.test.common; -import java.awt.Color; - import com.leviathanstudio.test.common.block.BlockTest; import com.leviathanstudio.test.common.entity.EntityTest; import com.leviathanstudio.test.common.entity.EntityTest2; @@ -9,48 +7,81 @@ import com.leviathanstudio.test.common.entity.EntityTest4; import com.leviathanstudio.test.common.item.ItemTest; import com.leviathanstudio.test.common.tileEntity.TileEntityTest; +import com.mojang.datafixers.DataFixUtils; +import com.mojang.datafixers.types.Type; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityClassification; +import net.minecraft.entity.EntityType; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.util.ResourceLocation; +import net.minecraft.item.ItemGroup; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.SharedConstants; +import net.minecraft.util.datafix.DataFixesManager; +import net.minecraft.util.datafix.TypeReferences; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.EntityEntry; -import net.minecraftforge.fml.common.registry.EntityRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder; - -@EventBusSubscriber(modid = Mod_Test.MODID) -@ObjectHolder(Mod_Test.MODID) + +@EventBusSubscriber(modid = ModTest.MODID) public class RegistryHandler { public static final Block block_test = null; @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { - event.getRegistry().register(new BlockTest()); - GameRegistry.registerTileEntity(TileEntityTest.class, "tile_entity_test"); + event.getRegistry().register(new BlockTest(Block.Properties.create(Material.ROCK).variableOpacity()).setRegistryName("block_test")); + } + + @SubscribeEvent + public static void registerTiles(RegistryEvent.Register> event) { + TileEntityType tileTest = register("tileTest", TileEntityType.Builder.create(TileEntityTest::new)).setRegistryName("tileTest"); + + event.getRegistry().register(tileTest); } @SubscribeEvent public static void registerItem(RegistryEvent.Register event) { - event.getRegistry().register(new ItemBlock(block_test).setRegistryName("item_block_test")); - event.getRegistry().register(new ItemTest().setRegistryName("item_test")); + event.getRegistry().register(new BlockItem(block_test, (new Item.Properties().group(ItemGroup.MISC))).setRegistryName("item_block_test")); + event.getRegistry().register(new ItemTest(new Item.Properties().group(ItemGroup.MISC)).setRegistryName("item_test")); } @SubscribeEvent - public static void registerEntities(RegistryEvent.Register event) { - EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest"), EntityTest.class, "entityTest", 420, Mod_Test.getInstance(), - 40, 1, true, new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest2"), EntityTest2.class, "entityTest2", 421, - Mod_Test.getInstance(), 40, 1, true, new Color(255, 0, 0).getRGB(), new Color(0, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest3"), EntityTest3.class, "entityTest3", 422, - Mod_Test.getInstance(), 40, 1, true, new Color(0, 0, 255).getRGB(), new Color(0, 0, 0).getRGB()); - EntityRegistry.registerModEntity(new ResourceLocation("craftstudioapi", "entityTest4"), EntityTest4.class, "entityTest4", 423, - Mod_Test.getInstance(), 40, 1, true, new Color(255, 255, 0).getRGB(), new Color(0, 0, 0).getRGB()); - Mod_Test.getProxy().registerEntityRender(); - Mod_Test.getProxy().bindTESR(); + public static void registerEntities(RegistryEvent.Register> event) { + + EntityType entityTest = EntityType.Builder.create(EntityTest::new, EntityClassification.MISC).build("entityTest"); + EntityType entityTest2 = EntityType.Builder.create(EntityTest2::new, EntityClassification.MISC).build("entityTest2"); + EntityType entityTest3 = EntityType.Builder.create(EntityTest3::new, EntityClassification.MISC).build("entityTest3"); + EntityType entityTest4 = EntityType.Builder.create(EntityTest4::new, EntityClassification.MISC).build("entityTest4"); + + + event.getRegistry().register(entityTest); + event.getRegistry().register(entityTest2); + event.getRegistry().register(entityTest3); + event.getRegistry().register(entityTest4); + + ModTest.PROXY.registerEntityRender(); + ModTest.PROXY.bindTESR(); + } + + private static TileEntityType register(String id, TileEntityType.Builder builder) { + Type type = null; + + try { + type = DataFixesManager.getDataFixer().getSchema(DataFixUtils.makeKey(1631)).getChoiceType(TypeReferences.BLOCK_ENTITY, ModTest.MODID + ":" + id); + } + catch(IllegalArgumentException e) { + if(SharedConstants.developmentMode) { + throw e; + } + } + + TileEntityType tileEntityType = builder.build(type); + + return tileEntityType; } + } diff --git a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java index 5fd6d59..267987e 100644 --- a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java @@ -5,28 +5,15 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.world.IBlockReader; public class BlockTest extends Block { - public BlockTest() { - super(Material.ROCK); - this.setRegistryName("block_test").setUnlocalizedName("block_test"); - this.setCreativeTab(CreativeTabs.MISC); + public BlockTest(Block.Properties props) { + super(props); } - @Override - public boolean isOpaqueCube(BlockState state) { - return false; - } - - @Override - public boolean isFullCube(BlockState state) { - return false; - } @Override public BlockRenderType getRenderType(BlockState state) { @@ -36,7 +23,7 @@ public BlockRenderType getRenderType(BlockState state) { @Override public TileEntityTest createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityTest(world); + return new TileEntityTest(); } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java index 994709b..5189266 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java @@ -3,8 +3,9 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedEntity; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; +import net.minecraft.entity.CreatureEntity; import net.minecraft.entity.EntityType; import net.minecraft.world.World; @@ -13,13 +14,13 @@ public class EntityTest extends AnimatedEntity protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest.class); static { - EntityTest.animHandler.addAnim(Mod_Test.MODID, "position", "craftstudio_api_test", true); - EntityTest.animHandler.addAnim(Mod_Test.MODID, "offset", "craftstudio_api_test", true); - EntityTest.animHandler.addAnim(Mod_Test.MODID, "streching", "craftstudio_api_test", true); + EntityTest.animHandler.addAnim(ModTest.MODID, "position", "craftstudio_api_test", true); + EntityTest.animHandler.addAnim(ModTest.MODID, "offset", "craftstudio_api_test", true); + EntityTest.animHandler.addAnim(ModTest.MODID, "streching", "craftstudio_api_test", true); } - - public EntityTest(World par1World) { - super(null, par1World); + + public EntityTest(EntityType type, World par1World) { + super(type, par1World); } @Override @@ -31,7 +32,7 @@ public AnimationHandler getAnimationHandler() { public void livingTick() { super.livingTick(); - if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "streching", this)) - this.getAnimationHandler().startAnimation(Mod_Test.MODID, "streching", this); + if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(ModTest.MODID, "streching", this)) + this.getAnimationHandler().startAnimation(ModTest.MODID, "streching", this); } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java index d4c0425..36d4c03 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest2.java @@ -3,59 +3,63 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.pack.animation.AnimationLootAt; import net.minecraft.entity.AgeableEntity; +import net.minecraft.entity.EntityType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.goal.LookAtGoal; import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.EnumHand; import net.minecraft.util.Hand; import net.minecraft.world.World; +import net.minecraft.world.dimension.DimensionType; public class EntityTest2 extends AnimalEntity implements IAnimated { - protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest2.class); + protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest2.class); protected boolean fanOpen = true; static { - EntityTest2.animHandler.addAnim(Mod_Test.MODID, "close_fan", "peacock", false); - EntityTest2.animHandler.addAnim(Mod_Test.MODID, "open_fan", "close_fan"); - EntityTest2.animHandler.addAnim(Mod_Test.MODID, "lookat", new AnimationLootAt("Head")); + EntityTest2.animHandler.addAnim(ModTest.MODID, "close_fan", "peacock", false); + EntityTest2.animHandler.addAnim(ModTest.MODID, "open_fan", "close_fan"); + EntityTest2.animHandler.addAnim(ModTest.MODID, "lookat", new AnimationLootAt("Head")); } - public EntityTest2(World par1World) { - super(par1World); - this.setSize(1.0F, 1.5F); - this.tasks.addTask(2, new LookAtGoal(this, PlayerEntity.class, 10)); - this.initEntityAI(); + public EntityTest2(EntityType type, World par1World) { + super(type, par1World); + this.stepHeight = 1.5F; } - + @Override - protected void applyEntityAttributes() { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(4.0D); - this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); + protected void registerGoals() { + this.goalSelector.addGoal(2, new LookAtGoal(this, PlayerEntity.class, 10)); } @Override - public AnimationHandler getAnimationHandler() { + protected void registerAttributes() { + super.registerAttributes(); + this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(4.0D); + this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D); + } + + @SuppressWarnings("unchecked") + @Override + public AnimationHandler getAnimationHandler() { return EntityTest2.animHandler; } @Override public boolean processInteract(PlayerEntity player, Hand hand) { - if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "close_fan", this) - && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "open_fan", this)) + if (!this.getAnimationHandler().isAnimationActive(ModTest.MODID, "close_fan", this) + && !this.getAnimationHandler().isAnimationActive(ModTest.MODID, "open_fan", this)) if (this.fanOpen) { - this.getAnimationHandler().networkStopStartAnimation(Mod_Test.MODID, "open_fan", "close_fan", this); + this.getAnimationHandler().networkStopStartAnimation(ModTest.MODID, "open_fan", "close_fan", this); this.fanOpen = false; } else { - this.getAnimationHandler().networkStopStartAnimation(Mod_Test.MODID, "close_fan", "open_fan", this); + this.getAnimationHandler().networkStopStartAnimation(ModTest.MODID, "close_fan", "open_fan", this); this.fanOpen = true; } return true; @@ -66,8 +70,8 @@ public void livingTick() { super.livingTick(); this.getAnimationHandler().animationsUpdate(this); - if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "lookat", this)) - this.getAnimationHandler().startAnimation(Mod_Test.MODID, "lookat", this); + if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(ModTest.MODID, "lookat", this)) + this.getAnimationHandler().startAnimation(ModTest.MODID, "lookat", this); } @Override @@ -76,7 +80,7 @@ public AgeableEntity createChild(AgeableEntity ageable) { } @Override - public int getDimension() { + public DimensionType getDimension() { return this.dimension; } diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java index 5783957..8850157 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest3.java @@ -3,28 +3,30 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedEntity; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; +import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Hand; import net.minecraft.world.World; public class EntityTest3 extends AnimatedEntity { - protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest3.class); + protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest3.class); boolean fly = false; static { - EntityTest3.animHandler.addAnim(Mod_Test.MODID, "fly", "dragon_brun", true); - EntityTest3.animHandler.addAnim(Mod_Test.MODID, "idle", "dragon_brun", true); + EntityTest3.animHandler.addAnim(ModTest.MODID, "fly", "dragon_brun", true); + EntityTest3.animHandler.addAnim(ModTest.MODID, "idle", "dragon_brun", true); } - public EntityTest3(World par1World) { - super(null, par1World); + public EntityTest3(EntityType type, World par1World) { + super(type, par1World); } - @Override - public AnimationHandler getAnimationHandler() { + @SuppressWarnings("unchecked") + @Override + public AnimationHandler getAnimationHandler() { return EntityTest3.animHandler; } @@ -39,8 +41,8 @@ public boolean processInteract(PlayerEntity player, Hand hand) { public void livingTick() { super.livingTick(); - if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "fly", this) && this.fly) - this.getAnimationHandler().networkStartAnimation(Mod_Test.MODID, "fly", this); + if (!this.getAnimationHandler().isAnimationActive(ModTest.MODID, "fly", this) && this.fly) + this.getAnimationHandler().networkStartAnimation(ModTest.MODID, "fly", this); } } diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java index 8c25a1a..69633cd 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java @@ -3,24 +3,27 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedEntity; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.world.World; public class EntityTest4 extends AnimatedEntity { - protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest4.class); + protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest4.class); static { - EntityTest4.animHandler.addAnim(Mod_Test.MODID, "rotation", "craftstudio_api_test2", true); + EntityTest4.animHandler.addAnim(ModTest.MODID, "rotation", "craftstudio_api_test2", true); } - public EntityTest4(World par1World) { - super(null, par1World); + public EntityTest4(EntityType type, World par1World) { + super(type, par1World); } - @Override - public AnimationHandler getAnimationHandler() { + @SuppressWarnings("unchecked") + @Override + public AnimationHandler getAnimationHandler() { return EntityTest4.animHandler; } @@ -28,7 +31,7 @@ public AnimationHandler getAnimationHandler() { public void livingTick() { super.livingTick(); - if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "rotation", this)) - this.getAnimationHandler().startAnimation(Mod_Test.MODID, "rotation", this); + if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(ModTest.MODID, "rotation", this)) + this.getAnimationHandler().startAnimation(ModTest.MODID, "rotation", this); } } diff --git a/src/mod/java/com/leviathanstudio/test/common/item/ItemTest.java b/src/mod/java/com/leviathanstudio/test/common/item/ItemTest.java index 561a5ac..587e72a 100644 --- a/src/mod/java/com/leviathanstudio/test/common/item/ItemTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/item/ItemTest.java @@ -1,14 +1,14 @@ package com.leviathanstudio.test.common.item; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemTest extends Item { - public ItemTest() { - this.setUnlocalizedName("itemTest"); - this.setCreativeTab(CreativeTabs.MISC); - } + public ItemTest(Properties properties) { + super(properties); + } + + } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java index 28cebc5..409a44c 100644 --- a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java @@ -3,7 +3,7 @@ import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedTileEntity; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import net.minecraft.world.World; @@ -12,7 +12,7 @@ public class TileEntityTest extends AnimatedTileEntity protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(TileEntityTest.class); static { - TileEntityTest.animHandler.addAnim(Mod_Test.MODID, "position", "craftstudio_api_test", true); + TileEntityTest.animHandler.addAnim(ModTest.MODID, "position", "craftstudio_api_test", true); } public TileEntityTest() { @@ -33,8 +33,8 @@ public AnimationHandler getAnimationHandler() { public void tick() { super.tick(); - if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "position", this)) - this.getAnimationHandler().startAnimation(Mod_Test.MODID, "position", this); + if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(ModTest.MODID, "position", this)) + this.getAnimationHandler().startAnimation(ModTest.MODID, "position", this); } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java b/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java index 1243499..2c3a02c 100644 --- a/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java +++ b/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java @@ -9,7 +9,7 @@ import com.leviathanstudio.test.client.entityRender.RenderTest2; import com.leviathanstudio.test.client.entityRender.RenderTest3; import com.leviathanstudio.test.client.entityRender.RenderTest4; -import com.leviathanstudio.test.common.Mod_Test; +import com.leviathanstudio.test.common.ModTest; import com.leviathanstudio.test.common.entity.EntityTest; import com.leviathanstudio.test.common.entity.EntityTest2; import com.leviathanstudio.test.common.entity.EntityTest3; @@ -24,7 +24,7 @@ public class ClientProxy extends CommonProxy { @CraftStudioLoader public static void registerCraftStudioAssets() { - CSRegistryHelper registry = new CSRegistryHelper(Mod_Test.MODID); + CSRegistryHelper registry = new CSRegistryHelper(ModTest.MODID); registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, "model_dead_corpse"); registry.register(EnumResourceType.MODEL, EnumRenderType.BLOCK, "craftstudio_api_test2"); registry.register(EnumResourceType.MODEL, EnumRenderType.BLOCK, "craftstudio_api_test"); @@ -50,7 +50,7 @@ public void registerEntityRender() { @Override public void bindTESR() { - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTest.class, new CSTileEntitySpecialRenderer(Mod_Test.MODID, "craftstudio_api_test", 64, - 32, new ResourceLocation(Mod_Test.MODID, "textures/entity/craftstudio_api_test.png"))); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityTest.class, new CSTileEntitySpecialRenderer(ModTest.MODID, "craftstudio_api_test", 64, + 32, new ResourceLocation(ModTest.MODID, "textures/entity/craftstudio_api_test.png"))); } } \ No newline at end of file From 543f6bad24c74bbbf5d97c1b6222cb96ae84cbc4 Mon Sep 17 00:00:00 2001 From: Phenix246 Date: Thu, 5 Sep 2019 15:31:02 +0200 Subject: [PATCH 7/9] Start fixing resource registration --- build.gradle | 6 ++-- .../craftstudio/CraftStudioApi.java | 21 +++++++----- .../client/model/ModelCraftStudio.java | 8 ++--- .../client/registry/AssetModel.java | 7 ++-- .../client/registry/RegistryHandler.java | 7 ++-- .../test/client/entityRender/RenderTest3.java | 2 +- .../test/client/entityRender/RenderTest4.java | 2 +- .../leviathanstudio/test/common/ModTest.java | 13 +++++++- .../test/common/RegistryHandler.java | 23 +++++++------ .../test/common/entity/EntityTest.java | 7 ++-- .../test/common/entity/EntityTest4.java | 1 - .../common/tileEntity/TileEntityTest.java | 7 ++-- .../test/proxy/ClientProxy.java | 8 ++--- .../test/proxy/CommonProxy.java | 2 ++ src/mod/resources/META-INF/mods.toml | 33 +++++++++++++++++++ src/mod/resources/pack.mcmeta | 7 ++++ 16 files changed, 106 insertions(+), 48 deletions(-) create mode 100644 src/mod/resources/META-INF/mods.toml create mode 100644 src/mod/resources/pack.mcmeta diff --git a/build.gradle b/build.gradle index 9540cd4..1c7d0bc 100644 --- a/build.gradle +++ b/build.gradle @@ -96,7 +96,7 @@ minecraft { property 'forge.logging.console.level', 'info' - args '--mod', 'craftstudioapi', '--all', '--output', file('src/generated/resources/') + args '--mod', 'craftstudioapi', '--mod', 'testmod', '--all', '--output', file('src/generated/resources/') mods { craftstudioapi { @@ -111,7 +111,9 @@ dependencies { minecraft 'net.minecraftforge:forge:1.14.4-28.0.51' } - +repositories { + maven { url = 'https://repo.leviathan-studio.com/libs-release' } +} // Example for how to get properties into the manifest for reading by the runtime.. jar { diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index 7d31c6b..31364e8 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -4,13 +4,12 @@ import com.leviathanstudio.craftstudio.client.registry.AssetModel; import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; import com.leviathanstudio.craftstudio.client.registry.RegistryHandler; -import com.leviathanstudio.craftstudio.client.util.EnumRenderType; -import com.leviathanstudio.craftstudio.client.util.EnumResourceType; import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.IAnimated; import com.leviathanstudio.craftstudio.proxy.CSClientProxy; import com.leviathanstudio.craftstudio.proxy.CSCommonProxy; import com.leviathanstudio.craftstudio.proxy.CSServerProxy; + import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; @@ -22,6 +21,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.RegistryBuilder; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,7 +41,6 @@ public class CraftStudioApi { private static IForgeRegistry modelRegistry = null; private static IForgeRegistry animationRegistry = null; - AssetModel testModel = new AssetModel(EnumResourceType.MODEL, EnumRenderType.BLOCK, new ResourceLocation(API_ID, "craftstudio_api_test")); public CraftStudioApi() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); @@ -74,11 +73,6 @@ public void commonSetup(FMLCommonSetupEvent event) { CraftStudioApi.proxy.commonSetup(event); } - @SubscribeEvent - public void onRegisterModel(RegistryEvent.Register event) { - event.getRegistry().register(testModel.setRegistryName("test", "test_model")); - } - @SubscribeEvent public void onCreateRegistry(RegistryEvent.NewRegistry event) { RegistryBuilder modelBuilder = new RegistryBuilder<>(); @@ -96,10 +90,19 @@ public void onCreateRegistry(RegistryEvent.NewRegistry event) { } public void loadCraftStudioLoaders(FMLClientSetupEvent event) { - RegistryHandler.init(); + CSRegistryHelper.loadModels(); CSRegistryHelper.loadAnims(); } + public static IForgeRegistry getModelRegistry() { + return modelRegistry; + } + + public static IForgeRegistry getAnimationRegistry() { + return animationRegistry; + } + + } \ No newline at end of file diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java index 712e709..9298112 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/model/ModelCraftStudio.java @@ -12,6 +12,7 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.SimpleRegistry; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -58,10 +59,9 @@ private ModelCraftStudio(ResourceLocation modelIn, int textureWidth, int texture this.textureWidth = textureWidth; this.textureHeight = textureHeight; - //TODO Check ifPresent() - CSReadedModel rModel = RegistryHandler.modelRegistry.getValue(modelIn).get(); - if (rModel == null) - throw new CSResourceNotRegisteredException(modelIn.toString()); + CSReadedModel rModel = RegistryHandler.modelRegistry + .getValue(modelIn) + .orElseThrow(() -> new CSResourceNotRegisteredException(modelIn.toString())); CSModelRenderer modelRend; for (CSReadedModelBlock rBlock : rModel.getParents()) { diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java index 604aa45..0467777 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/AssetModel.java @@ -1,6 +1,7 @@ package com.leviathanstudio.craftstudio.client.registry; import com.google.common.reflect.TypeToken; +import com.leviathanstudio.craftstudio.CraftStudioApi; import com.leviathanstudio.craftstudio.client.exception.CSMalformedJsonException; import com.leviathanstudio.craftstudio.client.exception.CSResourceNotFoundException; import com.leviathanstudio.craftstudio.client.json.CSJsonReader; @@ -24,10 +25,10 @@ public AssetModel(EnumResourceType resourceType, EnumRenderType renderType, Reso try { ResourceLocation parsedPath = new ResourceLocation(assetIn.getNamespace(), resourceType.getPath() + renderType.getFolderName() + assetIn.getPath() + resourceType.getExtension()); jsonReader = new CSJsonReader(parsedPath); - //if (assetIn.getNamespace() != CraftStudioApi.API_ID) { + if (assetIn.getNamespace() != CraftStudioApi.API_ID) { jsonReader.readModel(); - //} else - // CraftStudioApi.getLogger().fatal("You're not allowed to use the \"craftstudioapi\" to register CraftStudio resources."); + } else + CraftStudioApi.getLogger().fatal("You're not allowed to use the \"craftstudioapi\" to register CraftStudio resources."); } catch (CSResourceNotFoundException | CSMalformedJsonException e) { e.printStackTrace(); } diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java index 9ebbf9a..7efbbf9 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/RegistryHandler.java @@ -18,11 +18,8 @@ public class RegistryHandler { public static SimpleRegistry modelRegistry; public static SimpleRegistry animationRegistry; - /** - * Initialize the registries. - */ - public static void init() { - modelRegistry = new SimpleRegistry<>(); + static { + modelRegistry = new SimpleRegistry<>(); animationRegistry = new SimpleRegistry<>(); } diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java index 9f53341..ef97389 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest3.java @@ -12,7 +12,7 @@ public class RenderTest3 extends LivingRenderer> { - public static final Factory FACTORY = new Factory(); + public static final Factory FACTORY = new Factory<>(); public RenderTest3(EntityRendererManager manager) { super(manager, new ModelCraftStudio(ModTest.MODID, "dragon_brun", 256), 0.5F); diff --git a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java index 9c4d7ba..a83d906 100644 --- a/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java +++ b/src/mod/java/com/leviathanstudio/test/client/entityRender/RenderTest4.java @@ -13,7 +13,7 @@ public class RenderTest4 extends LivingRenderer> { - public static final Factory FACTORY = new Factory<>(); + public static final Factory FACTORY = new Factory<>(); public RenderTest4(EntityRendererManager manager) { super(manager, new ModelCraftStudio(ModTest.MODID, "craftstudio_api_test2", 64, 32), 0.5F); diff --git a/src/mod/java/com/leviathanstudio/test/common/ModTest.java b/src/mod/java/com/leviathanstudio/test/common/ModTest.java index 61ad3fc..3721dd3 100644 --- a/src/mod/java/com/leviathanstudio/test/common/ModTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/ModTest.java @@ -2,8 +2,11 @@ import com.leviathanstudio.test.proxy.*; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod(ModTest.MODID) public class ModTest @@ -13,6 +16,14 @@ public class ModTest public static final CommonProxy PROXY = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public ModTest( ) { - + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); + + MinecraftForge.EVENT_BUS.register(PROXY); + } + + public void clientSetup(FMLClientSetupEvent event) { + ModTest.PROXY.registerCraftStudioAssets(); + ModTest.PROXY.bindTESR(); } + } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java index 3ac6dee..5d7da47 100644 --- a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java +++ b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java @@ -1,5 +1,6 @@ package com.leviathanstudio.test.common; +import com.leviathanstudio.craftstudio.client.registry.AssetModel; import com.leviathanstudio.test.common.block.BlockTest; import com.leviathanstudio.test.common.entity.EntityTest; import com.leviathanstudio.test.common.entity.EntityTest2; @@ -7,6 +8,7 @@ import com.leviathanstudio.test.common.entity.EntityTest4; import com.leviathanstudio.test.common.item.ItemTest; import com.leviathanstudio.test.common.tileEntity.TileEntityTest; +import com.leviathanstudio.test.proxy.ClientProxy; import com.mojang.datafixers.DataFixUtils; import com.mojang.datafixers.types.Type; @@ -26,11 +28,13 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -@EventBusSubscriber(modid = ModTest.MODID) +@EventBusSubscriber(modid = ModTest.MODID, bus = EventBusSubscriber.Bus.MOD) public class RegistryHandler { public static final Block block_test = null; + + @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { event.getRegistry().register(new BlockTest(Block.Properties.create(Material.ROCK).variableOpacity()).setRegistryName("block_test")); @@ -38,33 +42,32 @@ public static void registerBlocks(RegistryEvent.Register event) { @SubscribeEvent public static void registerTiles(RegistryEvent.Register> event) { - TileEntityType tileTest = register("tileTest", TileEntityType.Builder.create(TileEntityTest::new)).setRegistryName("tileTest"); + TileEntityType tileTest = register("tileTest", TileEntityType.Builder.create(TileEntityTest::new)).setRegistryName("tile_test"); event.getRegistry().register(tileTest); } @SubscribeEvent public static void registerItem(RegistryEvent.Register event) { - event.getRegistry().register(new BlockItem(block_test, (new Item.Properties().group(ItemGroup.MISC))).setRegistryName("item_block_test")); - event.getRegistry().register(new ItemTest(new Item.Properties().group(ItemGroup.MISC)).setRegistryName("item_test")); + event.getRegistry().register(new BlockItem(block_test, (new Item.Properties())).setRegistryName("block_test")); + event.getRegistry().register(new ItemTest(new Item.Properties()).setRegistryName("item_test")); } @SubscribeEvent public static void registerEntities(RegistryEvent.Register> event) { - EntityType entityTest = EntityType.Builder.create(EntityTest::new, EntityClassification.MISC).build("entityTest"); EntityType entityTest2 = EntityType.Builder.create(EntityTest2::new, EntityClassification.MISC).build("entityTest2"); EntityType entityTest3 = EntityType.Builder.create(EntityTest3::new, EntityClassification.MISC).build("entityTest3"); EntityType entityTest4 = EntityType.Builder.create(EntityTest4::new, EntityClassification.MISC).build("entityTest4"); - event.getRegistry().register(entityTest); - event.getRegistry().register(entityTest2); - event.getRegistry().register(entityTest3); - event.getRegistry().register(entityTest4); + event.getRegistry().register(entityTest.setRegistryName("test_1")); + event.getRegistry().register(entityTest2.setRegistryName("test_2")); + event.getRegistry().register(entityTest3.setRegistryName("test_3")); + event.getRegistry().register(entityTest4.setRegistryName("test_4")); ModTest.PROXY.registerEntityRender(); - ModTest.PROXY.bindTESR(); + } private static TileEntityType register(String id, TileEntityType.Builder builder) { diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java index 5189266..b48fba7 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest.java @@ -11,7 +11,7 @@ public class EntityTest extends AnimatedEntity { - protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest.class); + protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest.class); static { EntityTest.animHandler.addAnim(ModTest.MODID, "position", "craftstudio_api_test", true); @@ -23,8 +23,9 @@ public EntityTest(EntityType type, World par1World) { super(type, par1World); } - @Override - public AnimationHandler getAnimationHandler() { + @SuppressWarnings("unchecked") + @Override + public AnimationHandler getAnimationHandler() { return EntityTest.animHandler; } diff --git a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java index 69633cd..4866388 100644 --- a/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java +++ b/src/mod/java/com/leviathanstudio/test/common/entity/EntityTest4.java @@ -6,7 +6,6 @@ import com.leviathanstudio.test.common.ModTest; import net.minecraft.entity.EntityType; -import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.world.World; public class EntityTest4 extends AnimatedEntity diff --git a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java index 409a44c..524beea 100644 --- a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java @@ -9,7 +9,7 @@ public class TileEntityTest extends AnimatedTileEntity { - protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(TileEntityTest.class); + protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(TileEntityTest.class); static { TileEntityTest.animHandler.addAnim(ModTest.MODID, "position", "craftstudio_api_test", true); @@ -24,8 +24,9 @@ public TileEntityTest(World worldIn) { this.world = worldIn; } - @Override - public AnimationHandler getAnimationHandler() { + @SuppressWarnings("unchecked") + @Override + public AnimationHandler getAnimationHandler() { return TileEntityTest.animHandler; } diff --git a/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java b/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java index 2c3a02c..e773a9a 100644 --- a/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java +++ b/src/mod/java/com/leviathanstudio/test/proxy/ClientProxy.java @@ -1,7 +1,6 @@ package com.leviathanstudio.test.proxy; import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper; -import com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader; import com.leviathanstudio.craftstudio.client.util.EnumRenderType; import com.leviathanstudio.craftstudio.client.util.EnumResourceType; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.CSTileEntitySpecialRenderer; @@ -22,15 +21,14 @@ public class ClientProxy extends CommonProxy { - @CraftStudioLoader - public static void registerCraftStudioAssets() { + public void registerCraftStudioAssets() { CSRegistryHelper registry = new CSRegistryHelper(ModTest.MODID); - registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, "model_dead_corpse"); registry.register(EnumResourceType.MODEL, EnumRenderType.BLOCK, "craftstudio_api_test2"); registry.register(EnumResourceType.MODEL, EnumRenderType.BLOCK, "craftstudio_api_test"); + registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, "model_dead_corpse"); registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, "dragon_brun"); registry.register(EnumResourceType.MODEL, EnumRenderType.ENTITY, "peacock"); - + registry.register(EnumResourceType.ANIM, EnumRenderType.BLOCK, "position"); registry.register(EnumResourceType.ANIM, EnumRenderType.BLOCK, "rotation"); registry.register(EnumResourceType.ANIM, EnumRenderType.BLOCK, "offset"); diff --git a/src/mod/java/com/leviathanstudio/test/proxy/CommonProxy.java b/src/mod/java/com/leviathanstudio/test/proxy/CommonProxy.java index 30493a0..d9a7f3d 100644 --- a/src/mod/java/com/leviathanstudio/test/proxy/CommonProxy.java +++ b/src/mod/java/com/leviathanstudio/test/proxy/CommonProxy.java @@ -2,6 +2,8 @@ public class CommonProxy { + public void registerCraftStudioAssets() {} + public void registerEntityRender() {} public void bindTESR() {} diff --git a/src/mod/resources/META-INF/mods.toml b/src/mod/resources/META-INF/mods.toml new file mode 100644 index 0000000..2f55dc8 --- /dev/null +++ b/src/mod/resources/META-INF/mods.toml @@ -0,0 +1,33 @@ + +modLoader="javafml" #mandatory +loaderVersion="[28,)" #mandatory (26 is current forge version) +issueTrackerURL="https://github.com/Leviathan-Studio/CraftStudioAPI" #optional +[[mods]] #mandatory +modId="testmod" #mandatory +version="${file.jarVersion}" #mandatory +displayName="CraftStudio API Test mod" #mandatory +updateJSONURL="https://leviathan-studio.com/craftstudioapi/update.json" #optional +#displayURL="http://example.com/" #optional +#logoFile="examplemod.png" #optional +credits="See https://github.com/Leviathan-Studio/CraftStudioAPI/blob/master/CREDITS.md" #optional +authors="ZeAmateis, Timmypote, Elisee, IncubeSupreme, Phenix246" #optional +description='''A CraftStudio API Test mod''' + +[[dependencies.testmod]] #optional + modId="forge" #mandatory + mandatory=true #mandatory + versionRange="[28,)" #mandatory + ordering="NONE" + side="BOTH" +[[dependencies.testmod]] + modId="minecraft" + mandatory=true + versionRange="[1.14.4]" + ordering="NONE" + side="BOTH" +[[dependencies.testmod]] + modId="craftstudioapi" + mandatory=true + versionRange="NONE" + ordering="NONE" + side="CLIENT" \ No newline at end of file diff --git a/src/mod/resources/pack.mcmeta b/src/mod/resources/pack.mcmeta new file mode 100644 index 0000000..b7fadad --- /dev/null +++ b/src/mod/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "craftstudio api test mod resources", + "pack_format": 4, + "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." + } +} From 1e37875fd8e286b296927fd6320bf1f3a46b5025 Mon Sep 17 00:00:00 2001 From: Phenix246 Date: Fri, 4 Oct 2019 15:21:04 +0200 Subject: [PATCH 8/9] Fix model registration --- .../craftstudio/CraftStudioApi.java | 37 +---------- .../client/registry/CSRegistryHelper.java | 66 +------------------ .../test/common/RegistryHandler.java | 4 +- 3 files changed, 4 insertions(+), 103 deletions(-) diff --git a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java index 31364e8..6b9a367 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java +++ b/src/main/java/com/leviathanstudio/craftstudio/CraftStudioApi.java @@ -39,9 +39,6 @@ public class CraftStudioApi { private static final Logger LOGGER = LogManager.getLogger("CraftStudio"); private static CSCommonProxy proxy = DistExecutor.runForDist(() -> CSClientProxy::new, () -> CSServerProxy::new); - private static IForgeRegistry modelRegistry = null; - private static IForgeRegistry animationRegistry = null; - public CraftStudioApi() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); @@ -66,43 +63,11 @@ public static AnimationHandler getNewAnimationHandler(C public void clientSetup(FMLClientSetupEvent event) { CraftStudioApi.proxy.clientSetup(event); - loadCraftStudioLoaders(event); } public void commonSetup(FMLCommonSetupEvent event) { CraftStudioApi.proxy.commonSetup(event); } - - @SubscribeEvent - public void onCreateRegistry(RegistryEvent.NewRegistry event) { - RegistryBuilder modelBuilder = new RegistryBuilder<>(); - RegistryBuilder animationBuilder = new RegistryBuilder<>(); - - modelBuilder.setName(new ResourceLocation(API_ID, "models")); - modelBuilder.setType(AssetModel.class); - modelBuilder.setIDRange(0, 10_000); - modelRegistry = modelBuilder.create(); - - animationBuilder.setName(new ResourceLocation(API_ID, "animations")); - animationBuilder.setType(AssetAnimation.class); - animationBuilder.setIDRange(0, 10_000); - animationRegistry = animationBuilder.create(); - } - - public void loadCraftStudioLoaders(FMLClientSetupEvent event) { - - CSRegistryHelper.loadModels(); - CSRegistryHelper.loadAnims(); - } - - public static IForgeRegistry getModelRegistry() { - return modelRegistry; - } - - public static IForgeRegistry getAnimationRegistry() { - return animationRegistry; - } - - + } \ No newline at end of file diff --git a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java index 204cee7..136ae14 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java +++ b/src/main/java/com/leviathanstudio/craftstudio/client/registry/CSRegistryHelper.java @@ -22,8 +22,6 @@ */ @OnlyIn(Dist.CLIENT) public class CSRegistryHelper { - private static List loadModelList = new ArrayList<>(); - private static List loadAnimList = new ArrayList<>(); private String modid; @@ -44,60 +42,15 @@ public CSRegistryHelper(String modid) { public static void register(EnumResourceType resourceTypeIn, ResourceLocation resourceLocationIn, String resourceNameIn) { switch (resourceTypeIn) { case MODEL: - if (CSRegistryHelper.loadModelList != null) - CSRegistryHelper.loadModelList.add(new LoadElement(resourceLocationIn, resourceNameIn)); - else - CraftStudioApi.getLogger() - .error("Unable to load model outside of the RegistryEvent.Register event, use forceRegister instead"); + registry(EnumResourceType.MODEL, resourceLocationIn, resourceNameIn); break; case ANIM: - if (CSRegistryHelper.loadAnimList != null) - CSRegistryHelper.loadAnimList.add(new LoadElement(resourceLocationIn, resourceNameIn)); - else - CraftStudioApi.getLogger() - .error("Unable to load animations outside of the RegistryEvent.Register event, use forceRegister instead"); + registry(EnumResourceType.ANIM, resourceLocationIn, resourceNameIn); break; } } - /** - * Load all the pre-registered models. Used internally. - */ - //TODO Rework on progress bar - public static void loadModels() { - if (loadModelList == null) - return; - //ProgressManager.ProgressBar progressBarModels; - //progressBarModels = ProgressManager.push("Registry Models", CSRegistryHelper.loadModelList.size()); - for (LoadElement el : CSRegistryHelper.loadModelList) { - //progressBarModels.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); - registry(EnumResourceType.MODEL, el.resourceLoc, el.ressourceName); - } - //ProgressManager.pop(progressBarModels); - - CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s models", CSRegistryHelper.loadModelList.size())); - CSRegistryHelper.loadModelList = null; - } - - /** - * Load all the pre-registered animations. Used internally. - */ - //TODO Rework on progress bar - public static void loadAnims() { - if (loadAnimList == null) - return; - //ProgressManager.ProgressBar progressBarAnim; - //progressBarAnim = ProgressManager.push("Registry Animations", CSRegistryHelper.loadAnimList.size()); - for (LoadElement el : CSRegistryHelper.loadAnimList) { - // progressBarAnim.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]"); - registry(EnumResourceType.ANIM, el.resourceLoc, el.ressourceName); - } - //ProgressManager.pop(progressBarAnim); - - CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s animations", CSRegistryHelper.loadAnimList.size())); - CSRegistryHelper.loadAnimList = null; - } /** * Register an assets. @@ -160,19 +113,4 @@ public void register(EnumResourceType resourceTypeIn, EnumRenderType renderTypeI resourceNameIn); } - /** - * An object containing informations about a pre-registered object to load - * later. - * - * @author Timmypote - */ - private static class LoadElement { - ResourceLocation resourceLoc; - String ressourceName; - - LoadElement(ResourceLocation resourceLoc, String ressourceName) { - this.resourceLoc = resourceLoc; - this.ressourceName = ressourceName; - } - } } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java index 5d7da47..83c4462 100644 --- a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java +++ b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java @@ -1,6 +1,5 @@ package com.leviathanstudio.test.common; -import com.leviathanstudio.craftstudio.client.registry.AssetModel; import com.leviathanstudio.test.common.block.BlockTest; import com.leviathanstudio.test.common.entity.EntityTest; import com.leviathanstudio.test.common.entity.EntityTest2; @@ -8,7 +7,6 @@ import com.leviathanstudio.test.common.entity.EntityTest4; import com.leviathanstudio.test.common.item.ItemTest; import com.leviathanstudio.test.common.tileEntity.TileEntityTest; -import com.leviathanstudio.test.proxy.ClientProxy; import com.mojang.datafixers.DataFixUtils; import com.mojang.datafixers.types.Type; @@ -18,7 +16,6 @@ import net.minecraft.entity.EntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.SharedConstants; @@ -27,6 +24,7 @@ import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.registries.ObjectHolder; @EventBusSubscriber(modid = ModTest.MODID, bus = EventBusSubscriber.Bus.MOD) public class RegistryHandler From e8073b7084cd17f1107ed8738d2667db31562248 Mon Sep 17 00:00:00 2001 From: ZeAmateis Date: Thu, 17 Oct 2019 19:18:56 +0200 Subject: [PATCH 9/9] + Fixed block_test renderer (TileEntityRenderer) --- .../CSTileEntitySpecialRenderer.java | 3 ++ .../test/common/RegistryHandler.java | 11 +++---- .../test/common/block/BlockTest.java | 30 ++++++++++++++----- .../common/tileEntity/TileEntityTest.java | 10 +++++-- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java index 98ef3e3..383bd4b 100644 --- a/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java +++ b/src/main/java/com/leviathanstudio/craftstudio/common/animation/simpleImpl/CSTileEntitySpecialRenderer.java @@ -47,10 +47,13 @@ public CSTileEntitySpecialRenderer(String modid, String modelNameIn, int texture this.model = new ModelCraftStudio(modid, modelNameIn, textureWidth, textureHeigth); this.texture = texture; } + + @Override public void render(T te, double x, double y, double z, float partialTicks, int destroyStage) { super.render(te, x, y, z, partialTicks, destroyStage); + GlStateManager.pushMatrix(); // Correction of the position. GlStateManager.translated(x + 0.5D, y + 1.5D, z + 0.5D); diff --git a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java index 83c4462..b10c8ff 100644 --- a/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java +++ b/src/mod/java/com/leviathanstudio/test/common/RegistryHandler.java @@ -29,20 +29,17 @@ @EventBusSubscriber(modid = ModTest.MODID, bus = EventBusSubscriber.Bus.MOD) public class RegistryHandler { - public static final Block block_test = null; - - + public static final Block block_test = new BlockTest(Block.Properties.create(Material.ROCK)); + public static final TileEntityType tile_test = register("tileTest", TileEntityType.Builder.create(TileEntityTest::new, block_test)); @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { - event.getRegistry().register(new BlockTest(Block.Properties.create(Material.ROCK).variableOpacity()).setRegistryName("block_test")); + event.getRegistry().register(block_test.setRegistryName("block_test")); } @SubscribeEvent public static void registerTiles(RegistryEvent.Register> event) { - TileEntityType tileTest = register("tileTest", TileEntityType.Builder.create(TileEntityTest::new)).setRegistryName("tile_test"); - - event.getRegistry().register(tileTest); + event.getRegistry().register(tile_test.setRegistryName("tile_test")); } @SubscribeEvent diff --git a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java index 267987e..7d3dcde 100644 --- a/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/block/BlockTest.java @@ -5,6 +5,10 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.tileentity.ChestTileEntity; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; public class BlockTest extends Block @@ -12,18 +16,30 @@ public class BlockTest extends Block public BlockTest(Block.Properties props) { super(props); + } + @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.ENTITYBLOCK_ANIMATED; - } + public BlockRenderType getRenderType(BlockState state) { + return BlockRenderType.INVISIBLE; + } + + + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return new TileEntityTest(); + } - @Override - public TileEntityTest createTileEntity(BlockState state, IBlockReader world) { - return new TileEntityTest(); - } + } \ No newline at end of file diff --git a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java index 524beea..83f0924 100644 --- a/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java +++ b/src/mod/java/com/leviathanstudio/test/common/tileEntity/TileEntityTest.java @@ -4,7 +4,9 @@ import com.leviathanstudio.craftstudio.common.animation.AnimationHandler; import com.leviathanstudio.craftstudio.common.animation.simpleImpl.AnimatedTileEntity; import com.leviathanstudio.test.common.ModTest; +import com.leviathanstudio.test.common.RegistryHandler; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.World; public class TileEntityTest extends AnimatedTileEntity @@ -15,12 +17,16 @@ public class TileEntityTest extends AnimatedTileEntity TileEntityTest.animHandler.addAnim(ModTest.MODID, "position", "craftstudio_api_test", true); } + public TileEntityTest(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + } + public TileEntityTest() { - super(null); + super(RegistryHandler.tile_test); } public TileEntityTest(World worldIn) { - this(); + super(RegistryHandler.tile_test); this.world = worldIn; }