Add-on

var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get; var metrics = new android.util.DisplayMetrics;	ctx.getWindowManager.getDefaultDisplay.getMetrics(metrics); var displayHeight = metrics.heightPixels; var displayWidth = metrics.widthPixels; var directionPath = android.os.Environment.getExternalStorageDirectory.getAbsolutePath+"/games/com.mojang/Better PvP/"; var font = new android.graphics.Typeface.createFromFile(directionPath+"minecraft.ttf");

//Diamond Tools var dSword = new android.graphics.drawable.BitmapDrawable(directionPath+"d_sword.png"); var dShovel = new android.graphics.drawable.BitmapDrawable(directionPath+"d_shovel.png"); var dPickaxe = new android.graphics.drawable.BitmapDrawable(directionPath+"d_pickaxe.png"); var dAxe = new android.graphics.drawable.BitmapDrawable(directionPath+"d_axe.png"); var dHoe = new android.graphics.drawable.BitmapDrawable(directionPath+"d_hoe.png");

//Gold Tools var gSword = new android.graphics.drawable.BitmapDrawable(directionPath+"g_sword.png"); var gShovel = new android.graphics.drawable.BitmapDrawable(directionPath+"g_shovel.png"); var gPickaxe = new android.graphics.drawable.BitmapDrawable(directionPath+"g_pickaxe.png"); var gAxe = new android.graphics.drawable.BitmapDrawable(directionPath+"g_axe.png"); var gHoe = new android.graphics.drawable.BitmapDrawable(directionPath+"g_hoe.png");

//Iron Tools var iSword = new android.graphics.drawable.BitmapDrawable(directionPath+"i_sword.png"); var iShovel = new android.graphics.drawable.BitmapDrawable(directionPath+"i_shovel.png"); var iPickaxe = new android.graphics.drawable.BitmapDrawable(directionPath+"i_pickaxe.png"); var iAxe = new android.graphics.drawable.BitmapDrawable(directionPath+"i_axe.png"); var iHoe = new android.graphics.drawable.BitmapDrawable(directionPath+"i_hoe.png");

//Stone Tools var sSword = new android.graphics.drawable.BitmapDrawable(directionPath+"s_sword.png"); var sShovel = new android.graphics.drawable.BitmapDrawable(directionPath+"s_shovel.png"); var sPickaxe = new android.graphics.drawable.BitmapDrawable(directionPath+"s_pickaxe.png"); var sAxe = new android.graphics.drawable.BitmapDrawable(directionPath+"s_axe.png"); var sHoe = new android.graphics.drawable.BitmapDrawable(directionPath+"s_hoe.png");

//Wooden Tools var wSword = new android.graphics.drawable.BitmapDrawable(directionPath+"w_sword.png"); var wShovel = new android.graphics.drawable.BitmapDrawable(directionPath+"w_shovel.png"); var wPickaxe = new android.graphics.drawable.BitmapDrawable(directionPath+"w_pickaxe.png"); var wAxe = new android.graphics.drawable.BitmapDrawable(directionPath+"w_axe.png"); var wHoe = new android.graphics.drawable.BitmapDrawable(directionPath+"w_hoe.png");

//Helmets var lHelmet = new android.graphics.drawable.BitmapDrawable(directionPath+"l_helmet.png"); var cHelmet = new android.graphics.drawable.BitmapDrawable(directionPath+"c_helmet.png"); var iHelmet = new android.graphics.drawable.BitmapDrawable(directionPath+"i_helmet.png"); var gHelmet = new android.graphics.drawable.BitmapDrawable(directionPath+"g_helmet.png"); var dHelmet = new android.graphics.drawable.BitmapDrawable(directionPath+"d_helmet.png");

//Chestplates var lChestplate = new android.graphics.drawable.BitmapDrawable(directionPath+"l_chestplate.png"); var cChestplate = new android.graphics.drawable.BitmapDrawable(directionPath+"c_chestplate.png"); var iChestplate = new android.graphics.drawable.BitmapDrawable(directionPath+"i_chestplate.png"); var gChestplate = new android.graphics.drawable.BitmapDrawable(directionPath+"g_chestplate.png"); var dChestplate = new android.graphics.drawable.BitmapDrawable(directionPath+"d_chestplate.png");

//Leggings var lLeggings = new android.graphics.drawable.BitmapDrawable(directionPath+"l_leggings.png"); var cLeggings = new android.graphics.drawable.BitmapDrawable(directionPath+"c_leggings.png"); var iLeggings = new android.graphics.drawable.BitmapDrawable(directionPath+"i_leggings.png"); var gLeggings = new android.graphics.drawable.BitmapDrawable(directionPath+"g_leggings.png"); var dLeggings = new android.graphics.drawable.BitmapDrawable(directionPath+"d_leggings.png");

//Boots var lBoots = new android.graphics.drawable.BitmapDrawable(directionPath+"l_boots.png"); var cBoots = new android.graphics.drawable.BitmapDrawable(directionPath+"c_boots.png"); var iBoots = new android.graphics.drawable.BitmapDrawable(directionPath+"i_boots.png"); var gBoots = new android.graphics.drawable.BitmapDrawable(directionPath+"g_boots.png"); var dBoots = new android.graphics.drawable.BitmapDrawable(directionPath+"d_boots.png");

//Others var bow = new android.graphics.drawable.BitmapDrawable(directionPath+"bow.png"); var fSteel = new android.graphics.drawable.BitmapDrawable(directionPath+"flint_steel.png"); var fRod = new android.graphics.drawable.BitmapDrawable(directionPath+"f_rod.png"); var cStick = new android.graphics.drawable.BitmapDrawable(directionPath+"c_stick.png"); var sButton = new android.graphics.drawable.BitmapDrawable(directionPath+"s_button.png");

var tools = [276,1562,dSword,277,1562,dShovel,278,1562,dPickaxe,279,1562,dAxe,293,1562,dHoe,283,33,gSword,284,33,gShovel,285,33,gPickaxe,286,33,gAxe,294,33,gHoe,267,251,iSword,256,251,iShovel,257,251,iPickaxe,258,251,iAxe,292,251,iHoe,272,132,sSword,273,132,sShovel,274,132,sPickaxe,275,132,sAxe,291,132,sHoe,268,60,wSword,269,60,wShovel,270,60,wPickaxe,271,60,wAxe,290,60,wHoe,261,385,bow,259,65,fSteel,346,65,fRod,398,26,cStick];

var helmets = [298,56,lHelmet,302,166,cHelmet,306,166,iHelmet,314,78,gHelmet,310,364,dHelmet];

var chestplates = [299,81,lChestplate,303,241,cChestplate,307,241,iChestplate,315,113,gChestplate,311,529,dChestplate];

var leggings = [300,76,lLeggings,304,196,cLeggings,308,196,iLeggings,316,106,gLeggings,312,496,dLeggings];

var boots = [301,66,lBoots,305,196,cBoots,309,196,iBoots,317,92,gBoots,313,430,dBoots];

function modTick{ toolStatus; helmetStatus; chestplateStatus; leggingStatus; bootStatus; if(ModPE.getMinecraftVersion=="0.10.5"){ bowParticles; }}

function newLevel{ settingsButton; }

function settingsButton{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ try{ settingsGUI = new android.widget.PopupWindow; layout11 = new android.widget.LinearLayout(ctx);	layout11.setOrientation(android.widget.LinearLayout.VERTICAL); settingsBtn = new android.widget.Button(ctx); settingsGUI.setContentView(layout11); settingsGUI.setWidth(displayWidth/16.7); settingsGUI.setHeight(displayWidth/16.7); layout11.addView(settingsBtn); settingsBtn.setBackgroundDrawable(sButton); settingsBtn.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(viewarg){ //Level.playSoundEnt(Player.getEntity,"random.click",100); ModPE.showTipMessage("Work In Progress :P!"); } })) settingsGUI.showAtLocation(ctx.getWindow.getDecorView,android.view.Gravity.RIGHT| android.view.Gravity.TOP,4, displayHeight/8.5); } catch (e){ print ("Error: "+e) } }}); }

///* Other Functions *///

var particles = false; var e;

function entityAddedHook(entity){ if(Entity.getEntityTypeId(entity)==80&&ModPE.getMinecraftVersion=="0.10.5"){ particles = true; e = entity; }}

function bowParticles{ if(particles == true){ Level.addParticle(ParticleType.crit,Entity.getX(e),Entity.getY(e),Entity.getZ(e),0,0,0,1.5); } if(Entity.getVelY(e)==0){ particles = false; }}

///* Tool GUI */// var toolPercentage = 0; var carringTool = false; var tool = 0; var toolGuiDisplayed1 = false; var toolGuiDisplayed2 = false; var toolDamage = 0;

function toolStatus1{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ toolGUI = new android.widget.PopupWindow(ctx); var layout = new android.widget.LinearLayout(ctx); layout.setOrientation(android.widget.LinearLayout.VERTICAL); toolText = new android.widget.TextView(ctx); toolText.setTextColor(android.graphics.Color.WHITE); toolText.setTextSize(7.5); toolText.setTypeface(font); toolText.setGravity(0x01); toolText.setShadowLayer(0.001, Math.round(toolText.getLineHeight/8), Math.round(toolText.getLineHeight/8), android.graphics.Color.parseColor("#FF464646")); layout.addView(toolText); toolGUI.setContentView(layout); toolGUI.setWidth(displayWidth/7.5); toolGUI.setHeight(displayHeight/14.5); toolGUI.setTouchable(false); toolGUI.setBackgroundDrawable(null); toolGUI.showAtLocation(ctx.getWindow.getDecorView,android.view.Gravity.LEFT|android.view.Gravity.CENTER,displayWidth/22,2); } }) }

function toolStatus2{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ toolGUI2 = new android.widget.PopupWindow(ctx); var layout2 = new android.widget.LinearLayout(ctx); layout2.setOrientation(android.widget.LinearLayout.HORIZONTAL); toolText2 = new android.widget.ImageView(ctx); layout2.addView(toolText2); toolGUI2.setContentView(layout2); toolGUI2.setWidth(displayWidth/20); toolGUI2.setHeight(displayWidth/20); toolGUI2.setTouchable(false); toolGUI2.setBackgroundDrawable(null); toolGUI2.showAtLocation(ctx.getWindow.getDecorView,android.view.Gravity.LEFT|android.view.Gravity.CENTER,2,2); } }) }

function toolStatus{ toolPercentage = Math.floor(100-(Player.getCarriedItemData*100/tools[tools.lastIndexOf(Player.getCarriedItem)+1])); if(tools.lastIndexOf(Player.getCarriedItem)!=-1&&toolDamage!=Player.getCarriedItemData&&toolGuiDisplayed1==true||tools.lastIndexOf(Player.getCarriedItem)!=-1&&Player.getCarriedItem!=tool&&toolGuiDisplayed1==true){ toolStatusUpdate; toolDamage = Player.getCarriedItemData; tool = Player.getCarriedItem } if(tools.lastIndexOf(Player.getCarriedItem)!=-1&&carringTool==false){ toolChanged; carringTool = true; toolDamage = Player.getCarriedItemData; } if(tools.lastIndexOf(Player.getCarriedItem)==-1&&carringTool==true){ deleteToolGUI; carringTool=false; }}

function toolStatusUpdate{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ toolText2.setBackgroundDrawable(tools[tools.lastIndexOf(Player.getCarriedItem)+2]); toolText.setText("\n  "+tools[tools.lastIndexOf(Player.getCarriedItem)+1]-Player.getCarriedItemData+"/"+tools[tools.lastIndexOf(Player.getCarriedItem)+1]+"\n("+toolPercentage+"%)"); } }) }

function toolChanged{ toolStatus1; toolStatus2; toolGuiDisplayed1 = true; toolGuiDisplayed2 = true; if(toolGuiDisplayed2==true){ toolGuiDisplayed2 = false; toolStatusUpdate; }}

function deleteToolGUI{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ toolGUI.dismiss; toolGUI2.dismiss; } }) }

///* Helmet GUI *///

var helmetPercentage = 0; var carringHelmet = false; var helmet = 0; var helmetGuiDisplayed1 = false; var helmetGuiDisplayed2 = false; var helmetDamage = 0;

function helmetStatus1{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ helmetGUI = new android.widget.PopupWindow(ctx); layout3 = new android.widget.LinearLayout(ctx); layout3.setOrientation(android.widget.LinearLayout.VERTICAL); helmetText = new android.widget.TextView(ctx); helmetText.setTextColor(android.graphics.Color.WHITE); helmetText.setTextSize(7.5); helmetText.setTypeface(font); helmetText.setGravity(0x01); helmetText.setShadowLayer(0.001, Math.round(helmetText.getLineHeight/8), Math.round(helmetText.getLineHeight/8), android.graphics.Color.parseColor("#FF464646")); layout3.addView(helmetText); helmetGUI.setContentView(layout3); helmetGUI.setWidth(displayWidth/7.5); helmetGUI.setHeight(displayHeight/14.5); helmetGUI.setTouchable(false); helmetGUI.setBackgroundDrawable(null); helmetGUI.showAtLocation(ctx.getWindow.getDecorView,android.view.Gravity.LEFT|android.view.Gravity.CENTER,displayWidth/22,displayHeight/-3.24); } }) }

function helmetStatus2{ ctx.runOnUiThread(new java.lang.Runnable{ run: function{ helmetGUI2 = new android.widget.PopupWindow(ctx); var layout4 = new android.widget.LinearLayout(ctx); layout4.setOrientation(android.widget.LinearLayout.HORIZONTAL); helmetText2 = new android.widget.ImageView(ctx); layout4.addView(helmetText2); helmetGUI2.setContentView(layout4); helmetGUI2.setWidth(displayWidth/20);//16.5); helmetGUI2.setHeight(displayWidth/20);//16.5); helmetGUI2.setTouchable(false);

Reference guides
Current Release (1.8.0.24):
 * Bedrock Edition Creator Guidelines
 * Add-Ons Reference Guide (1.6.0.13)
 * Animation Reference Guide
 * Particles Reference Guide

Beta (1.9.0.3):
 * Add-Ons Reference Guide
 * Minecraft Script Engine Reference Guide
 * MoLang Reference Guide
 * UI Reference Guide

Tutorials

 * Creating resource packs
 * Creating behavior packs
 * Changing Minecraft entity models

Templates
Current Release:
 * Vanilla Resource Pack files (1.8.0.24)
 * Vanilla Behavior Pack files (1.8.0.24)

Beta (1.9.0.3):
 * Beta Resource Pack files (1.9.0.3)
 * Beta Behavior Pack files (1.9.0.3)
 * MINECON 2018 New Entity Sample Resources
 * MINECON 2018 New Entity Sample Behaviors

Script Engine Example Packs:
 * Minecraft Scripting Mob Arena Demo
 * Minecraft Scripting Turn-Based Demo

Other resources

 * Add-ons information on minecraft.net
 * Add-ons on CurseForge
 * Minecraft.net blog post on different pack types
 * Visual Studio Code (Free text/code editor)
 * Paint.net (Free image editor)
 * Notepad++ (Free text editor)
 * Blockbench (Free 3D model editor)

History
Since the early development of the original Java edition of Minecraft, there have been plans to implement an official way for developers to add and change content in the game. Plans for official game customization date back to July 5, 2010, with the Modding API planned after the release of. It was then stated to be released in Beta 1.8. The Modding API was then rebranded as the Plugin API, with the release originally stated to be planned for 1.3, then for 1.4, and then it was accidentally stated by Curse that it would be implemented in 1.5.

At MINECON 2012, Mojang shared their vision for the future of the Plugin API. The API was to be developed by the Bukkit team and intended to simplify the modding  and downloading process,   although containing a slightly limited feature set. After initially publishing a developer website (http://dev.minecraft.net) and GitHub page, these were both taken down within a year.

Developers on numerous occasions have mentioned that many changes made in the game's code were in preparation for the Plugin API, including Dinnerbone on July 29th 2014, Grum at the "The Minecraft Team - Behind the Scenes" panel on July 5th, 2015 and Dinnerbone again on October 19th 2015 while working on the loot tables for 1.9. A user replied "I think an official "we're working on it" would really help a lot" to which Dinnerbone replied "We're working on it."

On August 12, 2016, Searge tweeted: "There will be news about the API at Minecon. I'll talk about the things I'm working on and what our plans are. But no more details for now." The next day it was confirmed by Grum to be for Pocket Edition and at MINECON the plan and roadmap for the development of Add-Ons were outlined.