Search in sources :

Example 6 with PotionEffect

use of com.viste.realisticarmortiers.data.PotionEffect in project RealisticArmorTiers by IsakViste.

the class ArmorStorage method readNBT.

@Override
public void readNBT(Capability<IArmor> capability, IArmor instance, Direction side, INBT nbt) {
    NBTTagCompound bigCompoundList = (NBTTagCompound) nbt;
    NBTTagList itemList = bigCompoundList.getTagList("items", net.minecraftforge.common.util.Constants.NBT.TAG_LIST);
    for (int i = 0; i < itemList.tagCount(); i++) {
        new ItemStack(itemList.getCompoundTagAt(i));
    }
    NBTTagList potionList = bigCompoundList.getTagList("setEffects", net.minecraftforge.common.util.Constants.NBT.TAG_LIST);
    for (int i = 0; i < potionList.tagCount(); i++) {
        new PotionEffect(potionList.getCompoundTagAt(i).getString("effect"), potionList.getCompoundTagAt(i).getInteger("efficiency"), 0);
    }
    NBTTagList usedPotionList = bigCompoundList.getTagList("usedSetEffects", net.minecraftforge.common.util.Constants.NBT.TAG_LIST);
    for (int i = 0; i < usedPotionList.tagCount(); i++) {
        new PotionEffect(usedPotionList.getCompoundTagAt(i).getString("effect"), usedPotionList.getCompoundTagAt(i).getInteger("efficiency"), usedPotionList.getCompoundTagAt(i).getInteger("duration"));
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) PotionEffect(com.viste.realisticarmortiers.data.PotionEffect) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Aggregations

PotionEffect (com.viste.realisticarmortiers.data.PotionEffect)6 ItemStack (net.minecraft.item.ItemStack)3 Effect (net.minecraft.potion.Effect)3 EffectInstance (net.minecraft.potion.EffectInstance)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 IArmor (com.viste.realisticarmortiers.capability.IArmor)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 EventEquipmentGlobalVar (com.viste.realisticarmortiers.data.EventEquipmentGlobalVar)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1