broken
parent
9378f40a75
commit
12f858bbbd
Binary file not shown.
@ -0,0 +1,64 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import lotr.common.LOTRLevelData;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
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 = getFaction(entityplayer);
|
||||
if (!world.isRemote) {
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, ((Entity)entityplayer).boundingBox.expand(12.0D, 8.0D, 12.0D));
|
||||
if (!entities.isEmpty())
|
||||
for (int i = 0; i < entities.size(); i++) {
|
||||
EntityLivingBase entity = entities.get(i);
|
||||
if (entity != entityplayer) {
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving)entity;
|
||||
if (!faction.isGoodRelation(LOTRMod.getNPCFaction((Entity)entityliving)))
|
||||
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;
|
||||
}
|
||||
|
||||
private LOTRFaction getFaction(EntityPlayer player) {
|
||||
LOTRFaction faction = LOTRFaction.WOOD_ELF;
|
||||
if (faction == null) {
|
||||
faction = LOTRFaction.WOOD_ELF;
|
||||
}
|
||||
return faction;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue