This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
var buttonWindow = null; var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); function newLevel() { var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); activity.runOnUiThread(new java.lang.Runnable({ run: function() { try{ buttonWindow = new android.widget.PopupWindow(); var layout = new android.widget.RelativeLayout(activity); var button = new android.widget.Button(activity); button.setText("Tools"); button.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(viewarg) { ModPE.setItem(506,"record_chirp",0,"Eraser"); ModPE.setItem(507,"record_far",0,"Eraser x3"); ModPE.setItem(508,"record_mall",0,"Eraser x5"); ModPE.setItem(483,"record_mellohi",0,"Teleportation Stick"); ModPE.setItem(480,"record_stal",0,"Cut"); ModPE.setItem(481,"record_strad",0,"Copy"); ModPE.setItem(482,"record_wait",0,"Copy x4"); ModPE.setItem(484,"repeater",0,"Morning"); ModPE.setItem(485,"rotten_flesh",0,"Night"); addItemInventory(509,1); addItemInventory(506,1); addItemInventory(507,1); addItemInventory(508,1); addItemInventory(483,1); addItemInventory(480,1); addItemInventory(481,1); addItemInventory(482,1); addItemInventory(484,1); addItemInventory(485,1); clientMessage("Tools added to inventory."); } })); layout.addView(button); buttonWindow.setContentView(layout); buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); buttonWindow.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.LEFT | android.view.Gravity.TOP, 475, 0); }catch(problem){ print("Button could not be displayed: " + problem); } }})); activity.runOnUiThread(new java.lang.Runnable({ run: function() { try{ buttonWindow = new android.widget.PopupWindow(); var layout = new android.widget.RelativeLayout(activity); var button = new android.widget.Button(activity); button.setText("Spawn Eggs"); button.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(viewarg) { ModPE.setItem(500,"quiver",0,"Spawn Zombie"); ModPE.setItem(501,"record_11",0,"Spawn Creeper"); ModPE.setItem(502,"record_13",0,"Spawn Skeleton"); ModPE.setItem(503,"record_blocks",0,"Spawn Spider"); ModPE.setItem(504,"record_cat",0,"Spawn Zombie Pigman"); addItemInventory(500,1); addItemInventory(501,1); addItemInventory(502,1); addItemInventory(503,1); addItemInventory(504,1); clientMessage("Eggs added to inventory.") } })); layout.addView(button); buttonWindow.setContentView(layout); buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); buttonWindow.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.LEFT | android.view.Gravity.TOP, 575, 0); }catch(problem){ } }})); } function useItem(x,y,z,itemId,blockId,side){ if(itemId==500){ Level.spawnMob(x+.5,y+1,z+.5,32,"mob/zombie.png"); }else if(itemId==501){ Level.spawnMob(x+.5,y+1,z+.5,33,"mob/creeper.png"); }else if(itemId==502){ Level.spawnMob(x+.5,y+1,z+.5,34,"mob/skeleton.png"); }else if(itemId==503){ Level.spawnMob(x+.5,y+1,z+.5,35,"mob/spider.png"); }else if(itemId==504){ Level.spawnMob(x+.5,y+1,z+.5,36,"mob/pigzombie.png"); }else if(itemId==506){ getTile(x,y,z); setTile(x,y,z,0); }else if(itemId==507){ getTile(x,y,z); setTile(x,y,z,0) setTile(x-1,y,z,0) setTile(x,y,z-1,0) setTile(x-1,y,z-1,0) setTile(x+1,y,z+1,0) setTile(x+1,y,z,0) setTile(x,y,z+1,0) setTile(x-1,y,z+1,0) setTile(x+1,y,z-1,0) }else if(itemId==508){ getTile(x,y,z); setTile(x,y,z,0) setTile(x-1,y,z,0) setTile(x,y,z-1,0) setTile(x-1,y,z-1,0) setTile(x+1,y,z+1,0) setTile(x+1,y,z,0) setTile(x,y,z+1,0) setTile(x-1,y,z+1,0) setTile(x+1,y,z-1,0) setTile(x+2,y,z,0) setTile(x+2,y,z-1,0) setTile(x+2,y,z-2,0) setTile(x+2,y,z+1,0) setTile(x+2,y,z+2,0) setTile(x-2,y,z,0) setTile(x-2,y,z-1,0) setTile(x-2,y,z+1,0) setTile(x-2,y,z+2,0) setTile(x-2,y,z-1,0) setTile(x-2,y,z-2,0) setTile(x,y,z-2,0) setTile(x,y,z+2,0) setTile(x+1,y,z-2,0) setTile(x+1,y,z+2,0) setTile(x-1,y,z-2,0) setTile(x-1,y,z+2,0) }else if(itemId==483){ var player = getPlayerEnt(); getTile(x,y,z); setPosition(player,x+0.5,y+2.625,z+0.5); }else if(itemId==480){ getTile(x,y,z); setTile(x,y,z,0) addItemInventory(blockId,damage); }else if(itemId==481){ addItemInventory(blockId,1); }else if(itemId==482){ addItemInventory(blockId,4); }else if(itemId==484){ Level.setTime(0); }else if(itemId==485){ Level.setTime(2500); }} function leaveGame() { var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); activity.runOnUiThread(new java.lang.Runnable({ run: function() { if(buttonWindow != null) { buttonWindow.dismiss(); buttonwindow = null; } }})); }
Quote from BeATz_UnKNoWN Well that's because you can't run the UI thread twice and you can't use the same PopupWindow twice!
Quote from Jorge1232 Oh, is there still a possibility on fixing this or would I have to make these separate GUI mod scripts?
var buttonWindow = null; var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); function newLevel() { var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); activity.runOnUiThread(new java.lang.Runnable({ run: function() { try{ buttonWindow = new android.widget.PopupWindow(); var layout = new android.widget.RelativeLayout(activity); var button = new android.widget.Button(activity); button.setText("Tools"); button.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(viewarg) { ModPE.setItem(506,"record_chirp",0,"Eraser"); ModPE.setItem(507,"record_far",0,"Eraser x3"); ModPE.setItem(508,"record_mall",0,"Eraser x5"); ModPE.setItem(483,"record_mellohi",0,"Teleportation Stick"); ModPE.setItem(480,"record_stal",0,"Cut"); ModPE.setItem(481,"record_strad",0,"Copy"); ModPE.setItem(482,"record_wait",0,"Copy x4"); ModPE.setItem(484,"repeater",0,"Morning"); ModPE.setItem(485,"rotten_flesh",0,"Night"); addItemInventory(509,1); addItemInventory(506,1); addItemInventory(507,1); addItemInventory(508,1); addItemInventory(483,1); addItemInventory(480,1); addItemInventory(481,1); addItemInventory(482,1); addItemInventory(484,1); addItemInventory(485,1); clientMessage("Tools added to inventory."); } })); layout.addView(button); buttonWindow.setContentView(layout); buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); buttonWindow.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.LEFT | android.view.Gravity.TOP, 475, 0); }catch(problem){ print("Button could not be displayed: " + problem); } }})); activity.runOnUiThread(new java.lang.Runnable({ run: function() { try{ buttonWindow = new android.widget.PopupWindow(); var layout = new android.widget.RelativeLayout(activity); var button = new android.widget.Button(activity); button.setText("Spawn Eggs"); button.setOnClickListener(new android.view.View.OnClickListener({ onClick: function(viewarg) { ModPE.setItem(500,"quiver",0,"Spawn Zombie"); ModPE.setItem(501,"record_11",0,"Spawn Creeper"); ModPE.setItem(502,"record_13",0,"Spawn Skeleton"); ModPE.setItem(503,"record_blocks",0,"Spawn Spider"); ModPE.setItem(504,"record_cat",0,"Spawn Zombie Pigman"); addItemInventory(500,1); addItemInventory(501,1); addItemInventory(502,1); addItemInventory(503,1); addItemInventory(504,1); clientMessage("Eggs added to inventory.") } })); layout.addView(button); buttonWindow.setContentView(layout); buttonWindow.setWidth(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setHeight(android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); buttonWindow.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT)); buttonWindow.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.LEFT | android.view.Gravity.TOP, 575, 0); }catch(problem){ } }})); } function useItem(x,y,z,itemId,blockId,side){ if(itemId==500){ Level.spawnMob(x+.5,y+1,z+.5,32,"mob/zombie.png"); }else if(itemId==501){ Level.spawnMob(x+.5,y+1,z+.5,33,"mob/creeper.png"); }else if(itemId==502){ Level.spawnMob(x+.5,y+1,z+.5,34,"mob/skeleton.png"); }else if(itemId==503){ Level.spawnMob(x+.5,y+1,z+.5,35,"mob/spider.png"); }else if(itemId==504){ Level.spawnMob(x+.5,y+1,z+.5,36,"mob/pigzombie.png"); }else if(itemId==506){ getTile(x,y,z); setTile(x,y,z,0); }else if(itemId==507){ getTile(x,y,z); setTile(x,y,z,0) setTile(x-1,y,z,0) setTile(x,y,z-1,0) setTile(x-1,y,z-1,0) setTile(x+1,y,z+1,0) setTile(x+1,y,z,0) setTile(x,y,z+1,0) setTile(x-1,y,z+1,0) setTile(x+1,y,z-1,0) }else if(itemId==508){ getTile(x,y,z); setTile(x,y,z,0) setTile(x-1,y,z,0) setTile(x,y,z-1,0) setTile(x-1,y,z-1,0) setTile(x+1,y,z+1,0) setTile(x+1,y,z,0) setTile(x,y,z+1,0) setTile(x-1,y,z+1,0) setTile(x+1,y,z-1,0) setTile(x+2,y,z,0) setTile(x+2,y,z-1,0) setTile(x+2,y,z-2,0) setTile(x+2,y,z+1,0) setTile(x+2,y,z+2,0) setTile(x-2,y,z,0) setTile(x-2,y,z-1,0) setTile(x-2,y,z+1,0) setTile(x-2,y,z+2,0) setTile(x-2,y,z-1,0) setTile(x-2,y,z-2,0) setTile(x,y,z-2,0) setTile(x,y,z+2,0) setTile(x+1,y,z-2,0) setTile(x+1,y,z+2,0) setTile(x-1,y,z-2,0) setTile(x-1,y,z+2,0) }else if(itemId==483){ var player = getPlayerEnt(); getTile(x,y,z); setPosition(player,x+0.5,y+2.625,z+0.5); }else if(itemId==480){ getTile(x,y,z); setTile(x,y,z,0) addItemInventory(blockId,damage); }else if(itemId==481){ addItemInventory(blockId,1); }else if(itemId==482){ addItemInventory(blockId,4); }else if(itemId==484){ Level.setTime(0); }else if(itemId==485){ Level.setTime(2500); }} function leaveGame() { var activity = com.mojang.minecraftpe.MainActivity.currentMainActivity.get(); activity.runOnUiThread(new java.lang.Runnable({ run: function() { if(buttonWindow != null) { buttonWindow.dismiss(); buttonwindow = null; } }})); }Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
Oh, is there still a possibility on fixing this or would I have to make these separate GUI mod scripts?
Put the two GUI's into 2 custom functions. Then launch the function in the newLevel hook.
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]