package com.minelittlepony.unicopia.entity; import java.util.Optional; import javax.annotation.Nullable; import net.minecraft.entity.Entity; public interface PonyContainer> { Equine create(); T get(); @SuppressWarnings("unchecked") static > Optional> of(@Nullable Entity entity) { if (entity instanceof PonyContainer) { return Optional.of(((PonyContainer)entity)); } return Optional.empty(); } }