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

Commit

Permalink
Bump Idofront, Geary and ModelEngine 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Oct 3, 2023
1 parent 74086ee commit 19a9f5c
Show file tree
Hide file tree
Showing 38 changed files with 287 additions and 385 deletions.
10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand All @@ -12,6 +13,8 @@ plugins {
alias(libs.plugins.mia.autoversion)
}

val mavenUser: String by project
val mavenPassword: String by project
allprojects {
apply(plugin = "java")
apply(plugin = "org.jetbrains.dokka")
Expand All @@ -28,6 +31,13 @@ allprojects {
mavenCentral()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven {
url = URI("https://${mavenUser}:${mavenPassword}@repo.mineinabyss.com/private")
credentials {
username = mavenUser
password = mavenPassword
}
}
maven("https://repo.dmulloy2.net/nexus/repository/public/") //ProtocolLib
maven("https://maven.enginehub.org/repo/") //WorldGuard/Edit
maven("https://mvn.lumine.io/repository/maven-public/") { metadataSources { artifact() } } // Model Engine
Expand Down
2 changes: 1 addition & 1 deletion 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.15
idofrontVersion=0.18.27
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.mineinabyss.mobzy.features.bossbar

import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.papermc.tracking.entities.toGeary
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.systems.RepeatingSystem
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointer
import com.mineinabyss.idofront.entities.toPlayer
import com.mineinabyss.idofront.typealiases.BukkitEntity
import org.bukkit.attribute.Attribute
Expand All @@ -22,10 +21,10 @@ import kotlin.time.Duration.Companion.seconds
*/
@AutoScan
class BossBarDisplaySystem : RepeatingSystem(interval = 0.5.seconds), Listener {
private val TargetScope.bossbar by get<DisplayBossBar>()
private val TargetScope.bukkitentity by get<BukkitEntity>()
private val Pointer.bossbar by get<DisplayBossBar>()
private val Pointer.bukkitentity by get<BukkitEntity>()

override fun TargetScope.tick() {
override fun Pointer.tick() {
val bukkit = bukkitentity as? LivingEntity ?: return
val playersInRange = bukkitentity.getNearbyEntities(bossbar.range, bossbar.range, bossbar.range)
.filterIsInstance<Player>().mapTo(mutableSetOf()) { it.uniqueId }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.mineinabyss.mobzy.features.copynbt

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.annotations.optin.UnsafeAccessors
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.papermc.datastore.loadComponentsFrom
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.nms.aliases.toNMS
import com.mineinabyss.idofront.typealiases.BukkitEntity

Expand All @@ -15,13 +15,13 @@ import com.mineinabyss.idofront.typealiases.BukkitEntity
*/
@AutoScan
class CopyNBTSystem : GearyListener() {
private val TargetScope.nbt by onSet<CopyNBT>()
private val TargetScope.bukkitEntity by onSet<BukkitEntity>()
private val Pointers.nbt by get<CopyNBT>().whenSetOnTarget()
private val Pointers.bukkitEntity by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.copyNBT() {
@OptIn(UnsafeAccessors::class)
override fun Pointers.handle() {
bukkitEntity.toNMS().load(nbt.compound)
entity.loadComponentsFrom(bukkitEntity.persistentDataContainer)
entity.remove<CopyNBT>()
target.entity.loadComponentsFrom(bukkitEntity.persistentDataContainer)
target.entity.remove<CopyNBT>()
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -16,11 +15,10 @@ value class SetBreakDownDoor(val value: Boolean = false)

@AutoScan
class SetBreakDownDoorListener : GearyListener() {
private val TargetScope.breakDoor by onSet<SetBreakDownDoor>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.breakDoor by get<SetBreakDownDoor>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.apply() {
override fun Pointers.handle() {
when (val mob = bukkit) {
is Zombie -> if (mob.supportsBreakingDoors()) mob.setCanBreakDoors(breakDoor.value)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -18,11 +17,10 @@ value class SetBurnInDay(val value: Boolean = true)

@AutoScan
class SetBurnInDaySystem : GearyListener() {
private val TargetScope.burn by onSet<SetBurnInDay>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.burn by get<SetBurnInDay>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.apply() {
override fun Pointers.handle() {
when (val mob = bukkit) {
is Phantom -> mob.setShouldBurnInDay(burn.value)
is AbstractSkeleton -> mob.setShouldBurnInDay(burn.value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -15,11 +14,9 @@ class SetCanPickupItems(val value: Boolean)

@AutoScan
class SetCanPickupItemsSystem : GearyListener() {
private val TargetScope.pickup by onSet<SetCanPickupItems>()
private val TargetScope.bukkit by onSet<BukkitEntity>()

@Handler
fun TargetScope.apply() {
private val Pointers.pickup by get<SetCanPickupItems>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()
override fun Pointers.handle() {
when (val mob = bukkit) {
is LivingEntity -> mob.canPickupItems = pickup.value
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.serialization.SerializableItemStack
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.bukkit.entity.Mob
import org.bukkit.event.EventHandler

/**
* A component for adding equipment to spawned mobs.
Expand All @@ -22,11 +21,10 @@ data class SetEquipment(
)

class SetEquipmentSystem : GearyListener() {
private val TargetScope.equipment by onSet<SetEquipment>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.equipment by get<SetEquipment>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@EventHandler
fun TargetScope.apply() {
override fun Pointers.handle() {
val mob = bukkit as? Mob ?: return
mob.equipment.apply {
equipment.helmet?.toItemStack()?.let { helmet = it }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.nms.aliases.NMSEntity
import com.mineinabyss.idofront.nms.aliases.toNMS
import com.mineinabyss.idofront.typealiases.BukkitEntity
Expand Down Expand Up @@ -37,12 +36,11 @@ data class SetMobAttributes(

@AutoScan
class SetMobAttributesSystem : GearyListener() {
private val TargetScope.bukkitEntity by onSet<BukkitEntity>()
private val TargetScope.attributes by onSet<SetMobAttributes>()
private val Pointers.bukkitEntity by get<BukkitEntity>().whenSetOnTarget()
private val Pointers.attributes by get<SetMobAttributes>().whenSetOnTarget()

@Handler
fun TargetScope.setAttributes() {
if(attributes.width != null && attributes.height != null) {
override fun Pointers.handle() {
if (attributes.width != null && attributes.height != null) {
bukkitEntity.toNMS().setDimensions(attributes.width!!, attributes.height!!)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.serialization.SerializableItemStack
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
Expand All @@ -18,11 +17,10 @@ data class SetProjectileItem(

@AutoScan
class SetProjectileItemSystem : GearyListener() {
private val TargetScope.model by onSet<SetProjectileItem>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.model by get<SetProjectileItem>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.applyModel() {
override fun Pointers.handle() {
val projectile = bukkit as? ThrowableProjectile ?: return
projectile.item = model.item.toItemStack()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -20,11 +19,10 @@ class SetRemoveWhenFarAway(val value: Boolean)

@AutoScan
class SetRemoveWhenFarAwaySystem : GearyListener() {
private val TargetScope.removeWhenFarAway by onSet<SetRemoveWhenFarAway>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.removeWhenFarAway by get<SetRemoveWhenFarAway>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.setRemoveWhenFarAway() {
override fun Pointers.handle() {
val living = bukkit as? LivingEntity ?: return
living.removeWhenFarAway = removeWhenFarAway.value
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.mineinabyss.mobzy.features.initializers

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.serialization.IntRangeSerializer
import com.mineinabyss.idofront.typealiases.BukkitEntity
import com.mineinabyss.idofront.util.randomOrMin
Expand All @@ -18,11 +17,10 @@ value class SetSlimeSize(@Serializable(with = IntRangeSerializer::class) val siz

@AutoScan
class SetSlimeSizeSystem : GearyListener() {
private val TargetScope.slimeSize by onSet<SetSlimeSize>()
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val Pointers.slimeSize by get<SetSlimeSize>().whenSetOnTarget()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()

@Handler
fun TargetScope.apply() {
override fun Pointers.handle() {
val slime = (bukkit as? Slime) ?: return
slime.size = slimeSize.size.randomOrMin()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
package com.mineinabyss.mobzy.features.nointeractions

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.papermc.tracking.entities.toGearyOrNull
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity
import io.papermc.paper.event.entity.EntityMoveEvent
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener

@AutoScan
class DisableMobInteractionsSystem : GearyListener(), Listener {
val TargetScope.bukkit by onSet<BukkitEntity>()
val TargetScope.cancel by onSet<DisableMobInteractions>()
val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()
val Pointers.cancel by get<DisableMobInteractions>().whenSetOnTarget()

@Handler
fun TargetScope.handle() {
override fun Pointers.handle() {
bukkit.isInvulnerable = true
bukkit.setGravity(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package com.mineinabyss.mobzy.features.sounds

import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.RepeatingSystem
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointer
import com.mineinabyss.idofront.time.ticks
import com.mineinabyss.idofront.typealiases.BukkitEntity
import kotlin.random.Random

@AutoScan
class AmbientSoundsSystem : RepeatingSystem(interval = 1.ticks) {
private val TargetScope.sounds by get<Sounds>()
private val TargetScope.bukkit by get<BukkitEntity>()
private val Pointer.sounds by get<Sounds>()
private val Pointer.bukkit by get<BukkitEntity>()

override fun TargetScope.tick() {
override fun Pointer.tick() {
if (Random.nextDouble() < sounds.ambientChance)
OverrideMobSoundsSystem.makeSound(bukkit, sounds.ambient)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package com.mineinabyss.mobzy.features.sounds

import com.mineinabyss.geary.annotations.Handler
import com.mineinabyss.geary.autoscan.AutoScan
import com.mineinabyss.geary.systems.GearyListener
import com.mineinabyss.geary.systems.accessors.TargetScope
import com.mineinabyss.geary.systems.accessors.Pointers
import com.mineinabyss.idofront.typealiases.BukkitEntity

@AutoScan
class SilenceVanillaSoundsSystem : GearyListener() {
private val TargetScope.bukkit by onSet<BukkitEntity>()
private val TargetScope.sounds by onSet<Sounds>()
private val Pointers.bukkit by get<BukkitEntity>().whenSetOnTarget()
private val Pointers.sounds by get<Sounds>().whenSetOnTarget()

@Handler
fun TargetScope.removeSounds() {
override fun Pointers.handle() {
bukkit.isSilent = true
}
}
4 changes: 4 additions & 0 deletions mobzy-modelengine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ dependencies {

compileOnly(project(":mobzy-core"))
}

/*configurations.all {
resolutionStrategy.cacheChangingModulesFor( 0, "seconds")
}*/
Loading

0 comments on commit 19a9f5c

Please sign in to comment.