promotional bannermobile promotional banner

Equipment API

An API that allows mods to register their own equipment slots

An API that allows mods to add their own equipment slots, based on baubles, but allowing mods to register dedicated slots for special items.

 

Press the R key or click the pickaxe in the corner of the player inventory screen to open the equipment screen.

 

The equipment screen will show all the registered slots. If there are more than 8 you can click the arrow buttons to go to other pages.

- All the slots here are only for demonstration purposes, they aren't included in the mod.

 

How to use the API:

The API is very simple, it mostly consists of registering an EquipmentType, which handles what can be placed in a slot, the appearance of that slot, and what happens when that slot changes.

Registering a basic slot:

EquipmentApi.registerEquipment(YOUR_EQUIPMENT_ID, new EquipmentType() {
	
	ResourceLocation overlay = new ResourceLocation(YOURMODID, "textures/YOUR_SLOT_OVERLAY.png");
	
	@Override
	/* The texture to overlay on the slot (displays below the item) */
	public ResourceLocation getSlotOverlay(ItemStack stack) {
		return overlay;
		// you may also want to do `return stack == null ? null : overlay;`
		// this will make the background image disappear when you place an item in the slot
	}
	
	@Override
	/* Whether the player can take the supplied stack out of the slot */
	public boolean canRemoveStack(ItemStack stack, EntityPlayer player) {
		return true;
	}
	
	@Override
	/* Whether the player can place the supplied stack in the slot */
	public boolean canPlaceStack(ItemStack stack) {
		return stack != null && stack.getItem() != null && stack.getItem() == Items.arrow;
	}
	
	@Override
	/* The maximum stack size of this slot */
	public int getStackLimit() {
		return 64;
	}

	@Override
	/* The text description to show on hover, "\n" will work */
	public String getSlotDescription(EntityPlayer player) {
		return "Arrows";
	}
	
	@Override
	/* This is called whenever the slot is changed */
	public void onChange(ItemStack from, ItemStack to,
			EntityPlayer player) {
		
	}
});

 

 

The Equipment API Team

profile avatar
  • 11
    Followers
  • 10
    Projects
  • 9.2M
    Downloads

More from thecodewarrior1View all

  • Hooked project image

    Hooked

    • 8.5M
    • Mods

    Grappling hooks done simple, natural, and useful.

    • 8.5M
    • October 21, 2025
    • Mods
    • +1
  • LibrarianLib project image

    LibrarianLib

    • 29.7M
    • Mods

    An extensive collection of tools, utilities, and frameworks.

    • 29.7M
    • June 10, 2025
    • Mods
  • SoundCap project image

    SoundCap

    • 12.9K
    • Mods

    Increases the maximum number of sounds that can play at one time

    • 12.9K
    • December 12, 2020
    • Mods
  • Catwalks 4 project image

    Catwalks 4

    • 925.5K
    • Mods

    Making factories look nicer since 2018!

    • 925.5K
    • April 21, 2020
    • Mods
    • +2
  • Hooked project image

    Hooked

    • 8.5M
    • Mods

    Grappling hooks done simple, natural, and useful.

    • 8.5M
    • October 21, 2025
    • Mods
    • +1
  • LibrarianLib project image

    LibrarianLib

    • 29.7M
    • Mods

    An extensive collection of tools, utilities, and frameworks.

    • 29.7M
    • June 10, 2025
    • Mods
  • SoundCap project image

    SoundCap

    • 12.9K
    • Mods

    Increases the maximum number of sounds that can play at one time

    • 12.9K
    • December 12, 2020
    • Mods
  • Catwalks 4 project image

    Catwalks 4

    • 925.5K
    • Mods

    Making factories look nicer since 2018!

    • 925.5K
    • April 21, 2020
    • Mods
    • +2