Documentary for Developers

Documentary

Here you'll find the most important things about how to use the API. There are many examples in the Conquest class you can see with Luyten or JDGui.

XBlock

The XBlock class is the standart class. The constructor always contains the name to be shown to the player, the id and the data value. It can contain a list of drops or quantum drops which means they are dropped at a special rate (e.g. 10%)

boolean on(Right/Left)Click(Player actor, ItemStack inHand, Block clicked) will be called if your XBlock is clicked by a player. It returns whether the called event should be cancelled.

XBlockDeco extends XBlock

A subclass for the special behavior of a decoration block: do nothing on click There is a special constructor for needed silktouch, too.

XBlockDeco.SimpleChange extends XBlockDeco

A subclass for the special behavior of a block that changes its id and data values onRightClick with a special tool with the ending "chisel". The second data can be overgiven in the constructor.

XBlockInventory

A subclass for the special behavior of a chest like block. The construcor expects the name to be shown to the player, the properties (null), the id, the data value, the name shown in inventory, the Shape as String which should have the lenght of invsize*9, and the invsize in 9. (1 means 9, 2 means 18, ...)

The Shape-String adds some standart behavior:

  • space: a space for own blocks
  • d: Diamond
  • x: Nothing (a black window pane which can't be taken)
  • X: Close the inventory (vines with red title | can't be taken eighter)

The method InventoryClick will be called on inventory click and InventorySave on closing... so if you don't want to save nothing or create your own saving strategie you should let it be the same.

XBasicRecipe

Is the basic class for recipes. You have to register them in the MoBlocks.recipes-arraylist before onEnable if you want to use them! Each recipe contains a public String show() which gives you the string for /recipe help.

XRecipe extends XBasicRecipe

A shaped recipe. Expects the result Itemstack, the shape as String(0..8 are allowed chars, space means nothing), and a list of XMaterials to use (first = 0, second = 1, ...).

SRecipe extends XRecipe

A shapeless recipe, just expects the result ItemStack and a list of your XMaterials. The property amount of XMaterial will be used, you don't have to write is multiple times per recipe.

FRecipe extends XBasicRecipe

A furnace recipe expects just the result and the burned itemstack

XMaterial

There are several constructors, but there is a rule you can't fail: <amount>, Material as ID, <data value> OR <ItemStack>, <name as String>


Comments

Posts Quoted:
Reply
Clear All Quotes