Skip to content

Commit 856d94a

Browse files
committed
feat: global texture (global_)
1 parent e317200 commit 856d94a

File tree

9 files changed

+11
-38
lines changed

9 files changed

+11
-38
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public boolean canBeRendered() {
7272
* @return pack name
7373
*/
7474
public @NotNull String packName(@NotNull String parent) {
75-
return PackUtil.toPackName(parent + "_" + name());
75+
return PackUtil.toPackName(name().startsWith("global_") ? name() : parent + "_" + name());
7676
}
7777

7878
/**

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ public record ModelTexture(
3636
* @return converted textures
3737
*/
3838
public @NotNull BlueprintTexture toBlueprint() {
39+
var nameIndex = name().indexOf('.');
3940
return new BlueprintTexture(
40-
name().split("\\.")[0],
41-
Base64.getDecoder().decode(source().split(",")[1]),
41+
nameIndex >= 0 ? name().substring(0, nameIndex) : name(),
42+
Base64.getDecoder().decode(source().substring(source().indexOf(',') + 1)),
4243
width(),
4344
height(),
4445
uvWidth(),

nms/v1_20_R4/src/main/kotlin/kr/toxicity/model/nms/v1_20_R4/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import net.minecraft.world.phys.AABB
4040
import net.minecraft.world.phys.Vec3
4141
import org.bukkit.Bukkit
4242
import org.bukkit.Color
43-
import org.bukkit.Location
4443
import org.bukkit.Particle
4544
import org.bukkit.craftbukkit.CraftServer
4645
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -71,10 +70,7 @@ internal class HitBoxImpl(
7170
private var onFly = false
7271

7372
val craftEntity: HitBox by lazy {
74-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
75-
override fun getLocation(): Location = interaction.bukkitEntity.location
76-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
77-
}
73+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
7874
}
7975
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8076
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R1/src/main/kotlin/kr/toxicity/model/nms/v1_21_R1/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import net.minecraft.world.phys.AABB
3939
import net.minecraft.world.phys.Vec3
4040
import org.bukkit.Bukkit
4141
import org.bukkit.Color
42-
import org.bukkit.Location
4342
import org.bukkit.Particle
4443
import org.bukkit.craftbukkit.CraftServer
4544
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -70,10 +69,7 @@ internal class HitBoxImpl(
7069
private var onFly = false
7170

7271
val craftEntity: HitBox by lazy {
73-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
74-
override fun getLocation(): Location = interaction.bukkitEntity.location
75-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
76-
}
72+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
7773
}
7874
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
7975
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R2/src/main/kotlin/kr/toxicity/model/nms/v1_21_R2/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import net.minecraft.world.phys.AABB
4141
import net.minecraft.world.phys.Vec3
4242
import org.bukkit.Bukkit
4343
import org.bukkit.Color
44-
import org.bukkit.Location
4544
import org.bukkit.Particle
4645
import org.bukkit.craftbukkit.CraftServer
4746
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -72,10 +71,7 @@ internal class HitBoxImpl(
7271
private var onFly = false
7372

7473
val craftEntity: HitBox by lazy {
75-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
76-
override fun getLocation(): Location = interaction.bukkitEntity.location
77-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
78-
}
74+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
7975
}
8076
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8177
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R3/src/main/kotlin/kr/toxicity/model/nms/v1_21_R3/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import net.minecraft.world.phys.AABB
4141
import net.minecraft.world.phys.Vec3
4242
import org.bukkit.Bukkit
4343
import org.bukkit.Color
44-
import org.bukkit.Location
4544
import org.bukkit.Particle
4645
import org.bukkit.craftbukkit.CraftServer
4746
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -73,10 +72,7 @@ internal class HitBoxImpl(
7372
private var onFly = false
7473

7574
val craftEntity: HitBox by lazy {
76-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
77-
override fun getLocation(): Location = interaction.bukkitEntity.location
78-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
79-
}
75+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
8076
}
8177
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8278
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R4/src/main/kotlin/kr/toxicity/model/nms/v1_21_R4/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import net.minecraft.world.phys.AABB
4141
import net.minecraft.world.phys.Vec3
4242
import org.bukkit.Bukkit
4343
import org.bukkit.Color
44-
import org.bukkit.Location
4544
import org.bukkit.Particle
4645
import org.bukkit.craftbukkit.CraftServer
4746
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -73,10 +72,7 @@ internal class HitBoxImpl(
7372
private var onFly = false
7473

7574
val craftEntity: HitBox by lazy {
76-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
77-
override fun getLocation(): Location = interaction.bukkitEntity.location
78-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
79-
}
75+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
8076
}
8177
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8278
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R5/src/main/kotlin/kr/toxicity/model/nms/v1_21_R5/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import net.minecraft.world.phys.AABB
4141
import net.minecraft.world.phys.Vec3
4242
import org.bukkit.Bukkit
4343
import org.bukkit.Color
44-
import org.bukkit.Location
4544
import org.bukkit.Particle
4645
import org.bukkit.craftbukkit.CraftServer
4746
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -73,10 +72,7 @@ internal class HitBoxImpl(
7372
private var onFly = false
7473

7574
val craftEntity: HitBox by lazy {
76-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
77-
override fun getLocation(): Location = interaction.bukkitEntity.location
78-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
79-
}
75+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
8076
}
8177
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8278
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

nms/v1_21_R6/src/main/kotlin/kr/toxicity/model/nms/v1_21_R6/HitBoxImpl.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import net.minecraft.world.phys.AABB
4141
import net.minecraft.world.phys.Vec3
4242
import org.bukkit.Bukkit
4343
import org.bukkit.Color
44-
import org.bukkit.Location
4544
import org.bukkit.Particle
4645
import org.bukkit.craftbukkit.CraftServer
4746
import org.bukkit.craftbukkit.entity.CraftArmorStand
@@ -73,10 +72,7 @@ internal class HitBoxImpl(
7372
private var onFly = false
7473

7574
val craftEntity: HitBox by lazy {
76-
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {
77-
override fun getLocation(): Location = interaction.bukkitEntity.location
78-
override fun getLocation(loc: Location?): Location? = interaction.bukkitEntity.getLocation(loc)
79-
}
75+
object : CraftArmorStand(Bukkit.getServer() as CraftServer, this), HitBox by this {}
8076
}
8177
private val _rotatedSource = FunctionUtil.throttleTick(Supplier {
8278
source.rotate(Quaterniond(bone.hitBoxViewRotation()))

0 commit comments

Comments
 (0)