From b35add9effb340a526ad6d054ba5a0dddf6f4c7f Mon Sep 17 00:00:00 2001 From: Boy Date: Sat, 21 Oct 2023 13:39:56 +0200 Subject: [PATCH] 1.20.2 --- gradle.properties | 4 ++-- gradle/myLibs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../com/mineinabyss/mobzy/MobzyConfig.kt | 1 - .../bindings/goals/MeleeAttackBehavior.kt | 4 ++-- .../bindings/goals/TemptBehavior.kt | 2 +- .../mobzy/spawning/MobzySpawning.kt | 6 +----- .../mineinabyss/mobzy/spawning/SpawnConfig.kt | 18 ++++++++++++------ .../com/mineinabyss/mobzy/MobzyPlugin.kt | 16 +++++++++------- src/main/resources/config.yml | 14 -------------- src/main/resources/spawning.yml | 10 ---------- 11 files changed, 29 insertions(+), 50 deletions(-) delete mode 100644 src/main/resources/config.yml delete mode 100644 src/main/resources/spawning.yml diff --git a/gradle.properties b/gradle.properties index 34ece6fa9..881af04e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group=com.mineinabyss -version=0.21 -idofrontVersion=0.18.27 +version=0.22 +idofrontVersion=0.19.14 diff --git a/gradle/myLibs.versions.toml b/gradle/myLibs.versions.toml index aae56ae66..1f91156d8 100644 --- a/gradle/myLibs.versions.toml +++ b/gradle/myLibs.versions.toml @@ -1,5 +1,5 @@ [versions] -gearyPaper = "0.25-SNAPSHOT" +gearyPaper = "0.26.0" [libraries] geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c24e7330c..15bc9344b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mobzy-core/src/main/kotlin/com/mineinabyss/mobzy/MobzyConfig.kt b/mobzy-core/src/main/kotlin/com/mineinabyss/mobzy/MobzyConfig.kt index c0014e333..258f2dc02 100644 --- a/mobzy-core/src/main/kotlin/com/mineinabyss/mobzy/MobzyConfig.kt +++ b/mobzy-core/src/main/kotlin/com/mineinabyss/mobzy/MobzyConfig.kt @@ -9,6 +9,5 @@ import kotlinx.serialization.Serializable @Serializable class MobzyConfig( val debug: Boolean = false, - val supportNonMEEntities: Boolean = false, val doMobSpawns: Boolean = false, ) diff --git a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/MeleeAttackBehavior.kt b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/MeleeAttackBehavior.kt index 04dd7a73d..fe49cd91a 100644 --- a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/MeleeAttackBehavior.kt +++ b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/MeleeAttackBehavior.kt @@ -22,10 +22,10 @@ class MeleeAttackBehavior( inner class MeleeAttackGoal( private val entity: Mob ) : NMSMeleeAttackGoal(entity.toNMS(), attackSpeed, seeThroughWalls) { - override fun checkAndPerformAttack(target: LivingEntity, squaredDistance: Double) { + override fun checkAndPerformAttack(target: LivingEntity/*, squaredDistance: Double*/) { val width = mob.bbWidth val d = (1 + width) * (1 + width) + target.bbWidth - if (squaredDistance <= d && ticksUntilNextAttack <= 0) { + if (/*squaredDistance <= d && */ticksUntilNextAttack <= 0) { entity.playAnimation("attack", 0.0, 0.0, 1.0, false) resetAttackCooldown() mob.doHurtTarget(target) diff --git a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/TemptBehavior.kt b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/TemptBehavior.kt index 5d947a6c8..a83b7ddcb 100644 --- a/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/TemptBehavior.kt +++ b/mobzy-pathfinding/src/main/kotlin/com/mineinabyss/mobzy/pathfinding/bindings/goals/TemptBehavior.kt @@ -8,7 +8,7 @@ import kotlinx.serialization.Serializable import net.minecraft.world.entity.PathfinderMob import net.minecraft.world.entity.ai.goal.TemptGoal import net.minecraft.world.item.crafting.Ingredient -import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack +import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack import org.bukkit.entity.Mob import org.bukkit.inventory.ItemStack diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobzySpawning.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobzySpawning.kt index 9ce6ea424..70106cf7c 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobzySpawning.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/MobzySpawning.kt @@ -5,10 +5,8 @@ import com.mineinabyss.geary.addons.dsl.GearyAddonWithDefault import com.mineinabyss.geary.modules.geary import com.mineinabyss.idofront.config.config import com.mineinabyss.idofront.di.DI -import com.mineinabyss.idofront.plugin.Plugins import com.mineinabyss.idofront.plugin.actions import com.mineinabyss.mobzy.mobzy -import com.sk89q.worldguard.bukkit.WorldGuardPlugin val mobzySpawning by DI.observe() @@ -22,9 +20,7 @@ interface MobzySpawning { override fun default() = object : MobzySpawning { override val spawnTask = SpawnTask() override val spawnRegistry = SpawnRegistry() - override val config: SpawnConfig by config("spawning") { - mobzy.plugin.fromPluginPath(loadDefault = true) - } + override val config: SpawnConfig by config("spawning", mobzy.plugin.dataFolder.toPath(), SpawnConfig()) override val worldGuardFlags: WorldGuardSpawnFlags = DI.get() } diff --git a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnConfig.kt b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnConfig.kt index d486b1ff6..51f3e8d40 100644 --- a/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnConfig.kt +++ b/mobzy-spawning/src/main/kotlin/com/mineinabyss/mobzy/spawning/SpawnConfig.kt @@ -2,6 +2,7 @@ package com.mineinabyss.mobzy.spawning import com.mineinabyss.idofront.serialization.DurationSerializer import com.mineinabyss.idofront.serialization.IntRangeSerializer +import com.mineinabyss.idofront.time.ticks import kotlinx.serialization.Serializable import org.bukkit.entity.SpawnCategory import kotlin.time.Duration @@ -17,13 +18,18 @@ import kotlin.time.Duration @Serializable class SpawnConfig( @Serializable(with = IntRangeSerializer::class) - val chunkSpawnRad: IntRange, - val maxCommandSpawns: Int, - val playerGroupRadius: Double, + val chunkSpawnRad: IntRange = 2..4, + val maxCommandSpawns: Int = 20, + val playerGroupRadius: Double = 96.0, @Serializable(with = DurationSerializer::class) - val spawnTaskDelay: Duration, - val creatureTypeCaps: MutableMap = mutableMapOf(), - val spawnHeightRange: Int, + val spawnTaskDelay: Duration = 40.ticks, + val creatureTypeCaps: MutableMap = mutableMapOf( + SpawnCategory.ANIMAL to 60, + SpawnCategory.MONSTER to 55, + SpawnCategory.WATER_ANIMAL to 30, + SpawnCategory.AMBIENT to 0 + ), + val spawnHeightRange: Int = 40, ) { /** @return The spawn cap for that mob in config. */ fun getCreatureTypeCap(creatureType: SpawnCategory): Int = creatureTypeCaps[creatureType] ?: 0 diff --git a/src/main/kotlin/com/mineinabyss/mobzy/MobzyPlugin.kt b/src/main/kotlin/com/mineinabyss/mobzy/MobzyPlugin.kt index 3f3321ab1..14424ef81 100644 --- a/src/main/kotlin/com/mineinabyss/mobzy/MobzyPlugin.kt +++ b/src/main/kotlin/com/mineinabyss/mobzy/MobzyPlugin.kt @@ -39,13 +39,7 @@ class MobzyPlugin : JavaPlugin() { } override fun onEnable() = actions { - DI.add(object : MobzyModule { - override val plugin: MobzyPlugin = this@MobzyPlugin - override val config: MobzyConfig by config("config") { - fromPluginPath(loadDefault = true) - } - }) - + createMobzyContext() MobzyCommands() geary { @@ -80,4 +74,12 @@ class MobzyPlugin : JavaPlugin() { CopyNBTSystem(), ) } + + fun createMobzyContext() { + DI.remove() + DI.add(object : MobzyModule { + override val plugin: MobzyPlugin = this@MobzyPlugin + override val config: MobzyConfig by config("config", dataFolder.toPath(), MobzyConfig()) + }) + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml deleted file mode 100644 index 843e894b3..000000000 --- a/src/main/resources/config.yml +++ /dev/null @@ -1,14 +0,0 @@ -# Send debug messages -debug: false -doMobSpawns: false -chunkSpawnRad: 3..6 -maxCommandSpawns: 50 -spawnTaskDelay: 100t -creatureTypeCaps: - CREATURE: 20 - MONSTER: 20 - WATER_CREATURE: 5 - MISC: 5 - AMBIENT: 0 -playerGroupRadius: 128.0 -spawnHeightRange: 150 diff --git a/src/main/resources/spawning.yml b/src/main/resources/spawning.yml deleted file mode 100644 index 28ddcdc7b..000000000 --- a/src/main/resources/spawning.yml +++ /dev/null @@ -1,10 +0,0 @@ -chunkSpawnRad: 2..4 -maxCommandSpawns: 20 -playerGroupRadius: 96.0 -spawnTaskDelay: 40t -creatureTypeCaps: - "ANIMAL": 60 - "MONSTER": 55 - "WATER_ANIMAL": 30 - "AMBIENT": 0 -spawnHeightRange: 40