Entity.getEntityAtPosition(float x, float y, float z); //Returns an Entity at the position
Entity.getMobSkin(); //Returns a string/url of the mob's skin
ModPE.overrideFile(String file, String url); //Or does override texture already work for this?
ModPE.importPackage(javapackage); //Imports a java package
//Anymore?
Entity.getEntityAtPosition(float x, float y, float z); //Returns an Entity at the position
Entity.getMobSkin(); //Returns a string/url of the mob's skin
ModPE.overrideFile(String file, String url); //Or does override texture already work for this?
ModPE.importPackage(javapackage); //Imports a java package
//Anymore?
OverrideTexture works for this; isn't importPackage defined by Rhino? Or am I dumb?
Re. getEntityAtPosition: do you need a radius as well?
OverrideTexture works for this; isn't importPackage defined by Rhino? Or am I dumb?
Re. getEntityAtPosition: do you need a radius as well?
It seems to not work. I saw this on their site. It just says importPackage not defined. A radius would be better so exact positions won't be needed too much. It should only get the entity closest to the center of the search area.
Seems that getAllEntities is not yet implemented. I used this to make breeding mod.
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:
I think a deleteWorldHook() would be very good, with the parameters worldName, worldDir, anyOtherAdditionalParams, as instead of saving a file in the world directory so it can,t be deleted in-game and must be deleted manually with a file manager, you could just use ModPE.saveData() and delete it when a world is deleted. And also, ModPE.saveEntity(entity) would be pretty good too, allowing for custom mobs scripts.
What would be the point of deleting it in-game but still having to delete it in a file manager?
Entity.getEntityAtPosition(float x, float y, float z); //Returns an Entity at the position
Entity.getMobSkin(); //Returns a string/url of the mob's skin
ModPE.overrideFile(String file, String url); //Or does override texture already work for this?
ModPE.importPackage(javapackage); //Imports a java package
//Anymore?
I was able to create a custom function for Entity.getEntityAtPositionpm me if you want it
This is actually already possible. If you want I can PM you the code.
Put it here
For anyone who needs Entity.getEntityAtPosition() immediately here is some code:
var ents = new Array();
function entityAddedHook(ent){
ents.push(ent);
}
function entityRemovedHook(ent){
if(ents.indexOf(ent) != -1)ents.splice(ents.indexOf(ent));
}
Entity.getEntityAtPosition = function(x, y, z, r){
var ent = null;
for(var i = 0; i < ents.length; i++){
var e = ents[i];
var ex = Math.floor(Entity.getX(e));
var ey = Math.floor(Entity.getY(e));
var ez = Math.floor(Entity.getZ(e));
var rx = Math.max(ex, x) - Math.min(ex, x);
var ry = Math.max(ey, y) - Math.min(ey, y);
var rz = Math.max(ez, z) - Math.min(ez, z);
if(rx == r || ry == r || rz == r){
ent = e;
break;
}
}
return ent;
}
Just copy that to your script and you should be able to use Entity.getEntityAtPosition. Use this until the next beta comes out with the function :PAlso if you want to save entities I had an idea. I was working on a library but I thought I'd share the concept first.
First, you need to create an array of entities. For each entity store their entity id, skin, rendertype, etc... If those are possible yet. Afterwards you can store the data in a file and you can then remove all entities when you leave the game or join the game, your choice. Then spawn all entities. So technically all you're doing is creating a file that replaced the job of the entities.dat file.
Controlling a script's enable status. This is an altered version of MrARM's script, put into a custom function. When calling the function, make sure that the first parameter is a string and make sure you don't include the extension ".js".
function controlScript(file, boolean){ //An example of file is "/games/scripts/ultimate_script"
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
ctx.runOnUiThread(new java.lang.Runnable({ run: function(){
try{
var rootDir = android.os.Environment.getExternalStorageDirectory();
var scriptDir = new java.io.File(rootDir, file + ".js");
net.zhuoweizhang.mcpelauncher.ScriptManager.setEnabled(scriptDir, boolean);
}catch(error){
print("The script could not be controlled, because: ");
}
}}));
}
For anyone who needs Entity.getEntityAtPosition() immediately here is some code:
var ents = new Array();
function entityAddedHook(ent){
ents.push(ent);
}
function entityRemovedHook(ent){
if(ents.indexOf(ent) != -1)ents.splice(ents.indexOf(ent));
}
Entity.getEntityAtPosition = function(x, y, z, r){
var ent = null;
for(var i = 0; i < ents.length; i++){
var e = ents[i];
var ex = Math.floor(Entity.getX(e));
var ey = Math.floor(Entity.getY(e));
var ez = Math.floor(Entity.getZ(e));
var rx = Math.max(ex, x) - Math.min(ex, x);
var ry = Math.max(ey, y) - Math.min(ey, y);
var rz = Math.max(ez, z) - Math.min(ez, z);
if(rx == r || ry == r || rz == r){
ent = e;
break;
}
}
return ent;
}
Just copy that to your script and you should be able to use Entity.getEntityAtPosition. Use this until the next beta comes out with the function
Also if you want to save entities I had an idea. I was working on a library but I thought I'd share the concept first.
First, you need to create an array of entities. For each entity store their entity id, skin, rendertype, etc... If those are possible yet. Afterwards you can store the data in a file and you can then remove all entities when you leave the game or join the game, your choice. Then spawn all entities. So technically all you're doing is creating a file that replaced the job of the entities.dat file.
The problem is, are those mobs spawned before the script is loaded, saved?
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.
K? But what would that return? An array? What?
Uhm... like a multiple gettile.. idk :/
Follow @Darth377Apps
Please check out my Twitter account!

I have been working on a few games!
Give me ALL THE INTERNETS!
Idk. Maybe it should be
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOverrideTexture works for this; isn't importPackage defined by Rhino? Or am I dumb?
Re. getEntityAtPosition: do you need a radius as well?
Can you tell me how ModPE.setItemCategory() works? And can you tell which tabs have the value of which numbers?
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI don't even know. I'm still looking into this.
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
It seems to not work. I saw this on their site. It just says importPackage not defined. A radius would be better so exact positions won't be needed too much. It should only get the entity closest to the center of the search area.
What would be the point of deleting it in-game but still having to delete it in a file manager?
I was able to create a custom function for Entity.getEntityAtPositionpm me if you want it
Follow @Darth377Apps
Please check out my Twitter account!

I have been working on a few games!
Give me ALL THE INTERNETS!
setOtherScriptState("script_name", true/false); //sets another script active/disabled
This is actually already possible. If you want I can PM you the code.
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
Put it here
For anyone who needs Entity.getEntityAtPosition() immediately here is some code:
var ents = new Array(); function entityAddedHook(ent){ ents.push(ent); } function entityRemovedHook(ent){ if(ents.indexOf(ent) != -1)ents.splice(ents.indexOf(ent)); } Entity.getEntityAtPosition = function(x, y, z, r){ var ent = null; for(var i = 0; i < ents.length; i++){ var e = ents[i]; var ex = Math.floor(Entity.getX(e)); var ey = Math.floor(Entity.getY(e)); var ez = Math.floor(Entity.getZ(e)); var rx = Math.max(ex, x) - Math.min(ex, x); var ry = Math.max(ey, y) - Math.min(ey, y); var rz = Math.max(ez, z) - Math.min(ez, z); if(rx == r || ry == r || rz == r){ ent = e; break; } } return ent; }Just copy that to your script and you should be able to use Entity.getEntityAtPosition. Use this until the next beta comes out with the function :PAlso if you want to save entities I had an idea. I was working on a library but I thought I'd share the concept first.
First, you need to create an array of entities. For each entity store their entity id, skin, rendertype, etc... If those are possible yet. Afterwards you can store the data in a file and you can then remove all entities when you leave the game or join the game, your choice. Then spawn all entities. So technically all you're doing is creating a file that replaced the job of the entities.dat file.
function controlScript(file, boolean){ //An example of file is "/games/scripts/ultimate_script" var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); ctx.runOnUiThread(new java.lang.Runnable({ run: function(){ try{ var rootDir = android.os.Environment.getExternalStorageDirectory(); var scriptDir = new java.io.File(rootDir, file + ".js"); net.zhuoweizhang.mcpelauncher.ScriptManager.setEnabled(scriptDir, boolean); }catch(error){ print("The script could not be controlled, because: "); } }})); }Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
The problem is, are those mobs spawned before the script is loaded, saved?