You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.9 KiB
Java
67 lines
2.9 KiB
Java
package com.zivilon.cinder_loe.items;
|
|
|
|
import com.zivilon.cinder_loe.CinderLoE;
|
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
import lotr.common.LOTRLevelData;
|
|
import lotr.common.LOTRMod;
|
|
import lotr.common.fac.LOTRFaction;
|
|
import lotr.common.item.LOTRItemSword;
|
|
import lotr.common.item.LOTRStoryItem;
|
|
import lotr.common.network.LOTRPacketHandler;
|
|
import lotr.common.network.LOTRPacketWeaponFX;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityLiving;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.potion.Potion;
|
|
import net.minecraft.potion.PotionEffect;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.List;
|
|
|
|
public class WoodElfRelic extends WizardStaff {
|
|
public WoodElfRelic() {
|
|
super();
|
|
}
|
|
|
|
|
|
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
|
entityplayer.swingItem();
|
|
itemstack.damageItem(2, (EntityLivingBase) entityplayer);
|
|
world.playSoundAtEntity((Entity) entityplayer, "lotr:elf.woodElf_teleport", 2.0F, (Item.itemRand.nextFloat() - Item.itemRand.nextFloat()) * 0.2F + 1.0F);
|
|
LOTRFaction faction = LOTRLevelData.getData(entityplayer).getPledgeFaction();
|
|
LOTRFaction woodElfFaction = LOTRFaction.WOOD_ELF;
|
|
|
|
if (!world.isRemote) {
|
|
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, ((Entity) entityplayer).boundingBox.expand(12.0D, 8.0D, 12.0D));
|
|
if (!entities.isEmpty()) {
|
|
for (EntityLivingBase entity : entities) {
|
|
if (entity != entityplayer) {
|
|
if (entity instanceof EntityLiving) {
|
|
EntityLiving entityliving = (EntityLiving) entity;
|
|
if (LOTRMod.getNPCFaction((Entity) entityliving) != woodElfFaction) {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
if (entity instanceof EntityPlayer) {
|
|
if (!MinecraftServer.getServer().isPVPEnabled() || LOTRLevelData.getData((EntityPlayer) entity).getAlignment(faction) < 0.0F) {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
entity.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 1200, 0));
|
|
entity.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 1200, 0));
|
|
}
|
|
}
|
|
}
|
|
|
|
LOTRPacketWeaponFX packet = new LOTRPacketWeaponFX(LOTRPacketWeaponFX.Type.MACE_SAURON, (Entity) entityplayer);
|
|
LOTRPacketHandler.networkWrapper.sendToAllAround((IMessage) packet, LOTRPacketHandler.nearEntity((Entity) entityplayer, 64.0D));
|
|
}
|
|
return itemstack;
|
|
}
|
|
} |