BlockAPI
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
command | information | permission |
---|---|---|
/blocklist | Display the whole custom block list | cblock.list |
/getblock <name> [amount] | Gives you the custom block with that name in amount times | cblock.get |
DEVELOPER PART
How to create my custom block ?
Plugin Solution
- Download the BlockAPI.jar and add it to your build path as a library
- Add this line depend : [BlockAPI] to your plugin.yml
- Create a new class that extends CustomBlock
- ( 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)
- 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):
- Say to your users that if they want to use your plugin they must download this one
- Now that's OK !
No plugin just the class
- Create a new class that extends CustomBlock with the constructor with no args
- You can make calls to BlockAPi methods or Bukkit API methods
- ( 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)
- Then compile it as a .class file
- Add your class file in plugins/BlockAPI/Blocks/ and your custom block will be automatically added
- 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
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 )
SRC SRC!
GITHUB!
Is there any updated version of this? I'm trying to make a custom block that acts as a hydroelectric generator and would love to use this but I need some documentation or an updated version for 1.8.7. If anyone has any information please let me know!
@Hartorn
can u give me updated file?
Hello man ! I found this plugin some time ago, and really think it is a useful and good one.
I modified it a bit, and updated it to the latest version.
Is it alright if I take it over and continue maintaining it ? Do you allow me to put it online ?
is vid now coming ?
@sonicwolfsspeed
Sorry, i'm sick currently then i did half the video part but can't do the rest.....
hmm just gone wate for the vid :/
@sonicwolfsspeed
EDIT : There is no persistnce if you use these characters currently
Ya it is possible ( i used \u00XX character ) :
@_Justyce_
just plz try it D:
@sonicwolfsspeed
It's may possible but that's not the aim of this plugin.
The aim is to provide an easy way to re-use current blocks to recreate new one with different effects
i just want to collor name blocks :D like (nametags)
whell i used the /blocklist and otter command it diten know the command the plugin fille dident made D:
@sonicwolfsspeed
I will make one when i can ( not before than saturday :$ )
Otherwise what exactly you don't get ?
plz make a vid i dont get it ?!?
@sonicwolfsspeed
Yes if in your CustomBlock class in the name of your block you add characters such as \u00A79 you can change the color of the name of the book, but when your block is placed it will render as a normal block. And when you'll destroy it it will drop the book. In fact without spout, currently you can not change a block name or its texture.
so u are saying that if it is done u can name or collor name the block?