Interface DistExecutor.SafeReferent

All Known Subinterfaces:
DistExecutor.SafeCallable<T>, DistExecutor.SafeRunnable, DistExecutor.SafeSupplier<T>
Enclosing class:

public static interface DistExecutor.SafeReferent
A safe referent. This will assert that it is being called via a separated class method reference. This will avoid the common pitfalls of DistExecutor.callWhenOn(Dist, Supplier) above. SafeReferents assert that they are defined as a separate method outside the scope of the calling class. Implementations need to be defined in a separate class to the referring site, with appropriate visibility to be accessible at the callsite (generally, avoid private methods).

DistExecutor.safeCallWhenOn(Dist.CLIENT, ()->AnotherClass::clientOnlyMethod);

DistExecutor.safeCallWhenOn(Dist.CLIENT, ()->()->Minecraft.getInstance().world);