Skip to content
Permalink
Browse files

add a hack for horses

  • Loading branch information...
EmreTr1 committed Mar 30, 2019
1 parent eb692a7 commit 7b7751161bfb0718d89b9f3d128985f836a92651
@@ -55,6 +55,7 @@ public function setJumpPower(float $jumpPowerIn) : void{
$jumpPowerIn = 0;
}else{
$this->setRearing(true);
$this->rearingCounter = 40; // HACK!
}
if($jumpPowerIn >= 90){
@@ -105,6 +106,15 @@ public function onBehaviorUpdate() : void{
$this->setRearing(false);
}
}
$rider = $this->getRiddenByEntity();
if($rider !== null){
$rider->resetFallDistance();
if($rider->isUnderwater()){
$this->throwRider();
}
}
}
public function onInteract(Player $player, Item $item, Vector3 $clickPos) : bool{
@@ -24,6 +24,7 @@
namespace pocketmine\network\mcpe;
use pocketmine\entity\passive\AbstractHorse;
use pocketmine\entity\passive\Horse;
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\maps\MapData;
use pocketmine\maps\MapManager;
@@ -222,8 +223,10 @@ public function handleRiderJump(RiderJumpPacket $packet) : bool{
if($this->player->isRiding()){
$horse = $this->player->getRidingEntity();
if($horse instanceof AbstractHorse){
// This is useless for now, only may usable for plugins
$horse->setJumpPower($packet->jumpStrength);
if($horse->onGround){
// This is useless for now, only may usable for plugins
$horse->setJumpPower($packet->jumpStrength);
}
return true;
}
}

0 comments on commit 7b77511

Please sign in to comment.
You can’t perform that action at this time.