A ModPE Library is like a ModPE Plugin/Add-On. This is something I hope would catch on. These Libraries contain functions that make modding a lot easier for modders. Like this library, it is designed to add more advanced functions in the ModPE API.
What is StructureJS?
StructureJS is a ModPE Functions and Objects Library. This is an API that would make Structure building in ModPE a lot easier. Designed especially for building structures through scripts.
How does it work?
The Library is based off of one object: A Plane.
Not the flying vehicles but in geometrical terms. A Plane includes an X, a Y, and a Z axis. The system works very much like the coordinate location system already built in the game as well as ModPE. The height, width, and depth of the plane is specified by certain parameters.
E.g.
var test = new Plane(x, y, z, h, w, d);
//This is how a Plane would be created.
//x, y, z is the coordinates of where the Plane is placed
//h, w, d are the 3 Dimensions required for the Plane to exist. (Height, width, and depth)
How do I use it?
For now, what you must do is Copy and Paste the contents of the StructureJS script into your script.
I am still waiting on certain BlockLauncher functions to make this process of using Libraries easier.
How does this make things easier?
The next two codes create the same structure, a 9x9x9 hollow cobblestone box with a piece of glowstone in the center.
Without StructureJS:
function useItem(x, y, z, itemId, blockId, side){
setTile(x, y, z, 4);
setTile(x+1, y, z, 4);
setTile(x+2, y, z, 4);
//Blah, blah... too lazy to write the rest
}
With StructureJS:
function useItem(x, y, z, itemId, blockId, side){
var box = new Plane(x, y, z, 9, 9, 9);
box.hfill(4);
box.setBlock(5, 1, 5, 89);
}
The ALMIGHTY Functions!
These are the functions that can be used with a Plane.
fill(block); //Fills the plane with the specified block
hfill(block); //Fills the plane with a hollow box made out of the specified block
setBlock(x, y, z, block); //Sets a block within the plane
setPlatform(y, block); //Sets a platform filling the width and depth of the plane at the specified y coordinate
spawnMob(x, y, z, modId, quantity); //Spawns a mob within the plane
rX(max, min); //Random X Coordinate
rY(max, min); //Random Y Coordinate
rZ(max, min); //Random Z Coordinate
Examples?
Well, here you go. (With comments, too!)
/**Creeper Hotel**/
//Create a new Plane that spawns randomly above ground
var room = new Plane(rX(256, 0), rY(128, 64), rZ(256, 0), 15, 15, 15);
//Glass cuboid
room.hfill(20);
//The floors
for(var i = 0; i <= 15; i + 5){ //Five blocks between floors
//Wood for the floors
room.setPlatform(i, 5);
//Spawn 5 creepers on every floor
room.spawnMob(7, i+1, 7, 33, 5);
}
I like it! Hope it actually catches on! I could see it making ModPE more available to new users.. Oh gawd! I can see it now it'll be a mix Stick gives you diamonds and a huge ass cube!
IOS Or Android? I can't test on my Android right now. I've only been testing on IOS. Which could be the root of the problem.
That might be the problem. I used some functions in the library that aren't supported on iOS. But I don't see a problem as log as you don't call those functions. I really don't see the problem. I test only on Android because I do not have an iOS Device. Try it another time.
That might be the problem. I used some functions in the library that aren't supported on iOS. But I don't see a problem as log as you don't call those functions. I really don't see the problem. I test only on Android because I do not have an iOS Device. Try it another time.
Okaidokie! I was really looking forward to this but I will have to deal with my ridiculously long scripts...
One of the coolest things I have ever seen in module!!
"Module"?
Mod is abbr. Modification.
P.S. arjay_07 There's no var myMods[] in JS (your signature), if it is JS.
Rollback Post to RevisionRollBack
I can be found on Freenode IRC channels #pocketmine, #ModPEScripts, #LegendOfMCPE, #pmplugins or #BeaconMine.
I am a PocketMine-MP plugin developer. I hate it when people think that I love stupid admin positions. Being an admin is nothing compared to being a plugin developer.
I am also a main developer of BlockServer, a work-in-progress MCPE server software. You are welcome to download it, but it so far onlly spawns you in the upther (above the world). You can chat, though.
I do not own this server but I just love to put this banner here:
P.S. arjay_07 There's no var myMods[] in JS (your signature), if it is JS.
He was making a 'var' it could be anything he wanted. It would still be 'useable' I think there are like two exceptions none of which could be used in his signature.
He was making a 'var' it could be anything he wanted. It would still be 'useable' I think there are like two exceptions none of which could be used in his signature.
I mean when declaring a js var you need not tell the environment it is an array i.e. use []. This is syntax error.
Most JS environments don't accept [] as part of var name.
In fact I only know JS that uses var to declare var.
I can be found on Freenode IRC channels #pocketmine, #ModPEScripts, #LegendOfMCPE, #pmplugins or #BeaconMine.
I am a PocketMine-MP plugin developer. I hate it when people think that I love stupid admin positions. Being an admin is nothing compared to being a plugin developer.
I am also a main developer of BlockServer, a work-in-progress MCPE server software. You are welcome to download it, but it so far onlly spawns you in the upther (above the world). You can chat, though.
I do not own this server but I just love to put this banner here:
Then fix it now. At least add this library into it.
Rollback Post to RevisionRollBack
I can be found on Freenode IRC channels #pocketmine, #ModPEScripts, #LegendOfMCPE, #pmplugins or #BeaconMine.
I am a PocketMine-MP plugin developer. I hate it when people think that I love stupid admin positions. Being an admin is nothing compared to being a plugin developer.
I am also a main developer of BlockServer, a work-in-progress MCPE server software. You are welcome to download it, but it so far onlly spawns you in the upther (above the world). You can chat, though.
I do not own this server but I just love to put this banner here:
To post a comment, please login or register a new account.
NOTE: This is NOT a Mod. This is a ModPE Library.
What is a ModPE Library?
A ModPE Library is like a ModPE Plugin/Add-On. This is something I hope would catch on. These Libraries contain functions that make modding a lot easier for modders. Like this library, it is designed to add more advanced functions in the ModPE API.
What is StructureJS?
StructureJS is a ModPE Functions and Objects Library. This is an API that would make Structure building in ModPE a lot easier. Designed especially for building structures through scripts.
How does it work?
The Library is based off of one object: A Plane.
Not the flying vehicles but in geometrical terms. A Plane includes an X, a Y, and a Z axis. The system works very much like the coordinate location system already built in the game as well as ModPE. The height, width, and depth of the plane is specified by certain parameters.
E.g.
How do I use it?
For now, what you must do is Copy and Paste the contents of the StructureJS script into your script.
I am still waiting on certain BlockLauncher functions to make this process of using Libraries easier.
How does this make things easier?
The next two codes create the same structure, a 9x9x9 hollow cobblestone box with a piece of glowstone in the center.
Without StructureJS:
function useItem(x, y, z, itemId, blockId, side){ setTile(x, y, z, 4); setTile(x+1, y, z, 4); setTile(x+2, y, z, 4); //Blah, blah... too lazy to write the rest }With StructureJS:
function useItem(x, y, z, itemId, blockId, side){ var box = new Plane(x, y, z, 9, 9, 9); box.hfill(4); box.setBlock(5, 1, 5, 89); }The ALMIGHTY Functions!
These are the functions that can be used with a Plane.
Examples?
Well, here you go. (With comments, too!)
/**Creeper Hotel**/ //Create a new Plane that spawns randomly above ground var room = new Plane(rX(256, 0), rY(128, 64), rZ(256, 0), 15, 15, 15); //Glass cuboid room.hfill(20); //The floors for(var i = 0; i <= 15; i + 5){ //Five blocks between floors //Wood for the floors room.setPlatform(i, 5); //Spawn 5 creepers on every floor room.spawnMob(7, i+1, 7, 33, 5); }Don't Like Reading?
Check out the video!
Awesome! Where can I get it?
Well you can get it here!
DOWNLOADS:
BETA 2.8:
https://db.tt/S3U3krwm
Suggestions?
Email me: [email protected]
or
Comment below!
Click Banner to SUBSCRIBE!!! I'm in the Team Flame Clan!!! Click that little green arrow!! -------------->
rX(max, min), rY(min, max), and rZ(min, max) creates a random number between the min and max Examples- var test = new Plane(rX(0, 256), rY(64, 128), rZ(0, 256), 3, 3, 3); //Creates a new plane test.fill(4); //fill plane with cobble Coming Soon: plane.color(color); //Replaces existing blocks Plane.colorFill(color); //Fills Plane.colorGradient(color1, color2); //Gradient color change from color1 to color2 Plane.colorHollow(color); //Hollow color tube **/ /** **StructureJS BETA 2.0** **Create structures easily!** © Copyright 2013 Arjay07 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. **/ function Plane(px, py, pz, h, w, d){ var x, y, z; this.x = px; this.y = py; this.z = pz; this.h = h; this.w = w; this.d = d; this.fill = fillPlane; this.hfill = fillHollow; this.setBlock = setBlockPlane; this.setPlatform = setPlanePlatform; this.spawnMob = spawnPlaneMob; } function fillPlane(block){ //fill the whole plane for(var y = this.y; y <= this.y + this.h; y++){ for(var x = this.x; x <= this.x + this.w; x++){ for(var z = this.z; z <= this.z + this.d; z++){ setTile(x, y, z, block); } } } } function fillHollow(block){ for(var y = this.y; y <= this.y + this.h; y++){ for(var x = this.x; x <= this.x + this.w; x++){ for(var z = this.z; z <= this.z + this.d; z++){ setTile(x, y, z, block); } } } //set the hollowness
for(var y1 = this.y+1; y1 <= this.y + this.h-1; y1++){
for(var x1 = this.x+1; x1 <= this.x + this.w-1; x1++){
for(var z1 = this.z+1; z1 <= this.z + this.d-1; z1++){
setTile(x1, y1, z1, 0);
}
}
}
}
//Set a block within the plane
function setBlockPlane(x, y, z, block){
x = this.x + x;
y = this.y + y;
z = this.z + z;
setTile(x, y, z, block);
}
function setPlanePlatform(py, block){
var y = this.y + py;
for(var x = this.x; x <= this.x + this.w; x++){
for(var z = this.z; z <= this.z + this.d; z++){
setTile(x, y, z, block);
}
}
}
function rX(max, min){
var x = Math.floor(Math.random()*(max-min)+min);
return x;
}
function rY(max, min){
var y = Math.floor(Math.random()*(max-min)+min);
return y;
}
function rZ(max, min){
var z = Math.floor(Math.random()*(max-min)+min);
return z;
}
function spawnPlaneMob(px, py, pz, mob, quantity){
var x = this.x + px;
var y = this.y + py;
var z = this.z + pz;
//How many mobs to spawn?
for(var i = 0; i <= quantity; i++){
Level.spawnMob(x, y, z, mob);
}
}
function useItem(x,y,z,itemId,blockId,side)
{
var MCPE = new Plane(x, y, z, 20, 20, 20);
if(itemId==280)
{
MCPE.hfill(4);
}
}Make sure you copied and pasted everything from any "/**"
Everything seems to work fine for me.
Email me you're entire script.
I copied and pasted your script and fixed your comment error and it worked perfectly. I don't see the problem.
That might be the problem. I used some functions in the library that aren't supported on iOS. But I don't see a problem as log as you don't call those functions. I really don't see the problem. I test only on Android because I do not have an iOS Device. Try it another time.
"Module"?
Mod is abbr. Modification.
P.S. arjay_07 There's no var myMods[] in JS (your signature), if it is JS.
Most JS environments don't accept [] as part of var name.
In fact I only know JS that uses var to declare var.
haha old signature. Never had time to fix it. by the way, who wants a Plane.centerX() function? (Along with y and z)