mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 06:36:25 -04:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
642ad77228 |
@@ -57,6 +57,7 @@ class NPCClass {
|
||||
var isMovable: Boolean = true
|
||||
var isInvulnerable = false
|
||||
var isLeashable = true
|
||||
var visibilityCondition = true
|
||||
var allowProjectileHits = true
|
||||
var hideNameTag = false
|
||||
|
||||
@@ -98,6 +99,7 @@ class NPCClass {
|
||||
buffer.writeBoolean(isMovable)
|
||||
buffer.writeBoolean(isInvulnerable)
|
||||
buffer.writeBoolean(isLeashable)
|
||||
buffer.writeBoolean(visibilityCondition)
|
||||
buffer.writeBoolean(allowProjectileHits)
|
||||
buffer.writeBoolean(hideNameTag)
|
||||
}
|
||||
@@ -150,6 +152,7 @@ class NPCClass {
|
||||
isMovable = buffer.readBoolean()
|
||||
isInvulnerable = buffer.readBoolean()
|
||||
isLeashable = buffer.readBoolean()
|
||||
visibilityCondition = buffer.readBoolean()
|
||||
allowProjectileHits = buffer.readBoolean()
|
||||
hideNameTag = buffer.readBoolean()
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class NPCPreset {
|
||||
var isMovable: Boolean? = null
|
||||
var isInvulnerable: Boolean? = null
|
||||
var isLeashable: Boolean? = null
|
||||
var visibilityCondition: Boolean? = null
|
||||
var allowProjectileHits: Boolean? = null
|
||||
var hideNameTag: Boolean? = null
|
||||
|
||||
@@ -63,6 +64,7 @@ class NPCPreset {
|
||||
isMovable?.let { npcClass.isMovable = it }
|
||||
isInvulnerable?.let { npcClass.isInvulnerable = it }
|
||||
isLeashable?.let { npcClass.isLeashable = it }
|
||||
visibilityCondition?.let { npcClass.visibilityCondition = it }
|
||||
allowProjectileHits?.let { npcClass.allowProjectileHits = it }
|
||||
hideNameTag?.let { npcClass.hideNameTag = it }
|
||||
}
|
||||
|
||||
@@ -421,6 +421,10 @@ class NPCEntity(world: Level) : AgeableMob(CobblemonEntities.NPC, world), Npc, P
|
||||
val hide = value.map["hide"] as? DoubleValue
|
||||
return hide?.asDouble() == 1.0
|
||||
}
|
||||
val conditionValue = npc.visibilityCondition
|
||||
if (!conditionValue) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ object NPCClassAdapter : JsonDeserializer<NPCClass> {
|
||||
obj.get("isMovable")?.let { npcClass.isMovable = it.asBoolean }
|
||||
obj.get("isInvulnerable")?.let { npcClass.isInvulnerable = it.asBoolean }
|
||||
obj.get("isLeashable")?.let { npcClass.isLeashable = it.asBoolean }
|
||||
obj.get("visibilityCondition")?.let { npcClass.visibilityCondition = it.asBoolean }
|
||||
obj.get("allowProjectileHits")?.let { npcClass.allowProjectileHits = it.asBoolean }
|
||||
obj.get("hideNameTag")?.let { npcClass.hideNameTag = it.asBoolean }
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"cobblemon:battler_test"
|
||||
],
|
||||
"canDespawn": false,
|
||||
"visibilityCondition": "q.player.is_creative()",
|
||||
"ai": [
|
||||
{
|
||||
"type": "apply_behaviours",
|
||||
|
||||
Reference in New Issue
Block a user