mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Fixed Level::setBlock() old calls
This commit is contained in:
parent
d3c308c5a8
commit
ac4b4b08fd
@ -109,8 +109,8 @@ class Bed extends Transparent{
|
||||
$downNext = $this->getSide(0);
|
||||
if($next->isReplaceable === true and $downNext->isTransparent === false){
|
||||
$meta = (($d + 3) % 4) & 0x03;
|
||||
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, false, true);
|
||||
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);
|
||||
$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -127,26 +127,26 @@ class Bed extends Transparent{
|
||||
|
||||
if(($this->meta & 0x08) === 0x08){ //This is the Top part of bed
|
||||
if($blockNorth->getID() === $this->id and $blockNorth->meta !== 0x08){ //Checks if the block ID and meta are right
|
||||
$this->getLevel()->setBlock($blockNorth, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
|
||||
}elseif($blockSouth->getID() === $this->id and $blockSouth->meta !== 0x08){
|
||||
$this->getLevel()->setBlock($blockSouth, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
|
||||
}elseif($blockEast->getID() === $this->id and $blockEast->meta !== 0x08){
|
||||
$this->getLevel()->setBlock($blockEast, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
|
||||
}elseif($blockWest->getID() === $this->id and $blockWest->meta !== 0x08){
|
||||
$this->getLevel()->setBlock($blockWest, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
|
||||
}
|
||||
}else{ //Bottom Part of Bed
|
||||
if($blockNorth->getID() === $this->id and ($blockNorth->meta & 0x08) === 0x08){
|
||||
$this->getLevel()->setBlock($blockNorth, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockNorth, new Air(), true, true);
|
||||
}elseif($blockSouth->getID() === $this->id and ($blockSouth->meta & 0x08) === 0x08){
|
||||
$this->getLevel()->setBlock($blockSouth, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockSouth, new Air(), true, true);
|
||||
}elseif($blockEast->getID() === $this->id and ($blockEast->meta & 0x08) === 0x08){
|
||||
$this->getLevel()->setBlock($blockEast, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockEast, new Air(), true, true);
|
||||
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
||||
$this->getLevel()->setBlock($blockWest, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($blockWest, new Air(), true, true);
|
||||
}
|
||||
}
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Beetroot extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -50,7 +50,7 @@ class Beetroot extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true, true);
|
||||
$item->count--;
|
||||
|
||||
return true;
|
||||
@ -63,7 +63,7 @@ class Beetroot extends Flowable{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //TODO: Replace with common break method
|
||||
$this->getLevel()->dropItem($this, Item::get(Item::BEETROOT_SEEDS, 0, 1));
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), false);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
@ -71,7 +71,7 @@ class Beetroot extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class BrownMushroom extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class BurningFurnace extends Solid{
|
||||
3 => 3,
|
||||
];
|
||||
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::FURNACE),
|
||||
|
@ -60,7 +60,7 @@ class Cactus extends Transparent{
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === self::AIR){
|
||||
$this->getLevel()->setBlock($b, new Cactus(), true, false, true);
|
||||
$this->getLevel()->setBlock($b, new Cactus(), true, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ class Cactus extends Transparent{
|
||||
$block2 = $this->getSide(4);
|
||||
$block3 = $this->getSide(5);
|
||||
if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class Cake extends Transparent{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== self::AIR){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -62,7 +62,7 @@ class Cake extends Transparent{
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
@ -80,9 +80,9 @@ class Cake extends Transparent{
|
||||
++$this->meta;
|
||||
$player->heal(3, "cake");
|
||||
if($this->meta >= 0x06){
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
}else{
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -67,7 +67,7 @@ class Carpet extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== self::AIR){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -79,7 +79,7 @@ class Carpet extends Flowable{
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === self::AIR){ //TODO: Replace with common break method
|
||||
$this->getLevel()->dropItem($this, Item::get($this->id, $this->meta, 1));
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class Carrot extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -51,7 +51,7 @@ class Carrot extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
$item->count--;
|
||||
|
||||
return true;
|
||||
@ -73,7 +73,7 @@ class Carrot extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class Chest extends Transparent{
|
||||
}
|
||||
}
|
||||
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::CHEST),
|
||||
|
@ -39,7 +39,7 @@ class CyanFlower extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Dandelion extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Dirt extends Solid{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->isHoe()){
|
||||
$item->useOn($this);
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true, false, true);
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -216,10 +216,10 @@ abstract class Door extends Transparent{
|
||||
if($next->getID() === $this->id or ($next2->isTransparent === false and $next->isTransparent === true)){ //Door hinge
|
||||
$metaUp |= 0x01;
|
||||
}
|
||||
$this->getLevel()->setBlock($blockUp, Block::get($this->id, $metaUp), true, false, true); //Top
|
||||
$this->getLevel()->setBlock($blockUp, Block::get($this->id, $metaUp), true); //Top
|
||||
|
||||
$this->meta = $player->getDirection() & 0x03;
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true); //Bottom
|
||||
$this->getLevel()->setBlock($block, $this, true, true); //Bottom
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -230,15 +230,15 @@ abstract class Door extends Transparent{
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
$this->getLevel()->setBlock($down, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($down, new Air(), true);
|
||||
}
|
||||
}else{
|
||||
$up = $this->getSide(1);
|
||||
if($up->getID() === $this->id){
|
||||
$this->getLevel()->setBlock($up, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($up, new Air(), true);
|
||||
}
|
||||
}
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -248,7 +248,7 @@ abstract class Door extends Transparent{
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
$meta = $down->getDamage() ^ 0x04;
|
||||
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true, false, true);
|
||||
$this->getLevel()->setBlock($down, Block::get($this->id, $meta), true);
|
||||
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||
if($player instanceof Player){
|
||||
unset($players[$player->getID()]);
|
||||
@ -267,7 +267,7 @@ abstract class Door extends Transparent{
|
||||
return false;
|
||||
}else{
|
||||
$this->meta ^= 0x04;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
$players = $this->getLevel()->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||
if($player instanceof Player){
|
||||
unset($players[$player->getID()]);
|
||||
|
@ -68,7 +68,7 @@ class FenceGate extends Transparent{
|
||||
3 => 2,
|
||||
];
|
||||
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03;
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -92,7 +92,7 @@ class FenceGate extends Transparent{
|
||||
}else{
|
||||
$this->isFullBlock = false;
|
||||
}
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ class Fire extends Flowable{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
|
||||
if($this->getSide(0)->getID() !== self::NETHERRACK){
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class HayBale extends Solid{
|
||||
];
|
||||
|
||||
$this->meta = ($this->meta & 0x03) | $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class Ice extends Transparent{
|
||||
}
|
||||
|
||||
public function onBreak(Item $item){
|
||||
$this->getLevel()->setBlock($this, new Water(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Water(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class Ladder extends Transparent{
|
||||
];
|
||||
if(isset($faces[$face])){
|
||||
$this->meta = $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Lava extends Liquid{
|
||||
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$ret = $this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$ret = $this->getLevel()->setBlock($this, $this, true);
|
||||
$this->getLevel()->scheduleUpdate(clone $this, 40);
|
||||
|
||||
return $ret;
|
||||
|
@ -142,7 +142,7 @@ class Leaves extends Transparent{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$this->meta |= 0x04;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
|
@ -131,7 +131,7 @@ class Leaves2 extends Leaves{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$this->meta |= 0x04;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
|
@ -34,7 +34,7 @@ class LitPumpkin extends Solid{
|
||||
if($player instanceof Player){
|
||||
$this->meta = (int) $player->getDirection();
|
||||
}
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class MelonStem extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -60,7 +60,7 @@ class MelonStem extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}else{
|
||||
@ -73,7 +73,7 @@ class MelonStem extends Flowable{
|
||||
$side = $this->getSide(mt_rand(2, 5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){
|
||||
$this->getLevel()->setBlock($side, new Melon(), true, false, true);
|
||||
$this->getLevel()->setBlock($side, new Melon(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ class MelonStem extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class Potato extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -51,7 +51,7 @@ class Potato extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
@ -74,7 +74,7 @@ class Potato extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class PumpkinStem extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -61,7 +61,7 @@ class PumpkinStem extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}else{
|
||||
@ -74,7 +74,7 @@ class PumpkinStem extends Flowable{
|
||||
$side = $this->getSide(mt_rand(2, 5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){
|
||||
$this->getLevel()->setBlock($side, new Pumpkin(), true, false, true);
|
||||
$this->getLevel()->setBlock($side, new Pumpkin(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ class PumpkinStem extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class RedMushroom extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class Sapling extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -94,7 +94,7 @@ class Sapling extends Flowable{
|
||||
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);
|
||||
}else{
|
||||
$this->meta |= 0x08;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
|
@ -48,12 +48,12 @@ class SignPost extends Transparent{
|
||||
];
|
||||
if(!isset($faces[$face])){
|
||||
$this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}else{
|
||||
$this->meta = $faces[$face];
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::WALL_SIGN, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::WALL_SIGN, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ class Slab extends Transparent{
|
||||
$this->meta &= 0x07;
|
||||
if($face === 0){
|
||||
if($target->getID() === self::SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}elseif($block->getID() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}else{
|
||||
@ -74,11 +74,11 @@ class Slab extends Transparent{
|
||||
}
|
||||
}elseif($face === 1){
|
||||
if($target->getID() === self::SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}elseif($block->getID() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -86,7 +86,7 @@ class Slab extends Transparent{
|
||||
}elseif(!($player instanceof Player)){
|
||||
if($block->getID() === self::SLAB){
|
||||
if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -103,7 +103,7 @@ class Slab extends Transparent{
|
||||
if($block->getID() === self::SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){
|
||||
return false;
|
||||
}
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class SnowLayer extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down instanceof Solid){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -53,7 +53,7 @@ class SnowLayer extends Flowable{
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class Stair extends Transparent{
|
||||
if(($fy > 0.5 and $face !== 1) or $face === 0){
|
||||
$this->meta |= 0x04; //Upside-down stairs
|
||||
}
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -49,12 +49,12 @@ class Sugarcane extends Flowable{
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === self::AIR){
|
||||
$this->getLevel()->setBlock($b, new Sugarcane(), true, false, true);
|
||||
$this->getLevel()->setBlock($b, new Sugarcane(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->meta = 0;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
@ -82,15 +82,15 @@ class Sugarcane extends Flowable{
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === self::AIR){
|
||||
$this->getLevel()->setBlock($b, new Sugarcane(), true, false, true);
|
||||
$this->getLevel()->setBlock($b, new Sugarcane(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->meta = 0;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}else{
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
@ -103,7 +103,7 @@ class Sugarcane extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::SUGARCANE_BLOCK){
|
||||
$this->getLevel()->setBlock($block, new Sugarcane(), true, false, true);
|
||||
$this->getLevel()->setBlock($block, new Sugarcane(), true);
|
||||
|
||||
return true;
|
||||
}elseif($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::SAND){
|
||||
@ -112,7 +112,7 @@ class Sugarcane extends Flowable{
|
||||
$block2 = $down->getSide(4);
|
||||
$block3 = $down->getSide(5);
|
||||
if(($block0 instanceof Water) or ($block1 instanceof Water) or ($block2 instanceof Water) or ($block3 instanceof Water)){
|
||||
$this->getLevel()->setBlock($block, new Sugarcane(), true, false, true);
|
||||
$this->getLevel()->setBlock($block, new Sugarcane(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Torch extends Flowable{
|
||||
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === self::FENCE)){ //Replace with common break method
|
||||
//TODO
|
||||
//Server::getInstance()->api->entity->drop($this, Item::get($this->id, 0, 1));
|
||||
$this->getLevel()->setBlock($this, new Air(), true, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
@ -71,12 +71,12 @@ class Torch extends Flowable{
|
||||
5 => 1,
|
||||
];
|
||||
$this->meta = $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === self::FENCE){
|
||||
$this->meta = 0;
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class Trapdoor extends Transparent{
|
||||
if($fy > 0.5){
|
||||
$this->meta |= 0x08;
|
||||
}
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -135,7 +135,7 @@ class Trapdoor extends Transparent{
|
||||
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
$this->meta ^= 0x04;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Water extends Liquid{
|
||||
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$ret = $this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$ret = $this->getLevel()->setBlock($this, $this, true);
|
||||
$this->getLevel()->scheduleUpdate(clone $this, 10);
|
||||
|
||||
return $ret;
|
||||
|
@ -40,7 +40,7 @@ class Wheat extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -51,7 +51,7 @@ class Wheat extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
@ -75,7 +75,7 @@ class Wheat extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class Wood extends Solid{
|
||||
];
|
||||
|
||||
$this->meta = ($this->meta & 0x03) | $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ class WoodSlab extends Transparent{
|
||||
$this->meta &= 0x07;
|
||||
if($face === 0){
|
||||
if($target->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}elseif($block->getID() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}else{
|
||||
@ -72,18 +72,18 @@ class WoodSlab extends Transparent{
|
||||
}
|
||||
}elseif($face === 1){
|
||||
if($target->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}elseif($block->getID() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}elseif(!($player instanceof Player)){ //TODO: collision
|
||||
if($block->getID() === self::WOOD_SLAB){
|
||||
if(($block->getDamage() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -100,7 +100,7 @@ class WoodSlab extends Transparent{
|
||||
if($block->getID() === self::WOOD_SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){
|
||||
return false;
|
||||
}
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Bucket extends Item{
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($this->meta === Item::AIR){
|
||||
if($target instanceof Liquid){
|
||||
$level->setBlock($target, new Air(), true, false, true);
|
||||
$level->setBlock($target, new Air(), true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->meta = ($target instanceof Water) ? Item::WATER : Item::LAVA;
|
||||
}
|
||||
@ -50,7 +50,7 @@ class Bucket extends Item{
|
||||
//Support Make Non-Support Water to Support Water
|
||||
if($block->getID() === self::AIR || ($block instanceof Water && ($block->getDamage() & 0x07) != 0x00)){
|
||||
$water = new Water();
|
||||
$level->setBlock($block, $water, true, false, true);
|
||||
$level->setBlock($block, $water, true);
|
||||
$water->place(clone $this, $block, $target, $face, $fx, $fy, $fz, $player);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->meta = 0;
|
||||
@ -60,7 +60,7 @@ class Bucket extends Item{
|
||||
}
|
||||
}elseif($this->meta === Item::LAVA){
|
||||
if($block->getID() === self::AIR){
|
||||
$level->setBlock($block, new Lava(), true, false, true);
|
||||
$level->setBlock($block, new Lava(), true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->meta = 0;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class FlintSteel extends Tool{
|
||||
}
|
||||
|
||||
if($block->getID() === self::AIR and ($target instanceof Solid)){
|
||||
$level->setBlock($block, new Fire(), true, false, true);
|
||||
$level->setBlock($block, new Fire(), true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1011,7 +1011,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$above = $level->getBlock(new Vector3($target->x, $target->y + 1, $target->z));
|
||||
if($above instanceof Block){
|
||||
if($above->getID() === Item::FIRE){
|
||||
$level->setBlock($above, new Air(), true, false, true);
|
||||
$level->setBlock($above, new Air(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1107,7 +1107,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$hand = $item->getBlock();
|
||||
$hand->position($block);
|
||||
}elseif($block->getID() === Item::FIRE){
|
||||
$this->setBlock($block, new Air(), true, false, true);
|
||||
$this->setBlock($block, new Air(), true);
|
||||
|
||||
return false;
|
||||
}else{
|
||||
|
@ -190,7 +190,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
|
||||
$this->inventory->setFuel($fuel);
|
||||
$current = $this->getLevel()->getBlock($this);
|
||||
if($current->getID() === Item::FURNACE){
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $current->getDamage()), true, false, true);
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $current->getDamage()), true);
|
||||
}
|
||||
}
|
||||
if($this->namedtag["BurnTime"] > 0){
|
||||
@ -221,7 +221,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
|
||||
}else{
|
||||
$current = $this->getLevel()->getBlock($this);
|
||||
if($current->getID() === Item::BURNING_FURNACE){
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $current->getDamage()), true, false);
|
||||
$this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $current->getDamage()), true);
|
||||
}
|
||||
$this->namedtag->BurnTime = new Short("BurnTime", 0);
|
||||
$this->namedtag->CookTime = new Short("CookTime", 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user