mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 17:20:02 +00:00
Fixed some slot sending
This commit is contained in:
parent
adce1ad920
commit
5e45567c1d
@ -237,7 +237,7 @@ class BlockAPI{
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cancelAction(Block $block, Player $player){
|
private function cancelAction(Block $block, Player $player, $send = true){
|
||||||
$player->dataPacket(MC_UPDATE_BLOCK, array(
|
$player->dataPacket(MC_UPDATE_BLOCK, array(
|
||||||
"x" => $block->x,
|
"x" => $block->x,
|
||||||
"y" => $block->y,
|
"y" => $block->y,
|
||||||
@ -245,7 +245,9 @@ class BlockAPI{
|
|||||||
"block" => $block->getID(),
|
"block" => $block->getID(),
|
||||||
"meta" => $block->getMetadata()
|
"meta" => $block->getMetadata()
|
||||||
));
|
));
|
||||||
|
if($send === true){
|
||||||
$player->sendInventorySlot($player->slot);
|
$player->sendInventorySlot($player->slot);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,21 +257,21 @@ class BlockAPI{
|
|||||||
$item = $player->getSlot($player->slot);
|
$item = $player->getSlot($player->slot);
|
||||||
|
|
||||||
if($this->server->api->dhandle("player.block.touch", array("type" => "break", "player" => $player, "target" => $target, "item" => $item)) === false){
|
if($this->server->api->dhandle("player.block.touch", array("type" => "break", "player" => $player, "target" => $target, "item" => $item)) === false){
|
||||||
return $this->cancelAction($target, $player);
|
return $this->cancelAction($target, $player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - 0.02) + $target->getBreakTime($item, $player)) >= microtime(true)){
|
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - 0.02) + $target->getBreakTime($item, $player)) >= microtime(true)){
|
||||||
return $this->cancelAction($target, $player);
|
return $this->cancelAction($target, $player, false);
|
||||||
}
|
}
|
||||||
$player->lastBreak = microtime(true);
|
$player->lastBreak = microtime(true);
|
||||||
|
|
||||||
if($this->server->api->dhandle("player.block.break", array("player" => $player, "target" => $target, "item" => $item)) !== false){
|
if($this->server->api->dhandle("player.block.break", array("player" => $player, "target" => $target, "item" => $item)) !== false){
|
||||||
$drops = $target->getDrops($item, $player);
|
$drops = $target->getDrops($item, $player);
|
||||||
if($target->onBreak($item, $player) === false){
|
if($target->onBreak($item, $player) === false){
|
||||||
return $this->cancelAction($target, $player);
|
return $this->cancelAction($target, $player, false);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return $this->cancelAction($target, $player);
|
return $this->cancelAction($target, $player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -324,15 +326,15 @@ class BlockAPI{
|
|||||||
$hand = $item->getBlock();
|
$hand = $item->getBlock();
|
||||||
$hand->position($block);
|
$hand->position($block);
|
||||||
}else{
|
}else{
|
||||||
return $this->cancelAction($block, $player);
|
return $this->cancelAction($block, $player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!($block->isReplaceable === true or ($hand->getID() === SLAB and $block->getID() === SLAB))){
|
if(!($block->isReplaceable === true or ($hand->getID() === SLAB and $block->getID() === SLAB))){
|
||||||
return $this->cancelAction($block, $player);
|
return $this->cancelAction($block, $player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($hand->isSolid === true and $player->entity->inBlock($block)){
|
if($hand->isSolid === true and $player->entity->inBlock($block)){
|
||||||
return $this->cancelAction($block, $player); //Entity in block
|
return $this->cancelAction($block, $player, false); //Entity in block
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->server->api->dhandle("player.block.place", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
|
if($this->server->api->dhandle("player.block.place", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
|
||||||
|
@ -217,7 +217,7 @@ class Entity extends Position{
|
|||||||
public function environmentUpdate(){
|
public function environmentUpdate(){
|
||||||
$hasUpdate = false;
|
$hasUpdate = false;
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true){
|
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true){
|
||||||
foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){
|
foreach($this->server->api->entity->getRadius($this, 1.5, ENTITY_ITEM) as $item){
|
||||||
if(($time - $item->spawntime) >= 0.6){
|
if(($time - $item->spawntime) >= 0.6){
|
||||||
if(($this->player->gamemode & 0x01) === 0x00){
|
if(($this->player->gamemode & 0x01) === 0x00){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user