mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 15:39:31 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e332bf845 | ||
|
|
7cec9f3e30 | ||
|
|
7db3af5dca |
@@ -41,7 +41,7 @@ allprojects {
|
|||||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
||||||
|
|
||||||
implementation("com.willfp:libreforge:3.106.0'
|
implementation("com.willfp:libreforge:3.107.0")
|
||||||
implementation("org.joml:joml:1.10.4")
|
implementation("org.joml:joml:1.10.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.willfp.eco.core.config.ConfigType
|
|||||||
import com.willfp.eco.core.config.TransientConfig
|
import com.willfp.eco.core.config.TransientConfig
|
||||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin
|
import com.willfp.ecobosses.EcoBossesPlugin
|
||||||
|
import com.willfp.libreforge.separatorAmbivalent
|
||||||
import org.bukkit.entity.Entity
|
import org.bukkit.entity.Entity
|
||||||
import org.bukkit.entity.LivingEntity
|
import org.bukkit.entity.LivingEntity
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -56,7 +57,8 @@ object Bosses {
|
|||||||
val ecoBossesYml = TransientConfig(File(plugin.dataFolder, "ecobosses.yml"), ConfigType.YAML)
|
val ecoBossesYml = TransientConfig(File(plugin.dataFolder, "ecobosses.yml"), ConfigType.YAML)
|
||||||
|
|
||||||
for (bossConfig in ecoBossesYml.getSubsections("bosses")) {
|
for (bossConfig in ecoBossesYml.getSubsections("bosses")) {
|
||||||
addNewBoss(EcoBoss(bossConfig.getString("id"), bossConfig, plugin))
|
// Boss configs are separator ambivalent in order to preserve backwards compatibility
|
||||||
|
addNewBoss(EcoBoss(bossConfig.getString("id"), bossConfig.separatorAmbivalent(), plugin))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,15 @@ import org.bukkit.entity.Mob
|
|||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
import java.util.*
|
import java.util.Objects
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
class EcoBoss(
|
class EcoBoss(
|
||||||
override val id: String,
|
override val id: String,
|
||||||
val config: Config,
|
val config: Config,
|
||||||
private val plugin: EcoPlugin
|
private val plugin: EcoPlugin
|
||||||
) : Holder {
|
) : Holder {
|
||||||
val displayName: String = config.getString("displayName")
|
val displayName: String = config.getString("display-name")
|
||||||
|
|
||||||
val lifespan = config.getInt("lifespan")
|
val lifespan = config.getInt("lifespan")
|
||||||
|
|
||||||
@@ -66,23 +67,23 @@ class EcoBoss(
|
|||||||
|
|
||||||
val targetMode = TargetMode.getByID(config.getString("target.mode"))!!
|
val targetMode = TargetMode.getByID(config.getString("target.mode"))!!
|
||||||
|
|
||||||
val isBossBarEnabled = config.getBool("bossBar.enabled")
|
val isBossBarEnabled = config.getBool("boss-bar.enabled")
|
||||||
|
|
||||||
val bossBarRadius = config.getDouble("bossBar.radius")
|
val bossBarRadius = config.getDouble("boss-bar.radius")
|
||||||
|
|
||||||
val isPreventingMounts = config.getBool("defence.preventMounts")
|
val isPreventingMounts = config.getBool("defence.prevent-mounts")
|
||||||
|
|
||||||
val isImmuneToExplosions = config.getBool("defence.explosionImmune")
|
val isImmuneToExplosions = config.getBool("defence.explosion-immune")
|
||||||
|
|
||||||
val isImmuneToFire = config.getBool("defence.fireImmune")
|
val isImmuneToFire = config.getBool("defence.fire-immune")
|
||||||
|
|
||||||
val isImmuneToDrowning = config.getBool("defence.drowningImmune")
|
val isImmuneToDrowning = config.getBool("defence.drowning-immune")
|
||||||
|
|
||||||
val isImmuneToSuffocation = config.getBool("defence.suffocationImmune")
|
val isImmuneToSuffocation = config.getBool("defence.suffocation-immune")
|
||||||
|
|
||||||
val meleeDamageMultiplier = config.getDouble("defence.meleeDamageMultiplier")
|
val meleeDamageMultiplier = config.getDouble("defence.melee-damage-multiplier")
|
||||||
|
|
||||||
val projectileDamageMultiplier = config.getDouble("defence.projectileDamageMultiplier")
|
val projectileDamageMultiplier = config.getDouble("defence.projectile-damage-multiplier")
|
||||||
|
|
||||||
val canTeleport = config.getBool("defence.teleportation.enabled")
|
val canTeleport = config.getBool("defence.teleportation.enabled")
|
||||||
|
|
||||||
@@ -175,16 +176,16 @@ class EcoBoss(
|
|||||||
locations
|
locations
|
||||||
}
|
}
|
||||||
|
|
||||||
val hasCustomAI = config.getBool("customai.enabled")
|
val hasCustomAI = config.getBool("custom-ai.enabled")
|
||||||
|
|
||||||
val targetGoals = config.getSubsections("customai.target-goals").mapNotNull {
|
val targetGoals = config.getSubsections("custom-ai.target-goals").mapNotNull {
|
||||||
val key = NamespacedKeyUtils.fromStringOrNull(it.getString("key")) ?: return@mapNotNull null
|
val key = NamespacedKeyUtils.fromStringOrNull(it.getString("key")) ?: return@mapNotNull null
|
||||||
val deserializer = TargetGoals.getByKey(key) ?: return@mapNotNull null
|
val deserializer = TargetGoals.getByKey(key) ?: return@mapNotNull null
|
||||||
val goal = deserializer.deserialize(it.getSubsection("args")) ?: return@mapNotNull null
|
val goal = deserializer.deserialize(it.getSubsection("args")) ?: return@mapNotNull null
|
||||||
ConfiguredGoal(it.getInt("priority"), goal)
|
ConfiguredGoal(it.getInt("priority"), goal)
|
||||||
}
|
}
|
||||||
|
|
||||||
val entityGoals = config.getSubsections("customai.ai-goals").mapNotNull {
|
val entityGoals = config.getSubsections("custom-ai.ai-goals").mapNotNull {
|
||||||
val key = NamespacedKeyUtils.fromStringOrNull(it.getString("key")) ?: return@mapNotNull null
|
val key = NamespacedKeyUtils.fromStringOrNull(it.getString("key")) ?: return@mapNotNull null
|
||||||
val deserializer = EntityGoals.getByKey(key) ?: return@mapNotNull null
|
val deserializer = EntityGoals.getByKey(key) ?: return@mapNotNull null
|
||||||
val goal = deserializer.deserialize(it.getSubsection("args")) ?: return@mapNotNull null
|
val goal = deserializer.deserialize(it.getSubsection("args")) ?: return@mapNotNull null
|
||||||
@@ -195,9 +196,9 @@ class EcoBoss(
|
|||||||
Conditions.compile(it, "$id Spawn Conditions")
|
Conditions.compile(it, "$id Spawn Conditions")
|
||||||
}
|
}
|
||||||
|
|
||||||
private val bossBarColor = BossBar.Color.valueOf(config.getString("bossBar.color").uppercase())
|
private val bossBarColor = BossBar.Color.valueOf(config.getString("boss-bar.color").uppercase())
|
||||||
|
|
||||||
private val bossBarStyle = BossBar.Overlay.valueOf(config.getString("bossBar.style").uppercase())
|
private val bossBarStyle = BossBar.Overlay.valueOf(config.getString("boss-bar.style").uppercase())
|
||||||
|
|
||||||
private val sounds: Map<BossLifecycle, PlayableSound> = run {
|
private val sounds: Map<BossLifecycle, PlayableSound> = run {
|
||||||
val map = mutableMapOf<BossLifecycle, PlayableSound>()
|
val map = mutableMapOf<BossLifecycle, PlayableSound>()
|
||||||
@@ -238,10 +239,10 @@ class EcoBoss(
|
|||||||
private val commandRewards: Map<Int, Iterable<CommandReward>> = run {
|
private val commandRewards: Map<Int, Iterable<CommandReward>> = run {
|
||||||
val map = mutableMapOf<Int, Iterable<CommandReward>>()
|
val map = mutableMapOf<Int, Iterable<CommandReward>>()
|
||||||
|
|
||||||
for (rank in config.getSubsection("rewards.topDamagerCommands").getKeys(false)) {
|
for (rank in config.getSubsection("rewards.top-damager-commands").getKeys(false)) {
|
||||||
val rankRewards = mutableListOf<CommandReward>()
|
val rankRewards = mutableListOf<CommandReward>()
|
||||||
|
|
||||||
for (config in config.getSubsections("rewards.topDamagerCommands.$rank")) {
|
for (config in config.getSubsections("rewards.top-damager-commands.$rank")) {
|
||||||
rankRewards.add(
|
rankRewards.add(
|
||||||
CommandReward(
|
CommandReward(
|
||||||
config.getDouble("chance"),
|
config.getDouble("chance"),
|
||||||
@@ -256,12 +257,12 @@ class EcoBoss(
|
|||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
private val nearbyCommandRewardRadius = config.getDouble("rewards.nearbyPlayerCommands.radius")
|
private val nearbyCommandRewardRadius = config.getDouble("rewards.nearby-player-commands.radius")
|
||||||
|
|
||||||
private val nearbyCommands: Iterable<CommandReward> = run {
|
private val nearbyCommands: Iterable<CommandReward> = run {
|
||||||
val list = mutableListOf<CommandReward>()
|
val list = mutableListOf<CommandReward>()
|
||||||
|
|
||||||
for (config in config.getSubsections("rewards.nearbyPlayerCommands.commands")) {
|
for (config in config.getSubsections("rewards.nearby-player-commands.commands")) {
|
||||||
list.add(
|
list.add(
|
||||||
CommandReward(
|
CommandReward(
|
||||||
config.getDouble("chance"),
|
config.getDouble("chance"),
|
||||||
@@ -298,7 +299,9 @@ class EcoBoss(
|
|||||||
|
|
||||||
private val mob: TestableEntity = Entities.lookup(config.getString("mob"))
|
private val mob: TestableEntity = Entities.lookup(config.getString("mob"))
|
||||||
|
|
||||||
private val modelEngineID = config.getStringOrNull("modelEngineID")
|
private val modelEngineID = config.getStringOrNull("model-engine-id")
|
||||||
|
|
||||||
|
private val modelEngineAnimation = config.getStringOrNull("model-engine-animation")
|
||||||
|
|
||||||
private val currentlyAlive = mutableMapOf<UUID, LivingEcoBoss>()
|
private val currentlyAlive = mutableMapOf<UUID, LivingEcoBoss>()
|
||||||
|
|
||||||
@@ -346,13 +349,30 @@ class EcoBoss(
|
|||||||
entityGoals.forEach { controller.addEntityGoal(it.priority, it.goal as EntityGoal<in Mob>) }
|
entityGoals.forEach { controller.addEntityGoal(it.priority, it.goal as EntityGoal<in Mob>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelEngineID != null && Bukkit.getPluginManager().isPluginEnabled("modelEngine")) {
|
if (modelEngineID != null && Bukkit.getPluginManager().isPluginEnabled("ModelEngine")) {
|
||||||
val model = ModelEngineAPI.createActiveModel(modelEngineID)
|
val model = ModelEngineAPI.createActiveModel(modelEngineID)
|
||||||
|
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
plugin.logger.warning("Invalid Model Engine ID for boss $id")
|
plugin.logger.warning("Invalid Model Engine ID for boss $id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modelEngineAnimation != null) {
|
||||||
|
val animationHandler = model.animationHandler
|
||||||
|
val animationProperty = animationHandler.getAnimation(modelEngineAnimation)
|
||||||
|
|
||||||
|
if (animationProperty != null) {
|
||||||
|
animationHandler.playAnimation(animationProperty, true)
|
||||||
|
} else {
|
||||||
|
plugin.logger.warning("Animation $modelEngineAnimation not found in model $modelEngineID, defaulting to walk!")
|
||||||
|
val animationPropertyWalk = animationHandler.getAnimation("walk")
|
||||||
|
if (animationPropertyWalk != null) {
|
||||||
|
animationHandler.playAnimation(animationPropertyWalk, true)
|
||||||
|
} else {
|
||||||
|
plugin.logger.warning("Walk animation not found in $modelEngineID!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val modelled = ModelEngineAPI.createModeledEntity(mob)
|
val modelled = ModelEngineAPI.createModeledEntity(mob)
|
||||||
modelled.addModel(model, true)
|
modelled.addModel(model, true)
|
||||||
modelled.isBaseEntityVisible = false
|
modelled.isBaseEntityVisible = false
|
||||||
|
|||||||
@@ -9,14 +9,14 @@
|
|||||||
mob: iron_golem attack-damage:90 movement-speed:1.5 follow-range:16 health:1200
|
mob: iron_golem attack-damage:90 movement-speed:1.5 follow-range:16 health:1200
|
||||||
|
|
||||||
# If you're using model engine, you can specify the ID here
|
# If you're using model engine, you can specify the ID here
|
||||||
modelEngineID: ""
|
model-engine-id: ""
|
||||||
|
|
||||||
# Supported placeholders: %health%, %time% (formats as minutes:seconds, eg 1:56)
|
# Supported placeholders: %health%, %time% (formats as minutes:seconds, eg 1:56)
|
||||||
displayName: "&8Steel Golem &7| &c%health%♥ &7| &e%time%"
|
display-name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%"
|
||||||
|
|
||||||
influence: 40 # The distance at which effects will be applied to players
|
influence: 40 # The distance at which effects will be applied to players
|
||||||
|
|
||||||
customai: # Custom mob AI using the entity goal system.
|
custom-ai: # Custom mob AI using the entity goal system.
|
||||||
enabled: false # If custom AI should be enabled, this will override the vanilla mob behaviour.
|
enabled: false # If custom AI should be enabled, this will override the vanilla mob behaviour.
|
||||||
target-goals: [ ] # How the boss decides who to attack, if the target mode isn't being used.
|
target-goals: [ ] # How the boss decides who to attack, if the target mode isn't being used.
|
||||||
ai-goals: [ ] # How the boss should behave.
|
ai-goals: [ ] # How the boss should behave.
|
||||||
@@ -35,14 +35,14 @@ conditions: [ ] # Conditions to apply effects to players; useful if you don't wa
|
|||||||
lifespan: 120 # The lifespan of the boss before it despawns, in seconds. Set to a massive number to disable.
|
lifespan: 120 # The lifespan of the boss before it despawns, in seconds. Set to a massive number to disable.
|
||||||
|
|
||||||
defence:
|
defence:
|
||||||
preventMounts: true # If the boss shouldn't be able to get into boats, minecarts, etc
|
prevent-mounts: true # If the boss shouldn't be able to get into boats, minecarts, etc
|
||||||
explosionImmune: true # If the boss should be immune to explosions
|
explosion-immune: true # If the boss should be immune to explosions
|
||||||
fireImmune: true # If the boss should be immune to fire damage
|
fire-immune: true # If the boss should be immune to fire damage
|
||||||
drowningImmune: true # If the boss should be immune to drowning damage
|
drowning-immune: true # If the boss should be immune to drowning damage
|
||||||
suffocationImmune: true # If the boss should be immune to suffocation
|
suffocation-immune: true # If the boss should be immune to suffocation
|
||||||
|
|
||||||
meleeDamageMultiplier: 0.8 # Incoming melee damage will be multiplied by this value. Set to 0 to render immune against melee
|
melee-damage-multiplier: 0.8 # Incoming melee damage will be multiplied by this value. Set to 0 to render immune against melee
|
||||||
projectileDamageMultiplier: 0.2 # Same as melee multiplier, but for projectiles
|
projectile-damage-multiplier: 0.2 # Same as melee multiplier, but for projectiles
|
||||||
|
|
||||||
teleportation: # Teleport every x ticks in order to avoid being caged in obsidian or similar
|
teleportation: # Teleport every x ticks in order to avoid being caged in obsidian or similar
|
||||||
enabled: true # If the boss should teleport
|
enabled: true # If the boss should teleport
|
||||||
@@ -54,7 +54,7 @@ rewards:
|
|||||||
minimum: 30000
|
minimum: 30000
|
||||||
maximum: 60000
|
maximum: 60000
|
||||||
|
|
||||||
topDamagerCommands:
|
top-damager-commands:
|
||||||
# You can specify as many ranks as you want (adding 4, 5, etc)
|
# You can specify as many ranks as you want (adding 4, 5, etc)
|
||||||
# You can use %player% as a placeholder for the player name
|
# You can use %player% as a placeholder for the player name
|
||||||
1:
|
1:
|
||||||
@@ -64,7 +64,7 @@ rewards:
|
|||||||
2: [ ]
|
2: [ ]
|
||||||
3: [ ]
|
3: [ ]
|
||||||
|
|
||||||
nearbyPlayerCommands:
|
nearby-player-commands:
|
||||||
# Commands to be executed for all players near the boss death location
|
# Commands to be executed for all players near the boss death location
|
||||||
radius: 10
|
radius: 10
|
||||||
# Uses the same syntax as top damager commands (chance and a list of commands, can use %player%)
|
# Uses the same syntax as top damager commands (chance and a list of commands, can use %player%)
|
||||||
@@ -83,7 +83,7 @@ target:
|
|||||||
# The distance to scan for players
|
# The distance to scan for players
|
||||||
range: 40
|
range: 40
|
||||||
|
|
||||||
bossBar:
|
boss-bar:
|
||||||
# If the boss should have a boss bar
|
# If the boss should have a boss bar
|
||||||
enabled: true
|
enabled: true
|
||||||
color: white # Options: blue, green, pink, purple, red, white, yellow
|
color: white # Options: blue, green, pink, purple, red, white, yellow
|
||||||
@@ -108,7 +108,7 @@ spawn:
|
|||||||
top: netherite_block
|
top: netherite_block
|
||||||
middle: iron_block
|
middle: iron_block
|
||||||
bottom: magma_block
|
bottom: magma_block
|
||||||
notInWorlds: [ ] # If spawn totems should be disallowed in certain worlds, specify them here
|
not-in-worlds: [ ] # If spawn totems should be disallowed in certain worlds, specify them here
|
||||||
egg:
|
egg:
|
||||||
enabled: true # If the boss should have a spawn egg
|
enabled: true # If the boss should have a spawn egg
|
||||||
item: evoker_spawn_egg unbreaking:1 hide_enchants
|
item: evoker_spawn_egg unbreaking:1 hide_enchants
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Wed Sep 28 17:53:14 BST 2022
|
#Sun Oct 02 14:58:47 BST 2022
|
||||||
version=8.92.0
|
version=8.93.0
|
||||||
plugin-name=EcoBosses
|
plugin-name=EcoBosses
|
||||||
|
|||||||
Reference in New Issue
Block a user