Search in sources :

Example 1 with GenericDataStorage

use of com.cjm721.overloaded.storage.GenericDataStorage in project Overloaded by CJ-MC-Mods.

the class ArmorEventHandler method getHelmetDataStorage.

@Nonnull
private static IGenericDataStorage getHelmetDataStorage(PlayerEntity player) {
    for (ItemStack stack : player.inventory.armor) {
        if (stack.getItem() instanceof ItemMultiHelmet) {
            IGenericDataStorage cap = stack.getCapability(GENERIC_DATA_STORAGE).orElse(new GenericDataStorage());
            cap.suggestUpdate();
            return cap;
        }
    }
    return new GenericDataStorage();
}
Also used : IGenericDataStorage(com.cjm721.overloaded.storage.IGenericDataStorage) IGenericDataStorage(com.cjm721.overloaded.storage.IGenericDataStorage) GenericDataStorage(com.cjm721.overloaded.storage.GenericDataStorage) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Aggregations

GenericDataStorage (com.cjm721.overloaded.storage.GenericDataStorage)1 IGenericDataStorage (com.cjm721.overloaded.storage.IGenericDataStorage)1 Nonnull (javax.annotation.Nonnull)1 ItemStack (net.minecraft.item.ItemStack)1