mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
Merge 'minor-next' into 'major-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11769186885
This commit is contained in:
@@ -57,7 +57,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
$this->setModifier($this->getBaseDamage() * 0.3 * $strength->getEffectLevel(), self::MODIFIER_STRENGTH);
|
||||
}
|
||||
|
||||
if(($weakness = $effects->get(VanillaEffects::WEAKNESS())) !== null){
|
||||
if(($weakness = $effects->get(VanillaEffects::WEAKNESS())) !== null && $this->getCause() === EntityDamageEvent::CAUSE_ENTITY_ATTACK){
|
||||
$this->setModifier(-($this->getBaseDamage() * 0.2 * $weakness->getEffectLevel()), self::MODIFIER_WEAKNESS);
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class GoldenAppleEnchanted extends GoldenApple{
|
||||
|
||||
public function getAdditionalEffects() : array{
|
||||
return [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 600, 4),
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 600, 1),
|
||||
new EffectInstance(VanillaEffects::ABSORPTION(), 2400, 3),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 6000),
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 6000)
|
||||
|
@@ -26,6 +26,7 @@ namespace pocketmine\item;
|
||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||
use pocketmine\entity\Living;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\sound\BottleEmptySound;
|
||||
|
||||
class Potion extends Item implements ConsumableItem{
|
||||
|
||||
@@ -50,7 +51,7 @@ class Potion extends Item implements ConsumableItem{
|
||||
}
|
||||
|
||||
public function onConsume(Living $consumer) : void{
|
||||
|
||||
$consumer->broadcastSound(new BottleEmptySound());
|
||||
}
|
||||
|
||||
public function getAdditionalEffects() : array{
|
||||
|
@@ -1630,7 +1630,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->resetItemCooldown($item);
|
||||
$this->resetItemCooldown($oldItem);
|
||||
$this->returnItemsFromAction($oldItem, $item, $returnedItems);
|
||||
|
||||
$this->setUsingItem($item instanceof Releasable && $item->canStartUsingItem($this));
|
||||
@@ -1659,7 +1659,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
|
||||
$this->setUsingItem(false);
|
||||
$this->resetItemCooldown($slot);
|
||||
$this->resetItemCooldown($oldItem);
|
||||
|
||||
$slot->pop();
|
||||
$this->returnItemsFromAction($oldItem, $slot, [$slot->getResidue()]);
|
||||
@@ -1687,7 +1687,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$returnedItems = [];
|
||||
$result = $item->onReleaseUsing($this, $returnedItems);
|
||||
if($result === ItemUseResult::SUCCESS){
|
||||
$this->resetItemCooldown($item);
|
||||
$this->resetItemCooldown($oldItem);
|
||||
$this->returnItemsFromAction($oldItem, $item, $returnedItems);
|
||||
return true;
|
||||
}
|
||||
|
35
src/world/sound/BottleEmptySound.php
Normal file
35
src/world/sound/BottleEmptySound.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\world\sound;
|
||||
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\network\mcpe\protocol\LevelSoundEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelSoundEvent;
|
||||
|
||||
class BottleEmptySound implements Sound{
|
||||
|
||||
public function encode(Vector3 $pos) : array{
|
||||
return [LevelSoundEventPacket::nonActorSound(LevelSoundEvent::BOTTLE_EMPTY, $pos, false)];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user