mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Added correct Painting placing checks & bigger Paintings
This commit is contained in:
parent
dffbfa0754
commit
13aa73d26e
@ -32,7 +32,8 @@ class PaintingItem extends Item{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(BlockAPI $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function onActivate(BlockAPI $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($target->isTransparent === false and $face > 1){
|
if($target->isTransparent === false and $face > 1 and $block->isFlowable === true){
|
||||||
|
$server = ServerAPI::request();
|
||||||
$faces = array(
|
$faces = array(
|
||||||
2 => 1,
|
2 => 1,
|
||||||
3 => 3,
|
3 => 3,
|
||||||
@ -41,21 +42,41 @@ class PaintingItem extends Item{
|
|||||||
|
|
||||||
);
|
);
|
||||||
$motives = array(
|
$motives = array(
|
||||||
"Kebab",
|
// Motive Width Height
|
||||||
"Aztec",
|
array("Kebab", 1, 1),
|
||||||
"Alban",
|
array("Aztec", 1, 1),
|
||||||
"Aztec2",
|
array("Alban", 1, 1),
|
||||||
"Bomb",
|
array("Aztec2", 1, 1),
|
||||||
"Plant",
|
array("Bomb", 1, 1),
|
||||||
"Wasteland",
|
array("Plant", 1, 1),
|
||||||
|
array("Wasteland", 1, 1),
|
||||||
|
array("Wanderer", 1, 2),
|
||||||
|
array("Graham", 1, 2),
|
||||||
|
array("Pool", 2, 1),
|
||||||
|
array("Courbet", 2, 1),
|
||||||
|
array("Sunset", 2, 1),
|
||||||
|
array("Sea", 2, 1),
|
||||||
|
array("Creebet", 2, 1),
|
||||||
|
array("Match", 2, 2),
|
||||||
|
array("Bust", 2, 2),
|
||||||
|
array("Stage", 2, 2),
|
||||||
|
array("Void", 2, 2),
|
||||||
|
array("SkullAndRoses", 2, 2),
|
||||||
|
//array("Wither", 2, 2),
|
||||||
|
array("Fighters", 4, 2),
|
||||||
|
array("Skeleton", 4, 3),
|
||||||
|
array("DonkeyKong", 4, 3),
|
||||||
|
array("Pointer", 4, 4),
|
||||||
|
array("Pigscene", 4, 4),
|
||||||
|
array("Flaming Skull", 4, 4),
|
||||||
);
|
);
|
||||||
|
$motive = $motives[mt_rand(0, count($motives) - 1)];
|
||||||
$data = array(
|
$data = array(
|
||||||
"x" => $target->x,
|
"x" => $target->x,
|
||||||
"y" => $target->y,
|
"y" => $target->y,
|
||||||
"z" => $target->z,
|
"z" => $target->z,
|
||||||
"yaw" => $faces[$face] * 90,
|
"yaw" => $faces[$face] * 90,
|
||||||
"Motive" => $motives[mt_rand(0, count($motives) - 1)],
|
"Motive" => $motive[0],
|
||||||
);
|
);
|
||||||
$server = ServerAPI::request();
|
$server = ServerAPI::request();
|
||||||
$e = $server->api->entity->add(ENTITY_OBJECT, OBJECT_PAINTING, $data);
|
$e = $server->api->entity->add(ENTITY_OBJECT, OBJECT_PAINTING, $data);
|
||||||
|
@ -187,7 +187,7 @@ class Entity extends stdClass{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(($time - $this->spawntime) >= 2){
|
if(($time - $this->spawntime) >= 2){
|
||||||
$player = $this->server->query("SELECT EID FROM entities WHERE class == ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
|
$player = $this->server->query("SELECT EID FROM entities WHERE class = ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
|
||||||
$player = $this->server->api->entity->get($player["EID"]);
|
$player = $this->server->api->entity->get($player["EID"]);
|
||||||
if($player instanceof Entity){
|
if($player instanceof Entity){
|
||||||
$player = $player->player;
|
$player = $player->player;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user