mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +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){
|
||||
if($target->isTransparent === false and $face > 1){
|
||||
if($target->isTransparent === false and $face > 1 and $block->isFlowable === true){
|
||||
$server = ServerAPI::request();
|
||||
$faces = array(
|
||||
2 => 1,
|
||||
3 => 3,
|
||||
@ -41,21 +42,41 @@ class PaintingItem extends Item{
|
||||
|
||||
);
|
||||
$motives = array(
|
||||
"Kebab",
|
||||
"Aztec",
|
||||
"Alban",
|
||||
"Aztec2",
|
||||
"Bomb",
|
||||
"Plant",
|
||||
"Wasteland",
|
||||
// Motive Width Height
|
||||
array("Kebab", 1, 1),
|
||||
array("Aztec", 1, 1),
|
||||
array("Alban", 1, 1),
|
||||
array("Aztec2", 1, 1),
|
||||
array("Bomb", 1, 1),
|
||||
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(
|
||||
"x" => $target->x,
|
||||
"y" => $target->y,
|
||||
"z" => $target->z,
|
||||
"yaw" => $faces[$face] * 90,
|
||||
"Motive" => $motives[mt_rand(0, count($motives) - 1)],
|
||||
"Motive" => $motive[0],
|
||||
);
|
||||
$server = ServerAPI::request();
|
||||
$e = $server->api->entity->add(ENTITY_OBJECT, OBJECT_PAINTING, $data);
|
||||
|
@ -187,7 +187,7 @@ class Entity extends stdClass{
|
||||
return false;
|
||||
}
|
||||
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"]);
|
||||
if($player instanceof Entity){
|
||||
$player = $player->player;
|
||||
|
Loading…
x
Reference in New Issue
Block a user