Skip to content

Commit e94efdd

Browse files
committed
feat: add frame time and frame interpolate in texture
1 parent d00fc32 commit e94efdd

File tree

5 files changed

+87
-49
lines changed

5 files changed

+87
-49
lines changed

api/src/main/java/kr/toxicity/model/api/BetterModelConfig.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ public interface BetterModelConfig {
109109
*/
110110
boolean followMobInvisibility();
111111

112-
/**
113-
* Gets animation time in texture mcmeta
114-
* @return animation time
115-
*/
116-
int animatedTextureFrameTime();
117-
118112
/**
119113
* Checks use Purpur afk.
120114
* @return use Purpur afk

api/src/main/java/kr/toxicity/model/api/data/blueprint/BlueprintTexture.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
* @param uvWidth the UV width of the texture, if specified
2727
* @param uvHeight the UV height of the texture, if specified
2828
* @param canBeRendered whether this texture should be included in the resource pack
29+
* @param frameTime the frame time of the texture
30+
* @param frameInterpolate the interpolation flag of the texture
2931
* @since 1.15.2
3032
*/
3133
public record BlueprintTexture(
@@ -35,7 +37,9 @@ public record BlueprintTexture(
3537
int height,
3638
int uvWidth,
3739
int uvHeight,
38-
boolean canBeRendered
40+
boolean canBeRendered,
41+
int frameTime,
42+
boolean frameInterpolate
3943
) {
4044
/**
4145
* Checks if this texture is an animated texture (a texture atlas for animation).
@@ -62,8 +66,8 @@ public boolean isAnimatedTexture() {
6266
public @NotNull JsonObject toMcmeta() {
6367
return JsonObjectBuilder.builder()
6468
.jsonObject("animation", animation -> {
65-
animation.property("interpolate", true);
66-
animation.property("frametime", BetterModel.config().animatedTextureFrameTime());
69+
animation.property("interpolate", frameInterpolate());
70+
animation.property("frametime", frameTime());
6771
})
6872
.build();
6973
}

api/src/main/java/kr/toxicity/model/api/data/raw/ModelTexture.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
* @param height the height of the texture in pixels
2727
* @param uvWidth the UV width of the texture
2828
* @param uvHeight the UV height of the texture
29+
* @param frameTime the frame time of the texture
30+
* @param frameInterpolate the interpolation flag of the texture
2931
* @since 1.15.2
3032
*/
3133
@ApiStatus.Internal
@@ -35,7 +37,9 @@ public record ModelTexture(
3537
int width,
3638
int height,
3739
@SerializedName("uv_width") int uvWidth,
38-
@SerializedName("uv_height") int uvHeight
40+
@SerializedName("uv_height") int uvHeight,
41+
@SerializedName("frame_time") int frameTime,
42+
@SerializedName("frame_interpolate") boolean frameInterpolate
3943
) {
4044

4145
/**
@@ -57,7 +61,9 @@ public record ModelTexture(
5761
height(),
5862
uvWidth(),
5963
uvHeight(),
60-
!name.startsWith("-")
64+
!name.startsWith("-"),
65+
frameTime(),
66+
frameInterpolate()
6167
);
6268
}
6369

core/src/main/kotlin/kr/toxicity/model/BetterModelConfigImpl.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class BetterModelConfigImpl(yaml: ConfigurationSection) : BetterModelConfig {
5555
} ?: BetterModelConfig.PackType.ZIP
5656
private val buildFolderLocation = (yaml.getString("build-folder-location") ?: "BetterModel/build").replace('/', File.separatorChar)
5757
private val followMobInvisibility = yaml.getBoolean("follow-mob-invisibility", true)
58-
private val animatedTextureFrameTime = yaml.getInt("animated-texture-frame-time", 10)
5958
private val usePurpurAfk = yaml.getBoolean("use-purpur-afk", true)
6059
private val versionCheck = yaml.getBoolean("version-check", true)
6160
private val defaultMountController = when (yaml.getString("default-mount-controller")?.lowercase()) {
@@ -85,7 +84,6 @@ class BetterModelConfigImpl(yaml: ConfigurationSection) : BetterModelConfig {
8584
override fun packType(): BetterModelConfig.PackType = packType
8685
override fun buildFolderLocation(): String = buildFolderLocation
8786
override fun followMobInvisibility(): Boolean = followMobInvisibility
88-
override fun animatedTextureFrameTime(): Int = animatedTextureFrameTime
8987
override fun usePurpurAfk(): Boolean = usePurpurAfk
9088
override fun versionCheck(): Boolean = versionCheck
9189
override fun defaultMountController(): MountController = defaultMountController

core/src/main/resources/config.yml

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,104 @@
1-
#toggles debug option.
1+
# BetterModel Configuration
2+
#
3+
# This file contains all the configuration options for the BetterModel plugin.
4+
# For detailed information on each option, please refer to the official documentation.
5+
6+
# Debugging options for development and troubleshooting.
7+
# Enable these only if you are diagnosing issues.
28
debug:
3-
#hitbox
9+
# Toggles debug messages for hitbox creation and interaction.
410
hitbox: false
5-
#exception
11+
# Toggles detailed stack traces for exceptions handled by the plugin.
612
exception: false
7-
#pack
13+
# Toggles debug messages related to resource pack generation.
814
pack: false
9-
#tracker
15+
# Toggles debug messages for model tracker lifecycle and updates.
1016
tracker: false
11-
#toggles indicator option.
17+
18+
# Visual indicator settings.
1219
indicator:
13-
#progress bar
20+
# Shows a progress bar during resource pack generation.
1421
progress_bar: true
15-
#toggle BetterModel's feature you want
22+
23+
# Core feature modules.
24+
# Disable modules you don't need to save resources.
1625
module:
17-
#general entity model
26+
# Enables general entity models.
1827
model: true
19-
#player model
28+
# Enables player-specific animations and models (e.g., custom limbs).
2029
player-animation: true
21-
#toggle resource pack generation
30+
31+
# Resource pack generation settings.
2232
pack:
23-
#generates modern resource pack (>=1.21.4)
33+
# Generates models compatible with modern Minecraft versions (>=1.21.4).
2434
generate-modern-model: true
25-
#generates legacy resource pack (<1.21.3)
35+
# Generates models compatible with legacy Minecraft versions (<=1.21.3).
2636
generate-legacy-model: true
27-
#should obfuscate this resource pack
37+
# Obfuscates model and texture names in the resource pack to prevent easy extraction.
2838
use-obfuscation: false
29-
#toggles metrics in bStats (https://bstats.org/plugin/bukkit/BetterModel/24237)
39+
40+
# Toggles metrics collection via bStats (https://bstats.org/plugin/bukkit/BetterModel/24237).
41+
# Disabling this helps us less to improve the plugin.
3042
metrics: true
31-
#enables sight-trace culling
43+
44+
# Enables sight-trace culling: models are only rendered if there is a clear line of sight.
3245
sight-trace: true
33-
#should merging resource pack with external plugin.
46+
47+
# Merges the generated resource pack with packs from other plugins.
3448
merge-with-external-resources: true
35-
#target item material about resource pack
49+
50+
# The base item used for custom model data.
51+
# It's recommended to use an item that is not commonly used for other purposes.
3652
item: leather_horse_armor
37-
#item namespace
53+
54+
# The namespace used for custom model items.
3855
item-namespace: bm_models
39-
#max distance about sending an animation packet
56+
57+
# Maximum distance (in blocks) for sending animation packets. -1 for default server view distance.
4058
max-sight: -1
41-
#min distance about sending an animation packet
59+
# Minimum distance (in blocks) before animation packets are sent.
4260
min-sight: 5
43-
#resource pack namespace
61+
62+
# The namespace used for resource pack assets (e.g., assets/bettermodel/...).
4463
namespace: "bettermodel"
45-
#resource pack type (folder, zip)
64+
65+
# The format of the generated resource pack.
66+
# 'zip': A standard .zip file.
67+
# 'folder': A raw folder structure (useful for merging or debugging).
4668
pack-type: zip
47-
#resoruce pack location
69+
70+
# The location where the resource pack file or folder will be generated, relative to the server root.
4871
build-folder-location: BetterModel/build
49-
#toggle following mob's invisibility
72+
73+
# If enabled, models attached to invisible mobs will also be invisible.
5074
follow-mob-invisibility: true
51-
#default frame time of animated texture
52-
animated-texture-frame-time: 10
53-
#toggles using Purpur afk (https://purpurmc.org/)
75+
76+
# If enabled, utilizes Purpur's AFK API to pause animations for AFK players.
5477
use-purpur-afk: true
55-
#toggles version update announcement
78+
79+
# Checks for new plugin versions on startup and notifies admins.
5680
version-check: true
57-
#default mount controller (walk, fly)
81+
82+
# The default movement controller for mountable models.
83+
# 'walk': Standard ground-based movement.
84+
# 'fly': Flying movement.
5885
default-mount-controller: walk
59-
#keyframe insertion tick time
86+
87+
# The time in ticks between inserted keyframes for smooth interpolation (lerp).
88+
# Lower values result in smoother but potentially more resource-intensive animations.
6089
lerp-frame-time: 3
61-
#toggles canceling player hotbar swap if target player is disguised or in player animation
90+
91+
# Prevents players from swapping hotbar slots if they have a custom player model or animation active.
6292
cancel-player-model-inventory: false
63-
#delay of applying hiding player entity
93+
94+
# The delay in ticks before a player's original entity is hidden after a model is applied.
95+
# This can help prevent visual glitches.
6496
player-hide-delay: 3
65-
#packet bundling size
97+
98+
# The number of packets to bundle together before sending.
99+
# Higher values can reduce network overhead but may increase perceived latency. 0 to disable.
66100
packet-bundling-size: 16
67-
#enable strict loading
68-
enable-strict-loading: false
101+
102+
# Enables strict loading mode. If true, the plugin will fail to load models with unsupported features.
103+
# If false, it will attempt to load them by ignoring unsupported parts, which may cause visual issues.
104+
enable-strict-loading: false

0 commit comments

Comments
 (0)