Chest Tracker
Home
  • 📗Overview
  • ⛏️Install Requirements & Integrations
  • User Guide
    • 🔎Searching for Items
    • 🪟Using the GUI
    • 🟢Using the Inventory Button
    • 🔤In-world Labels
    • ⚠️Common Issues
  • Developer Guide
    • 🛠️Adding Button Positions
Powered by GitBook
On this page
  1. Developer Guide

Adding Button Positions

How it works and adding your own defaults

When opening the GUI, Chest Tracker places the button based on the following criteria:

  1. Where a user has manually moved it (stored under chesttracker/user_button_positions.dat)

  2. From a position specified for that particular screen's class via resource pack (see below)

  3. From the default position specified via resource pack (see below)

  4. A hardcoded copy of the default position, if for whatever reason pack loading fails

Don't write it yourself!

Chest Tracker adds an export button which can be turned on in the global mod settings. This allows you to export the button's current position to the chesttracker/export directory, after dragging and positioning it yourself.

Adding your own default positions

Position references are stored under assets/<pack id>/chesttracker_button_positions. Files consist of a list of screens to apply to, and a position object saying where to place the button based on anchor points and offsets.

The file name doesn't matter; feel free to name it whatever you want for organisational purposes.

Adding the class name DEFAULT will replace the default position for screens that don't have a registered position. This may be useful in the case of pack devs which are also shipping button-supplying mods.

For a practical example, take the shipped position for the enchanting table, which moves the button outside as to not overlap the top enchanting option:

{
  // a list of java class names to apply this to.
  // This is generally intended for vanilla classes' intermediary and mojmap names,
  // but can be used to apply to multiple classes.
  // A special case is the class name 'DEFAULT', which is used as the generic fallback.
  "class_names": [ 
    "net.minecraft.class_486",
    "net.minecraft.client.gui.screens.inventory.EnchantmentScreen"
  ],
  // A definition consisting of X and Y anchor points and their offsets.
  "position": {
    "x_align": "right",
    "x_offset": 14,
    "y_align": "top",
    "y_offset": -11
  }
}

The valid options for x_align, as well as their x_offset behavior is as follows:

x_align
Description
x_offset

screen_left

Aligned to the left side of the window.

Pixels from the left of the screen.

screen_right

Aligned to the right side of the window.

Pixels from the right of the screen.

left_with_recipe

Aligned to the left side of the GUI. Moves left when a recipe book is open.

Pixels from the left of the GUI or Open Recipe Book, positive rightwards.

left

Aligned to the left side of the GUI. Does not move left when a recipe book is open.

Pixels from the left of the GUI, positive rightwards.

right

Aligned to the right side of the GUI.

Pixels from the left of the GUI, positive leftwards.

The valid options for y_align, as well as their y_offset behavior is as follows:

y_align
Description
y_offset

screen_top

Aligned to the top side of the window.

Pixels from the top of the screen.

screen_bottom

Aligned to the bottom side of the window.

Pixels from the bottom of the screen.

top

Aligned to the top side of the GUI.

Pixels from the top of the GUI, positive downwards.

bottom

Aligned to the bottom side of the GUI.

Pixels from the bottom of the GUI, positive upwards.

PreviousCommon Issues

Last updated 8 months ago

🛠️