Entity.getEntityTypeId(ent) returns the kind of an Entity, but you have no input...
Do it so:
(inside function modTick())
var ents=Entity.getAll(); //ents is an array, and Entity.getAll() fills it with all Entitys
for(var i=0; i<ents.length; i++){ //loops and array are a good team, because you can easily go through an array with loops
if(Level.getTile(Entity.getX(ents[i]), Entity.getY(ents[i])-2, Entity.getZ(ents[i]))==28){ //just a little bit less lines, DON´T forget the Entity.getX(ents[i])
Minecraft has really much Entitys at one time in the game, so modTick() does really much really often, so it is maybe better to do this every [...] ticks instead of every tick, because otherwise it will slow down the game.
Entity.getEntityTypeId(ent) returns the kind of an Entity, but you have no input...
Do it so:
(inside function modTick())
var ents=Entity.getAll(); //ents is an array, and Entity.getAll() fills it with all Entitys
for(var i=0; i<ents.length; i++){ //loops and array are a good team, because you can easily go through an array with loops
if(Level.getTile(Entity.getX(ents), Entity.getY(ents)-2, Entity.getZ(ents))==28){ //just a little bit less lines, DON´T forget the Entity.getX(ents[i])
Entity.setHealth(ents, Entity.getHealth(ents)-1);
}
}
Minecraft has really much Entitys at one time in the game, so modTick() does really much really often, so it is maybe better to do this every [...] ticks instead of every tick, because otherwise it will slow down the game.
Thank you, although is not really working. I did not forget the Entity.getX(ents) and I even tried using the specific mob and nothing.
The Meaning of Life, the Universe, and Everything.
Join Date:
5/16/2015
Posts:
45
Location:
Mexico
Member Details
@Clagdriff. It wasn't your mistake. I realized if you want to get the block for an entity that is not the player, you have to use Entity.getY()-1 and it works. Thanks for all the help.
I have another question. It is possible to get the x,y,z values of all the same kind of blocks using getTile and modTick? For example. Can I turn all the grass blocks into sand and similar?
@Clagdriff. It wasn't your mistake. I realized if you want to get the block for an entity that is not the player, you have to use Entity.getY()-1 and it works. Thanks for all the help.
I have another question. It is possible to get the x,y,z values of all the same kind of blocks using getTile and modTick? For example. Can I turn all the grass blocks into sand and similar?
You can use loops to get all blocks and look which blocks are the same (maybe save their position in an array). But this will cause a (maybe big) lag.
Hi. I need help installing mods on a galaxy s4 mini. I have block launcher installed. My problem is that most of the mods I have found are in zip files of course, and when extracted I get "mod name".zip and "mod name".js. I can get the .js file to install but then I start getting a bunch of messages like "this icon is missing" or whatever it might be. So my question is where does the "mod name".zip file go and how to use Block Launcher to get it there?
Hi. I need help installing mods on a galaxy s4 mini. I have block launcher installed. My problem is that most of the mods I have found are in zip files of course, and when extracted I get "mod name".zip and "mod name".js. I can get the .js file to install but then I start getting a bunch of messages like "this icon is missing" or whatever it might be. So my question is where does the "mod name".zip file go and how to use Block Launcher to get it there?
Extract the .js-file, open BlockLauncher, click on the tool-button in the top center, click on manage ModPE-Scripts, click on import, choose the .js-file, ready!
(If you try to open the .js-file you can choose import with BlockLauncher, but sometimes you need to enable it over the manage ModPE-Scripts.)
Extract the .js-file, open BlockLauncher, click on the tool-button in the top center, click on manage ModPE-Scripts, click on import, choose the .js-file, ready!
(If you try to open the .js-file you can choose import with BlockLauncher, but sometimes you need to enable it over the manage ModPE-Scripts.)
Thanks for the reply but I got that part, What I need to know is where the other zip file goes or whatever because it has all the icons and textures for the mod. The mod is buildcraft, the file I downloaded was "ajtycbdfgdhrdbfvsyudgf.zip" and it was really named something like that, lol, when I extracted it I got two files, buildcraft.zip and buildcraft.js. The buildcraft.js file imported fine through Block Launcher but when I tried to start the game I get these erros for missing icons and such, so they must be in the buildcraft.zip file. So that is what I need to know what to do with it or where to put it?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Do I delete the speech marks?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe BlockLauncher functions list says it is Player.canFly()...
But maybe both work.
ModTick example:
var tick = 600;
function modTick(){
tick--;
if(tick==0){
tick=600;
clientMessage("spam every 30 seconds");
}
}
Activate using an item:
var active = false;
function useItem(x,y,z,itemId,blockId){
if(item==280){
active = true //if tap with stick activate modtick
}
}
var tick = 600;
function modTick(){
if(active){ //if active is true
tick--; //tick -1 per tick 20 a second
if(tick==0){
tick=600;
clientMessage("spam every 30 seconds");
}
}
}
Want Custom ModPE functions? Look here -> WolfyPE ModPE functions
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumvar closebutton = new android.widget.Button(ctx);
closebutton.setText('Close');
closebutton.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg){
menu.dismiss(); //change menu with the name of your GUI
menu=null; //not necessary, but keepa RAM free
}
}));
layout.addView(closebutton);
If the background is false I would like to know how it should look (image?).
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumvar closebutton = new android.widget.Button(ctx);
closebutton.setText('Close');
closebutton.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg){
if(menu!=null){
menu.dismiss(); //close Menu
menu=null;
}else{
menu(); //change menu() with the function that opens a GUI
}
}
}));
layout.addView(closebutton);
Can you please help me with my mod? Everytime I tried to enable it, an error shows up. It says
Please and thankyou!
If you want to check the js file, here!
*no copying pls, tnx...
Want to check my mod? Here!
Looks like you have a variable with a number for the name.
Hmm? I can't see anything like that... all of my variables are letters.
Edit: I found what's wrong! It's the
part! It seems that you can't use 'Objects' (like: "string", "null", "array", etc.) for function hooks. Hahaha.
Have you tried using an if statement in the getTile part?
as in if(getTile(x,y,z)==*id of the block*){
*the things you want to happen* }
I want to know when any kind of mob is standing on a particular block and then take damage while doing so.
I tried using this.
(inside function modTick)
var np=Entity.getEntityTypeId();
var x=Entity.getX(np);
var y=Entity.getY(np);
var z=Entity.getZ(np);
if(Level.getTile(x,y-2,z)==28){
Entity.setHealth(np,Entity.getHealth(np)-1):}
But nothing happens. Can somebody please tell me what am I doing wrong?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumEntity.getEntityTypeId(ent) returns the kind of an Entity, but you have no input...
Do it so:
(inside function modTick())
var ents=Entity.getAll(); //ents is an array, and Entity.getAll() fills it with all Entitys
for(var i=0; i<ents.length; i++){ //loops and array are a good team, because you can easily go through an array with loops
if(Level.getTile(Entity.getX(ents[i]), Entity.getY(ents[i])-2, Entity.getZ(ents[i]))==28){ //just a little bit less lines, DON´T forget the Entity.getX(ents[i])
Entity.setHealth(ents[i], Entity.getHealth(ents[i])-1);
}
}
Minecraft has really much Entitys at one time in the game, so modTick() does really much really often, so it is maybe better to do this every [...] ticks instead of every tick, because otherwise it will slow down the game.
What would I do if I am trying to make a pickaxe in a mod and i want it to actually break diamonds and other materials instead of just haste
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumUse this Hook:
function startDestroyBlock(x, y, z, side){}Thank you, although is not really working. I did not forget the Entity.getX(ents) and I even tried using the specific mob and nothing.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI think that's my mistake because I forgot it. Please replace all ents with ents[i] and try it again.
@Clagdriff. It wasn't your mistake. I realized if you want to get the block for an entity that is not the player, you have to use Entity.getY()-1 and it works. Thanks for all the help.
I have another question. It is possible to get the x,y,z values of all the same kind of blocks using getTile and modTick? For example. Can I turn all the grass blocks into sand and similar?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou can use loops to get all blocks and look which blocks are the same (maybe save their position in an array). But this will cause a (maybe big) lag.
Hi. I need help installing mods on a galaxy s4 mini. I have block launcher installed. My problem is that most of the mods I have found are in zip files of course, and when extracted I get "mod name".zip and "mod name".js. I can get the .js file to install but then I start getting a bunch of messages like "this icon is missing" or whatever it might be. So my question is where does the "mod name".zip file go and how to use Block Launcher to get it there?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumExtract the .js-file, open BlockLauncher, click on the tool-button in the top center, click on manage ModPE-Scripts, click on import, choose the .js-file, ready!
(If you try to open the .js-file you can choose import with BlockLauncher, but sometimes you need to enable it over the manage ModPE-Scripts.)
Thanks for the reply but I got that part, What I need to know is where the other zip file goes or whatever because it has all the icons and textures for the mod. The mod is buildcraft, the file I downloaded was "ajtycbdfgdhrdbfvsyudgf.zip" and it was really named something like that, lol, when I extracted it I got two files, buildcraft.zip and buildcraft.js. The buildcraft.js file imported fine through Block Launcher but when I tried to start the game I get these erros for missing icons and such, so they must be in the buildcraft.zip file. So that is what I need to know what to do with it or where to put it?