Interface IPocketAccess

All Superinterfaces:
PocketComputer

@NonExtendable public interface IPocketAccess extends PocketComputer
Access to a pocket computer for pocket upgrades.
  • Method Details

    • getLight

      int getLight()
      Get the colour of this pocket computer's light as a RGB number.
      Returns:
      The colour this light is. This will be a RGB colour between 0x000000 and 0xFFFFFF or -1 if it has no colour.
      See Also:
    • setLight

      void setLight(int colour)
      Set the colour of the pocket computer's light to a RGB number.
      Parameters:
      colour - The colour this modem's light will be changed to. This should be a RGB colour between 0x000000 and 0xFFFFFF or -1 to reset to the default colour.
      See Also:
    • getUpgrade

      @Nullable UpgradeData<IPocketUpgrade> getUpgrade()
      Get the currently equipped upgrade.
      Returns:
      The currently equipped upgrade.
      See Also:
    • setUpgrade

      void setUpgrade(@Nullable UpgradeData<IPocketUpgrade> upgrade)
      Set the upgrade for this pocket computer, also updating the item stack.

      This method can only be called from the main server thread, when this computer is is active.

      Parameters:
      upgrade - The new upgrade to set it to, may be null.
      See Also:
    • getUpgradeData

      net.minecraft.core.component.DataComponentPatch getUpgradeData()
      Get the upgrade-specific NBT.

      This is persisted between computer reboots and chunk loads.

      Returns:
      The upgrade's NBT.
      See Also:
    • setUpgradeData

      void setUpgradeData(net.minecraft.core.component.DataComponentPatch data)
      Update the upgrade-specific data.

      This method can only be called from the main server thread, when this computer is is active.

      Parameters:
      data - The new upgrade data.
      See Also:
    • invalidatePeripheral

      void invalidatePeripheral()
      Remove the current peripheral and create a new one.

      You may wish to do this if the methods available change, for instance when the owning entity changes.