public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz) { if ($target->isTransparent() === false and $face !== 0 and $face !== 1 and $block->isSolid() === false) { $faces = [2 => 0, 3 => 2, 4 => 1, 5 => 3]; $motives = [["Kebab", 1, 1], ["Aztec", 1, 1], ["Alban", 1, 1], ["Aztec2", 1, 1], ["Bomb", 1, 1], ["Plant", 1, 1], ["Wasteland", 1, 1], ["Wanderer", 1, 2], ["Graham", 1, 2], ["Pool", 2, 1], ["Courbet", 2, 1], ["Sunset", 2, 1], ["Sea", 2, 1], ["Creebet", 2, 1], ["Match", 2, 2], ["Bust", 2, 2], ["Stage", 2, 2], ["Void", 2, 2], ["SkullAndRoses", 2, 2], ["Fighters", 4, 2], ["Skeleton", 4, 3], ["DonkeyKong", 4, 3], ["Pointer", 4, 4], ["Pigscene", 4, 4], ["Flaming Skull", 4, 4]]; $motive = $motives[mt_rand(0, count($motives) - 1)]; $data = ["x" => $target->x, "y" => $target->y + 0.4, "z" => $target->z, "yaw" => $faces[$face] * 90, "Motive" => $motive[0]]; $nbt = new Compound("", ["Motive" => new String("Motive", $data["Motive"]), "Pos" => new Enum("Pos", [new Double("", $data["x"]), new Double("", $data["y"]), new Double("", $data["z"])]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", $data["yaw"]), new Float("", 0)])]); $painting = new PaintingEntity($player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), $nbt); $painting->spawnToAll(); /*if($player->isSurvival()){ $item = $player->getInventory()->getItemInHand(); $count = $item->getCount(); if(--$count <= 0){ $player->getInventory()->setItemInHand(Item::get(Item::AIR)); return; } $item->setCount($count); $player->getInventory()->setItemInHand($item); }*/ return true; } return false; }
public function canConnect(Block $block) { //TODO: activate comments when the NetherBrickFenceGate class has been created. return $block instanceof NetherBrickFence ? true : $block->isSolid() and !$block->isTransparent(); }
public function canConnect(Block $block) { return ($block->getId() !== self::COBBLE_WALL and $block->getId() !== self::FENCE_GATE) ? $block->isSolid() and !$block->isTransparent() : true; }
public function canConnect(Block $block) { return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent(); }
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null) { if ((!$target->isTransparent() and $target->isSolid()) || $target->getId() === Block::LEAVES || $target->getId() === Block::LEAVES2) { $faces = [0 => 0, 1 => 0, 2 => 1, 3 => 4, 4 => 8, 5 => 2]; if (isset($faces[$face])) { $this->meta = $faces[$face]; $this->getLevel()->setBlock($block, $this, true, true); return true; } } return false; }
public function canConnect(Block $block) { return $block->isSolid() or $block->getId() === $this->getId() or $block->getId() === self::GLASS_PANE or $block->getId() === self::GLASS; }