Files
Wizardry/src/main/java/electroblob/wizardry/spell/ConjureArmour.java
T
Electroblob77 f37812be3e That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
2019-08-18 00:04:18 +01:00

53 lines
1.8 KiB
Java

package electroblob.wizardry.spell;
import com.google.common.collect.ImmutableMap;
import electroblob.wizardry.item.IConjuredItem;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import java.util.Map;
public class ConjureArmour extends SpellConjuration {
private static final Map<EntityEquipmentSlot, Item> SPECTRAL_ARMOUR_MAP = ImmutableMap.of(
EntityEquipmentSlot.HEAD, WizardryItems.spectral_helmet,
EntityEquipmentSlot.CHEST, WizardryItems.spectral_chestplate,
EntityEquipmentSlot.LEGS, WizardryItems.spectral_leggings,
EntityEquipmentSlot.FEET, WizardryItems.spectral_boots);
public ConjureArmour(){
super("conjure_armour", null);
}
@Override
protected boolean conjureItem(EntityPlayer caster, SpellModifiers modifiers){
ItemStack armour;
boolean flag = false;
// Used this rather than getArmorInventoryList because I need to access the slot itself
for(EntityEquipmentSlot slot : WizardryUtilities.ARMOUR_SLOTS){
if(caster.getItemStackFromSlot(slot).isEmpty() &&
!WizardryUtilities.doesPlayerHaveItem(caster, SPECTRAL_ARMOUR_MAP.get(slot))){
armour = new ItemStack(SPECTRAL_ARMOUR_MAP.get(slot));
IConjuredItem.setDurationMultiplier(armour, modifiers.get(WizardryItems.duration_upgrade));
// Sets a blank "ench" tag to trick the renderer into showing the enchantment effect on the armour model
armour.getTagCompound().setTag("ench", new NBTTagList());
caster.setItemStackToSlot(slot, armour);
flag = true;
}
}
return flag;
}
}