Because you have 2 "function entityAddedHook(entity)"s. You only need 1.
function entityAddedHook(entity) {if (Entity.getEntityTypeId(entity) == 33) {
clientMessage(ChatColor.GREEN+"A Creeper has been detected!");
}
if (Entity.getEntityTypeId(entity) == 32) {
clientMessage(ChatColor.GREEN+"A Zombie has been detected!");
}
}
I am trying to make an item that projects an effect in a linear direction. I am using Entity.getYaw(Player.getEntity).
The result is awkward. The number does not loop back after 360 or 0. When I first used it I got a player yaw angle of over a thousand degrees, 1008.
Is there method to get a more consistent number?
At present I am experimenting with formulas and math functions but my java is limited at I cannot get any of the js coding websites to work right on my tablet. (specificly the code acvademy website)
I am trying to make an item that projects an effect in a linear direction. I am using Entity.getYaw(Player.getEntity).
The result is awkward. The number does not loop back after 360 or 0. When I first used it I got a player yaw angle of over a thousand degrees, 1008.
Is there method to get a more consistent number?
At present I am experimenting with formulas and math functions but my java is limited at I cannot get any of the js coding websites to work right on my tablet. (specificly the code acvademy website)
Hello, Im MrGlassArmor, and I have found that, when making a new texture png, and putting it in the terrain-atlas folder, if you make a custom block using the texture, there is a chance of having animated lava/water replacing it, with a slight view of the texture you made if you are at a certain angel.
I have tried to put decoys, but, it doesnt always work...
Hello, Im MrGlassArmor, and I have found that, when making a new texture png, and putting it in the terrain-atlas folder, if you make a custom block using the texture, there is a chance of having animated lava/water replacing it, with a slight view of the texture you made if you are at a certain angel.
I have tried to put decoys, but, it doesnt always work...
I need help on my mod ANY TIME I make a crafting it says this (but with a different I'd 507 508 etc.)
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe. (Industrial Weaponry.js#116)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
at org.mozilla.javascript.FunctionObject.call(Unknown Source)
at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
at script(Industrial Weaponry.js:116)
at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager.initJustLoadedScript(ScriptManager.java:257)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:179)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe.
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.verifyAndAddShapedRecipe(ScriptManager.java:2795)
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.addCraftRecipe(ScriptManager.java:2747)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
I need help on my mod ANY TIME I make a crafting it says this (but with a different I'd 507 508 etc.)
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe. (Industrial Weaponry.js#116)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
at org.mozilla.javascript.FunctionObject.call(Unknown Source)
at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
at script(Industrial Weaponry.js:116)
at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager.initJustLoadedScript(ScriptManager.java:257)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:179)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe.
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.verifyAndAddShapedRecipe(ScriptManager.java:2795)
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.addCraftRecipe(ScriptManager.java:2747)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
... 11 more
Make sure ALL CRAFTING RECIPES come AFTER ALL SETITEM() AND DEFINEBLOCK() functions. Else the crafting recipe wont find an item/block, because it hasn't been created.
function useItem(x, y, z, itemId, blockId, side) { if (itemId==490) { Level.addParticle(3,getPlayerX(),getPlayerY()-1, getPlayerZ(),0,0,0,1); Level.setTile(getPlayerX(),getPlayerY()+1,getPlayerZ(),63,0);
Its a funny thing actually. The moment a chest/sign is placed, you cannot use setSignText(), or setChestSlot(). You must do it a In Game Tick later, not instantly after plscing a block. Try using a timer, which is set to a short time, then do all of the stuff related with the prize chest & sign. Everthing else seems fine @_@.
Small Question is it possible to make it so armor can give extra health ( instead of having 10 hearts you have 12 for example) if so how?
It would also help for some info on how to give potion effects to armor (speed haste jump boost etc.)
Same goes for weapons?
Thanks in advance! : - )
How to give potion-effects on armor etc:
function modTick(){
//armor
if(Player.getArmorSlot(slot)==Id){ //slot should be 0, 1, 2 or 3
Entity.removeEffect(ent, effect-Id); //remove it first
Entity.addEffect(ent, effect-Id, time in ticks, level, booleanamplifier, booleanshowParticles); //Add it then (for at least two ticks)
}
//
//weapons etc:
if(Player.getCarriedItem()==Id){ //you can also add Player.getCarriedItemData() for Ids with more than one item
Entity.removeEffect(ent, effect-Id); //remove it first
Entity.addEffect(ent, effect-Id, time in ticks, level, booleanamplifier, booleanshowParticles); //Add it then (for at least two ticks)
}
}
I made bold what you have to change.
---
You can give extra-health from armor with an effect like a absortion or by setting the health higher, but you have to use a timer or whatever to heal the player slowly to the extra hearts and to prevent that the Player can´t loose health because the Player always get healed to 12 hearts.
I'm a bit new to modding and want to make a script so that whenever I click a block with a bone, it makes a large explosion, maybe 20x larger than tnt. Could someone help me with an example script?
I came up with a script but I know it's wrong and I got this error message:
function useItem(getPlayerX(), getPlayerY(), getPlayerZ(), 352, explode(getPlayerX()+1, getPlayerY()-1, getPlayerZ(), 20)){
org.mozilla.javascript.EvaluatorException: missing ) after formal parameters
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown Source)
at org.mozilla.javascript.DefaultErrorReporter.error(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.parseFunctionParams(Unknown Source)
at org.mozilla.javascript.Parser.function(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Context.compileImpl(Unknown Source)
at org.mozilla.javascript.Context.compileReader(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:178)
I'm a bit new to modding and want to make a script so that whenever I click a block with a bone, it makes a large explosion, maybe 20x larger than tnt. Could someone help me with an example script?
I came up with a script but I know it's wrong and I got this error message:
function useItem(getPlayerX(), getPlayerY(), getPlayerZ(), 352, explode(getPlayerX()+1, getPlayerY()-1, getPlayerZ(), 20)){
org.mozilla.javascript.EvaluatorException: missing ) after formal parameters
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown Source)
at org.mozilla.javascript.DefaultErrorReporter.error(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.parseFunctionParams(Unknown Source)
at org.mozilla.javascript.Parser.function(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Context.compileImpl(Unknown Source)
at org.mozilla.javascript.Context.compileReader(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:178)
at java.lang.Thread.run(Thread.java:841)
Okay. Functions can be redesigned, but not like that. You need to add the explosion as an effect, rather than everything at once.
Its pretty much cause & consecuence. IF something happens, the THIS will happen. It's a simple concept. Replace that section of the code with this, and tell me if that worked, or Clagdriff can help out as well.
function useItem(x,y,z,iID,bID,s) {
bone = 352;
explosionSize = 20;
if (iID == bone) {
Level.explode(Player.getX()+1,Player.getY()-1,Player.getZ(),explosionSize);
}
}
P.S. Based from the title, it came out since BlockLauncher 1.6.11... and umm... btw, I didn't check if it still does work on the higher versions... so just test if it works as expected
P.S.S The post is not mine! It's by the famous byteandahalf (lol), who also made the PocketPower.
P.S.S.S umm... another thing... the only (new) functions in the post is to renderCross() and to renderTorch()... and the (new) hook is the renderBlockHook(), which happens when a block is rendered... kind of like an entityAddedHook() but for blocks
okay, so ive seen a lot of ModPE tutorials that suggest something about custom functions. Dont judge me if im being such an idiot, but is there an actual way to create my very own function? I tried googling "How do I make a custom function for ModPE" and nothing really helpful came up. But if there is a way of making my own function for me, I would like to know.
Rollback Post to RevisionRollBack
Heard of an app called AppNana? It's an app that rewards you for installing games, testing apps, watching adds, with Google Play, Amazon, and iTunes gift cards, and more! And the app, is completely free!
An easy way of earning Nanas is to add other people's Invite Codes. Whenever you invite someone or get invited, you get 2.5k nanas!
My code is t3305123, pm me your codes so we can just keep gettin nanas for doing pretty much nothing at all!
nope, just look up arjay07 on you tube and watch some javape tutorials!
function newLevel() {
clientMessage(ChatColor.DARK_GRAY + "Detecter Mod!");
clientMessage(ChatColor.RED + "Mod Made By: " + ChatColor.GOLD + "Chaos_Elamental");
}
function entityAddedHook(entity) {
if (Entity.getEntityTypeId(entity) == 33) {
clientMessage(ChatColor.GREEN+"A Creeper has been detected!"); }
}
function entityAddedHook(entity) {
if (Entity.getEntityTypeId(entity) == 32) {
clientMessage(ChatColor.GREEN+"A Zombie has been detected!");
}
} now why won't it say when a creeper has spawned pls no steal
Because you have 2 "function entityAddedHook(entity)"s. You only need 1.
Something like this.
OMG THANK YOU I HAD THE SAME PROBLEM WITH MY MODS
The heck is this for
I hope someonbe has an idea that can help.
I am trying to make an item that projects an effect in a linear direction. I am using Entity.getYaw(Player.getEntity).
The result is awkward. The number does not loop back after 360 or 0. When I first used it I got a player yaw angle of over a thousand degrees, 1008.
Is there method to get a more consistent number?
At present I am experimenting with formulas and math functions but my java is limited at I cannot get any of the js coding websites to work right on my tablet. (specificly the code acvademy website)
var yaw=Entity.getYaw(getPlayerEnt());
for(yaw>360){
yaw=yaw-360;
}
for(yaw<=0){
yaw=yaw+360;
}
Yaw is now a number from 0 to 360
Hello, Im MrGlassArmor, and I have found that, when making a new texture png, and putting it in the terrain-atlas folder, if you make a custom block using the texture, there is a chance of having animated lava/water replacing it, with a slight view of the texture you made if you are at a certain angel.
I have tried to put decoys, but, it doesnt always work...
Hello, Im MrGlassArmor, and I have found that, when making a new texture png, and putting it in the terrain-atlas folder, if you make a custom block using the texture, there is a chance of having animated lava/water replacing it, with a slight view of the texture you made if you are at a certain angel.
I have tried to put decoys, but, it doesnt always work...
"Its all SHITS and GIGGLES, till someone GIGGLES and SHITS!"

I need help on my mod ANY TIME I make a crafting it says this (but with a different I'd 507 508 etc.)
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe. (Industrial Weaponry.js#116)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
at org.mozilla.javascript.FunctionObject.call(Unknown Source)
at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
at script(Industrial Weaponry.js:116)
at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager.initJustLoadedScript(ScriptManager.java:257)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:179)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: Invalid input in recipe: 503 is not a valid item. You must create the item before you can add it to a recipe.
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.verifyAndAddShapedRecipe(ScriptManager.java:2795)
at net.zhuoweizhang.mcpelauncher.ScriptManager$NativeItemApi.addCraftRecipe(ScriptManager.java:2747)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
... 11 more
Make sure ALL CRAFTING RECIPES come AFTER ALL SETITEM() AND DEFINEBLOCK() functions. Else the crafting recipe wont find an item/block, because it hasn't been created.
Its a funny thing actually. The moment a chest/sign is placed, you cannot use setSignText(), or setChestSlot(). You must do it a In Game Tick later, not instantly after plscing a block. Try using a timer, which is set to a short time, then do all of the stuff related with the prize chest & sign. Everthing else seems fine @_@.
Excellent Suggestion! This concept was able to point me down the path i needed.
Now I can easily determine cardinal direction, assuming sunrise in mcpe is still east, and up and down.
Thank you very much.
Now to find a tutorial on how to do an bject like torches(multiple placement styles in the same block)
Small Question is it possible to make it so armor can give extra health ( instead of having 10 hearts you have 12 for example) if so how?
It would also help for some info on how to give potion effects to armor (speed haste jump boost etc.)
Same goes for weapons?
Thanks in advance! : - )
Thx
How to give potion-effects on armor etc:
function modTick(){
//armor
if(Player.getArmorSlot(slot)==Id){ //slot should be 0, 1, 2 or 3
Entity.removeEffect(ent, effect-Id); //remove it first
Entity.addEffect(ent, effect-Id, time in ticks, level, boolean amplifier, boolean showParticles); //Add it then (for at least two ticks)
}
//
//weapons etc:
if(Player.getCarriedItem()==Id){ //you can also add Player.getCarriedItemData() for Ids with more than one item
Entity.removeEffect(ent, effect-Id); //remove it first
Entity.addEffect(ent, effect-Id, time in ticks, level, boolean amplifier, boolean showParticles); //Add it then (for at least two ticks)
}
}
I made bold what you have to change.
---
You can give extra-health from armor with an effect like a absortion or by setting the health higher, but you have to use a timer or whatever to heal the player slowly to the extra hearts and to prevent that the Player can´t loose health because the Player always get healed to 12 hearts.
I'm a bit new to modding and want to make a script so that whenever I click a block with a bone, it makes a large explosion, maybe 20x larger than tnt. Could someone help me with an example script?
I came up with a script but I know it's wrong and I got this error message:
function useItem(getPlayerX(), getPlayerY(), getPlayerZ(), 352, explode(getPlayerX()+1, getPlayerY()-1, getPlayerZ(), 20)){
org.mozilla.javascript.EvaluatorException: missing ) after formal parameters
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown Source)
at org.mozilla.javascript.DefaultErrorReporter.error(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.parseFunctionParams(Unknown Source)
at org.mozilla.javascript.Parser.function(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Context.compileImpl(Unknown Source)
at org.mozilla.javascript.Context.compileReader(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:178)
at java.lang.Thread.run(Thread.java:841)
Okay. Functions can be redesigned, but not like that. You need to add the explosion as an effect, rather than everything at once.
Its pretty much cause & consecuence. IF something happens, the THIS will happen. It's a simple concept. Replace that section of the code with this, and tell me if that worked, or Clagdriff can help out as well.
Are complex blocks possible?
By complex bocks I mean shapes that are more than a single cube. Like a table with legs.
For that matter is it possible to do multiple block angles without multiple blocks? Like torches and pistons.
There's a particular post that I think says something how to do that.
ummm.... wait a minute. I'll go find it...
Update:
Here's the link to the post.
P.S. Based from the title, it came out since BlockLauncher 1.6.11... and umm... btw, I didn't check if it still does work on the higher versions... so just test if it works as expected
P.S.S The post is not mine! It's by the famous byteandahalf (lol), who also made the PocketPower.
P.S.S.S umm... another thing... the only (new) functions in the post is to renderCross() and to renderTorch()... and the (new) hook is the renderBlockHook(), which happens when a block is rendered... kind of like an entityAddedHook() but for blocks
okay, so ive seen a lot of ModPE tutorials that suggest something about custom functions. Dont judge me if im being such an idiot, but is there an actual way to create my very own function? I tried googling "How do I make a custom function for ModPE" and nothing really helpful came up. But if there is a way of making my own function for me, I would like to know.