From c9bd55687cfe39ed640e9f50655fefb6c839392c Mon Sep 17 00:00:00 2001 From: Boy0000 <62521371+Boy0000@users.noreply.github.com> Date: Sun, 14 Aug 2022 21:51:57 +0200 Subject: [PATCH 1/2] 1.19.2 (#110) --- build.gradle.kts | 4 ++-- gradle.properties | 6 +++--- gradle/{mobzylibs.versions.toml => mobzyLibs.versions.toml} | 4 ++-- mobzy-systems/build.gradle.kts | 2 +- .../mobzy/systems/systems/WalkingAnimationSystem.kt | 4 ++-- settings.gradle.kts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) rename gradle/{mobzylibs.versions.toml => mobzyLibs.versions.toml} (60%) diff --git a/build.gradle.kts b/build.gradle.kts index b2462e71c..54204f763 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,9 +36,9 @@ allprojects { dependencies { val libs = rootProject.libs - val mobzylibs = rootProject.mobzylibs + val mobzyLibs = rootProject.mobzyLibs - compileOnly(mobzylibs.geary.papermc.core) + compileOnly(mobzyLibs.geary.papermc.core) implementation(libs.idofront.nms) } diff --git a/gradle.properties b/gradle.properties index b692ba066..497b69c79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group=com.mineinabyss -version=0.17 +version=0.18 useNMS=true -idofrontVersion=0.11.95 +idofrontVersion=0.12.103 kotlinVersion=1.6.10 -serverVersion=1.19-R0.1-SNAPSHOT +serverVersion=1.19.2-R0.1-SNAPSHOT # Workaround for dokka builds failing on CI, see https://github.com/Kotlin/dokka/issues/1405 org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m diff --git a/gradle/mobzylibs.versions.toml b/gradle/mobzyLibs.versions.toml similarity index 60% rename from gradle/mobzylibs.versions.toml rename to gradle/mobzyLibs.versions.toml index 2c7aee9ed..53a1bc797 100644 --- a/gradle/mobzylibs.versions.toml +++ b/gradle/mobzyLibs.versions.toml @@ -1,6 +1,6 @@ [versions] -geary = "0.18.103" +geary = "0.19.108" [libraries] -protocolburrito = "com.mineinabyss:protocolburrito:0.4.33" +protocolburrito = "com.mineinabyss:protocolburrito:0.5.34" geary-papermc-core = { module = "com.mineinabyss:geary-papermc-core", version.ref = "geary" } diff --git a/mobzy-systems/build.gradle.kts b/mobzy-systems/build.gradle.kts index f053c046d..3f28abf67 100644 --- a/mobzy-systems/build.gradle.kts +++ b/mobzy-systems/build.gradle.kts @@ -20,7 +20,7 @@ dependencies { compileOnly(libs.minecraft.plugin.modelengine) compileOnly(libs.minecraft.plugin.protocollib) - compileOnly(mobzylibs.protocolburrito) + compileOnly(mobzyLibs.protocolburrito) compileOnly(project(":mobzy-core")) compileOnly(project(":mobzy-components")) diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt index 911a47830..14e0da741 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/systems/WalkingAnimationSystem.kt @@ -1,7 +1,7 @@ package com.mineinabyss.mobzy.systems.systems import com.mineinabyss.geary.annotations.AutoScan -import com.mineinabyss.geary.systems.TickingSystem +import com.mineinabyss.geary.systems.RepeatingSystem import com.mineinabyss.geary.systems.accessors.TargetScope import com.mineinabyss.idofront.nms.aliases.toNMS import com.mineinabyss.idofront.typealiases.BukkitEntity @@ -13,7 +13,7 @@ import org.bukkit.entity.Mob import kotlin.time.Duration.Companion.seconds @AutoScan -class WalkingAnimationSystem : TickingSystem(interval = 0.5.seconds) { +class WalkingAnimationSystem : RepeatingSystem(interval = 0.5.seconds) { private val TargetScope.model by get() private val TargetScope.mob by get() diff --git a/settings.gradle.kts b/settings.gradle.kts index b60fc823e..979d811c0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -41,6 +41,6 @@ dependencyResolutionManagement { versionCatalogs { create("libs").from("com.mineinabyss:catalog:$idofrontVersion") - create("mobzylibs").from(files("gradle/mobzylibs.versions.toml")) + create("mobzyLibs").from(files("gradle/mobzyLibs.versions.toml")) } } From 633dfb3017caeef7fcb22ff94e5d3f92fd0d3162 Mon Sep 17 00:00:00 2001 From: Boy0000 Date: Fri, 19 Aug 2022 00:28:55 +0200 Subject: [PATCH 2/2] handle falldamage on mounted players (#109) --- .../systems/listeners/RidableListener.kt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/RidableListener.kt b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/RidableListener.kt index 77a01809c..ab39d57f6 100644 --- a/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/RidableListener.kt +++ b/mobzy-systems/src/main/kotlin/com/mineinabyss/mobzy/systems/listeners/RidableListener.kt @@ -6,9 +6,11 @@ import com.mineinabyss.mobzy.ecs.components.interaction.Rideable import com.mineinabyss.mobzy.systems.systems.ModelEngineSystem.toModelEntity import io.papermc.paper.event.entity.EntityMoveEvent import org.bukkit.Material +import org.bukkit.entity.LivingEntity import org.bukkit.entity.Player import org.bukkit.event.EventHandler import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityDamageEvent import org.bukkit.event.player.PlayerInteractEntityEvent object RidableListener : Listener { @@ -53,4 +55,27 @@ object RidableListener : Listener { isCancelled = true } } + + /** Apply remaining damage to driver and passengers of a [Rideable] entity when it dies */ + @EventHandler + fun EntityDamageEvent.onMountFallDamage() { + val mount = entity.toModelEntity()?.mountHandler ?: return + val health = (entity as LivingEntity).health + + if (entity.toGearyOrNull() == null) return + if (cause != EntityDamageEvent.DamageCause.FALL) return + if (health - finalDamage > 0) return + + if (mount.hasDriver() && mount.driver is Player) { + val driver = mount.driver as Player + driver.damage(damage - health) + driver.lastDamageCause = this + driver.noDamageTicks = 0 + } + mount.passengers["mount"]?.passengers?.filterIsInstance()?.forEach { + it.damage(damage - health) + it.lastDamageCause = this + it.noDamageTicks = 0 + } + } }