Skip to content

Commit

Permalink
#632 Fixed riding state and calling of ride command position.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Nov 22, 2024
1 parent db289c1 commit 2cfd25c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "com.github.shynixn"
version = "9.16.0"
version = "9.17.0"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/github/shynixn/petblocks/impl/PetImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin-legacy.yml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 2cfd25c

Please sign in to comment.