Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
675d2b8508 | ||
|
|
edddd67f58 | ||
|
|
ed676e50c7 | ||
|
|
b36551a179 |
@@ -48,7 +48,7 @@ allprojects {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.willfp:eco:6.37.1'
|
compileOnly 'com.willfp:eco:6.37.1'
|
||||||
implementation 'com.willfp:libreforge:3.73.0'
|
implementation 'com.willfp:libreforge:3.74.0'
|
||||||
implementation 'org.joml:joml:1.10.4'
|
implementation 'org.joml:joml:1.10.4'
|
||||||
|
|
||||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||||
|
|||||||
@@ -4,34 +4,18 @@ import com.ticxo.modelengine.api.ModelEngineAPI
|
|||||||
import com.willfp.ecopets.pets.Pet
|
import com.willfp.ecopets.pets.Pet
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.entity.ArmorStand
|
import org.bukkit.entity.ArmorStand
|
||||||
import org.bukkit.entity.EntityType
|
|
||||||
import org.bukkit.inventory.EquipmentSlot
|
|
||||||
|
|
||||||
class ModelEnginePetEntity(
|
class ModelEnginePetEntity(
|
||||||
pet: Pet,
|
pet: Pet,
|
||||||
private val modelID: String
|
private val modelID: String
|
||||||
) : PetEntity(pet) {
|
) : PetEntity(pet) {
|
||||||
override fun spawn(location: Location): ArmorStand {
|
override fun spawn(location: Location): ArmorStand {
|
||||||
val stand = location.world!!.spawnEntity(location, EntityType.ARMOR_STAND) as ArmorStand
|
val stand = emptyArmorStandAt(location, pet)
|
||||||
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 model = ModelEngineAPI.createActiveModel(modelID)
|
val model = ModelEngineAPI.createActiveModel(modelID)
|
||||||
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
val modelled = ModelEngineAPI.createModeledEntity(stand)
|
||||||
modelled.addActiveModel(model)
|
modelled.addActiveModel(model)
|
||||||
|
|
||||||
stand.isCustomNameVisible = true
|
|
||||||
stand.customName = pet.name
|
|
||||||
|
|
||||||
return stand
|
return stand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.willfp.ecopets.pets.entity
|
|||||||
import com.willfp.ecopets.pets.Pet
|
import com.willfp.ecopets.pets.Pet
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.entity.ArmorStand
|
import org.bukkit.entity.ArmorStand
|
||||||
|
import org.bukkit.entity.EntityType
|
||||||
|
import org.bukkit.inventory.EquipmentSlot
|
||||||
|
|
||||||
abstract class PetEntity(
|
abstract class PetEntity(
|
||||||
val pet: Pet
|
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 com.willfp.ecopets.pets.Pet
|
||||||
import org.bukkit.Location
|
import org.bukkit.Location
|
||||||
import org.bukkit.entity.ArmorStand
|
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
|
import org.bukkit.inventory.ItemStack
|
||||||
|
|
||||||
class SkullPetEntity(pet: Pet) : PetEntity(pet) {
|
class SkullPetEntity(pet: Pet) : PetEntity(pet) {
|
||||||
override fun spawn(location: Location): ArmorStand {
|
override fun spawn(location: Location): ArmorStand {
|
||||||
val newStand = location.world!!.spawnEntity(location, EntityType.ARMOR_STAND) as ArmorStand
|
val stand = emptyArmorStandAt(location, pet)
|
||||||
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 skull: ItemStack = SkullBuilder()
|
val skull: ItemStack = SkullBuilder()
|
||||||
.setSkullTexture(pet.entityTexture)
|
.setSkullTexture(pet.entityTexture)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
newStand.equipment?.helmet = skull
|
stand.equipment?.helmet = skull
|
||||||
newStand.isCustomNameVisible = true
|
|
||||||
newStand.customName = pet.name
|
|
||||||
|
|
||||||
return newStand
|
return stand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Sat Jul 09 12:11:27 BST 2022
|
#Mon Jul 11 16:17:10 BST 2022
|
||||||
version=1.9.0
|
version=1.10.0
|
||||||
plugin-name=EcoPets
|
plugin-name=EcoPets
|
||||||
|
|||||||
Reference in New Issue
Block a user