Interface IPocketUpgrade

All Superinterfaces:
UpgradeBase
All Known Implementing Classes:
AbstractPocketUpgrade

public interface IPocketUpgrade extends UpgradeBase
A peripheral which can be equipped to the back side of a pocket computer.

Pocket upgrades are defined in two stages. First, on creates a IPocketUpgrade subclass and corresponding PocketUpgradeSerialiser instance, which are then registered in a Forge registry.

You then write a JSON file in your mod's data/ folder. This is then parsed when the world is loaded, and the upgrade registered internally. See the documentation in PocketUpgradeSerialiser for details on this process and where files should be located.

See Also:
  • Method Details

    • createPeripheral

      @Nullable IPeripheral createPeripheral(IPocketAccess access)
      Creates a peripheral for the pocket computer.

      The peripheral created will be stored for the lifetime of the upgrade, will be passed an argument to update(IPocketAccess, IPeripheral) and will be attached, detached and have methods called in the same manner as an ordinary peripheral.

      Parameters:
      access - The access object for the pocket item stack.
      Returns:
      The newly created peripheral.
      See Also:
    • update

      default void update(IPocketAccess access, @Nullable IPeripheral peripheral)
      Called when the pocket computer item stack updates.
      Parameters:
      access - The access object for the pocket item stack.
      peripheral - The peripheral for this upgrade.
      See Also:
    • onRightClick

      default boolean onRightClick(net.minecraft.world.level.Level world, IPocketAccess access, @Nullable IPeripheral peripheral)
      Called when the pocket computer is right clicked.
      Parameters:
      world - The world the computer is in.
      access - The access object for the pocket item stack.
      peripheral - The peripheral for this upgrade.
      Returns:
      true to stop the GUI from opening, otherwise false. You should always provide some code path which returns false, such as requiring the player to be sneaking - otherwise they will be unable to access the GUI.
      See Also: