mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Fixed dropped items going too fast
This commit is contained in:
parent
acf7eb1ce9
commit
e94ddcabe0
@ -1903,9 +1903,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
|
||||
$this->inventory->setItemInHand(Item::get(Item::AIR, 0, 1));
|
||||
$motion = $this->getDirectionVector()->multiply(10);
|
||||
$motion = $this->getDirectionVector()->multiply(0.4);
|
||||
|
||||
$this->getLevel()->dropItem($this->add(0, 1, 0), $item, $motion);
|
||||
$this->getLevel()->dropItem($this->add(0, 1.3, 0), $item, $motion);
|
||||
|
||||
if($this->inAction === true){
|
||||
$this->inAction = false;
|
||||
|
@ -924,7 +924,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
* @param Vector3 $motion
|
||||
*/
|
||||
public function dropItem(Vector3 $source, Item $item, Vector3 $motion = null){
|
||||
$motion = $motion === null ? new Vector3(0, 0, 0) : $motion;
|
||||
$motion = $motion === null ? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1) : $motion;
|
||||
if($item->getID() !== Item::AIR and $item->getCount() > 0){
|
||||
$itemEntity = new DroppedItem($this->getChunkAt($source->getX() >> 4, $source->getZ() >> 4), new Compound("", [
|
||||
"Pos" => new Enum("Pos", [
|
||||
@ -934,9 +934,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
]),
|
||||
//TODO: add random motion with physics
|
||||
"Motion" => new Enum("Motion", [
|
||||
new Double("", $motion->x + (lcg_value() * 0.2 - 0.1)),
|
||||
new Double("", $motion->y + 0.2),
|
||||
new Double("", $motion->z + (lcg_value() * 0.2 - 0.1))
|
||||
new Double("", $motion->x),
|
||||
new Double("", $motion->y),
|
||||
new Double("", $motion->z)
|
||||
]),
|
||||
"Rotation" => new Enum("Rotation", [
|
||||
new Float("", lcg_value() * 360),
|
||||
|
Loading…
x
Reference in New Issue
Block a user