Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package spicy.jojomod.objects.armor;
- import net.minecraft.client.model.ModelBiped;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.MobEffects;
- import net.minecraft.inventory.EntityEquipmentSlot;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- import net.minecraftforge.event.entity.living.LivingDeathEvent;
- import net.minecraftforge.event.entity.living.LivingEvent;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import spicy.jojomod.JojoMod;
- import spicy.jojomod.init.ItemInit;
- import spicy.jojomod.objects.item.models.ModelStoneMask;
- import spicy.jojomod.util.IHasModel;
- @Mod.EventBusSubscriber
- public class ItemStoneMask extends ItemArmor implements IHasModel {
- public ItemStoneMask(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {
- super(materialIn, renderIndexIn, equipmentSlotIn);
- setUnlocalizedName(JojoMod.modid + name);
- setRegistryName(name);
- setCreativeTab(JojoMod.jojoTab);
- ItemInit.ITEMS.add(this);
- }
- public static boolean isVampire = false;
- @SubscribeEvent
- public static void onDeath(LivingDeathEvent e){
- if(e.getSource().getTrueSource() instanceof EntityPlayer){ //If the killer was a player & helmet is equipped
- EntityPlayer sourcePlayer = (EntityPlayer) e.getSource().getTrueSource(); //Cast the source to a player varible
- if(sourcePlayer.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem() == ItemInit.STONE_MASK){
- //Vampire Effects
- effectsVampire(sourcePlayer);
- }
- }
- }
- private static void effectsVampire(EntityPlayer player){
- isVampire = true;
- player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 100000, 20, false, false));
- player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 100000, 3, false, false));
- player.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 100000, 2, false, false));
- player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 100000, 3, false, false));
- player.setAbsorptionAmount(20.0F);
- }
- @SubscribeEvent
- public static void onLivingUpdate(LivingEvent.LivingUpdateEvent e){
- if(e.getEntityLiving() instanceof EntityPlayer){
- EntityPlayer player = (EntityPlayer)e.getEntityLiving();
- while(isVampire = true){
- if(player.world.isDaytime()){
- if (player.world.canSeeSky(new BlockPos(player.posX, player.posY + (double)player.getEyeHeight(), player.posZ))){
- player.attackEntityFrom(DamageSource.ON_FIRE, Integer.MAX_VALUE);
- }
- }
- }
- }
- }
- /* lame model registry stuff nobody cares about and i hate it */
- public void registerModels(){
- JojoMod.proxy.registerItemRenderer(this,0, "inventory");
- }
- @SideOnly(Side.CLIENT)
- @Override
- public String getArmorTexture(ItemStack itemStack, Entity entity, EntityEquipmentSlot slot, String type){
- return JojoMod.modid + ":textures/items/stonemask.png";
- }
- @SideOnly(Side.CLIENT)
- @Override
- public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSLot, ModelBiped _default){
- return new ModelStoneMask(_default);
- }
- }
Add Comment
Please, Sign In to add comment