var GUI1;
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
var held = false;
var click = true;
function modTick(){
if(getCarriedItem() == potionId && held == false){
held = true;
ctx.runOnUiThread(new java.lang.Runnable({ run: function(){
try{
var layout = new android.widget.LinearLayout(ctx);
layout.setOrientation(1);
var btn1 = new android.widget.Button(ctx);
btn1.setText("Throw");
layout.setOrientation(android.widget.LinearLayout.VERTICAL);
layout.addView(btn1);
btn1.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(p1){
click == true;
}
}));
GUI1 = new android.widget.PopupWindow(layout, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
GUI1.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.RED));
GUI1.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}catch(error){
clientMessage("Error: " + error);
}
else if(getCarriedItem() != potionId && held == true){
GUI1.dismiss();
GUI1 = null;
}
}}));
if(click){
click = false;
lookdir(getPitch(), getYaw());
Entity.remove(shotid);
var shotid = Level.spawnMob(getPlayerX() + (dirx * 2),getPlayerY() + (diry * 2),getPlayerZ() + (dirz * 2), 81,"mob/arrow.png");
setVelX(shotid,(dirx * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
setVelY(shotid,(diry * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
setVelZ(shotid,(dirz * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
}
}
This is a basic code where it creates a button when a potion is held. And when the button is clicked it shoots an snowball. You can use entityRemovedHook() for the effects when the snowball hits the ground. If your really stuck PM me.
Rollback Post to RevisionRollBack
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
var GUI1;
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
var held = false;
var click = true;
function modTick(){
if(getCarriedItem() == potionId && held == false){
held = true;
ctx.runOnUiThread(new java.lang.Runnable({ run: function(){
try{
var layout = new android.widget.LinearLayout(ctx);
layout.setOrientation(1);
var btn1 = new android.widget.Button(ctx);
btn1.setText("Throw");
layout.setOrientation(android.widget.LinearLayout.VERTICAL);
layout.addView(btn1);
btn1.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(p1){
click == true;
}
}));
GUI1 = new android.widget.PopupWindow(layout, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
GUI1.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.RED));
GUI1.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}catch(error){
clientMessage("Error: " + error);
}
else if(getCarriedItem() != potionId && held == true){
GUI1.dismiss();
GUI1 = null;
}
}}));
if(click){
click = false;
lookdir(getPitch(), getYaw());
Entity.remove(shotid);
var shotid = Level.spawnMob(getPlayerX() + (dirx * 2),getPlayerY() + (diry * 2),getPlayerZ() + (dirz * 2), 81,"mob/arrow.png");
setVelX(shotid,(dirx * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
setVelY(shotid,(diry * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
setVelZ(shotid,(dirz * 35) + (Math.floor(Math.random() * 2000) / 1000) -1);
}
}
This is a basic code where it creates a button when a potion is held. And when the button is clicked it shoots an snowball. You can use entityRemovedHook() for the effects when the snowball hits the ground. If your really stuck PM me.
Rollback Post to RevisionRollBack
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
To post a comment, please login or register a new account.
I will make splash potions.But i dont know how to do this.
Please tell me how to make splash potions.
Check out my more blocks mod: http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/2172046-more-blocks-mod-16-new-blocks-with-functions
var GUI1; var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); var held = false; var click = true; function modTick(){ if(getCarriedItem() == potionId && held == false){ held = true; ctx.runOnUiThread(new java.lang.Runnable({ run: function(){ try{ var layout = new android.widget.LinearLayout(ctx); layout.setOrientation(1); var btn1 = new android.widget.Button(ctx); btn1.setText("Throw"); layout.setOrientation(android.widget.LinearLayout.VERTICAL); layout.addView(btn1); btn1.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(p1){ click == true; } })); GUI1 = new android.widget.PopupWindow(layout, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT); GUI1.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.RED)); GUI1.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0); }catch(error){ clientMessage("Error: " + error); } else if(getCarriedItem() != potionId && held == true){ GUI1.dismiss(); GUI1 = null; } }})); if(click){ click = false; lookdir(getPitch(), getYaw()); Entity.remove(shotid); var shotid = Level.spawnMob(getPlayerX() + (dirx * 2),getPlayerY() + (diry * 2),getPlayerZ() + (dirz * 2), 81,"mob/arrow.png"); setVelX(shotid,(dirx * 35) + (Math.floor(Math.random() * 2000) / 1000) -1); setVelY(shotid,(diry * 35) + (Math.floor(Math.random() * 2000) / 1000) -1); setVelZ(shotid,(dirz * 35) + (Math.floor(Math.random() * 2000) / 1000) -1); } }This is a basic code where it creates a button when a potion is held. And when the button is clicked it shoots an snowball. You can use entityRemovedHook() for the effects when the snowball hits the ground. If your really stuck PM me.
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->