Skip to content

A library to easily create Minecraft style buttons in ModPE

License

Notifications You must be signed in to change notification settings

Desno365/Minecraft-Button-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A library to easily create Minecraft style buttons in ModPE

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published