Hey guys. How do you remove dropped items? The entity I'd is 64, and I can't get them to go. MrARM did it in his too many items mod when a button is pressed. I want to add a button to my NukePE mod to clear lag.
Also, how do you call a pre-defined code? I know that in python u use:
Def whatever():
Dowhatever= blah
Return Dowhatever
Bot how to do in JS? Cause I want to add stuff to GUI but what the code I am calling in a separate place, so it is easier to read, and edit.
There's no getAllEntities function. If you want to make dropped items do not spawn:
function entityAddedHook(e){
Entity.remove(e);
}
Not sure it's correcy.
MrARM. in your Too Many Items mod, you used a button to remove dropped items.
Remember the NukePE mod that you helped me with a while back?
well, that causes alot of lag with the dropped items and I need a button to remove them.
You seem to be the only one who knows how to have a GUI button remove dropped entities, could you post a
sample script please?
Thanks
So look at my source... There's a something library-like on the end:
/*
Too Many Items Script by MrARM
Licensed on MIT License
*/
//...
// MOB MANAGER
var entities = [];
function entityAddedHook(ent){
entities.push(ent);
}
function entityRemovedCallback(ent){
entities.splice(entities.indexOf(ent));
}
function killAll(entType){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.remove(entities[i]);
}
}
}
function ageAll(entType, age){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setAnimalAge(entities[i], age);
}
}
}
function fireAll(entType, time){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setFireTicks(entities[i], time);
}
}
}
function healAll(entType, lives){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setHealth(entities[i], lives);
}
}
}
So in short...
// code from Too Many Items script by MrARM which is Licensed on MIT License
var entities = [];
function entityAddedHook(ent){
entities.push(ent);
}
function entityRemovedCallback(ent){
entities.splice(entities.indexOf(ent));
}
function killAll(entType){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.remove(entities[i]);
}
}
}
And then use: killAll(64);
ahh!!! "I see said the blind man, I SEE!"
AWESOME so i could do:
var entities = [];
function entityAddedHook(ent){
entities.push(ent);
}
function entityRemovedCallback(ent){
entities.splice(entities.indexOf(ent));
}
function killAll(entType){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.remove(entities[i]);
}
}
}
function useItem (x, y, z, itemId, blockId, side)
{
if (itemId == 280);
{
killAll(64);
}
}
right?also, this will only work on android, correct?
So look at my source... There's a something library-like on the end:
/*
Too Many Items Script by MrARM
Licensed on MIT License
*/
//...
// MOB MANAGER
var entities = [];
function entityAddedHook(ent){
entities.push(ent);
}
function entityRemovedCallback(ent){
entities.splice(entities.indexOf(ent));
}
function killAll(entType){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.remove(entities[i]);
}
}
}
function ageAll(entType, age){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setAnimalAge(entities[i], age);
}
}
}
function fireAll(entType, time){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setFireTicks(entities[i], time);
}
}
}
function healAll(entType, lives){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.setHealth(entities[i], lives);
}
}
}
So in short...
// code from Too Many Items script by MrARM which is Licensed on MIT License
var entities = [];
function entityAddedHook(ent){
entities.push(ent);
}
function entityRemovedCallback(ent){
entities.splice(entities.indexOf(ent));
}
function killAll(entType){
for(var i=0;i<entities.length;i++){
if(Entity.getEntityTypeId(entities[i]) == entType){
Entity.remove(entities[i]);
}
}
}
And then use: killAll(64);
THANKS it works!
also, could you report this bug to 500ise?
randomly when running blocklauncher, it freezes my phone. i cant do anything about it except take my batt out and reboot...
im using a Samsung Infuse i997 4G
i am running a custom jellybean ROM cause the highest supported (ATT) OS wont run MCPE.
Also, how do you call a pre-defined code? I know that in python u use:
Def whatever():
Dowhatever= blah
Return Dowhatever
Bot how to do in JS? Cause I want to add stuff to GUI but what the code I am calling in a separate place, so it is easier to read, and edit.
Please help.
Thanks!
~MattdaveMatt
Just put the code into a custom function and call the function when you want to.
To clear all entities:
I'm sure there is a get all entities function.
MrARM. in your Too Many Items mod, you used a button to remove dropped items.
Remember the NukePE mod that you helped me with a while back?
well, that causes alot of lag with the dropped items and I need a button to remove them.
You seem to be the only one who knows how to have a GUI button remove dropped entities, could you post a
sample script please?
Thanks
ahh!!! "I see said the blind man, I SEE!"
AWESOME so i could do:
var entities = []; function entityAddedHook(ent){ entities.push(ent); } function entityRemovedCallback(ent){ entities.splice(entities.indexOf(ent)); } function killAll(entType){ for(var i=0;i<entities.length;i++){ if(Entity.getEntityTypeId(entities[i]) == entType){ Entity.remove(entities[i]); } } } function useItem (x, y, z, itemId, blockId, side) { if (itemId == 280); { killAll(64); } }right?also, this will only work on android, correct?
THANKS it works!
also, could you report this bug to 500ise?
randomly when running blocklauncher, it freezes my phone. i cant do anything about it except take my batt out and reboot...
im using a Samsung Infuse i997 4G
i am running a custom jellybean ROM cause the highest supported (ATT) OS wont run MCPE.
Thanks!
~MattdaveMatt