Skip to content

Custom Blocks

Devan-Kerman edited this page Mar 1, 2020 · 1 revision

Custom Blocks are more advanced than custom items, so go read that one first.

LocalEvents

the @LocalEvent annotation is used for listeners of per-block events

public class MyBlock {
   ... fields and other methods ...
   @LocalEvent
   private void place(PlaceEvent event) {
   	System.out.println("placed!");
	event.getBlock().setType(Material.STONE);
   }
   ... serializers and deserializers ... 
}

I'm too lazy to write docs on this, but it's not too complicated, if the examples aren't enough, tell me and I'll update them

Simple Example Advanced Example

BlockItem

block item is a class that allows you to handle block and item logic in the same class, look at the TestBlock.java for reference

Clone this wiki locally