Skip to content
Adrian Siekierka edited this page Jan 3, 2018 · 1 revision

Developer Tips

Last updated on 28th July 2017. Please note that other APIs exist in the Charset codebase, but they might not yet be finalized if not documented here. Always ask if you need more information!

Adding Charset to your development environment

See the GitHub readme for details.

Charset IMCs (Inter-Mod Communications)

Whitelisting blocks for Charset functionality

Charset, since 0.4.0-pre5, has begun adding robust handlers for actions such as block carrying. However, it cannot know whether it can execute said actions on every block safely, particularly blocks with tile entities added to them. The easiest way to whitelist your mod's blocks for Charset to know it's safe to use them in this manner is to notify Charset via an add/remove message.

Example:

FMLInterModComms.sendMessage("charset", "addCarry", barrelBlock.getRegistryName());

"charset" refers to the mod the messages are being sent to (in this case, Charset); "addCarry" is the whitelist command, telling Charset to add the "barrelBlock" block to the "carry" registry. As the value, you can either send the block's registry name or the tile entity's registry name.

The add/remove commands also support passing multiple categories for a single block, such as "add[carry,vehicle]" or "add[vehicle];remove[carry,push]".

Current functionality registries:

  • carry - Allow a block to be carried by shift-middleclicking it.
  • doubleDoor - Allow a BlockDoor to be affected by the double door tweak.
  • lock - Allow a given tile entity ID to be locked (storage.locks). Please note that you should provide an IMultiblockStructure capability if the given tile entity can be part of a multiblock! (Alternatively, you can provide the Lockable capability on the "null" EnumFacing yourself.)

Planned functionality registries:

  • push - Allow a block to be pushed and rotated (if possible) by Pistons.
  • vehicle - Allow a block to be inserted into Entity-based vehicles, such as Minecarts and boats.

Charset APIs

EntityGatherItemsEvent

This event is used by Charset to collect items which are being worn and/or held by an entity. Charset provides support for vanilla armor/hand slots, as well as Baubles. You can use it yourself, too!

Charset Capabilities

Caching

Charset has functionality built-in to cache capability objects which implement the ICacheable interface.

Base

The following capabilities are used across the entire mod, and providing them can greatly help in integrating your mod with Charset.

  • IAxisRotatable - provide this to allow your tile to be rotated clockwise around a specified axis. This is used, among others, by the Block Carrying tweak, and will be used for various forms of non-user block rotation in Charset.
  • IMovable - provide this to allow special handling for moving objects around. This is used, for example, by the Block Carrying tweak.
  • IMultiblockStructure - provide this to make Charset detect your tile as part of a multiblock. This is used, for example, by the storage.locks module, as well to prevent carrying certain objects in the Block Carrying tweak.