Giter Club home page Giter Club logo

Comments (38)

Ivanzar avatar Ivanzar commented on July 17, 2024
use pocketmine\level\generator\Generator;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;

use pocketmine\math\Vector3;
use pocketmine\block\Block;

class TWWGenerator extends Generator{

    private $random,$level;

    public function __construct(array $settings=array()){

    }



    public function getName(){
        return "tww";

    }

    public function getSettings(){

    }

    public function getSpawn(){
        return new Vector3(128.5, 64, 128.5);
    }

    public function init(ChunkManager $level,Random $random){
        $this->random = $rnadom;
        $this->level = $level;

    }

    public function generateChunk($chunkX,$chunkZ){

        $chunk = $this->level->getChunk($chunkX, $chunkZ);
        $startX = min($selection[0][0] = 0, $selection[1][0] = 128);
        $endX = max($selection[0][0] = 0, $selection[1][0] = 128);
        $startY = min($selection[0][1] = 0, $selection[1][1] = 128);
        $endY = max($selection[0][1] = 0, $selection[1][1] = 128);
        $startZ = min($selection[0][2] = 0, $selection[1][2] = 128);
        $endZ = max($selection[0][2] = 0, $selection[1][2] = 128);
        for($x = $startX; $x < $endX; ++$x){
                for($y = $startY; $y < $endY; ++$y){
                for($z = $startZ; $z < $endZ; ++$z){
            $chunk->setBlockId($x,$y,$z,1);
        }
        }
        }
    }

    public function populateChunk($chunkX,$chunkZ){

    }

}

I used it as an experiment. Ignore if you did not understand me, give me example a generation

from pocketmine-plugin-tutorials.

PEMapModder avatar PEMapModder commented on July 17, 2024

What if I am not sure? :P

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

Just to explain the principle of generation. I honestly didn't quite understand what i write xD

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

i forgot load: STARTUP )

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar Айайай, плахой!!
:D

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

it`s progress
line 15, __construct()
16:47:49 [CRITICAL] Could not execute asynchronous task GenerationTask: Argument 1 passed to Ivanzar\TheTwoTowerns\TWWGenerator::__construct() must be of the type array, null given, called in phar://C:/Users/ivanzar/PocketMine Progect/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/level/generator/GenerationTask.php on line 63 and defined

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar

public function __construct(){
     private $settings = array();
}

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

да я знаю

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

это есть

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar Fixed. Исправил коммент

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar попробуй моё. вдруг поможет

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

это ты про это
public function __construct(array $settings=array()){

}

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar угу, замени мое на твоё и попробуй.

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

может вместо приват php private $settings = array(); поставить php return

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar попробуй.

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

нет
Declaration of Ivanzar\TheTwoTowerns\TWWGenerator::__construct() must be compatible with pocketmine\level\generator\Generator::__construct(array $settings = Array) in C:\Users\ivanzar\PocketMine Progect\PocketMine-MP\plugins\DevTools\src\Ivanzar\TheTwoTowerns\TWWGenerator.php on line 0

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

сразу на 0
<php ему не нравиться )

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar <?php или <? сделай

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

<php

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar <?php надо, лал

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

ой у меня <?php

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar скинь весь код

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

вот

<?php
namespace Ivanzar\TheTwoTowerns;

use pocketmine\level\generator\Generator;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;

use pocketmine\math\Vector3;
use pocketmine\block\Block;

class TWWGenerator extends Generator{

    private $random,$level;

    public function __construct(array $settings=array()){
        return $settings = array();
}


    public function getName(){
        return "tww";

    }

    public function getSettings(){

    }

    public function getSpawn(){
        return new Vector3(128, 64, 128);
    }

    public function init(ChunkManager $level,Random $random){
        $this->random = $random;
        $this->level = $level;

    }

    public function generateChunk($chunkX,$chunkZ){

        $chunk = $this->level->getChunk($chunkX, $chunkZ);
        $startX = min($selection[0][0] = 0, $selection[1][0] = 128);
        $endX = max($selection[0][0] = 0, $selection[1][0] = 128);
        $startY = min($selection[0][1] = 0, $selection[1][1] = 128);
        $endY = max($selection[0][1] = 0, $selection[1][1] = 128);
        $startZ = min($selection[0][2] = 0, $selection[1][2] = 128);
        $endZ = max($selection[0][2] = 0, $selection[1][2] = 128);
        for($x = $startX; $x < $endX; ++$x){
                for($y = $startY; $y < $endY; ++$y){
                for($z = $startZ; $z < $endZ; ++$z){
            $chunk->setBlockId($x,$y,$z,1);
        }
        }
        }
    }

    public function populateChunk($chunkX,$chunkZ){

    }

}

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

сейчас жалуется на __construct

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar мля..
сделай так:

public function __construct(){
    private $settings = array();
}

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

private не может быть в функции

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar тогда сделай ее не в конструкте.
А выше, где другие переменные.
В конструкте ничего тогда не пиши. И можно её удалить

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

нет, то же самое

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar что теперь?

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

Declaration of Ivanzar\TheTwoTowerns\TWWGenerator::__construct() must be compatible with pocketmine\level\generator\Generator::__construct(array $settings = Array) in C:\Users\ivanzar\PocketMine Progect\PocketMine-MP\plugins\DevTools\src\Ivanzar\TheTwoTowerns\TWWGenerator.php on line 0

from pocketmine-plugin-tutorials.

xpyctum avatar xpyctum commented on July 17, 2024

@Ivanzar как ты сделал, скинь код

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024
use pocketmine\level\generator\Generator;
use pocketmine\level\ChunkManager;
use pocketmine\utils\Random;

use pocketmine\math\Vector3;
use pocketmine\block\Block;

class TWWGenerator extends Generator{

    private $random,$level;

    public function __construct(){
}


    public function getName(){
        return "tww";

    }

    public function getSettings(){

    }

    public function getSpawn(){
        return new Vector3(128, 64, 128);
    }

    public function init(ChunkManager $level,Random $random){
        $this->random = $random;
        $this->level = $level;

    }

    public function generateChunk($chunkX,$chunkZ){

        $chunk = $this->level->getChunk($chunkX, $chunkZ);
        $startX = min($selection[0][0] = 0, $selection[1][0] = 128);
        $endX = max($selection[0][0] = 0, $selection[1][0] = 128);
        $startY = min($selection[0][1] = 0, $selection[1][1] = 128);
        $endY = max($selection[0][1] = 0, $selection[1][1] = 128);
        $startZ = min($selection[0][2] = 0, $selection[1][2] = 128);
        $endZ = max($selection[0][2] = 0, $selection[1][2] = 128);
        for($x = $startX; $x < $endX; ++$x){
                for($y = $startY; $y < $endY; ++$y){
                for($z = $startZ; $z < $endZ; ++$z){
            $chunk->setBlockId($x,$y,$z,1);
        }
        }
        }
    }

    public function populateChunk($chunkX,$chunkZ){

    }

}

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

ура

private $random,$level,$options;

    public function getSettings(){
        return $this->options;
    }
    public function getName(){
        return "tww";
    }

    public function __construct(array $options = []){
        $this->options = $options;
    }


    public function getSpawn(){
        return new Vector3(128, 64, 128);
    }

from pocketmine-plugin-tutorials.

PEMapModder avatar PEMapModder commented on July 17, 2024

Use English please.

from pocketmine-plugin-tutorials.

PEMapModder avatar PEMapModder commented on July 17, 2024

And avoid doing PocketMine API-related things (like setting blocks) in other threads (including worker threads like AsyncTask), otherwise it will be dangerous.

from pocketmine-plugin-tutorials.

alejzeis avatar alejzeis commented on July 17, 2024

Set blocks in tasks ran by the main thread or scheduler. Spigot doesn't
allow you to do world related things in async threads.

On Thursday, April 16, 2015, PEMapModder [email protected] wrote:

And avoid doing PocketMine API-related things (like setting blocks) in
other threads (including worker threads like AsyncTask), otherwise it will
be dangerous.


Reply to this email directly or view it on GitHub
#16 (comment)
.

from pocketmine-plugin-tutorials.

falkirks avatar falkirks commented on July 17, 2024

If you want to modify chunks asynchronously the best you can get is what MineReset does. It blocks update events to the chunk, serializes it on the main thread, unserializes it on an AsyncTask, calculates chunk updates and then passes it back to the main thread for sending to clients.

from pocketmine-plugin-tutorials.

Ivanzar avatar Ivanzar commented on July 17, 2024

thanks

from pocketmine-plugin-tutorials.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.