GuiModule.item constructor

GuiModule.item(
  1. Item handItem, {
  2. required List<GuiPage> pages,
  3. Item? placeholder,
  4. String countScore = _DEF_Count,
  5. String pageScore = _DEF_Page,
  6. Location? offset,
  7. bool alwaysActive = true,
  8. TextComponent? name,
  9. List<GuiSlot>? globalSlots,
  10. String path = 'gui',
})

objd_gui also includes the feature to show and hide the gui(as a minecart) if the player holds a specific item in their hand. So this acts kind of like a game menu or portable menu. Therefore a few additional arguments can be specified.

GuiModule.item(
	Item(Items.stone),
	alwaysActive: false,
	name: TextComponent('my awesome gui'),
)

The Item is obviously the item that you want to detect, you can also provide nbt or custommodels here. With the alwaysActive option you can toggle whether the Gui should appear always in front of the player or just in the floor when you look straight down (you can also provide a custom location with offset). And you can give the corresponding Minecart a custom name that will be displayed in the gui.

Implementation

factory GuiModule.item(
  Item handItem, {
  required List<GuiPage> pages,
  Item? placeholder,
  String countScore = _DEF_Count,
  String pageScore = _DEF_Page,
  Location? offset,
  bool alwaysActive = true,
  TextComponent? name,
  List<GuiSlot>? globalSlots,
  String path = 'gui',
}) =>
    GuiModule._(
      GuiContainer.minecart,
      null,
      null,
      pages,
      placeholder,
      countScore,
      pageScore,
      globalSlots,
      path,
      triggerGui: handItem,
      offset: offset,
      minecartAlwaysActive: alwaysActive,
      minecartName: name,
    );