A library to easily create Minecraft style buttons in ModPE
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
screenshots
LICENSE
README.md
library.js
mod-test.js

README.md

Minecraft Button Library for MCPE mods

The Minecraft Button Library brings a nice Minecraft style for your buttons created with the android.widget.Button class.
This library is intended to work only for Minecraft Pocket Edition mods, also known as ModPE Scripts.

Version

2.1.0

Screenshots

Features

  • Easy installation (you just have to copy the code of the library in your mod)
  • Easy upgrade from the default Android buttons to the Minecraft style button: only one line of code has to be changed
  • Works with every device, resolution and screen density!
  • Support Texture Pack (NEW!)

Installation

Copy the code of the library.js and paste it into your ModPE script.

Example

If you want to see how this library looks you can try the mod-test.js script.
The test buttons are displayed when you hold the Iron Sword in the game.
Just copy this link https://raw.githubusercontent.com/Desno365/Minecraft-Button-Library/master/mod-test.js and paste it in BlockLauncher --> Manage ModPE Scripts --> Import --> Web address.

Upgrade

To upgrade your default Android buttons to the Minecraft buttons you just need to change this var button1 = new android.widget.Button(context); to this var button1 = MinecraftButton();

Example of the code of the default Android button:

var button1 = new android.widget.Button(com.mojang.minecraftpe.MainActivity.currentMainActivity.get());
button1.setOnClickListener(new android.view.View.OnClickListener()
{
	onClick: function(v)
	{
		clientMessage("You clicked me");

		return false;
	}
});
button1.setText("I'm a button!");

Example of the code of the Minecraft style button:

var button1 = MinecraftButton();
button1.setOnClickListener(new android.view.View.OnClickListener()
{
	onClick: function(v)
	{
		clientMessage("You clicked me");

		return false;
	}
});
button1.setText("I'm a Minecraft button!");

Changelog

2.1.0:
 - Added a global option to disable padding animation when button is pressed
 - Added a global option to change color of the shadow when the button is pressed

2.0.0:
 - Support Texture Packs!
 - Completely new engine to load the NinePatchDrawable

Known bugs

No bugs found.
If you find one bug you can report it here on the Github repository. Just create a new issue and explain what the bug is.

License

MIT