Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Oct 21, 2023
1 parent 19a9f5c commit b35add9
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 50 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.mineinabyss
version=0.21
idofrontVersion=0.18.27
version=0.22
idofrontVersion=0.19.14
2 changes: 1 addition & 1 deletion gradle/myLibs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
gearyPaper = "0.25-SNAPSHOT"
gearyPaper = "0.26.0"

[libraries]
geary-papermc = { module = "com.mineinabyss:geary-papermc", version.ref = "gearyPaper" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ import kotlinx.serialization.Serializable
@Serializable
class MobzyConfig(
val debug: Boolean = false,
val supportNonMEEntities: Boolean = false,
val doMobSpawns: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class MeleeAttackBehavior(
inner class MeleeAttackGoal(
private val entity: Mob
) : NMSMeleeAttackGoal(entity.toNMS<PathfinderMob>(), 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MobzySpawning>()

Expand All @@ -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<WorldGuardSpawnFlags>()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<SpawnCategory, Int> = mutableMapOf(),
val spawnHeightRange: Int,
val spawnTaskDelay: Duration = 40.ticks,
val creatureTypeCaps: MutableMap<SpawnCategory, Int> = 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
Expand Down
16 changes: 9 additions & 7 deletions src/main/kotlin/com/mineinabyss/mobzy/MobzyPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ class MobzyPlugin : JavaPlugin() {
}

override fun onEnable() = actions {
DI.add<MobzyModule>(object : MobzyModule {
override val plugin: MobzyPlugin = this@MobzyPlugin
override val config: MobzyConfig by config("config") {
fromPluginPath(loadDefault = true)
}
})

createMobzyContext()
MobzyCommands()

geary {
Expand Down Expand Up @@ -80,4 +74,12 @@ class MobzyPlugin : JavaPlugin() {
CopyNBTSystem(),
)
}

fun createMobzyContext() {
DI.remove<MobzyModule>()
DI.add<MobzyModule>(object : MobzyModule {
override val plugin: MobzyPlugin = this@MobzyPlugin
override val config: MobzyConfig by config("config", dataFolder.toPath(), MobzyConfig())
})
}
}
14 changes: 0 additions & 14 deletions src/main/resources/config.yml

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/resources/spawning.yml

This file was deleted.

0 comments on commit b35add9

Please sign in to comment.