mirror of
https://github.com/KAMKEEL/CustomNPC-Gecko-Addon.git
synced 2026-11-27 03:52:58 +00:00
Merge pull request #2 from KAMKEEL/gradle
Submodule Approach to Gecko Addon with CNPC+, GeckoLib
This commit is contained in:
59 files changed
+9302
-3542
No files matched your search
@@ -36,3 +36,6 @@ addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
|
||||
# Generated D.TS files (rebuilt by gradle on every build)
|
||||
src/main/resources/assets/npcgecko/api
|
||||
+6
-3
@@ -1,4 +1,7 @@
|
||||
[submodule "src/api"]
|
||||
path = src/api
|
||||
url = https://github.com/KAMKEEL/CustomNPC-Plus-API.git
|
||||
[submodule "CustomNPC-Plus"]
|
||||
path = CustomNPC-Plus
|
||||
url = https://github.com/KAMKEEL/CustomNPC-Plus.git
|
||||
branch = dev
|
||||
[submodule "GeckoLib"]
|
||||
path = GeckoLib
|
||||
url = https://github.com/Goodbird-git/Geckolib-Unofficial-1.7.10.git
|
||||
@@ -1,3 +0,0 @@
|
||||
# Any Github changes require admin approval
|
||||
/.github/** @GTNewHorizons/admin
|
||||
|
||||
Submodule
+1
Submodule CustomNPC-Plus added at 81c2b860c6.
Submodule
+1
Submodule GeckoLib added at 19da3e3fc0.
+24
-1
@@ -2,7 +2,30 @@
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
id 'dts.typescript-generator'
|
||||
}
|
||||
|
||||
apply from: 'gradle.submodules.gradle'
|
||||
|
||||
version = "1.3"
|
||||
group= "com.goodbird.npcgecko"
|
||||
group = "com.goodbird.npcgecko"
|
||||
|
||||
// ============================================================================
|
||||
// TypeScript Definition Generation Task
|
||||
// Generates .d.ts files from Java API sources for scripting IDE support
|
||||
// ============================================================================
|
||||
tasks.named("generateTypeScriptDefinitions").configure {
|
||||
sourceDirectories = ['src/main/java']
|
||||
outputDirectory = "src/main/resources/assets/${project.property("modId")}/api"
|
||||
apiPackages = ['com.goodbird.npcgecko.api'] as Set
|
||||
cleanOutputFirst = true
|
||||
patchesDirectory = "dts-patches"
|
||||
implementationPackages = [
|
||||
'com.goodbird.npcgecko.data',
|
||||
'com.goodbird.npcgecko.entity',
|
||||
'com.goodbird.npcgecko.tile',
|
||||
'com.goodbird.npcgecko.client'
|
||||
] as Set
|
||||
}
|
||||
processResources.dependsOn generateTypeScriptDefinitions
|
||||
sourcesJar.dependsOn generateTypeScriptDefinitions
|
||||
@@ -1,14 +0,0 @@
|
||||
[0514/203945.010:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/203945.039:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/203945.047:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/205447.662:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/205458.151:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/205458.162:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0514/205458.186:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/004913.901:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/004914.692:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/004914.711:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/004914.724:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/011427.812:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/011427.829:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
[0515/011427.838:WARNING:dns_config_service_win.cc(668)] Failed to read DnsConfig.
|
||||
+3
-3
@@ -34,9 +34,9 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.74-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("curse.maven:Nashorn-374413:2924946")
|
||||
|
||||
implementation rfg.deobf(name: "CustomNPC-Plus-1.10.2")
|
||||
implementation name: "geckolib3-1.0.4-beta"
|
||||
// CustomNPC+ and GeckoLib are managed as submodule dependencies
|
||||
// See gradle.submodules.gradle for details
|
||||
}
|
||||
+6
-1
@@ -3,11 +3,16 @@ modName = CustomNPC-Plus-Gecko-Addon
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
modId = npcgecko
|
||||
modGroup = com.goodbird.npcgecko
|
||||
modVersion = 1.1
|
||||
modVersion = 1.3
|
||||
|
||||
gtnh.modules.codeStyle=true
|
||||
gtnh.modules.gitVersion=false
|
||||
|
||||
# JVM args for Gradle daemon - increase for faster builds
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1g
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// ============================================================================
|
||||
// Submodule Dependency Management
|
||||
// ============================================================================
|
||||
// Manages CustomNPC+ and GeckoLib as git submodule dependencies.
|
||||
//
|
||||
// How it works:
|
||||
// - Both mods are git submodules built automatically alongside this mod
|
||||
// - Their dev JARs are referenced as devOnlyNonPublishable dependencies
|
||||
// - This means: available at COMPILE + RUNTIME, but NOT in the output JAR
|
||||
// - ./gradlew build -> builds CNPC+ & GeckoLib first, then clean addon-only JAR
|
||||
// - ./gradlew runClient -> builds CNPC+ & GeckoLib first, then runs with all on classpath
|
||||
//
|
||||
// First-time setup:
|
||||
// ./gradlew initSubmodules (clones/updates submodules recursively)
|
||||
// ============================================================================
|
||||
|
||||
def isWindows = System.getProperty('os.name').toLowerCase().contains('windows')
|
||||
|
||||
// Resolve the gradlew executable for a submodule directory
|
||||
def gradlewFor = { File submoduleDir ->
|
||||
if (isWindows) {
|
||||
return new File(submoduleDir, 'gradlew.bat').absolutePath
|
||||
} else {
|
||||
return new File(submoduleDir, 'gradlew').absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
// Helper: find the dev JAR in a submodule's build output (resolved at execution time)
|
||||
def findDevJar = { String submoduleDir ->
|
||||
def libsDir = file("${submoduleDir}/build/libs")
|
||||
if (!libsDir.exists()) return []
|
||||
return libsDir.listFiles()?.findAll { it.name.endsWith('-dev.jar') && !it.name.contains('-preshadow') } ?: []
|
||||
}
|
||||
|
||||
// ---- Submodule Init Task ----
|
||||
tasks.register('initSubmodules', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Initialize and update all git submodules recursively'
|
||||
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
||||
}
|
||||
|
||||
// Helper: clean old dev JARs from a submodule's build/libs before rebuilding
|
||||
// Prevents stale JARs from different versions accumulating on the classpath
|
||||
def cleanDevJars = { String submoduleDir ->
|
||||
def libsDir = file("${submoduleDir}/build/libs")
|
||||
if (libsDir.exists()) {
|
||||
libsDir.listFiles()?.each { if (it.name.endsWith('.jar')) it.delete() }
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Build CustomNPC+ ----
|
||||
// Uses -Pnomixin to avoid embedding Mixin into the JAR (UniMixins provides it at runtime)
|
||||
tasks.register('buildCNPC', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Builds CustomNPC+ dev JAR from submodule source (no embedded Mixin)'
|
||||
workingDir file('CustomNPC-Plus')
|
||||
|
||||
doFirst { cleanDevJars('CustomNPC-Plus') }
|
||||
|
||||
def gradlew = gradlewFor(file('CustomNPC-Plus'))
|
||||
if (isWindows) {
|
||||
commandLine 'cmd', '/c', gradlew, 'build', '-Pnomixin', '-x', 'test'
|
||||
} else {
|
||||
commandLine gradlew, 'build', '-Pnomixin', '-x', 'test'
|
||||
}
|
||||
|
||||
// Gradle up-to-date checking
|
||||
inputs.dir file('CustomNPC-Plus/src')
|
||||
outputs.dir file('CustomNPC-Plus/build/libs')
|
||||
}
|
||||
|
||||
// ---- Build GeckoLib ----
|
||||
tasks.register('buildGeckoLib', Exec) {
|
||||
group = 'submodules'
|
||||
description = 'Builds GeckoLib dev JAR from submodule source'
|
||||
workingDir file('GeckoLib')
|
||||
|
||||
doFirst { cleanDevJars('GeckoLib') }
|
||||
|
||||
def gradlew = gradlewFor(file('GeckoLib'))
|
||||
if (isWindows) {
|
||||
commandLine 'cmd', '/c', gradlew, 'build', '-x', 'test'
|
||||
} else {
|
||||
commandLine gradlew, 'build', '-x', 'test'
|
||||
}
|
||||
|
||||
// Gradle up-to-date checking
|
||||
inputs.dir file('GeckoLib/src')
|
||||
outputs.dir file('GeckoLib/build/libs')
|
||||
}
|
||||
|
||||
// ---- Convenience: build all submodules ----
|
||||
tasks.register('buildSubmodules') {
|
||||
group = 'submodules'
|
||||
description = 'Builds all submodule dev JARs'
|
||||
dependsOn 'buildCNPC', 'buildGeckoLib'
|
||||
}
|
||||
|
||||
// ---- Auto-build: submodules compile before this mod ----
|
||||
tasks.named('compileJava').configure {
|
||||
dependsOn 'buildCNPC', 'buildGeckoLib'
|
||||
}
|
||||
|
||||
// ---- Dependency Declarations ----
|
||||
// devOnlyNonPublishable = compile + runtime, but NOT in output JAR and NOT published
|
||||
// Dev JARs are already deobfuscated (MCP names), so no rfg.deobf() needed
|
||||
// Using lazy file resolution so JARs are found AFTER submodule build tasks execute
|
||||
dependencies {
|
||||
devOnlyNonPublishable files({ findDevJar('CustomNPC-Plus') })
|
||||
devOnlyNonPublishable files({ findDevJar('GeckoLib') })
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+2
-4
@@ -1,7 +1,5 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
// Additional repositories for dependencies
|
||||
// Submodule dependencies (CustomNPC+, GeckoLib) are managed via gradle.submodules.gradle
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'lib'
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -10,6 +10,7 @@ pluginManagement {
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
maven { url "https://jitpack.io" }
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
@@ -17,5 +18,10 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
}
|
||||
|
||||
// Include the D.TS generator plugin from CustomNPC+ submodule
|
||||
if (file('CustomNPC-Plus/gradle-plugins/settings.gradle').exists()) {
|
||||
includeBuild 'CustomNPC-Plus/gradle-plugins'
|
||||
}
|
||||
@@ -12,22 +12,21 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import software.bernie.example.block.tile.BotariumTileEntity;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent ev){
|
||||
public void preInit(FMLPreInitializationEvent ev) {
|
||||
EntityRegistry.registerModEntity(EntityCustomModel.class, "CustomModelEntity", 0, CustomNpcPlusGecko.instance, 64, 10, false);
|
||||
NpcAPI.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent ev){
|
||||
public void init(FMLInitializationEvent ev) {
|
||||
NetworkHandler.init();
|
||||
GameRegistry.registerTileEntity(TileEntityCustomModel.class, "custommodeltile");
|
||||
NpcAPI.Instance().addGlobalObject("GeckoAPI", AbstractGeckoAPI.Instance());
|
||||
}
|
||||
|
||||
public World getWorldById(int id){
|
||||
public World getWorldById(int id) {
|
||||
return MinecraftServer.getServer().worldServers[id];
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ public class CustomNpcPlusGecko {
|
||||
public void preInit(FMLPreInitializationEvent ev) {
|
||||
proxy.preInit(ev);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent ev) {
|
||||
proxy.init(ev);
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
import com.goodbird.npcgecko.data.CustomItemModelData;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.api.block.IBlockScripted;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
|
||||
public abstract class AbstractGeckoAPI {
|
||||
private static AbstractGeckoAPI instance = null;
|
||||
@@ -33,21 +30,202 @@ public abstract class AbstractGeckoAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract AnimationBuilder createAnimationBuilder();
|
||||
// ========================================================================
|
||||
// Animation Builder
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Create a new animation builder for constructing animation sequences.
|
||||
*
|
||||
* @return A new animation builder
|
||||
*/
|
||||
public abstract IGeckoAnimationBuilder createAnimBuilder();
|
||||
|
||||
/**
|
||||
* Create a new animation builder for constructing animation sequences.
|
||||
*
|
||||
* @return A new animation builder
|
||||
*/
|
||||
public abstract IGeckoAnimationBuilder createAnimationBuilder();
|
||||
|
||||
// ========================================================================
|
||||
// Animatable Access
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Get the animation configuration interface for an NPC.
|
||||
*
|
||||
* @param npc The NPC to get animation config for
|
||||
* @return The animatable interface for this NPC
|
||||
*/
|
||||
public abstract IGeckoAnimatable getAnimatable(ICustomNpc<EntityNPCInterface> npc);
|
||||
|
||||
/**
|
||||
* Get the animation configuration interface for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The block to get animation config for
|
||||
* @return The animatable interface for this block
|
||||
*/
|
||||
public abstract IGeckoAnimatable getAnimatable(IBlockScripted scriptedBlock);
|
||||
|
||||
// ========================================================================
|
||||
// Animation Queries
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Get a list of all animation names in an animation file.
|
||||
*
|
||||
* @param animationFile The animation file resource location (e.g. "npcgecko:animations/geo_npc.animation.json")
|
||||
* @return Array of animation names, or empty array if file not found
|
||||
*/
|
||||
public abstract String[] getAnimationList(String animationFile);
|
||||
|
||||
/**
|
||||
* Get a list of all loaded animation file resource locations.
|
||||
*
|
||||
* @return Array of animation file paths
|
||||
*/
|
||||
public abstract String[] getAnimationFileList();
|
||||
|
||||
/**
|
||||
* Get animation metadata from a loaded animation file.
|
||||
*
|
||||
* @param animationFile The animation file resource location
|
||||
* @param animationName The animation name within the file
|
||||
* @return The animation metadata, or null if not found
|
||||
*/
|
||||
public abstract IGeckoAnimation getAnimation(String animationFile, String animationName);
|
||||
|
||||
// ========================================================================
|
||||
// Color Utilities
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Create a color from RGB components.
|
||||
*
|
||||
* @param r Red component (0-255)
|
||||
* @param g Green component (0-255)
|
||||
* @param b Blue component (0-255)
|
||||
* @return A new color
|
||||
*/
|
||||
public abstract IGeckoColor colorOfRGB(int r, int g, int b);
|
||||
|
||||
/**
|
||||
* Create a color from RGBA components.
|
||||
*
|
||||
* @param r Red component (0-255)
|
||||
* @param g Green component (0-255)
|
||||
* @param b Blue component (0-255)
|
||||
* @param a Alpha component (0-255)
|
||||
* @return A new color
|
||||
*/
|
||||
public abstract IGeckoColor colorOfRGBA(int r, int g, int b, int a);
|
||||
|
||||
// ========================================================================
|
||||
// NPC Methods
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Set the geo model resource location for an NPC.
|
||||
*
|
||||
* @param npc The target NPC
|
||||
* @param model The model path (e.g. "geckolib3:geo/npc.geo.json")
|
||||
*/
|
||||
public abstract void setModel(ICustomNpc<EntityNPCInterface> npc, String model);
|
||||
public abstract void setTexture(ICustomNpc<EntityNPCInterface> npc, String texture);
|
||||
public abstract void setAnimationFile(ICustomNpc<EntityNPCInterface> npc, String animation);
|
||||
public abstract void setIdleAnimation(ICustomNpc<EntityNPCInterface> npc, String animation);
|
||||
public abstract void syncAnimForPlayer(ICustomNpc<EntityNPCInterface> npc, AnimationBuilder builder, IPlayer<EntityPlayerMP> player);
|
||||
public abstract void syncAnimForAll(ICustomNpc<EntityNPCInterface> npc, AnimationBuilder builder);
|
||||
|
||||
/**
|
||||
* Set the texture resource location for an NPC.
|
||||
*
|
||||
* @param npc The target NPC
|
||||
* @param texture The texture path
|
||||
*/
|
||||
public abstract void setTexture(ICustomNpc<EntityNPCInterface> npc, String texture);
|
||||
|
||||
/**
|
||||
* Set the animation file resource location for an NPC.
|
||||
*
|
||||
* @param npc The target NPC
|
||||
* @param animation The animation file path
|
||||
*/
|
||||
public abstract void setAnimationFile(ICustomNpc<EntityNPCInterface> npc, String animation);
|
||||
|
||||
/**
|
||||
* Set the idle animation name for an NPC.
|
||||
*
|
||||
* @param npc The target NPC
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
public abstract void setIdleAnimation(ICustomNpc<EntityNPCInterface> npc, String animation);
|
||||
|
||||
/**
|
||||
* Sync an animation to a specific player for an NPC.
|
||||
*
|
||||
* @param npc The NPC to play the animation on
|
||||
* @param builder The animation builder with queued animations
|
||||
* @param player The player to send the animation to
|
||||
*/
|
||||
public abstract void syncAnimForPlayer(ICustomNpc<EntityNPCInterface> npc, IGeckoAnimationBuilder builder, IPlayer<EntityPlayerMP> player);
|
||||
|
||||
/**
|
||||
* Sync an animation to all players for an NPC.
|
||||
*
|
||||
* @param npc The NPC to play the animation on
|
||||
* @param builder The animation builder with queued animations
|
||||
*/
|
||||
public abstract void syncAnimForAll(ICustomNpc<EntityNPCInterface> npc, IGeckoAnimationBuilder builder);
|
||||
|
||||
// ========================================================================
|
||||
// Block Methods
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* Set the geo model resource location for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The target block
|
||||
* @param model The model path
|
||||
*/
|
||||
public abstract void setModel(IBlockScripted scriptedBlock, String model);
|
||||
|
||||
/**
|
||||
* Set the texture resource location for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The target block
|
||||
* @param texture The texture path
|
||||
*/
|
||||
public abstract void setTexture(IBlockScripted scriptedBlock, String texture);
|
||||
|
||||
/**
|
||||
* Set the animation file resource location for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The target block
|
||||
* @param animation The animation file path
|
||||
*/
|
||||
public abstract void setAnimationFile(IBlockScripted scriptedBlock, String animation);
|
||||
|
||||
/**
|
||||
* Set the idle animation name for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The target block
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
public abstract void setIdleAnimation(IBlockScripted scriptedBlock, String animation);
|
||||
public abstract void syncAnimForPlayer(IBlockScripted scriptedBlock, AnimationBuilder builder, IPlayer<EntityPlayerMP> player);
|
||||
public abstract void syncAnimForAll(IBlockScripted scriptedBlock, AnimationBuilder builder);
|
||||
|
||||
/**
|
||||
* Sync an animation to a specific player for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The block to play the animation on
|
||||
* @param builder The animation builder with queued animations
|
||||
* @param player The player to send the animation to
|
||||
*/
|
||||
public abstract void syncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<EntityPlayerMP> player);
|
||||
|
||||
/**
|
||||
* Sync an animation to all players for a scripted block.
|
||||
*
|
||||
* @param scriptedBlock The block to play the animation on
|
||||
* @param builder The animation builder with queued animations
|
||||
*/
|
||||
public abstract void syncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder);
|
||||
|
||||
// TODO: Fix ScriptCustomItem
|
||||
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
import com.goodbird.npcgecko.client.renderer.RenderTileCustomModel;
|
||||
import com.goodbird.npcgecko.data.CustomItemModelData;
|
||||
import com.goodbird.npcgecko.wrapper.*;
|
||||
import com.goodbird.npcgecko.mixin.IDataDisplay;
|
||||
import com.goodbird.npcgecko.mixin.IScriptCustomItem;
|
||||
import com.goodbird.npcgecko.network.CPacketSyncManualAnim;
|
||||
import com.goodbird.npcgecko.network.CPacketSyncTileManualAnim;
|
||||
import com.goodbird.npcgecko.network.NetworkHandler;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.api.block.IBlockScripted;
|
||||
@@ -17,14 +13,17 @@ import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.blocks.tiles.TileScripted;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.BlockScriptedWrapper;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import software.bernie.geckolib3.core.builder.Animation;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
import software.bernie.geckolib3.core.util.Color;
|
||||
import software.bernie.geckolib3.file.AnimationFile;
|
||||
import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
|
||||
public class GeckoAPI extends AbstractGeckoAPI {
|
||||
private static AbstractGeckoAPI Instance;
|
||||
|
||||
private GeckoAPI() {}
|
||||
private GeckoAPI() {
|
||||
}
|
||||
|
||||
public static AbstractGeckoAPI Instance() {
|
||||
if (GeckoAPI.Instance == null) {
|
||||
@@ -33,14 +32,108 @@ public class GeckoAPI extends AbstractGeckoAPI {
|
||||
return Instance;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Internal helper - unwrap IGeckoAnimationBuilder to GeckoLib AnimationBuilder
|
||||
// ========================================================================
|
||||
|
||||
private static AnimationBuilder unwrap(IGeckoAnimationBuilder builder) {
|
||||
return ((GeckoAnimationBuilderWrapper) builder).getBuilder();
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Animation Builder
|
||||
// ========================================================================
|
||||
|
||||
@Override
|
||||
public AnimationBuilder createAnimationBuilder() {
|
||||
return new AnimationBuilder();
|
||||
public IGeckoAnimationBuilder createAnimBuilder() {
|
||||
return new GeckoAnimationBuilderWrapper(new AnimationBuilder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder createAnimationBuilder() {
|
||||
return createAnimBuilder();
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Animatable Access
|
||||
// ========================================================================
|
||||
|
||||
@Override
|
||||
public IGeckoAnimatable getAnimatable(ICustomNpc<EntityNPCInterface> npc) {
|
||||
return new GeckoNpcAnimatable(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimatable getAnimatable(IBlockScripted scriptedBlock) {
|
||||
TileEntityCustomModel tile = getOrCreateTECM(scriptedBlock);
|
||||
return new GeckoBlockAnimatable(scriptedBlock, tile);
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Animation Queries
|
||||
// ========================================================================
|
||||
|
||||
@Override
|
||||
public String[] getAnimationList(String animationFile) {
|
||||
AnimationFile file = GeckoLibCache.getInstance().getAnimations().get(new ResourceLocation(animationFile));
|
||||
if (file == null) {
|
||||
return new String[0];
|
||||
}
|
||||
java.util.Collection<Animation> animations = file.getAllAnimations();
|
||||
String[] names = new String[animations.size()];
|
||||
int i = 0;
|
||||
for (Animation anim : animations) {
|
||||
names[i++] = anim.animationName;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAnimationFileList() {
|
||||
java.util.Set<ResourceLocation> keys = GeckoLibCache.getInstance().getAnimations().keySet();
|
||||
String[] result = new String[keys.size()];
|
||||
int i = 0;
|
||||
for (ResourceLocation resLoc : keys) {
|
||||
result[i++] = resLoc.toString();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimation getAnimation(String animationFile, String animationName) {
|
||||
AnimationFile file = GeckoLibCache.getInstance().getAnimations().get(new ResourceLocation(animationFile));
|
||||
if (file == null) {
|
||||
return null;
|
||||
}
|
||||
for (Animation anim : file.getAllAnimations()) {
|
||||
if (anim.animationName.equals(animationName)) {
|
||||
return new GeckoAnimationWrapper(anim);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Color Utilities
|
||||
// ========================================================================
|
||||
|
||||
@Override
|
||||
public IGeckoColor colorOfRGB(int r, int g, int b) {
|
||||
return new GeckoColorWrapper(Color.ofRGB(r, g, b));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoColor colorOfRGBA(int r, int g, int b, int a) {
|
||||
return new GeckoColorWrapper(Color.ofRGBA(r, g, b, a));
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// NPC Methods
|
||||
// ========================================================================
|
||||
|
||||
@Override
|
||||
public void setModel(ICustomNpc<EntityNPCInterface> npc, String model) {
|
||||
((IDataDisplay)npc.getMCEntity().display).getCustomModelData().setModel(model);
|
||||
((IDataDisplay) npc.getMCEntity().display).getCustomModelData().setModel(model);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@@ -52,31 +145,33 @@ public class GeckoAPI extends AbstractGeckoAPI {
|
||||
|
||||
@Override
|
||||
public void setAnimationFile(ICustomNpc<EntityNPCInterface> npc, String animation) {
|
||||
((IDataDisplay)npc.getMCEntity().display).getCustomModelData().setAnimFile(animation);
|
||||
((IDataDisplay) npc.getMCEntity().display).getCustomModelData().setAnimFile(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdleAnimation(ICustomNpc<EntityNPCInterface> npc, String animation) {
|
||||
((IDataDisplay)npc.getMCEntity().display).getCustomModelData().setIdleAnim(animation);
|
||||
((IDataDisplay) npc.getMCEntity().display).getCustomModelData().setIdleAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAnimForPlayer(ICustomNpc<EntityNPCInterface> npc, AnimationBuilder builder, IPlayer<EntityPlayerMP> player) {
|
||||
NetworkHandler.sendToPlayer(new CPacketSyncManualAnim(npc.getMCEntity(),builder), player.getMCEntity());
|
||||
public void syncAnimForPlayer(ICustomNpc<EntityNPCInterface> npc, IGeckoAnimationBuilder builder, IPlayer<EntityPlayerMP> player) {
|
||||
NetworkHandler.sendToPlayer(new CPacketSyncManualAnim(npc.getMCEntity(), unwrap(builder)), player.getMCEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAnimForAll(ICustomNpc<EntityNPCInterface> npc, AnimationBuilder builder) {
|
||||
NetworkHandler.sendToAll(new CPacketSyncManualAnim(npc.getMCEntity(),builder));
|
||||
public void syncAnimForAll(ICustomNpc<EntityNPCInterface> npc, IGeckoAnimationBuilder builder) {
|
||||
NetworkHandler.sendToAll(new CPacketSyncManualAnim(npc.getMCEntity(), unwrap(builder)));
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Block Methods
|
||||
// ========================================================================
|
||||
|
||||
|
||||
private TileEntityCustomModel getOrCreateTECM(IBlockScripted scriptedBlock){
|
||||
private TileEntityCustomModel getOrCreateTECM(IBlockScripted scriptedBlock) {
|
||||
TileScripted tile = (TileScripted) scriptedBlock.getMCTileEntity();
|
||||
if(!(tile.renderTile instanceof TileEntityCustomModel)){
|
||||
if (!(tile.renderTile instanceof TileEntityCustomModel)) {
|
||||
tile.renderTile = new TileEntityCustomModel(tile);
|
||||
}
|
||||
return (TileEntityCustomModel) tile.renderTile;
|
||||
@@ -111,13 +206,13 @@ public class GeckoAPI extends AbstractGeckoAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAnimForPlayer(IBlockScripted scriptedBlock, AnimationBuilder builder, IPlayer<EntityPlayerMP> player) {
|
||||
NetworkHandler.sendToPlayer(new CPacketSyncTileManualAnim(scriptedBlock.getMCTileEntity(), builder), player.getMCEntity());
|
||||
public void syncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<EntityPlayerMP> player) {
|
||||
NetworkHandler.sendToPlayer(new CPacketSyncTileManualAnim(scriptedBlock.getMCTileEntity(), unwrap(builder)), player.getMCEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncAnimForAll(IBlockScripted scriptedBlock, AnimationBuilder builder) {
|
||||
NetworkHandler.sendToAll(new CPacketSyncTileManualAnim(scriptedBlock.getMCTileEntity(), builder));
|
||||
public void syncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder) {
|
||||
NetworkHandler.sendToAll(new CPacketSyncTileManualAnim(scriptedBlock.getMCTileEntity(), unwrap(builder)));
|
||||
}
|
||||
|
||||
// private CustomItemModelData getOrCreateCIMD(ScriptCustomItem item){
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Interface for accessing and modifying Gecko model configuration on NPCs and scripted blocks.
|
||||
* Provides control over model, texture, animation files, and animation names for each state.
|
||||
*
|
||||
* <p>Obtain via {@link AbstractGeckoAPI#getAnimatable(noppes.npcs.api.entity.ICustomNpc)}
|
||||
* or {@link AbstractGeckoAPI#getAnimatable(noppes.npcs.api.block.IBlockScripted)}.</p>
|
||||
*/
|
||||
public interface IGeckoAnimatable {
|
||||
|
||||
/**
|
||||
* Get the geo model resource location.
|
||||
*
|
||||
* @return The model path (e.g. "geckolib3:geo/npc.geo.json")
|
||||
*/
|
||||
String getModel();
|
||||
|
||||
/**
|
||||
* Set the geo model resource location.
|
||||
*
|
||||
* @param model The model path (e.g. "geckolib3:geo/npc.geo.json")
|
||||
*/
|
||||
void setModel(String model);
|
||||
|
||||
/**
|
||||
* Get the texture resource location.
|
||||
*
|
||||
* @return The texture path
|
||||
*/
|
||||
String getTexture();
|
||||
|
||||
/**
|
||||
* Set the texture resource location.
|
||||
*
|
||||
* @param texture The texture path
|
||||
*/
|
||||
void setTexture(String texture);
|
||||
|
||||
/**
|
||||
* Get the animation file resource location.
|
||||
*
|
||||
* @return The animation file path (e.g. "npcgecko:animations/geo_npc.animation.json")
|
||||
*/
|
||||
String getAnimationFile();
|
||||
|
||||
/**
|
||||
* Set the animation file resource location.
|
||||
*
|
||||
* @param animationFile The animation file path
|
||||
*/
|
||||
void setAnimationFile(String animationFile);
|
||||
|
||||
/**
|
||||
* Get the idle animation name.
|
||||
*
|
||||
* @return The idle animation name, or empty string if none
|
||||
*/
|
||||
String getIdleAnimation();
|
||||
|
||||
/**
|
||||
* Set the idle animation name.
|
||||
*
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
void setIdleAnimation(String animation);
|
||||
|
||||
/**
|
||||
* Get the walk animation name.
|
||||
*
|
||||
* @return The walk animation name, or empty string if none
|
||||
*/
|
||||
String getWalkAnimation();
|
||||
|
||||
/**
|
||||
* Set the walk animation name.
|
||||
*
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
void setWalkAnimation(String animation);
|
||||
|
||||
/**
|
||||
* Get the hurt animation name.
|
||||
*
|
||||
* @return The hurt animation name, or empty string if none
|
||||
*/
|
||||
String getHurtAnimation();
|
||||
|
||||
/**
|
||||
* Set the hurt animation name.
|
||||
*
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
void setHurtAnimation(String animation);
|
||||
|
||||
/**
|
||||
* Get the melee attack animation name.
|
||||
*
|
||||
* @return The melee attack animation name, or empty string if none
|
||||
*/
|
||||
String getMeleeAttackAnimation();
|
||||
|
||||
/**
|
||||
* Set the melee attack animation name.
|
||||
*
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
void setMeleeAttackAnimation(String animation);
|
||||
|
||||
/**
|
||||
* Get the ranged attack animation name.
|
||||
*
|
||||
* @return The ranged attack animation name, or empty string if none
|
||||
*/
|
||||
String getRangedAttackAnimation();
|
||||
|
||||
/**
|
||||
* Set the ranged attack animation name.
|
||||
*
|
||||
* @param animation The animation name from the animation file
|
||||
*/
|
||||
void setRangedAttackAnimation(String animation);
|
||||
|
||||
/**
|
||||
* Get the bone name used for head tracking/rotation.
|
||||
*
|
||||
* @return The head bone name (default: "head")
|
||||
*/
|
||||
String getHeadBoneName();
|
||||
|
||||
/**
|
||||
* Set the bone name used for head tracking/rotation.
|
||||
*
|
||||
* @param boneName The bone name in the model
|
||||
*/
|
||||
void setHeadBoneName(String boneName);
|
||||
|
||||
/**
|
||||
* Get the transition duration between animations in ticks.
|
||||
*
|
||||
* @return Transition length in ticks (default: 10)
|
||||
*/
|
||||
int getTransitionLengthTicks();
|
||||
|
||||
/**
|
||||
* Set the transition duration between animations in ticks.
|
||||
*
|
||||
* @param ticks Transition length in ticks
|
||||
*/
|
||||
void setTransitionLengthTicks(int ticks);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Interface for querying animation metadata from a loaded animation file.
|
||||
* Provides read-only access to animation properties defined in Blockbench.
|
||||
*
|
||||
* <p>Obtain via {@link AbstractGeckoAPI#getAnimation(String, String)}.</p>
|
||||
*/
|
||||
public interface IGeckoAnimation {
|
||||
|
||||
/**
|
||||
* Get the animation name as defined in the animation file.
|
||||
*
|
||||
* @return The animation name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Get the duration of this animation in seconds.
|
||||
*
|
||||
* @return The animation length in seconds
|
||||
*/
|
||||
double getLength();
|
||||
|
||||
/**
|
||||
* Whether this animation loops by default.
|
||||
*
|
||||
* @return True if the animation loops
|
||||
*/
|
||||
boolean isLooping();
|
||||
|
||||
/**
|
||||
* Get the names of all bones that have keyframes in this animation.
|
||||
*
|
||||
* @return Array of bone names with animation data
|
||||
*/
|
||||
String[] getAnimatedBoneNames();
|
||||
|
||||
/**
|
||||
* Get the number of sound keyframes in this animation.
|
||||
*
|
||||
* @return The sound keyframe count
|
||||
*/
|
||||
int getSoundKeyframeCount();
|
||||
|
||||
/**
|
||||
* Get the number of particle keyframes in this animation.
|
||||
*
|
||||
* @return The particle keyframe count
|
||||
*/
|
||||
int getParticleKeyframeCount();
|
||||
|
||||
/**
|
||||
* Get the number of custom instruction keyframes in this animation.
|
||||
*
|
||||
* @return The custom instruction keyframe count
|
||||
*/
|
||||
int getCustomInstructionKeyframeCount();
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Builder interface for constructing animation sequences.
|
||||
* Follows the builder pattern - all methods return the builder for chaining.
|
||||
*
|
||||
* <p>Example usage in scripts:</p>
|
||||
* <pre>
|
||||
* var builder = GeckoAPI.Instance().createAnimationBuilder();
|
||||
* builder.playOnce("attack").loop("idle");
|
||||
* GeckoAPI.Instance().syncAnimForAll(npc, builder);
|
||||
* </pre>
|
||||
*/
|
||||
public interface IGeckoAnimationBuilder {
|
||||
|
||||
/**
|
||||
* Add an animation that plays once then moves to the next in queue.
|
||||
*
|
||||
* @param animationName The animation name matching the Blockbench file
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder playOnce(String animationName);
|
||||
|
||||
/**
|
||||
* Add an animation that loops indefinitely until replaced.
|
||||
*
|
||||
* @param animationName The animation name matching the Blockbench file
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder loop(String animationName);
|
||||
|
||||
/**
|
||||
* Add an animation that plays once and holds on the last frame.
|
||||
*
|
||||
* @param animationName The animation name matching the Blockbench file
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder playAndHold(String animationName);
|
||||
|
||||
/**
|
||||
* Add an animation to the queue with default loop behavior from the animation file.
|
||||
*
|
||||
* @param animationName The animation name matching the Blockbench file
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder addAnimation(String animationName);
|
||||
|
||||
/**
|
||||
* Add an animation to the queue repeated multiple times.
|
||||
*
|
||||
* @param animationName The animation name matching the Blockbench file
|
||||
* @param timesToRepeat How many times to repeat the animation
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder addRepeatingAnimation(String animationName, int timesToRepeat);
|
||||
|
||||
/**
|
||||
* Clear all animations currently in the builder.
|
||||
*
|
||||
* @return This builder for chaining
|
||||
*/
|
||||
IGeckoAnimationBuilder clearAnimations();
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Interface for querying and modifying bone transforms on a Gecko model at runtime.
|
||||
* Bones represent individual parts of a model (e.g. "head", "left_arm", "held_item").
|
||||
*
|
||||
* <p>Position values are relative offsets from the bone's rest position.
|
||||
* Rotation values are in radians. Scale values are multipliers (1.0 = default).</p>
|
||||
*/
|
||||
public interface IGeckoBone {
|
||||
|
||||
/**
|
||||
* Get the name of this bone as defined in the model file.
|
||||
*
|
||||
* @return The bone name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return The X position offset
|
||||
*/
|
||||
float getPositionX();
|
||||
|
||||
/**
|
||||
* @return The Y position offset
|
||||
*/
|
||||
float getPositionY();
|
||||
|
||||
/**
|
||||
* @return The Z position offset
|
||||
*/
|
||||
float getPositionZ();
|
||||
|
||||
/**
|
||||
* Set the X position offset.
|
||||
*
|
||||
* @param value The X position offset
|
||||
*/
|
||||
void setPositionX(float value);
|
||||
|
||||
/**
|
||||
* Set the Y position offset.
|
||||
*
|
||||
* @param value The Y position offset
|
||||
*/
|
||||
void setPositionY(float value);
|
||||
|
||||
/**
|
||||
* Set the Z position offset.
|
||||
*
|
||||
* @param value The Z position offset
|
||||
*/
|
||||
void setPositionZ(float value);
|
||||
|
||||
/**
|
||||
* @return The X rotation in radians
|
||||
*/
|
||||
float getRotationX();
|
||||
|
||||
/**
|
||||
* @return The Y rotation in radians
|
||||
*/
|
||||
float getRotationY();
|
||||
|
||||
/**
|
||||
* @return The Z rotation in radians
|
||||
*/
|
||||
float getRotationZ();
|
||||
|
||||
/**
|
||||
* Set the X rotation in radians.
|
||||
*
|
||||
* @param value The X rotation in radians
|
||||
*/
|
||||
void setRotationX(float value);
|
||||
|
||||
/**
|
||||
* Set the Y rotation in radians.
|
||||
*
|
||||
* @param value The Y rotation in radians
|
||||
*/
|
||||
void setRotationY(float value);
|
||||
|
||||
/**
|
||||
* Set the Z rotation in radians.
|
||||
*
|
||||
* @param value The Z rotation in radians
|
||||
*/
|
||||
void setRotationZ(float value);
|
||||
|
||||
/**
|
||||
* @return The X scale multiplier
|
||||
*/
|
||||
float getScaleX();
|
||||
|
||||
/**
|
||||
* @return The Y scale multiplier
|
||||
*/
|
||||
float getScaleY();
|
||||
|
||||
/**
|
||||
* @return The Z scale multiplier
|
||||
*/
|
||||
float getScaleZ();
|
||||
|
||||
/**
|
||||
* Set the X scale multiplier.
|
||||
*
|
||||
* @param value The X scale multiplier (1.0 = default)
|
||||
*/
|
||||
void setScaleX(float value);
|
||||
|
||||
/**
|
||||
* Set the Y scale multiplier.
|
||||
*
|
||||
* @param value The Y scale multiplier (1.0 = default)
|
||||
*/
|
||||
void setScaleY(float value);
|
||||
|
||||
/**
|
||||
* Set the Z scale multiplier.
|
||||
*
|
||||
* @param value The Z scale multiplier (1.0 = default)
|
||||
*/
|
||||
void setScaleZ(float value);
|
||||
|
||||
/**
|
||||
* @return The X pivot point
|
||||
*/
|
||||
float getPivotX();
|
||||
|
||||
/**
|
||||
* @return The Y pivot point
|
||||
*/
|
||||
float getPivotY();
|
||||
|
||||
/**
|
||||
* @return The Z pivot point
|
||||
*/
|
||||
float getPivotZ();
|
||||
|
||||
/**
|
||||
* Set the X pivot point.
|
||||
*
|
||||
* @param value The X pivot point
|
||||
*/
|
||||
void setPivotX(float value);
|
||||
|
||||
/**
|
||||
* Set the Y pivot point.
|
||||
*
|
||||
* @param value The Y pivot point
|
||||
*/
|
||||
void setPivotY(float value);
|
||||
|
||||
/**
|
||||
* Set the Z pivot point.
|
||||
*
|
||||
* @param value The Z pivot point
|
||||
*/
|
||||
void setPivotZ(float value);
|
||||
|
||||
/**
|
||||
* @return Whether this bone is hidden from rendering
|
||||
*/
|
||||
boolean isHidden();
|
||||
|
||||
/**
|
||||
* Set whether this bone is hidden from rendering.
|
||||
*
|
||||
* @param hidden True to hide this bone
|
||||
*/
|
||||
void setHidden(boolean hidden);
|
||||
|
||||
/**
|
||||
* Get the parent bone, or null if this is a root bone.
|
||||
*
|
||||
* @return The parent bone, or null
|
||||
*/
|
||||
IGeckoBone getParent();
|
||||
|
||||
/**
|
||||
* Get the child bones of this bone.
|
||||
*
|
||||
* @return Array of child bones
|
||||
*/
|
||||
IGeckoBone[] getChildBones();
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Interface for color manipulation. Provides access to RGBA color components
|
||||
* and common color operations.
|
||||
*
|
||||
* <p>Create colors using the factory methods on {@link AbstractGeckoAPI}:</p>
|
||||
* <pre>
|
||||
* var color = GeckoAPI.Instance().colorOfRGB(255, 0, 0); // Red
|
||||
* var alpha = GeckoAPI.Instance().colorOfRGBA(255, 0, 0, 128); // Semi-transparent red
|
||||
* </pre>
|
||||
*/
|
||||
public interface IGeckoColor {
|
||||
|
||||
/**
|
||||
* Get the packed ARGB color value.
|
||||
*
|
||||
* @return The packed color as an integer
|
||||
*/
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* @return The red component (0-255)
|
||||
*/
|
||||
int getRed();
|
||||
|
||||
/**
|
||||
* @return The green component (0-255)
|
||||
*/
|
||||
int getGreen();
|
||||
|
||||
/**
|
||||
* @return The blue component (0-255)
|
||||
*/
|
||||
int getBlue();
|
||||
|
||||
/**
|
||||
* @return The alpha component (0-255)
|
||||
*/
|
||||
int getAlpha();
|
||||
|
||||
/**
|
||||
* Create a brighter version of this color.
|
||||
*
|
||||
* @param factor How much brighter (0.0 = no change, 1.0 = white)
|
||||
* @return A new brighter color
|
||||
*/
|
||||
IGeckoColor brighter(double factor);
|
||||
|
||||
/**
|
||||
* Create a darker version of this color.
|
||||
*
|
||||
* @param factor How much darker (0.0 = no change, 1.0 = black)
|
||||
* @return A new darker color
|
||||
*/
|
||||
IGeckoColor darker(double factor);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.goodbird.npcgecko.api;
|
||||
|
||||
/**
|
||||
* Read-only interface for querying the runtime state of a Gecko model.
|
||||
* Allows scripts to inspect model bones and their current transforms.
|
||||
*
|
||||
* <p>This interface provides access to the model's bone hierarchy after
|
||||
* animations have been applied, useful for attaching effects or
|
||||
* querying positions of specific model parts.</p>
|
||||
*/
|
||||
public interface IGeckoModel {
|
||||
|
||||
/**
|
||||
* Get a bone by name.
|
||||
*
|
||||
* @param name The bone name as defined in the model file
|
||||
* @return The bone, or null if not found
|
||||
*/
|
||||
IGeckoBone getBone(String name);
|
||||
|
||||
/**
|
||||
* Get the names of all bones in this model.
|
||||
*
|
||||
* @return Array of bone names
|
||||
*/
|
||||
String[] getBoneNames();
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCustomModel.class, new RenderTileCustomModel());
|
||||
}
|
||||
|
||||
public World getWorldById(int id){
|
||||
public World getWorldById(int id) {
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,17 @@ import com.goodbird.npcgecko.mixin.IDataDisplay;
|
||||
import com.goodbird.npcgecko.utils.AnimationFileUtil;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.ISubGuiListener;
|
||||
import noppes.npcs.client.gui.util.ITextfieldListener;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
|
||||
public class SubGuiModelAnimation extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
|
||||
public SubGuiModelAnimation(EntityNPCInterface npc){
|
||||
public SubGuiModelAnimation(EntityNPCInterface npc) {
|
||||
this.npc = npc;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
@@ -19,92 +24,92 @@ public class SubGuiModelAnimation extends SubGuiInterface implements ITextfieldL
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 44;
|
||||
addSelectionBlock(1,y,"Animation File:",getModelData(npc).getAnimFile());
|
||||
addSelectionBlock(2,y+=23,"Idle:",getModelData(npc).getIdleAnim());
|
||||
addSelectionBlock(3,y+=23,"Walk:",getModelData(npc).getWalkAnim());
|
||||
addSelectionBlock(4,y+=23,"Melee Attack:",getModelData(npc).getMeleeAttackAnim());
|
||||
addSelectionBlock(5,y+=23,"Ranged Attack:",getModelData(npc).getRangedAttackAnim());
|
||||
addSelectionBlock(6,y+23,"Hurt:",getModelData(npc).getHurtAnim());
|
||||
addSelectionBlock(1, y, "Animation File:", getModelData(npc).getAnimFile());
|
||||
addSelectionBlock(2, y += 23, "Idle:", getModelData(npc).getIdleAnim());
|
||||
addSelectionBlock(3, y += 23, "Walk:", getModelData(npc).getWalkAnim());
|
||||
addSelectionBlock(4, y += 23, "Melee Attack:", getModelData(npc).getMeleeAttackAnim());
|
||||
addSelectionBlock(5, y += 23, "Ranged Attack:", getModelData(npc).getRangedAttackAnim());
|
||||
addSelectionBlock(6, y + 23, "Hurt:", getModelData(npc).getHurtAnim());
|
||||
addButton(new GuiNpcButton(670, width - 22, 2, 20, 20, "X"));
|
||||
}
|
||||
|
||||
public void addSelectionBlock(int id, int y, String label, String value){
|
||||
addLabel(new GuiNpcLabel(id,label, guiLeft - 85, y + 5,0xffffff));
|
||||
addTextField(new GuiNpcTextField(id,this, fontRendererObj, guiLeft - 10, y, 200, 20, value));
|
||||
public void addSelectionBlock(int id, int y, String label, String value) {
|
||||
addLabel(new GuiNpcLabel(id, label, guiLeft - 85, y + 5, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(id, this, fontRendererObj, guiLeft - 10, y, 200, 20, value));
|
||||
this.addButton(new GuiNpcButton(id, guiLeft + 193, y, 80, 20, "gui.select"));
|
||||
}
|
||||
|
||||
public CustomModelData getModelData(EntityNPCInterface npc){
|
||||
return ((IDataDisplay)npc.display).getCustomModelData();
|
||||
public CustomModelData getModelData(EntityNPCInterface npc) {
|
||||
return ((IDataDisplay) npc.display).getCustomModelData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
|
||||
if(button.id == 670){
|
||||
if (button.id == 670) {
|
||||
close();
|
||||
}
|
||||
if(button.id==1){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib animation file:",
|
||||
AnimationFileUtil.getAnimationFileList(), (name)-> getModelData(npc).setAnimFile(name)));
|
||||
if (button.id == 1) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib animation file:",
|
||||
AnimationFileUtil.getAnimationFileList(), (name) -> getModelData(npc).setAnimFile(name)));
|
||||
}
|
||||
if(button.id==2){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib idle animation:",
|
||||
if (button.id == 2) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib idle animation:",
|
||||
AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()),
|
||||
(name)-> getModelData(npc).setIdleAnim(name)));
|
||||
(name) -> getModelData(npc).setIdleAnim(name)));
|
||||
}
|
||||
if(button.id==3){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib walk animation:",
|
||||
if (button.id == 3) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib walk animation:",
|
||||
AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()),
|
||||
(name)-> getModelData(npc).setWalkAnim(name)));
|
||||
(name) -> getModelData(npc).setWalkAnim(name)));
|
||||
}
|
||||
if(button.id==4){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib melee attack animation:",
|
||||
if (button.id == 4) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib melee attack animation:",
|
||||
AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()),
|
||||
(name)-> getModelData(npc).setMeleeAttackAnim(name)));
|
||||
(name) -> getModelData(npc).setMeleeAttackAnim(name)));
|
||||
}
|
||||
if(button.id==5){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib ranged attack animation:",
|
||||
if (button.id == 5) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib ranged attack animation:",
|
||||
AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()),
|
||||
(name)-> getModelData(npc).setRangedAttackAnim(name)));
|
||||
(name) -> getModelData(npc).setRangedAttackAnim(name)));
|
||||
}
|
||||
if(button.id==6){
|
||||
setSubGui(new GuiStringSelection(this,"Selecting geckolib hurt animation:",
|
||||
if (button.id == 6) {
|
||||
setSubGui(new GuiStringSelection(this, "Selecting geckolib hurt animation:",
|
||||
AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()),
|
||||
(name)-> getModelData(npc).setHurtAnim(name)));
|
||||
(name) -> getModelData(npc).setHurtAnim(name)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValidAnimFile(String name){
|
||||
public boolean isValidAnimFile(String name) {
|
||||
return GeckoLibCache.getInstance().getAnimations().containsKey(new ResourceLocation(name));
|
||||
}
|
||||
|
||||
public boolean isValidAnimation(String name){
|
||||
public boolean isValidAnimation(String name) {
|
||||
return AnimationFileUtil.getAnimationList(getModelData(npc).getAnimFile()).contains(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1 && isValidAnimFile(textfield.getText())){
|
||||
if(!textfield.isEmpty())
|
||||
if (textfield.id == 1 && isValidAnimFile(textfield.getText())) {
|
||||
if (!textfield.isEmpty())
|
||||
getModelData(npc).setAnimFile(textfield.getText());
|
||||
else
|
||||
textfield.setText(getModelData(npc).getAnimFile());
|
||||
}
|
||||
if(textfield.id == 2 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())){
|
||||
if (textfield.id == 2 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())) {
|
||||
getModelData(npc).setIdleAnim(textfield.getText());
|
||||
}
|
||||
if(textfield.id == 3 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())){
|
||||
if (textfield.id == 3 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())) {
|
||||
getModelData(npc).setWalkAnim(textfield.getText());
|
||||
}
|
||||
if(textfield.id == 4 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())){
|
||||
if (textfield.id == 4 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())) {
|
||||
getModelData(npc).setMeleeAttackAnim(textfield.getText());
|
||||
}
|
||||
if(textfield.id == 5 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())){
|
||||
if (textfield.id == 5 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())) {
|
||||
getModelData(npc).setRangedAttackAnim(textfield.getText());
|
||||
}
|
||||
if(textfield.id == 6 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())){
|
||||
if (textfield.id == 6 && (isValidAnimation(textfield.getText()) || textfield.getText().isEmpty())) {
|
||||
getModelData(npc).setHurtAnim(textfield.getText());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,16 @@ package com.goodbird.npcgecko.client.gui;
|
||||
import com.goodbird.npcgecko.data.CustomModelData;
|
||||
import com.goodbird.npcgecko.mixin.IDataDisplay;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.ISubGuiListener;
|
||||
import noppes.npcs.client.gui.util.ITextfieldListener;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class SubGuiModelExtras extends SubGuiInterface implements ITextfieldListener, ISubGuiListener {
|
||||
public SubGuiModelExtras(EntityNPCInterface npc){
|
||||
public SubGuiModelExtras(EntityNPCInterface npc) {
|
||||
this.npc = npc;
|
||||
closeOnEsc = true;
|
||||
}
|
||||
@@ -16,36 +21,36 @@ public class SubGuiModelExtras extends SubGuiInterface implements ITextfieldList
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
int y = guiTop + 44;
|
||||
addLabel(new GuiNpcLabel(1,"Head Bone Name", guiLeft - 85, y + 5,0xffffff));
|
||||
addTextField(new GuiNpcTextField(1,this, fontRendererObj, guiLeft + 50, y, 200, 20, getModelData(npc).getHeadBoneName()));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(2,"Transition Length (ticks)", guiLeft - 85, y + 5,0xffffff));
|
||||
GuiNpcTextField transitionLength = new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 50, y,
|
||||
200, 20, ""+getModelData(npc).getTransitionLengthTicks());
|
||||
addLabel(new GuiNpcLabel(1, "Head Bone Name", guiLeft - 85, y + 5, 0xffffff));
|
||||
addTextField(new GuiNpcTextField(1, this, fontRendererObj, guiLeft + 50, y, 200, 20, getModelData(npc).getHeadBoneName()));
|
||||
y += 23;
|
||||
addLabel(new GuiNpcLabel(2, "Transition Length (ticks)", guiLeft - 85, y + 5, 0xffffff));
|
||||
GuiNpcTextField transitionLength = new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 50, y,
|
||||
200, 20, "" + getModelData(npc).getTransitionLengthTicks());
|
||||
transitionLength.setIntegersOnly();
|
||||
transitionLength.setMinMaxDefault(0, Integer.MAX_VALUE, getModelData(npc).getTransitionLengthTicks());
|
||||
addTextField(transitionLength);
|
||||
addButton(new GuiNpcButton(670, width - 22, 2, 20, 20, "X"));
|
||||
}
|
||||
|
||||
public CustomModelData getModelData(EntityNPCInterface npc){
|
||||
return ((IDataDisplay)npc.display).getCustomModelData();
|
||||
public CustomModelData getModelData(EntityNPCInterface npc) {
|
||||
return ((IDataDisplay) npc.display).getCustomModelData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
if(button.id == 670){
|
||||
if (button.id == 670) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1){
|
||||
if (textfield.id == 1) {
|
||||
getModelData(npc).setHeadBoneName(textfield.getText());
|
||||
}
|
||||
if(textfield.id == 2){
|
||||
if (textfield.id == 2) {
|
||||
getModelData(npc).setTransitionLengthTicks(textfield.getInteger());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,40 +11,40 @@ import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
public class ModelCustom extends AnimatedGeoModel<EntityCustomModel> {
|
||||
@Override
|
||||
public ResourceLocation getAnimationFileLocation(EntityCustomModel entity) {
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","animations/none.animations.json");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "animations/none.animations.json");
|
||||
}
|
||||
return entity.animResLoc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelLocation(EntityCustomModel entity) {
|
||||
if(!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)){
|
||||
return new ResourceLocation("npcgecko","geo/modelnotfound.geo.json");
|
||||
if (!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "geo/modelnotfound.geo.json");
|
||||
}
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","geo/animfilenotfound.geo.json");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "geo/animfilenotfound.geo.json");
|
||||
}
|
||||
return entity.modelResLoc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(EntityCustomModel entity) {
|
||||
if(!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)){
|
||||
return new ResourceLocation("npcgecko","textures/model/alphabet.png");
|
||||
if (!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "textures/model/alphabet.png");
|
||||
}
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","textures/model/alphabet.png");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "textures/model/alphabet.png");
|
||||
}
|
||||
return entity.textureResLoc;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void setLivingAnimations(EntityCustomModel entity, Integer uniqueID, AnimationEvent animationEvent) {
|
||||
super.setLivingAnimations(entity, uniqueID, animationEvent); //We call the super-function
|
||||
IBone head = this.getAnimationProcessor().getBone(entity.headBoneName); //Then we take the head bone
|
||||
if(head!=null) {
|
||||
if (head != null) {
|
||||
//We get the model data for an entity
|
||||
EntityModelData extraData = (EntityModelData) animationEvent.getExtraDataOfType(EntityModelData.class).get(0);
|
||||
//And we set the head bone rotation to the interpolated pitch and yaw rotations of an entity
|
||||
|
||||
@@ -8,30 +8,30 @@ import software.bernie.geckolib3.resource.GeckoLibCache;
|
||||
public class TileModelCustom extends AnimatedGeoModel<TileEntityCustomModel> {
|
||||
@Override
|
||||
public ResourceLocation getAnimationFileLocation(TileEntityCustomModel entity) {
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","animations/none.animations.json");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "animations/none.animations.json");
|
||||
}
|
||||
return entity.animResLoc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelLocation(TileEntityCustomModel animatable) {
|
||||
if(!GeckoLibCache.getInstance().getGeoModels().containsKey(animatable.modelResLoc)){
|
||||
return new ResourceLocation("npcgecko","geo/modelnotfound.geo.json");
|
||||
if (!GeckoLibCache.getInstance().getGeoModels().containsKey(animatable.modelResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "geo/modelnotfound.geo.json");
|
||||
}
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(animatable.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","geo/animfilenotfound.geo.json");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(animatable.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "geo/animfilenotfound.geo.json");
|
||||
}
|
||||
return animatable.modelResLoc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(TileEntityCustomModel entity) {
|
||||
if(!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)){
|
||||
return new ResourceLocation("npcgecko","textures/model/alphabet.png");
|
||||
if (!GeckoLibCache.getInstance().getGeoModels().containsKey(entity.modelResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "textures/model/alphabet.png");
|
||||
}
|
||||
if(!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)){
|
||||
return new ResourceLocation("npcgecko","textures/model/alphabet.png");
|
||||
if (!GeckoLibCache.getInstance().getAnimations().containsKey(entity.animResLoc)) {
|
||||
return new ResourceLocation("npcgecko", "textures/model/alphabet.png");
|
||||
}
|
||||
return entity.textureResLoc;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
public RenderCustomModel() {
|
||||
super(new ModelCustom());
|
||||
}
|
||||
|
||||
public void renderAfter(GeoModel model, EntityCustomModel animatable, float ticks, float red, float green, float blue, float alpha) {
|
||||
super.renderAfter(model, animatable, ticks, red, green, blue, alpha);
|
||||
if (model.getBone("held_item").isPresent() && animatable.getHeldItem() != null) {
|
||||
@@ -39,7 +40,7 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
GlStateManager.rotate(-180, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
if (entityLiving.deathTime > 0) {
|
||||
float f = ((float)entityLiving.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
|
||||
float f = ((float) entityLiving.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
|
||||
f = net.minecraft.util.MathHelper.sqrt_float(f);
|
||||
if (f > 1.0F) {
|
||||
f = 1.0F;
|
||||
@@ -56,7 +57,7 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
|
||||
public GeoBone[] getPathFromRoot(GeoBone bone) {
|
||||
ArrayList<GeoBone> bones;
|
||||
for(bones = new ArrayList<>(); bone != null; bone = bone.parent) {
|
||||
for (bones = new ArrayList<>(); bone != null; bone = bone.parent) {
|
||||
bones.add(0, bone);
|
||||
}
|
||||
|
||||
@@ -108,30 +109,30 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
}
|
||||
|
||||
public Color getRenderColor(EntityCustomModel animatable, float partialTicks) {
|
||||
if(animatable.hurtTime>0 || animatable.deathTime > 0){
|
||||
if(animatable.tintData!=null && animatable.tintData.isTintEnabled() && animatable.tintData.isHurtTintEnabled()){
|
||||
if (animatable.hurtTime > 0 || animatable.deathTime > 0) {
|
||||
if (animatable.tintData != null && animatable.tintData.isTintEnabled() && animatable.tintData.isHurtTintEnabled()) {
|
||||
int hurtTint = animatable.tintData.getHurtTint();
|
||||
int r = (int) ((float)(hurtTint >> 16 & 255));
|
||||
int g = (int) ((float)(hurtTint >> 8 & 255));
|
||||
int b = (int) ((float)(hurtTint & 255));
|
||||
return Color.ofRGBA(r,g,b, 255);
|
||||
int r = (int) ((float) (hurtTint >> 16 & 255));
|
||||
int g = (int) ((float) (hurtTint >> 8 & 255));
|
||||
int b = (int) ((float) (hurtTint & 255));
|
||||
return Color.ofRGBA(r, g, b, 255);
|
||||
}
|
||||
return Color.ofRGBA(255, 153, 153, 255);
|
||||
}else{
|
||||
} else {
|
||||
int r = 255;
|
||||
int g = 255;
|
||||
int b = 255;
|
||||
if(animatable.tintData!=null && animatable.tintData.isTintEnabled() && animatable.tintData.isGeneralTintEnabled()){
|
||||
if (animatable.tintData != null && animatable.tintData.isTintEnabled() && animatable.tintData.isGeneralTintEnabled()) {
|
||||
int hurtTint = animatable.tintData.getGeneralTint();
|
||||
int tintR = (int) ((float)(hurtTint >> 16 & 255));
|
||||
int tintG = (int) ((float)(hurtTint >> 8 & 255));
|
||||
int tintB = (int) ((float)(hurtTint & 255));
|
||||
double alpha = ((double)animatable.tintData.getGeneralAlpha() / 100.0);
|
||||
r = (int) (alpha*tintR + r*(1-alpha));
|
||||
g = (int) (alpha*tintG + g*(1-alpha));
|
||||
b = (int) (alpha*tintB + b*(1-alpha));
|
||||
int tintR = (int) ((float) (hurtTint >> 16 & 255));
|
||||
int tintG = (int) ((float) (hurtTint >> 8 & 255));
|
||||
int tintB = (int) ((float) (hurtTint & 255));
|
||||
double alpha = ((double) animatable.tintData.getGeneralAlpha() / 100.0);
|
||||
r = (int) (alpha * tintR + r * (1 - alpha));
|
||||
g = (int) (alpha * tintG + g * (1 - alpha));
|
||||
b = (int) (alpha * tintB + b * (1 - alpha));
|
||||
}
|
||||
if(animatable.isSemiVisible){
|
||||
if (animatable.isSemiVisible) {
|
||||
return Color.ofRGBA(r, g, b, 100);
|
||||
}
|
||||
return Color.ofRGBA(r, g, b, 255);
|
||||
@@ -143,7 +144,7 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
public ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return super.getTextureLocation((EntityCustomModel) p_110775_1_);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.goodbird.npcgecko.client.renderer;
|
||||
import com.goodbird.npcgecko.client.model.TileModelCustom;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import software.bernie.example.client.model.tile.BotariumModel;
|
||||
import software.bernie.geckolib3.renderers.geo.GeoBlockRenderer;
|
||||
|
||||
public class RenderTileCustomModel extends GeoBlockRenderer<TileEntityCustomModel> {
|
||||
|
||||
@@ -22,12 +22,12 @@ public class CustomItemModelData {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
if(nbttagcompound.hasKey("Model")) {
|
||||
if (nbttagcompound.hasKey("Model")) {
|
||||
model = nbttagcompound.getString("Model");
|
||||
animFile = nbttagcompound.getString("AnimFile");
|
||||
idleAnim = nbttagcompound.getString("IdleAnim");
|
||||
texture = nbttagcompound.getString("Texture");
|
||||
if(nbttagcompound.hasKey("TransitionLengthTicks")){
|
||||
if (nbttagcompound.hasKey("TransitionLengthTicks")) {
|
||||
transitionLengthTicks = nbttagcompound.getInteger("TransitionLengthTicks");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public class CustomModelData {
|
||||
private String rangedAttackAnim = "";
|
||||
private String headBoneName = "head";
|
||||
private int transitionLengthTicks = 10;
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setString("Model", model);
|
||||
nbttagcompound.setString("AnimFile", animFile);
|
||||
@@ -26,7 +27,7 @@ public class CustomModelData {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
if(nbttagcompound.hasKey("Model")) {
|
||||
if (nbttagcompound.hasKey("Model")) {
|
||||
model = nbttagcompound.getString("Model");
|
||||
animFile = nbttagcompound.getString("AnimFile");
|
||||
idleAnim = nbttagcompound.getString("IdleAnim");
|
||||
@@ -35,7 +36,7 @@ public class CustomModelData {
|
||||
meleeAttackAnim = nbttagcompound.getString("MeleeAttackAnim");
|
||||
rangedAttackAnim = nbttagcompound.getString("RangedAttackAnim");
|
||||
headBoneName = nbttagcompound.getString("HeadBoneName");
|
||||
if(nbttagcompound.hasKey("TransitionLengthTicks")){
|
||||
if (nbttagcompound.hasKey("TransitionLengthTicks")) {
|
||||
transitionLengthTicks = nbttagcompound.getInteger("TransitionLengthTicks");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.goodbird.npcgecko.entity;
|
||||
|
||||
import com.goodbird.npcgecko.constants.EnumSyncAutoAnim;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -97,15 +95,16 @@ public class EntityCustomModel extends EntityCreature implements IAnimatable, IA
|
||||
public void setDialogAnim(String name) {
|
||||
dialogAnim = new AnimationBuilder().playOnce(name);
|
||||
}
|
||||
|
||||
public void activateReceivedAnim(EnumSyncAutoAnim type) {
|
||||
if(type == EnumSyncAutoAnim.HURT){
|
||||
if(!hurtAnimName.isEmpty())
|
||||
if (type == EnumSyncAutoAnim.HURT) {
|
||||
if (!hurtAnimName.isEmpty())
|
||||
hurtAnim = new AnimationBuilder().playOnce(hurtAnimName);
|
||||
}else if(type == EnumSyncAutoAnim.MELEE_ATTACK){
|
||||
if(!meleeAttackAnimName.isEmpty())
|
||||
} else if (type == EnumSyncAutoAnim.MELEE_ATTACK) {
|
||||
if (!meleeAttackAnimName.isEmpty())
|
||||
attackAnim = new AnimationBuilder().playOnce(meleeAttackAnimName);
|
||||
}else if(type == EnumSyncAutoAnim.RANGED_ATTACK){
|
||||
if(!rangedAttackAnimName.isEmpty())
|
||||
} else if (type == EnumSyncAutoAnim.RANGED_ATTACK) {
|
||||
if (!rangedAttackAnimName.isEmpty())
|
||||
attackAnim = new AnimationBuilder().playOnce(rangedAttackAnimName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,20 @@ import noppes.npcs.scripted.event.NpcEvent;
|
||||
|
||||
public class EventHandler {
|
||||
@SubscribeEvent
|
||||
public void onNpcMeleeAttack(NpcEvent.SwingEvent event){
|
||||
if(event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
public void onNpcMeleeAttack(NpcEvent.SwingEvent event) {
|
||||
if (event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
NetworkHandler.sendToAll(new CPacketSyncAutoAnim((EntityNPCInterface) event.npc.getMCEntity(), EnumSyncAutoAnim.MELEE_ATTACK));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onNpcRanged(NpcEvent.RangedLaunchedEvent event){
|
||||
if(event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
public void onNpcRanged(NpcEvent.RangedLaunchedEvent event) {
|
||||
if (event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
NetworkHandler.sendToAll(new CPacketSyncAutoAnim((EntityNPCInterface) event.npc.getMCEntity(), EnumSyncAutoAnim.RANGED_ATTACK));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onNpcDamaged(NpcEvent.DamagedEvent event){
|
||||
if(event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
public void onNpcDamaged(NpcEvent.DamagedEvent event) {
|
||||
if (event != null && event.npc != null && event.npc.getMCEntity() != null)
|
||||
NetworkHandler.sendToAll(new CPacketSyncAutoAnim((EntityNPCInterface) event.npc.getMCEntity(), EnumSyncAutoAnim.HURT));
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,8 @@ public class ItemCustomModelPredicate {
|
||||
public static <P extends Item & IAnimatable> PlayState predicate(AnimationEvent<P> event) {
|
||||
ItemStack stack = (ItemStack) event.getExtraData().get(0);
|
||||
IItemStack istack = NpcAPI.Instance().getIItemStack(stack);
|
||||
if(!(istack instanceof ScriptCustomItem)) return PlayState.STOP;
|
||||
IScriptCustomItem item = (IScriptCustomItem)istack;
|
||||
if (!(istack instanceof ScriptCustomItem)) return PlayState.STOP;
|
||||
IScriptCustomItem item = (IScriptCustomItem) istack;
|
||||
event.getController().setAnimation(new AnimationBuilder().loop(item.getCustomModelData().getIdleAnim()));
|
||||
return PlayState.CONTINUE;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import noppes.npcs.blocks.tiles.TileScripted;
|
||||
import noppes.npcs.client.renderer.blocks.BlockScriptedRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -25,10 +24,11 @@ public abstract class MixinBlockScriptedRenderer {
|
||||
|
||||
@Inject(method = "renderTileEntityAt", at = @At(value = "INVOKE", target = "Lnoppes/npcs/client/renderer/blocks/BlockScriptedRenderer;renderItem(Lnet/minecraft/tileentity/TileEntity;Lnet/minecraft/item/ItemStack;)V", remap = false))
|
||||
public void geckoModelRendering(TileEntity te, double x, double y, double z, float partialTicks, CallbackInfo ci) {
|
||||
if(!(te instanceof TileScripted)) return;
|
||||
if (!(te instanceof TileScripted)) return;
|
||||
TileScripted tileScripted = (TileScripted) te;
|
||||
if(tileScripted.itemModel == null) return;
|
||||
if(!(MinecraftForgeClient.getItemRenderer(tileScripted.itemModel, ENTITY) instanceof RenderBlockItem) || BlockScriptedRenderer.overrideModel()) return;
|
||||
if (tileScripted.itemModel == null) return;
|
||||
if (!(MinecraftForgeClient.getItemRenderer(tileScripted.itemModel, ENTITY) instanceof RenderBlockItem) || BlockScriptedRenderer.overrideModel())
|
||||
return;
|
||||
GL11.glTranslated(0, -0.5, 0);
|
||||
GL11.glScaled(2, 2, 2);
|
||||
}
|
||||
@@ -46,19 +46,19 @@ public abstract class MixinBlockScriptedRenderer {
|
||||
|
||||
@Inject(method = "renderTileEntityAt", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void customGeckoModelRendering(TileEntity te, double x, double y, double z, float partialTicks, CallbackInfo ci) {
|
||||
if(BlockScriptedRenderer.overrideModel()) return;
|
||||
if(!(te instanceof TileScripted)) return;
|
||||
if (BlockScriptedRenderer.overrideModel()) return;
|
||||
if (!(te instanceof TileScripted)) return;
|
||||
TileScripted tileScripted = (TileScripted) te;
|
||||
if(!(tileScripted.renderTile instanceof TileEntityCustomModel)) return;
|
||||
if (!(tileScripted.renderTile instanceof TileEntityCustomModel)) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x,y,z);
|
||||
GL11.glTranslated(0.5,0.5, 0.5);
|
||||
GL11.glRotatef((float)tileScripted.rotationY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef((float)tileScripted.rotationX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef((float)tileScripted.rotationZ, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
GL11.glRotatef((float) tileScripted.rotationY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef((float) tileScripted.rotationX, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef((float) tileScripted.rotationZ, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(tileScripted.scaleX, tileScripted.scaleY, tileScripted.scaleZ);
|
||||
GL11.glTranslated(-0.5,-0.5/tileScripted.scaleY, -0.5);
|
||||
GL11.glTranslated(-x,-y,-z);
|
||||
GL11.glTranslated(-0.5, -0.5 / tileScripted.scaleY, -0.5);
|
||||
GL11.glTranslated(-x, -y, -z);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tileScripted.renderTile, x, y, z, partialTicks);
|
||||
GL11.glPopMatrix();
|
||||
ci.cancel();
|
||||
|
||||
@@ -18,23 +18,24 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(DataDisplay.class)
|
||||
public class MixinDataDisplay implements IDataDisplay {
|
||||
|
||||
@Shadow(remap = false) public EntityNPCInterface npc;
|
||||
@Shadow(remap = false)
|
||||
public EntityNPCInterface npc;
|
||||
@Unique
|
||||
private final CustomModelData customNPC_Gecko_Addon$customModelData = new CustomModelData();
|
||||
|
||||
@Inject(method = "writeToNBT", at = @At("HEAD"), remap = false)
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound, CallbackInfoReturnable<NBTTagCompound> cir) {
|
||||
if(hasCustomModel())
|
||||
if (hasCustomModel())
|
||||
customNPC_Gecko_Addon$customModelData.writeToNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Inject(method = "readToNBT", at = @At("HEAD"), remap = false)
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound, CallbackInfo ci){
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound, CallbackInfo ci) {
|
||||
customNPC_Gecko_Addon$customModelData.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Unique
|
||||
public CustomModelData getCustomModelData(){
|
||||
public CustomModelData getCustomModelData() {
|
||||
return customNPC_Gecko_Addon$customModelData;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ import software.bernie.geckolib3.core.manager.AnimationData;
|
||||
@Mixin(GeckoAddon.class)
|
||||
public class MixinGeckoAddon {
|
||||
|
||||
@Shadow(remap = false) public boolean supportEnabled;
|
||||
@Shadow(remap = false)
|
||||
public boolean supportEnabled;
|
||||
|
||||
/**
|
||||
* @author Goodbird
|
||||
@@ -24,11 +25,11 @@ public class MixinGeckoAddon {
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void geckoCopyData(EntityLivingBase copied, EntityLivingBase entity) {
|
||||
if(!supportEnabled)
|
||||
if (!supportEnabled)
|
||||
return;
|
||||
|
||||
if (entity instanceof EntityCustomModel && copied instanceof EntityNPCInterface) {
|
||||
EntityCustomModel modelEntity = (EntityCustomModel) entity;
|
||||
EntityCustomModel modelEntity = (EntityCustomModel) entity;
|
||||
EntityNPCInterface npc = (EntityNPCInterface) copied;
|
||||
IDataDisplay display = (IDataDisplay) npc.display;
|
||||
modelEntity.textureResLoc = NpcTextureUtils.getNpcTexture((EntityNPCInterface) copied);
|
||||
@@ -45,7 +46,7 @@ public class MixinGeckoAddon {
|
||||
modelEntity.tintData = npc.display.tintData;
|
||||
modelEntity.headBoneName = display.getCustomModelData().getHeadBoneName();
|
||||
AnimationData animationData = modelEntity.getFactory().getOrCreateAnimationData(modelEntity.getUniqueID().hashCode());
|
||||
for(AnimationController controller : animationData.getAnimationControllers().values()){
|
||||
for (AnimationController controller : animationData.getAnimationControllers().values()) {
|
||||
controller.transitionLengthTicks = display.getCustomModelData().getTransitionLengthTicks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,20 +29,21 @@ import java.util.Vector;
|
||||
@Mixin(GeckoAddonClient.class)
|
||||
public class MixinGeckoAddonClient {
|
||||
|
||||
@Shadow(remap = false) public boolean supportEnabled;
|
||||
@Shadow(remap = false)
|
||||
public boolean supportEnabled;
|
||||
|
||||
/**
|
||||
* @author Goodbird
|
||||
* @reason Show Custom Model Selection button for Custom Entities
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void showGeckoButtons(GuiCreationScreen creationScreen, EntityLivingBase entity){
|
||||
if(!supportEnabled)
|
||||
public void showGeckoButtons(GuiCreationScreen creationScreen, EntityLivingBase entity) {
|
||||
if (!supportEnabled)
|
||||
return;
|
||||
|
||||
if(entity instanceof EntityCustomModel){
|
||||
creationScreen.addButton(new GuiNpcButton(202, creationScreen.guiLeft-60, creationScreen.guiTop+40, 180, 20, ((IDataDisplay)creationScreen.npc.display).getCustomModelData().getModel()));
|
||||
creationScreen.addButton(new GuiNpcButton(203, creationScreen.guiLeft-60, creationScreen.guiTop+62, 180, 20, "Extras"));
|
||||
if (entity instanceof EntityCustomModel) {
|
||||
creationScreen.addButton(new GuiNpcButton(202, creationScreen.guiLeft - 60, creationScreen.guiTop + 40, 180, 20, ((IDataDisplay) creationScreen.npc.display).getCustomModelData().getModel()));
|
||||
creationScreen.addButton(new GuiNpcButton(203, creationScreen.guiLeft - 60, creationScreen.guiTop + 62, 180, 20, "Extras"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,21 +52,21 @@ public class MixinGeckoAddonClient {
|
||||
* @reason Add support for new showGeckoButtons() in GuiCreationScreen
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void geckoGuiCreationScreenActionPerformed(GuiCreationScreen creationScreen, GuiNpcButton button){
|
||||
if(!supportEnabled)
|
||||
public void geckoGuiCreationScreenActionPerformed(GuiCreationScreen creationScreen, GuiNpcButton button) {
|
||||
if (!supportEnabled)
|
||||
return;
|
||||
|
||||
if(button.id == 202){
|
||||
if (button.id == 202) {
|
||||
Vector<String> list = new Vector<>();
|
||||
for(ResourceLocation resLoc : GeckoLibCache.getInstance().getGeoModels().keySet()){
|
||||
for (ResourceLocation resLoc : GeckoLibCache.getInstance().getGeoModels().keySet()) {
|
||||
list.add(resLoc.toString());
|
||||
}
|
||||
creationScreen.setSubGui(new GuiStringSelection(creationScreen,"Selecting GeckoLib Model:", list, name -> {
|
||||
((IDataDisplay)creationScreen.npc.display).getCustomModelData().setModel(name);
|
||||
creationScreen.setSubGui(new GuiStringSelection(creationScreen, "Selecting GeckoLib Model:", list, name -> {
|
||||
((IDataDisplay) creationScreen.npc.display).getCustomModelData().setModel(name);
|
||||
creationScreen.getButton(202).setDisplayText(name);
|
||||
}));
|
||||
}
|
||||
if(button.id == 203){
|
||||
if (button.id == 203) {
|
||||
creationScreen.setSubGui(new SubGuiModelExtras(creationScreen.npc));
|
||||
}
|
||||
}
|
||||
@@ -75,15 +76,15 @@ public class MixinGeckoAddonClient {
|
||||
* @reason Init Model Animation Button for NPCs
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void geckoNpcDisplayInitGui(GuiNPCInterface2 gui){
|
||||
if(!supportEnabled)
|
||||
public void geckoNpcDisplayInitGui(GuiNPCInterface2 gui) {
|
||||
if (!supportEnabled)
|
||||
return;
|
||||
|
||||
int y = gui.guiTop + 188;
|
||||
gui.addLabel(new GuiNpcLabel(212,"Model Animation", gui.guiLeft + 185, y + 5));
|
||||
gui.addLabel(new GuiNpcLabel(212, "Model Animation", gui.guiLeft + 185, y + 5));
|
||||
gui.addButton(new GuiNpcButton(212, gui.guiLeft + 300, y, 100, 20, "selectServer.edit"));
|
||||
if (!((IDataDisplay)gui.npc.display).hasCustomModel()) {
|
||||
gui.getLabel(212).enabled=false;
|
||||
if (!((IDataDisplay) gui.npc.display).hasCustomModel()) {
|
||||
gui.getLabel(212).enabled = false;
|
||||
gui.getButton(212).setVisible(false);
|
||||
gui.getButton(212).setEnabled(false);
|
||||
}
|
||||
@@ -94,11 +95,11 @@ public class MixinGeckoAddonClient {
|
||||
* @reason Add Support for Model Animation button on Npc Display
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void geckoNpcDisplayActionPerformed(GuiNPCInterface2 gui, GuiNpcButton btn){
|
||||
if(!supportEnabled)
|
||||
public void geckoNpcDisplayActionPerformed(GuiNPCInterface2 gui, GuiNpcButton btn) {
|
||||
if (!supportEnabled)
|
||||
return;
|
||||
|
||||
if(btn.id == 212){
|
||||
if (btn.id == 212) {
|
||||
gui.setSubGui(new SubGuiModelAnimation(gui.npc));
|
||||
}
|
||||
}
|
||||
@@ -108,8 +109,8 @@ public class MixinGeckoAddonClient {
|
||||
* @reason Check if Entity is a Gecko Model
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public boolean isGeckoModel(ModelBase mainModel){
|
||||
if(!supportEnabled)
|
||||
public boolean isGeckoModel(ModelBase mainModel) {
|
||||
if (!supportEnabled)
|
||||
return false;
|
||||
|
||||
return (mainModel instanceof ModelMPM && ((ModelMPM) mainModel).entity instanceof IAnimatable);
|
||||
@@ -120,23 +121,20 @@ public class MixinGeckoAddonClient {
|
||||
* @reason Render Gecko Model Support
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public void geckoRenderModel(ModelMPM mainModel, EntityNPCInterface npc, float rot, float partial){
|
||||
GL11.glRotatef(180, 1,0,0);
|
||||
GL11.glTranslated(0, -1.5,0);
|
||||
public void geckoRenderModel(ModelMPM mainModel, EntityNPCInterface npc, float rot, float partial) {
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glTranslated(0, -1.5, 0);
|
||||
|
||||
if (!npc.isInvisible())
|
||||
{
|
||||
if(mainModel.entity instanceof EntityCustomModel){
|
||||
((EntityCustomModel)mainModel.entity).isSemiVisible = false;
|
||||
if (!npc.isInvisible()) {
|
||||
if (mainModel.entity instanceof EntityCustomModel) {
|
||||
((EntityCustomModel) mainModel.entity).isSemiVisible = false;
|
||||
}
|
||||
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0,0,0,rot,partial);
|
||||
}
|
||||
else if (!npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
|
||||
{
|
||||
if(mainModel.entity instanceof EntityCustomModel){
|
||||
((EntityCustomModel)mainModel.entity).isSemiVisible = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0,0,0,rot,partial);
|
||||
}else {
|
||||
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0, 0, 0, rot, partial);
|
||||
} else if (!npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer)) {
|
||||
if (mainModel.entity instanceof EntityCustomModel) {
|
||||
((EntityCustomModel) mainModel.entity).isSemiVisible = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(mainModel.entity, 0, 0, 0, rot, partial);
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
// TODO: Fix ScriptCustomItem
|
||||
//package com.goodbird.npcgecko.mixin.impl;
|
||||
//
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.goodbird.npcgecko.mixin.impl;
|
||||
import com.goodbird.npcgecko.CustomNpcPlusGecko;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import noppes.npcs.blocks.tiles.TileScripted;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -22,12 +19,12 @@ public class TileScriptedMixin {
|
||||
|
||||
@Inject(method = "setDisplayNBT", at = @At("TAIL"), remap = false)
|
||||
public void setDisplayNBT(NBTTagCompound compound, CallbackInfo ci) {
|
||||
if(compound.hasKey("renderTileTag")){
|
||||
if (compound.hasKey("renderTileTag")) {
|
||||
renderTile = new TileEntityCustomModel();
|
||||
NBTTagCompound saveTag = compound.getCompoundTag("renderTileTag");
|
||||
if(saveTag.hasKey("dimID")){
|
||||
if (saveTag.hasKey("dimID")) {
|
||||
renderTile.setWorldObj(CustomNpcPlusGecko.proxy.getWorldById(saveTag.getInteger("dimID")));
|
||||
}else{
|
||||
} else {
|
||||
renderTile.setWorldObj(CustomNpcPlusGecko.proxy.getWorldById(0));
|
||||
}
|
||||
renderTile.readFromNBT(saveTag);
|
||||
@@ -36,10 +33,10 @@ public class TileScriptedMixin {
|
||||
|
||||
@Inject(method = "getDisplayNBT", at = @At("TAIL"), remap = false)
|
||||
public void getDisplayNBT(NBTTagCompound compound, CallbackInfo ci) {
|
||||
if(renderTile!=null) {
|
||||
if (renderTile != null) {
|
||||
NBTTagCompound saveTag = new NBTTagCompound();
|
||||
renderTile.writeToNBT(saveTag);
|
||||
if(renderTile.getWorldObj()!=null && renderTile.getWorldObj().provider!=null)
|
||||
if (renderTile.getWorldObj() != null && renderTile.getWorldObj().provider != null)
|
||||
saveTag.setInteger("dimID", renderTile.getWorldObj().provider.dimensionId);
|
||||
compound.setTag("renderTileTag", saveTag);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,11 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
public final class CPacketSyncAutoAnim implements IMessage, IMessageHandler<CPacketSyncAutoAnim, IMessage> {
|
||||
public EnumSyncAutoAnim animType;
|
||||
public int entityId;
|
||||
public CPacketSyncAutoAnim(){
|
||||
|
||||
public CPacketSyncAutoAnim() {
|
||||
|
||||
}
|
||||
|
||||
public CPacketSyncAutoAnim(EntityNPCInterface npc, EnumSyncAutoAnim animType) {
|
||||
this.animType = animType;
|
||||
this.entityId = npc.getEntityId();
|
||||
@@ -37,9 +39,9 @@ public final class CPacketSyncAutoAnim implements IMessage, IMessageHandler<CPac
|
||||
@Override
|
||||
public IMessage onMessage(CPacketSyncAutoAnim message, MessageContext ctx) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityId);
|
||||
if(!(entity instanceof EntityCustomNpc)) return null;
|
||||
if (!(entity instanceof EntityCustomNpc)) return null;
|
||||
EntityCustomNpc npc = (EntityCustomNpc) entity;
|
||||
if(npc.modelData==null || !(npc.modelData.getEntity(npc) instanceof EntityCustomModel)) return null;
|
||||
if (npc.modelData == null || !(npc.modelData.getEntity(npc) instanceof EntityCustomModel)) return null;
|
||||
EntityCustomModel entityCustomModel = (EntityCustomModel) npc.modelData.getEntity(npc);
|
||||
entityCustomModel.activateReceivedAnim(message.animType);
|
||||
return null;
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
@@ -22,9 +21,11 @@ import java.io.IOException;
|
||||
public final class CPacketSyncManualAnim implements IMessage, IMessageHandler<CPacketSyncManualAnim, IMessage> {
|
||||
public AnimationBuilder builder;
|
||||
public int entityId;
|
||||
public CPacketSyncManualAnim(){
|
||||
|
||||
public CPacketSyncManualAnim() {
|
||||
|
||||
}
|
||||
|
||||
public CPacketSyncManualAnim(EntityNPCInterface npc, AnimationBuilder builder) {
|
||||
this.builder = builder;
|
||||
this.entityId = npc.getEntityId();
|
||||
@@ -34,7 +35,8 @@ public final class CPacketSyncManualAnim implements IMessage, IMessageHandler<CP
|
||||
public void toBytes(ByteBuf buf) {
|
||||
try {
|
||||
writeAnimBuilder(buf, builder);
|
||||
}catch (Exception ignored){ }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
buf.writeInt(entityId);
|
||||
}
|
||||
|
||||
@@ -42,32 +44,33 @@ public final class CPacketSyncManualAnim implements IMessage, IMessageHandler<CP
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
try {
|
||||
builder = readAnimBuilder(buf);
|
||||
}catch (Exception ignored){ }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
entityId = buf.readInt();
|
||||
}
|
||||
|
||||
public static void writeAnimBuilder(ByteBuf buffer, AnimationBuilder builder) throws IOException {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList animList = new NBTTagList();
|
||||
for(RawAnimation anim: builder.getRawAnimationList()){
|
||||
for (RawAnimation anim : builder.getRawAnimationList()) {
|
||||
NBTTagCompound animTag = new NBTTagCompound();
|
||||
animTag.setString("name", anim.animationName);
|
||||
if(anim.loopType!=null) {
|
||||
if (anim.loopType != null) {
|
||||
animTag.setInteger("loop", ((ILoopType.EDefaultLoopTypes) anim.loopType).ordinal());
|
||||
}else{
|
||||
animTag.setInteger("loop",1);
|
||||
} else {
|
||||
animTag.setInteger("loop", 1);
|
||||
}
|
||||
animList.appendTag(animTag);
|
||||
}
|
||||
compound.setTag("anims",animList);
|
||||
ByteBufUtils.writeNBT(buffer,compound);
|
||||
compound.setTag("anims", animList);
|
||||
ByteBufUtils.writeNBT(buffer, compound);
|
||||
}
|
||||
|
||||
public static AnimationBuilder readAnimBuilder(ByteBuf buffer) throws IOException {
|
||||
AnimationBuilder builder = new AnimationBuilder();
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
|
||||
NBTTagList animList = compound.getTagList("anims",10);
|
||||
for(int i=0;i<animList.tagCount();i++){
|
||||
NBTTagList animList = compound.getTagList("anims", 10);
|
||||
for (int i = 0; i < animList.tagCount(); i++) {
|
||||
NBTTagCompound animTag = animList.getCompoundTagAt(i);
|
||||
builder.addAnimation(animTag.getString("name"),
|
||||
ILoopType.EDefaultLoopTypes.values()[animTag.getInteger("loop")]);
|
||||
@@ -78,9 +81,9 @@ public final class CPacketSyncManualAnim implements IMessage, IMessageHandler<CP
|
||||
@Override
|
||||
public IMessage onMessage(CPacketSyncManualAnim message, MessageContext ctx) {
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityId);
|
||||
if(!(entity instanceof EntityCustomNpc)) return null;
|
||||
if (!(entity instanceof EntityCustomNpc)) return null;
|
||||
EntityCustomNpc npc = (EntityCustomNpc) entity;
|
||||
if(npc.modelData==null || !(npc.modelData.getEntity(npc) instanceof EntityCustomModel)) return null;
|
||||
if (npc.modelData == null || !(npc.modelData.getEntity(npc) instanceof EntityCustomModel)) return null;
|
||||
EntityCustomModel entityCustomModel = (EntityCustomModel) npc.modelData.getEntity(npc);
|
||||
entityCustomModel.manualAnim = message.builder;
|
||||
return null;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.goodbird.npcgecko.network;
|
||||
|
||||
import com.goodbird.npcgecko.entity.EntityCustomModel;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -8,15 +7,10 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.blocks.tiles.TileScripted;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
import software.bernie.geckolib3.core.builder.ILoopType;
|
||||
import software.bernie.geckolib3.core.builder.RawAnimation;
|
||||
@@ -26,9 +20,11 @@ import java.io.IOException;
|
||||
public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPacketSyncTileManualAnim, IMessage> {
|
||||
public AnimationBuilder builder;
|
||||
public int x, y, z;
|
||||
public CPacketSyncTileManualAnim(){
|
||||
|
||||
public CPacketSyncTileManualAnim() {
|
||||
|
||||
}
|
||||
|
||||
public CPacketSyncTileManualAnim(TileEntity tile, AnimationBuilder builder) {
|
||||
this.builder = builder;
|
||||
this.x = tile.xCoord;
|
||||
@@ -40,7 +36,8 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
|
||||
public void toBytes(ByteBuf buf) {
|
||||
try {
|
||||
writeAnimBuilder(buf, builder);
|
||||
}catch (Exception ignored){ }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
buf.writeInt(x);
|
||||
buf.writeInt(y);
|
||||
buf.writeInt(z);
|
||||
@@ -50,7 +47,8 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
try {
|
||||
builder = readAnimBuilder(buf);
|
||||
}catch (Exception ignored){ }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
x = buf.readInt();
|
||||
y = buf.readInt();
|
||||
z = buf.readInt();
|
||||
@@ -60,25 +58,25 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
|
||||
public static void writeAnimBuilder(ByteBuf buffer, AnimationBuilder builder) throws IOException {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
NBTTagList animList = new NBTTagList();
|
||||
for(RawAnimation anim: builder.getRawAnimationList()){
|
||||
for (RawAnimation anim : builder.getRawAnimationList()) {
|
||||
NBTTagCompound animTag = new NBTTagCompound();
|
||||
animTag.setString("name", anim.animationName);
|
||||
if(anim.loopType!=null) {
|
||||
if (anim.loopType != null) {
|
||||
animTag.setInteger("loop", ((ILoopType.EDefaultLoopTypes) anim.loopType).ordinal());
|
||||
}else{
|
||||
animTag.setInteger("loop",1);
|
||||
} else {
|
||||
animTag.setInteger("loop", 1);
|
||||
}
|
||||
animList.appendTag(animTag);
|
||||
}
|
||||
compound.setTag("anims",animList);
|
||||
ByteBufUtils.writeNBT(buffer,compound);
|
||||
compound.setTag("anims", animList);
|
||||
ByteBufUtils.writeNBT(buffer, compound);
|
||||
}
|
||||
|
||||
public static AnimationBuilder readAnimBuilder(ByteBuf buffer) throws IOException {
|
||||
AnimationBuilder builder = new AnimationBuilder();
|
||||
NBTTagCompound compound = ByteBufUtils.readNBT(buffer);
|
||||
NBTTagList animList = compound.getTagList("anims",10);
|
||||
for(int i=0;i<animList.tagCount();i++){
|
||||
NBTTagList animList = compound.getTagList("anims", 10);
|
||||
for (int i = 0; i < animList.tagCount(); i++) {
|
||||
NBTTagCompound animTag = animList.getCompoundTagAt(i);
|
||||
builder.addAnimation(animTag.getString("name"),
|
||||
ILoopType.EDefaultLoopTypes.values()[animTag.getInteger("loop")]);
|
||||
@@ -89,9 +87,9 @@ public class CPacketSyncTileManualAnim implements IMessage, IMessageHandler<CPac
|
||||
@Override
|
||||
public IMessage onMessage(CPacketSyncTileManualAnim message, MessageContext ctx) {
|
||||
TileEntity entity = Minecraft.getMinecraft().theWorld.getTileEntity(message.x, message.y, message.z);
|
||||
if(!(entity instanceof TileScripted)) return null;
|
||||
if (!(entity instanceof TileScripted)) return null;
|
||||
TileScripted tile = (TileScripted) entity;
|
||||
if(tile.renderTile==null){
|
||||
if (tile.renderTile == null) {
|
||||
tile.renderTile = new TileEntityCustomModel();
|
||||
}
|
||||
TileEntityCustomModel geckoTile = (TileEntityCustomModel) tile.renderTile;
|
||||
|
||||
@@ -21,10 +21,11 @@ public class TileEntityCustomModel extends TileEntity implements IAnimatable {
|
||||
public String idleAnimName = "";
|
||||
public AnimationBuilder manualAnim = null;
|
||||
|
||||
public TileEntityCustomModel(){
|
||||
public TileEntityCustomModel() {
|
||||
|
||||
}
|
||||
public TileEntityCustomModel(TileEntity other){
|
||||
|
||||
public TileEntityCustomModel(TileEntity other) {
|
||||
setWorldObj(other.getWorldObj());
|
||||
xCoord = other.xCoord;
|
||||
yCoord = other.yCoord;
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.security.MessageDigest;
|
||||
import java.util.Map;
|
||||
|
||||
public class NpcTextureUtils {
|
||||
public static ResourceLocation getNpcTexture(EntityNPCInterface npc){
|
||||
public static ResourceLocation getNpcTexture(EntityNPCInterface npc) {
|
||||
if (npc.textureLocation == null) {
|
||||
if (npc.display.skinType == 0) {
|
||||
if (npc instanceof EntityCustomNpc && ((EntityCustomNpc) npc).modelData.entityClass == null) {
|
||||
@@ -37,22 +37,22 @@ public class NpcTextureUtils {
|
||||
} else {
|
||||
npc.textureLocation = new ResourceLocation(npc.display.texture);
|
||||
}
|
||||
} else if(RenderNPCInterface.LastTextureTick < 5) { //fixes request flood somewhat
|
||||
} else if (RenderNPCInterface.LastTextureTick < 5) { //fixes request flood somewhat
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
} else if(npc.display.skinType == 1 && npc.display.playerProfile != null) {
|
||||
} else if (npc.display.skinType == 1 && npc.display.playerProfile != null) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
Map map = minecraft.func_152342_ad().func_152788_a(npc.display.playerProfile);
|
||||
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)){
|
||||
npc.textureLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
|
||||
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
|
||||
npc.textureLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture) map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
RenderNPCInterface.LastTextureTick = 0;
|
||||
} else if (npc.display.skinType == 2 || npc.display.skinType == 3) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
byte[] hash = digest.digest(npc.display.url.getBytes(StandardCharsets.UTF_8));
|
||||
StringBuilder sb = new StringBuilder(2*hash.length);
|
||||
StringBuilder sb = new StringBuilder(2 * hash.length);
|
||||
for (byte b : hash) {
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
sb.append(String.format("%02x", b & 0xff));
|
||||
}
|
||||
if (npc.display.skinType == 2) {
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb);
|
||||
@@ -62,7 +62,8 @@ public class NpcTextureUtils {
|
||||
ClientCacheHandler.getNPCTexture(npc.display.url, true, npc.textureLocation);
|
||||
}
|
||||
RenderNPCInterface.LastTextureTick = 0;
|
||||
} catch(Exception ignored){}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} else {
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
}
|
||||
@@ -86,7 +87,7 @@ public class NpcTextureUtils {
|
||||
bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32);
|
||||
}
|
||||
|
||||
ImageDownloadAlt object = new ImageDownloadAlt((File)null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
|
||||
ImageDownloadAlt object = new ImageDownloadAlt((File) null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
|
||||
object.setBufferedImage(bufferedimage);
|
||||
|
||||
try {
|
||||
@@ -96,7 +97,7 @@ public class NpcTextureUtils {
|
||||
byte[] var13 = hash;
|
||||
int var14 = hash.length;
|
||||
|
||||
for(int var15 = 0; var15 < var14; ++var15) {
|
||||
for (int var15 = 0; var15 < var14; ++var15) {
|
||||
byte b = var13[var15];
|
||||
sb.append(String.format("%02x", b & 255));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoAnimationBuilder;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
|
||||
/**
|
||||
* Wrapper around GeckoLib's {@link AnimationBuilder} that implements {@link IGeckoAnimationBuilder}.
|
||||
* This allows the scripting API to work with animation builders without exposing GeckoLib internals.
|
||||
*/
|
||||
public class GeckoAnimationBuilderWrapper implements IGeckoAnimationBuilder {
|
||||
private final AnimationBuilder builder;
|
||||
|
||||
public GeckoAnimationBuilderWrapper(AnimationBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder playOnce(String animationName) {
|
||||
builder.playOnce(animationName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder loop(String animationName) {
|
||||
builder.loop(animationName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder playAndHold(String animationName) {
|
||||
builder.playAndHold(animationName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder addAnimation(String animationName) {
|
||||
builder.addAnimation(animationName);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder addRepeatingAnimation(String animationName, int timesToRepeat) {
|
||||
builder.addRepeatingAnimation(animationName, timesToRepeat);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoAnimationBuilder clearAnimations() {
|
||||
builder.clearAnimations();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying GeckoLib AnimationBuilder.
|
||||
* Used internally for network sync and animation application.
|
||||
*
|
||||
* @return The wrapped AnimationBuilder
|
||||
*/
|
||||
public AnimationBuilder getBuilder() {
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoAnimation;
|
||||
import software.bernie.geckolib3.core.builder.Animation;
|
||||
|
||||
/**
|
||||
* Wrapper around GeckoLib's {@link Animation} that implements {@link IGeckoAnimation}.
|
||||
*/
|
||||
public class GeckoAnimationWrapper implements IGeckoAnimation {
|
||||
private final Animation animation;
|
||||
|
||||
public GeckoAnimationWrapper(Animation animation) {
|
||||
this.animation = animation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return animation.animationName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLength() {
|
||||
return animation.animationLength != null ? animation.animationLength : 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLooping() {
|
||||
return animation.loop != null && animation.loop.isRepeatingAfterEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAnimatedBoneNames() {
|
||||
if (animation.boneAnimations == null) {
|
||||
return new String[0];
|
||||
}
|
||||
String[] names = new String[animation.boneAnimations.size()];
|
||||
for (int i = 0; i < animation.boneAnimations.size(); i++) {
|
||||
names[i] = animation.boneAnimations.get(i).boneName;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSoundKeyframeCount() {
|
||||
return animation.soundKeyFrames != null ? animation.soundKeyFrames.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParticleKeyframeCount() {
|
||||
return animation.particleKeyFrames != null ? animation.particleKeyFrames.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCustomInstructionKeyframeCount() {
|
||||
return animation.customInstructionKeyframes != null ? animation.customInstructionKeyframes.size() : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoAnimatable;
|
||||
import com.goodbird.npcgecko.tile.TileEntityCustomModel;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.api.block.IBlockScripted;
|
||||
import noppes.npcs.blocks.tiles.TileScripted;
|
||||
|
||||
/**
|
||||
* Implementation of {@link IGeckoAnimatable} that wraps a scripted block's {@link TileEntityCustomModel}.
|
||||
* Changes made through this interface are automatically synced to clients.
|
||||
*
|
||||
* <p>Note: Scripted blocks support a subset of animation features compared to NPCs.
|
||||
* Walk, hurt, melee attack, ranged attack animations, head bone name, and transition length
|
||||
* are not applicable to blocks and will return default/empty values.</p>
|
||||
*/
|
||||
public class GeckoBlockAnimatable implements IGeckoAnimatable {
|
||||
private final IBlockScripted block;
|
||||
private final TileEntityCustomModel tile;
|
||||
|
||||
public GeckoBlockAnimatable(IBlockScripted block, TileEntityCustomModel tile) {
|
||||
this.block = block;
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
private void markDirty() {
|
||||
((TileScripted) block.getMCTileEntity()).needsClientUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModel() {
|
||||
return tile.modelResLoc.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModel(String model) {
|
||||
tile.modelResLoc = new ResourceLocation(model);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTexture() {
|
||||
return tile.textureResLoc.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture(String texture) {
|
||||
tile.textureResLoc = new ResourceLocation(texture);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAnimationFile() {
|
||||
return tile.animResLoc.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnimationFile(String animationFile) {
|
||||
tile.animResLoc = new ResourceLocation(animationFile);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdleAnimation() {
|
||||
return tile.idleAnimName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdleAnimation(String animation) {
|
||||
tile.idleAnimName = animation;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWalkAnimation() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWalkAnimation(String animation) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHurtAnimation() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHurtAnimation(String animation) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeleeAttackAnimation() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeleeAttackAnimation(String animation) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRangedAttackAnimation() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRangedAttackAnimation(String animation) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeadBoneName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadBoneName(String boneName) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionLengthTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransitionLengthTicks(int ticks) {
|
||||
// Not applicable to blocks
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoBone;
|
||||
import software.bernie.geckolib3.geo.render.built.GeoBone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper around GeckoLib's {@link GeoBone} that implements {@link IGeckoBone}.
|
||||
*/
|
||||
public class GeckoBoneWrapper implements IGeckoBone {
|
||||
private final GeoBone bone;
|
||||
|
||||
public GeckoBoneWrapper(GeoBone bone) {
|
||||
this.bone = bone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return bone.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPositionX() {
|
||||
return bone.getPositionX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPositionY() {
|
||||
return bone.getPositionY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPositionZ() {
|
||||
return bone.getPositionZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionX(float value) {
|
||||
bone.setPositionX(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionY(float value) {
|
||||
bone.setPositionY(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionZ(float value) {
|
||||
bone.setPositionZ(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotationX() {
|
||||
return bone.getRotationX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotationY() {
|
||||
return bone.getRotationY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotationZ() {
|
||||
return bone.getRotationZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationX(float value) {
|
||||
bone.setRotationX(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationY(float value) {
|
||||
bone.setRotationY(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationZ(float value) {
|
||||
bone.setRotationZ(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScaleX() {
|
||||
return bone.getScaleX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScaleY() {
|
||||
return bone.getScaleY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScaleZ() {
|
||||
return bone.getScaleZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleX(float value) {
|
||||
bone.setScaleX(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleY(float value) {
|
||||
bone.setScaleY(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleZ(float value) {
|
||||
bone.setScaleZ(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPivotX() {
|
||||
return bone.getPivotX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPivotY() {
|
||||
return bone.getPivotY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPivotZ() {
|
||||
return bone.getPivotZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPivotX(float value) {
|
||||
bone.setPivotX(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPivotY(float value) {
|
||||
bone.setPivotY(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPivotZ(float value) {
|
||||
bone.setPivotZ(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return bone.isHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHidden(boolean hidden) {
|
||||
bone.setHidden(hidden);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoBone getParent() {
|
||||
if (bone.parent == null) {
|
||||
return null;
|
||||
}
|
||||
return new GeckoBoneWrapper(bone.parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoBone[] getChildBones() {
|
||||
List<GeoBone> children = bone.childBones;
|
||||
IGeckoBone[] result = new IGeckoBone[children.size()];
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
result[i] = new GeckoBoneWrapper(children.get(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoColor;
|
||||
import software.bernie.geckolib3.core.util.Color;
|
||||
|
||||
/**
|
||||
* Wrapper around GeckoLib's {@link Color} that implements {@link IGeckoColor}.
|
||||
*/
|
||||
public class GeckoColorWrapper implements IGeckoColor {
|
||||
private final Color color;
|
||||
|
||||
public GeckoColorWrapper(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRed() {
|
||||
return color.getRed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGreen() {
|
||||
return color.getGreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlue() {
|
||||
return color.getBlue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAlpha() {
|
||||
return color.getAlpha();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoColor brighter(double factor) {
|
||||
return new GeckoColorWrapper(color.brighter(factor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoColor darker(double factor) {
|
||||
return new GeckoColorWrapper(color.darker(factor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying GeckoLib Color.
|
||||
*
|
||||
* @return The wrapped Color
|
||||
*/
|
||||
public Color getInternalColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoBone;
|
||||
import com.goodbird.npcgecko.api.IGeckoModel;
|
||||
import software.bernie.geckolib3.geo.render.built.GeoBone;
|
||||
import software.bernie.geckolib3.geo.render.built.GeoModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper around GeckoLib's {@link GeoModel} that implements {@link IGeckoModel}.
|
||||
*/
|
||||
public class GeckoModelWrapper implements IGeckoModel {
|
||||
private final GeoModel model;
|
||||
|
||||
public GeckoModelWrapper(GeoModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGeckoBone getBone(String name) {
|
||||
if (model.getBone(name).isPresent()) {
|
||||
return new GeckoBoneWrapper(model.getBone(name).get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBoneNames() {
|
||||
List<String> names = new ArrayList<>();
|
||||
collectBoneNames(model.topLevelBones, names);
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
|
||||
private void collectBoneNames(List<GeoBone> bones, List<String> names) {
|
||||
for (GeoBone bone : bones) {
|
||||
names.add(bone.name);
|
||||
if (bone.childBones != null && !bone.childBones.isEmpty()) {
|
||||
collectBoneNames(bone.childBones, names);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.goodbird.npcgecko.wrapper;
|
||||
|
||||
import com.goodbird.npcgecko.api.IGeckoAnimatable;
|
||||
import com.goodbird.npcgecko.data.CustomModelData;
|
||||
import com.goodbird.npcgecko.mixin.IDataDisplay;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
* Implementation of {@link IGeckoAnimatable} that wraps an NPC's {@link CustomModelData}.
|
||||
* Changes made through this interface are automatically synced to clients.
|
||||
*/
|
||||
public class GeckoNpcAnimatable implements IGeckoAnimatable {
|
||||
private final ICustomNpc<EntityNPCInterface> npc;
|
||||
private final CustomModelData data;
|
||||
|
||||
public GeckoNpcAnimatable(ICustomNpc<EntityNPCInterface> npc) {
|
||||
this.npc = npc;
|
||||
this.data = ((IDataDisplay) npc.getMCEntity().display).getCustomModelData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModel() {
|
||||
return data.getModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModel(String model) {
|
||||
data.setModel(model);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTexture() {
|
||||
return npc.getMCEntity().display.texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture(String texture) {
|
||||
npc.getMCEntity().display.texture = texture;
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAnimationFile() {
|
||||
return data.getAnimFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnimationFile(String animationFile) {
|
||||
data.setAnimFile(animationFile);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdleAnimation() {
|
||||
return data.getIdleAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdleAnimation(String animation) {
|
||||
data.setIdleAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWalkAnimation() {
|
||||
return data.getWalkAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWalkAnimation(String animation) {
|
||||
data.setWalkAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHurtAnimation() {
|
||||
return data.getHurtAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHurtAnimation(String animation) {
|
||||
data.setHurtAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeleeAttackAnimation() {
|
||||
return data.getMeleeAttackAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeleeAttackAnimation(String animation) {
|
||||
data.setMeleeAttackAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRangedAttackAnimation() {
|
||||
return data.getRangedAttackAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRangedAttackAnimation(String animation) {
|
||||
data.setRangedAttackAnim(animation);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeadBoneName() {
|
||||
return data.getHeadBoneName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeadBoneName(String boneName) {
|
||||
data.setHeadBoneName(boneName);
|
||||
npc.updateClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionLengthTicks() {
|
||||
return data.getTransitionLengthTicks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransitionLengthTicks(int ticks) {
|
||||
data.setTransitionLengthTicks(ticks);
|
||||
npc.updateClient();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,21 +1,26 @@
|
||||
{
|
||||
"modListVersion": 2,
|
||||
"modList": [{
|
||||
"modid": "${modId}",
|
||||
"name": "${modName}",
|
||||
"description": "A mod that is made for integrating GeckoLib3 and CustomNPC",
|
||||
"version": "${modVersion}",
|
||||
"mcversion": "${minecraftVersion}",
|
||||
"url": "https://github.com/KAMKEEL/CustomNPC-Gecko-Addon",
|
||||
"updateUrl": "",
|
||||
"authorList": ["Goodbird","KAMKEEL"],
|
||||
"credits": "",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
"parent": "",
|
||||
"requiredMods": [],
|
||||
"dependencies": [],
|
||||
"dependants": [],
|
||||
"useDependencyInformation": false
|
||||
}]
|
||||
"modListVersion": 2,
|
||||
"modList": [
|
||||
{
|
||||
"modid": "${modId}",
|
||||
"name": "${modName}",
|
||||
"description": "A mod that is made for integrating GeckoLib3 and CustomNPC",
|
||||
"version": "${modVersion}",
|
||||
"mcversion": "${minecraftVersion}",
|
||||
"url": "https://github.com/KAMKEEL/CustomNPC-Gecko-Addon",
|
||||
"updateUrl": "",
|
||||
"authorList": [
|
||||
"Goodbird",
|
||||
"KAMKEEL"
|
||||
],
|
||||
"credits": "",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
"parent": "",
|
||||
"requiredMods": [],
|
||||
"dependencies": [],
|
||||
"dependants": [],
|
||||
"useDependencyInformation": false
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user