Interface ICapabilityInvalidationListener

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ICapabilityInvalidationListener
A listener for block capability invalidation.

Register with ServerLevel.registerCapabilityListener(net.minecraft.core.BlockPos, net.neoforged.neoforge.capabilities.ICapabilityInvalidationListener).

The listener will be held by a weak reference, so it is important to keep a strong reference to it as long as you need it.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Called when capabilities are invalidated.
  • Method Details

    • onInvalidate

      boolean onInvalidate()
      Called when capabilities are invalidated.

      The listener should check that it is valid before reacting to this notification, and if it is not valid anymore, it should return false.

      Returns:
      true if the listener is still valid, false if it should be removed from the list of listeners.