Comments (38)
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.
What if I am not sure? :P
from pocketmine-plugin-tutorials.
Just to explain the principle of generation. I honestly didn't quite understand what i write xD
from pocketmine-plugin-tutorials.
i forgot load: STARTUP )
from pocketmine-plugin-tutorials.
@Ivanzar Айайай, плахой!!
:D
from pocketmine-plugin-tutorials.
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.
public function __construct(){
private $settings = array();
}
from pocketmine-plugin-tutorials.
да я знаю
from pocketmine-plugin-tutorials.
это есть
from pocketmine-plugin-tutorials.
@Ivanzar Fixed. Исправил коммент
from pocketmine-plugin-tutorials.
@Ivanzar попробуй моё. вдруг поможет
from pocketmine-plugin-tutorials.
это ты про это
public function __construct(array $settings=array()){
}
from pocketmine-plugin-tutorials.
@Ivanzar угу, замени мое на твоё и попробуй.
from pocketmine-plugin-tutorials.
может вместо приват php private $settings = array();
поставить php return
from pocketmine-plugin-tutorials.
@Ivanzar попробуй.
from pocketmine-plugin-tutorials.
нет
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.
сразу на 0
<php ему не нравиться )
from pocketmine-plugin-tutorials.
@Ivanzar <?php или <? сделай
from pocketmine-plugin-tutorials.
<php
from pocketmine-plugin-tutorials.
@Ivanzar <?php надо, лал
from pocketmine-plugin-tutorials.
ой у меня <?php
from pocketmine-plugin-tutorials.
@Ivanzar скинь весь код
from pocketmine-plugin-tutorials.
вот
<?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.
сейчас жалуется на __construct
from pocketmine-plugin-tutorials.
@Ivanzar мля..
сделай так:
public function __construct(){
private $settings = array();
}
from pocketmine-plugin-tutorials.
private не может быть в функции
from pocketmine-plugin-tutorials.
@Ivanzar тогда сделай ее не в конструкте.
А выше, где другие переменные.
В конструкте ничего тогда не пиши. И можно её удалить
from pocketmine-plugin-tutorials.
нет, то же самое
from pocketmine-plugin-tutorials.
@Ivanzar что теперь?
from pocketmine-plugin-tutorials.
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 как ты сделал, скинь код
from pocketmine-plugin-tutorials.
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.
ура
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.
Use English please.
from pocketmine-plugin-tutorials.
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.
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.
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.
thanks
from pocketmine-plugin-tutorials.
Related Issues (19)
- Suggestion: Information on config files and storing data HOT 15
- help my plugin HOT 9
- Where can I get documentation on plugin.yml? HOT 4
- How to Vanish player HOT 3
- timer HOT 1
- Buttton or icon HOT 2
- explosion HOT 1
- I love this :D HOT 1
- Examples HOT 2
- inventory HOT 10
- How to make FormAPI? HOT 3
- Continue
- Pocketmine test
- make a tutorial on yaml, please. :-) HOT 14
- how to put a block HOT 1
- ChatBlocker
- New Bug HOT 4
- How to write in yml file ? HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pocketmine-plugin-tutorials.