Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
675d2b8508 | ||
|
|
edddd67f58 | ||
|
|
ed676e50c7 | ||
|
|
b36551a179 | ||
|
|
053f22258a |
@@ -48,7 +48,7 @@ allprojects {
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.37.1'
|
||||
implementation 'com.willfp:libreforge:3.72.1'
|
||||
implementation 'com.willfp:libreforge:3.74.0'
|
||||
implementation 'org.joml:joml:1.10.4'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||
|
||||
@@ -4,34 +4,18 @@ import com.ticxo.modelengine.api.ModelEngineAPI
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
import org.bukkit.entity.EntityType
|
||||
import org.bukkit.inventory.EquipmentSlot
|
||||
|
||||
class ModelEnginePetEntity(
|
||||
pet: Pet,
|
||||
private val modelID: String
|
||||
) : PetEntity(pet) {
|
||||
override fun spawn(location: Location): ArmorStand {
|
||||
val stand = location.world!!.spawnEntity(location, EntityType.ARMOR_STAND) as ArmorStand
|
||||
stand.isVisible = false
|
||||
stand.isInvulnerable = true
|
||||
stand.isPersistent = true
|
||||
stand.removeWhenFarAway = false
|
||||
stand.isSmall = true
|
||||
stand.setGravity(false)
|
||||
stand.isCollidable = false
|
||||
|
||||
for (slot in EquipmentSlot.values()) {
|
||||
stand.addEquipmentLock(slot, ArmorStand.LockType.ADDING_OR_CHANGING)
|
||||
}
|
||||
val stand = emptyArmorStandAt(location, pet)
|
||||
|
||||
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
||||
modelled.addActiveModel(model)
|
||||
|
||||
stand.isCustomNameVisible = true
|
||||
stand.customName = pet.name
|
||||
|
||||
return stand
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.willfp.ecopets.pets.entity
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
import org.bukkit.entity.EntityType
|
||||
import org.bukkit.inventory.EquipmentSlot
|
||||
|
||||
abstract class PetEntity(
|
||||
val pet: Pet
|
||||
@@ -31,3 +33,23 @@ abstract class PetEntity(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun emptyArmorStandAt(location: Location, pet: Pet): ArmorStand {
|
||||
val stand = location.world!!.spawnEntity(location, EntityType.ARMOR_STAND) as ArmorStand
|
||||
|
||||
stand.isVisible = false
|
||||
stand.isInvulnerable = true
|
||||
stand.isSmall = true
|
||||
stand.setGravity(false)
|
||||
stand.isCollidable = false
|
||||
stand.isPersistent = false
|
||||
|
||||
for (slot in EquipmentSlot.values()) {
|
||||
stand.addEquipmentLock(slot, ArmorStand.LockType.ADDING_OR_CHANGING)
|
||||
}
|
||||
|
||||
stand.isCustomNameVisible = true
|
||||
stand.customName = pet.name
|
||||
|
||||
return stand
|
||||
}
|
||||
|
||||
@@ -4,35 +4,18 @@ import com.willfp.eco.core.items.builder.SkullBuilder
|
||||
import com.willfp.ecopets.pets.Pet
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.entity.ArmorStand
|
||||
import org.bukkit.entity.Entity
|
||||
import org.bukkit.entity.EntityType
|
||||
import org.bukkit.inventory.EquipmentSlot
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class SkullPetEntity(pet: Pet) : PetEntity(pet) {
|
||||
override fun spawn(location: Location): ArmorStand {
|
||||
val newStand = location.world!!.spawnEntity(location, EntityType.ARMOR_STAND) as ArmorStand
|
||||
newStand.isVisible = false
|
||||
newStand.isInvulnerable = true
|
||||
newStand.isPersistent = true
|
||||
newStand.removeWhenFarAway = false
|
||||
newStand.isSmall = true
|
||||
newStand.setGravity(false)
|
||||
newStand.isCollidable = false
|
||||
|
||||
for (slot in EquipmentSlot.values()) {
|
||||
newStand.addEquipmentLock(slot, ArmorStand.LockType.ADDING_OR_CHANGING)
|
||||
}
|
||||
|
||||
val stand = emptyArmorStandAt(location, pet)
|
||||
|
||||
val skull: ItemStack = SkullBuilder()
|
||||
.setSkullTexture(pet.entityTexture)
|
||||
.build()
|
||||
|
||||
newStand.equipment?.helmet = skull
|
||||
newStand.isCustomNameVisible = true
|
||||
newStand.customName = pet.name
|
||||
stand.equipment?.helmet = skull
|
||||
|
||||
return newStand
|
||||
return stand
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#libreforge-updater
|
||||
#Tue Jul 05 18:33:01 BST 2022
|
||||
version=1.8.1
|
||||
#Mon Jul 11 16:17:10 BST 2022
|
||||
version=1.10.0
|
||||
plugin-name=EcoPets
|
||||
|
||||
Reference in New Issue
Block a user