All Downloads are FREE. Search and download functionalities are using the official Maven repository.

walkmc.nbt.EntityTag.kt Maven / Gradle / Ivy

package walkmc.nbt

import net.minecraft.server.*
import org.bukkit.entity.Entity
import walkmc.extensions.*

/**
 * Represents a entity tag object. All edited tags will be inserted
 * in the [model] after calling the function [inject]
 */
class EntityTag(val model: Entity) : AbstractTag() {
   
   /**
    * Returns if this entity tag object is silent.
    */
   inline var isSilent: Boolean
      get() = getBoolean("Silent")
      set(value) = setBoolean("Silent", value)
   
   /**
    * Returns if this entity tag object is persistent.
    */
   inline var isPersistent: Boolean
      get() = getBoolean("PersistenceRequired")
      set(value) = setBoolean("PersistenceRequired", value)
   
   /**
    * Returns if this entity tag object is invulnerable.
    */
   inline var isInvulnerable: Boolean
      get() = getBoolean("Invulnerable")
      set(value) = setBoolean("Invulnerable", value)
   
   /**
    * Returns if this entity tag object has artificial intelligence.
    */
   inline var hasAI: Boolean
      get() = !getBoolean("NoAI")
      set(value) = setBoolean("NoAI", !value)
   
   init {
      val tag = NBTTagCompound()
      model.handler.e(tag)
      a(tag)
   }
   
   override fun inject() {
      model.handler.f(this)
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy