promotional bannermobile promotional banner

BlockAPI

Easily create blocks with custom effects ! Persistence beetween restart !
<p>The first logo for this plugin.</p>

The first logo for this plugin.

Description

Latest build : v0.6 CraftBukkit: 1.5.2

Easily create blocks with custom effects ! Persistence beetween restart !

Do not need Spout or SpoutCraft !

This plugin provides an API for plugin developers to create blocks with custom effects. It's like creating new blocks but without new textures. You've got the total control of what you can do. There are some new events like when the player walks on your block, when he right/left click on, and soon much more !


Commands & Permissions

commandinformationpermission
/blocklistDisplay the whole custom block listcblock.list
/getblock <name> [amount]Gives you the custom block with that name in amount timescblock.get

DEVELOPER PART


How to create my custom block ?


Plugin Solution

  1. Download the BlockAPI.jar and add it to your build path as a library
  2. Add this line depend : [BlockAPI] to your plugin.yml
  3. Create a new class that extends CustomBlock
  4. ( You should do this part, but you can jump it ) Change its identifier, its name, its blockID ( the block id in what it will render to and by default its properties such as item to destroy... ), add its effect ( to get the methods see here)
  5. Add your custom block
    BlockAPI blockAPI =(BlockAPI) plugin.getServer().getPluginManager().getPlugin("BlockAPI");
    if(blockAPI==null)
    //Here handle that BlockAPI isn't installed on this server
    else
    blockAPI.addMyCustomBlock(myCustomBlock);
    //OR
    blockAPI.addMyCustomBlocks(myCustomBlockList):
    
  6. Say to your users that if they want to use your plugin they must download this one
  7. Now that's OK !

No plugin just the class

  1. Create a new class that extends CustomBlock with the constructor with no args
  2. You can make calls to BlockAPi methods or Bukkit API methods
  3. ( You should do this part, but you can jump it ) Change its identifier, its name, its blockID ( the block id in what it will render to and by default its properties such as item to destroy... ), add its effect ( to get the methods see here)
  4. Then compile it as a .class file
  5. Add your class file in plugins/BlockAPI/Blocks/ and your custom block will be automatically added
  6. You're done then if ou want to share it with the bukkit community post it on the forum

Methods

To see all the methods of CustomBlock and all the BlockAPI methods, see here


Sample

Otherwise this is a sample TrampolineBlock :

public class TrampolineBlock extends CustomBlock{

	public TrampolineBlock() {
		super("trampo");
		setName("Trampoline");
		setBlockID(1);
		setMaxStackSize(128);
		ArrayList<String> desc = new ArrayList<String>();
		desc.add("Jump ! Jump !");
		setDescription(desc);
                setDrops(BlockAPI.getItem(this));
	}
	@Override
	public void walk(PlayerMoveEvent event){
		event.getPlayer().setFallDistance(0);
		event.getPlayer().setVelocity(event.getPlayer().getVelocity().setY(1));
	}

}

and here then the code added in onEnable() in the plugin class if you use the plugin solution, otherwise that's it.

BlockAPI blockAPI =(BlockAPI) plugin.getServer().getPluginManager().getPlugin("BlockAPI");
blockAPI.addMyCustomBlock(new TrampolineBlock());

Render

Block in inventories will now render as normal Blocks but their name will change to your custom block name and the quantity is handled in the title to avoid to limit maxStackSize Here it's 47 Trampoline Blocks in my inventory On the left : trampoline block / On the right : a mine block / In my hand : 10 Mine blocks


To do

  • Create some way for users ( not developers ) to create a custom block ( see Skript for implementation )
  • Add new textures.
  • Add sound support ( see Pl3xMidiPlayer for implementation )

The BlockAPI Team

profile avatar
  • 9
    Projects
  • 105.3K
    Downloads

More from _ForgeUser7442387View all

  • UltraLogger project image

    UltraLogger

    • 28.1K
    • Bukkit Plugins

    The utlimate logger, nothing can be done without be logged into one of the logs of this plugin

    • 28.1K
    • May 25, 2013
    • Bukkit Plugins
    • +1
  • AirPlacer project image

    AirPlacer

    • 15.8K
    • Bukkit Plugins

    Now place block in air without placing any other blocks !

    • 15.8K
    • May 18, 2013
    • Bukkit Plugins
  • FishThemAll project image

    FishThemAll

    • 862
    • Bukkit Plugins

    Makes the fishing rod a must have ! Add many useful features to the fishing rod !

    • 862
    • May 18, 2013
    • Bukkit Plugins
  • LavaBoat+ project image

    LavaBoat+

    • 16.7K
    • Bukkit Plugins

    Now Boats can go in lava !

    • 16.7K
    • November 26, 2011
    • Bukkit Plugins
    • +1
  • UltraLogger project image

    UltraLogger

    • 28.1K
    • Bukkit Plugins

    The utlimate logger, nothing can be done without be logged into one of the logs of this plugin

    • 28.1K
    • May 25, 2013
    • Bukkit Plugins
    • +1
  • AirPlacer project image

    AirPlacer

    • 15.8K
    • Bukkit Plugins

    Now place block in air without placing any other blocks !

    • 15.8K
    • May 18, 2013
    • Bukkit Plugins
  • FishThemAll project image

    FishThemAll

    • 862
    • Bukkit Plugins

    Makes the fishing rod a must have ! Add many useful features to the fishing rod !

    • 862
    • May 18, 2013
    • Bukkit Plugins
  • LavaBoat+ project image

    LavaBoat+

    • 16.7K
    • Bukkit Plugins

    Now Boats can go in lava !

    • 16.7K
    • November 26, 2011
    • Bukkit Plugins
    • +1