mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
better bed head block detection, fixed bonemeal not decrementing from slot when used, fixed players seeing teleport to -256,128,-256 when dying
This commit is contained in:
parent
2f6e2ffcab
commit
6af453dcc3
12 changed files with 15 additions and 24 deletions
|
|
@ -1724,7 +1724,7 @@ class Entity extends Position
|
|||
$pk->yaw = 0;
|
||||
$pk->pitch = 0;
|
||||
foreach($this->level->players as $player){
|
||||
if($player->hasEntity($this)) $player->entityQueueDataPacket(clone $pk);
|
||||
if($player->hasEntity($this) && $player != $this->player) $player->entityQueueDataPacket(clone $pk);
|
||||
}
|
||||
}else{
|
||||
$pk = new EntityEventPacket;
|
||||
|
|
|
|||
|
|
@ -84,22 +84,13 @@ class BedBlock extends TransparentBlock{
|
|||
return true;
|
||||
}
|
||||
|
||||
$blockNorth = $this->getSide(2); //Gets the blocks around them
|
||||
$blockSouth = $this->getSide(3);
|
||||
$blockEast = $this->getSide(5);
|
||||
$blockWest = $this->getSide(4);
|
||||
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
|
||||
$b = $this;
|
||||
}else{ //Bottom Part of Bed
|
||||
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
|
||||
$b = $blockNorth;
|
||||
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
|
||||
$b = $blockSouth;
|
||||
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
|
||||
$b = $blockEast;
|
||||
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
||||
$b = $blockWest;
|
||||
}else{
|
||||
$dir = ($this->meta & 3);
|
||||
$o = BedBlock::HEAD_DIRECTION_OFFSETS[$dir];
|
||||
$b = $this->level->getBlockWithoutVector($this->x + $o[0], $this->y, $this->z + $o[1]);
|
||||
if($b->getID() != BED_BLOCK){
|
||||
$player->sendChat("This bed is incomplete");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class BeetrootBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CarrotBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class CyanFlowerBlock extends FlowableBlock{
|
|||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){
|
||||
$random = new Random();
|
||||
self::placeFlowers($this->level, new Vector3($this->x, $this->y, $this->z), $random, $random->nextRange(2, 5), 2);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class DandelionBlock extends FlowableBlock{
|
|||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){
|
||||
$random = new Random();
|
||||
self::placeFlowers($this->level, new Vector3($this->x, $this->y, $this->z), $random, $random->nextRange(2, 5), 2);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class MelonStemBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class PotatoBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class PumpkinStemBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class SaplingBlock extends FlowableBlock{
|
|||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class SugarcaneBlock extends FlowableBlock{
|
|||
$this->level->fastSetBlockUpdateMeta($this->x, $this->y, $this->z, $this->meta, true);
|
||||
}
|
||||
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class WheatBlock extends FlowableBlock{
|
|||
$this->meta = 7;
|
||||
}
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$player->consumeSingleItem();
|
||||
$player->consumeSingleItem(send:true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue