From 2cfd25c7d7472eadace64da7b5b76a1f14e55cbf Mon Sep 17 00:00:00 2001 From: Shynixn Date: Fri, 22 Nov 2024 20:44:18 +0100 Subject: [PATCH] #632 Fixed riding state and calling of ride command position. --- build.gradle.kts | 2 +- .../com/github/shynixn/petblocks/impl/PetEntityImpl.kt | 2 +- .../java/com/github/shynixn/petblocks/impl/PetImpl.kt | 9 ++++++++- src/main/resources/plugin-legacy.yml | 2 +- src/main/resources/plugin.yml | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index aa3a71382..baa29eac9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "com.github.shynixn" -version = "9.16.0" +version = "9.17.0" repositories { mavenCentral() diff --git a/src/main/java/com/github/shynixn/petblocks/impl/PetEntityImpl.kt b/src/main/java/com/github/shynixn/petblocks/impl/PetEntityImpl.kt index 2b9ea1f43..26a62f4b4 100644 --- a/src/main/java/com/github/shynixn/petblocks/impl/PetEntityImpl.kt +++ b/src/main/java/com/github/shynixn/petblocks/impl/PetEntityImpl.kt @@ -376,7 +376,7 @@ class PetEntityImpl( if (this.ridingMoveType == RidingMoveType.STOP) { this.ridingMoveType = moveType plugin.launch(physicObjectDispatcher) { - while (!isDead && ridingMoveType != RidingMoveType.STOP && player.isOnline) { + while (!isDead && ridingMoveType != RidingMoveType.STOP && player.isOnline && pet.isRiding()) { synchronizeRidingState(player) val movementVector = if (ridingMoveType == RidingMoveType.FORWARD) { player.location.direction.normalize().multiply(petMeta.physics.ridingSpeed).toVector3d() diff --git a/src/main/java/com/github/shynixn/petblocks/impl/PetImpl.kt b/src/main/java/com/github/shynixn/petblocks/impl/PetImpl.kt index 0e0cc456a..ad64c801d 100644 --- a/src/main/java/com/github/shynixn/petblocks/impl/PetImpl.kt +++ b/src/main/java/com/github/shynixn/petblocks/impl/PetImpl.kt @@ -3,6 +3,7 @@ package com.github.shynixn.petblocks.impl import com.github.shynixn.mccoroutine.bukkit.CoroutineTimings import com.github.shynixn.mccoroutine.bukkit.launch import com.github.shynixn.mccoroutine.bukkit.minecraftDispatcher +import com.github.shynixn.mccoroutine.bukkit.ticks import com.github.shynixn.mcutils.common.* import com.github.shynixn.mcutils.common.item.Item import com.github.shynixn.mcutils.common.item.ItemService @@ -430,7 +431,13 @@ class PetImpl( call() petMeta.ridingState = PetRidingState.GROUND - petEntity?.updateRidingState() + + plugin.launch { + val location = player.location.toVector3d() + petEntity?.updateRidingState() + delay(3.ticks) + petEntity?.teleportInWorld(location) // Correct riding position. + } } /** diff --git a/src/main/resources/plugin-legacy.yml b/src/main/resources/plugin-legacy.yml index 489651070..b439cd989 100644 --- a/src/main/resources/plugin-legacy.yml +++ b/src/main/resources/plugin-legacy.yml @@ -1,5 +1,5 @@ name: PetBlocks -version: 9.16.0 +version: 9.17.0 author: Shynixn main: com.github.shynixn.petblocks.PetBlocksPlugin softdepend: [ PlaceholderAPI, HeadDatabase] diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a77d4d261..0c53fc6cd 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: PetBlocks -version: 9.16.0 +version: 9.17.0 author: Shynixn main: com.github.shynixn.petblocks.PetBlocksPlugin softdepend: [ PlaceholderAPI, HeadDatabase]