I got a problem. I'm trying to make custom mobs with nametags (retextured villagers) despawn every 600 ticks when the chat says "names[rnd2] + " §e left""
if(this.i == 600){
var rnd2 = Math.floor(Math.random()*(names.length));
clientMessage(names[rnd2] + "§e left");
}
Further down in the code...
var rnd = Math.floor(Math.random()*(names.length));
this.spawn = 500;
clientMessage("§e" + names[rnd] + " §ehas joined the game"); Entity.setNameTag(Steve, names[rnd]);
}
if(this.dessage == 0) {
var rnd2 = Math.floor(Math.random()*(names.length));
var rnd1 = Math.floor(Math.random()*(message.length));
The Meaning of Life, the Universe, and Everything.
Join Date:
5/16/2015
Posts:
45
Location:
Mexico
Member Details
You have to set which entity will be affected with Entity.getEntityTypeId(), since you are using the function AddedHook you can try this.
if (Entity.getEntityTypeId(entity) == 15) { //villager
Entity.remove(entity);
}
Thanks, but like I said, I need it to remove certain custom named, custom rendered villagers with the same name the mod chose at the same time the chat said it. Thanks again, -Epic_stuf
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I got a problem. I'm trying to make custom mobs with nametags (retextured villagers) despawn every 600 ticks when the chat says "names[rnd2] + " §e left""
if(this.i == 600){
var rnd2 = Math.floor(Math.random()*(names.length));
clientMessage(names[rnd2] + "§e left");
}
Further down in the code...
var rnd = Math.floor(Math.random()*(names.length));
this.spawn = 500;
clientMessage("§e" + names[rnd] + " §ehas joined the game"); Entity.setNameTag(Steve, names[rnd]);
}
if(this.dessage == 0) {
var rnd2 = Math.floor(Math.random()*(names.length));
var rnd1 = Math.floor(Math.random()*(message.length));
this.dessage = 100;
clientMessage("<" + names[rnd2] + ">" + " " + message[rnd1]);
}
}
}
function entityAddedHook(entity) {
if (Entity.getEntityTypeId() == 15) { //villager
Entity.remove(entity);
}
}
I am posting this because it won't work. I don't want a button, a GUI or a command. All I want is for all villagers to be removed upon world restart.
You have to set which entity will be affected with Entity.getEntityTypeId(), since you are using the function AddedHook you can try this.
if (Entity.getEntityTypeId(entity) == 15) { //villager
Entity.remove(entity);
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumPut this in your Mod it removes all villagers:
var ents=Entity.getAll();
for(var i=0; i<ents.length;i++){
if(Entity.getEntityTypeId(ents[i])==15){
Entity.remove(ents[i]);
}
}
Or this to remove all villagers with your renderers, so you won´t remove villagers that are normal:
var ents=Entity.getAll();
for(var i=0; i<ents.length;i++){
if(Entity.getEntityTypeId(ents[i])==15 && Entity.getRenderType(ents[i])==YOURRENDERTYPE){
Entity.remove(ents[i]);
}
}
Thanks, but like I said, I need it to remove certain custom named, custom rendered villagers with the same name the mod chose at the same time the chat said it. Thanks again, -Epic_stuf