Search in sources :

Example 21 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.

the class Charm method applyEffectEntity.

@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (!(target instanceof EntityCreature) || ((EntityCreature) target).isPotionActive(BuffList.charmed) || EntityUtilities.isSummon((EntityCreature) target)) {
        return false;
    }
    int duration = SpellUtils.instance.getModifiedInt_Mul(BuffList.default_buff_duration, stack, caster, target, world, 0, SpellModifiers.DURATION);
    duration = SpellUtils.instance.modifyDurationBasedOnArmor(caster, duration);
    int x = (int) Math.floor(target.posX);
    int y = (int) Math.floor(target.posY);
    int z = (int) Math.floor(target.posZ);
    if (RitualShapeHelper.instance.checkForRitual(this, world, x, y, z) != null) {
        duration += (3600 * (SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0) + 1));
        RitualShapeHelper.instance.consumeRitualReagents(this, world, x, y, z);
    }
    if (target instanceof EntityAnimal) {
        ((EntityAnimal) target).func_146082_f(null);
        return true;
    }
    if (ExtendedProperties.For(caster).getCanHaveMoreSummons()) {
        if (caster instanceof EntityPlayer) {
            if (target instanceof EntityCreature) {
                BuffEffectCharmed charmBuff = new BuffEffectCharmed(duration, BuffEffectCharmed.CHARM_TO_PLAYER);
                charmBuff.setCharmer(caster);
                ((EntityCreature) target).addPotionEffect(charmBuff);
            }
            return true;
        } else if (caster instanceof EntityLiving) {
            if (target instanceof EntityCreature) {
                BuffEffectCharmed charmBuff = new BuffEffectCharmed(duration, BuffEffectCharmed.CHARM_TO_MONSTER);
                charmBuff.setCharmer(caster);
                ((EntityCreature) target).addPotionEffect(charmBuff);
            }
            return true;
        }
    } else {
        if (caster instanceof EntityPlayer) {
            ((EntityPlayer) caster).addChatMessage(new ChatComponentText("You cannot have any more summons."));
        }
        return true;
    }
    return false;
}
Also used : BuffEffectCharmed(am2.buffs.BuffEffectCharmed) EntityLiving(net.minecraft.entity.EntityLiving) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityAnimal(net.minecraft.entity.passive.EntityAnimal) ChatComponentText(net.minecraft.util.ChatComponentText) EntityCreature(net.minecraft.entity.EntityCreature)

Example 22 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.

the class Recall method applyEffectEntity.

@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
    if (!(target instanceof EntityLivingBase)) {
        return false;
    }
    if (caster.isPotionActive(BuffList.astralDistortion.id) || ((EntityLivingBase) target).isPotionActive(BuffList.astralDistortion.id)) {
        if (caster instanceof EntityPlayer)
            ((EntityPlayer) caster).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.cantTeleport")));
        return false;
    }
    int x = (int) Math.floor(target.posX);
    int y = (int) Math.floor(target.posY);
    int z = (int) Math.floor(target.posZ);
    ItemStack[] ritualRunes = RitualShapeHelper.instance.checkForRitual(this, world, x, y, z, false);
    if (ritualRunes != null) {
        return handleRitualReagents(ritualRunes, world, x, y, z, caster, target);
    }
    ExtendedProperties casterProperties = ExtendedProperties.For(caster);
    if (!casterProperties.getMarkSet()) {
        if (caster instanceof EntityPlayer && !world.isRemote)
            ((EntityPlayer) caster).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.noMark")));
        return false;
    } else if (casterProperties.getMarkDimension() != caster.dimension) {
        if (caster instanceof EntityPlayer && !world.isRemote)
            ((EntityPlayer) caster).addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.diffDimMark")));
        return false;
    }
    if (!world.isRemote) {
        ((EntityLivingBase) target).setPositionAndUpdate(casterProperties.getMarkX(), casterProperties.getMarkY(), casterProperties.getMarkZ());
    }
    return true;
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) ChatComponentText(net.minecraft.util.ChatComponentText) ParticleExpandingCollapsingRingAtPoint(am2.particles.ParticleExpandingCollapsingRingAtPoint) ExtendedProperties(am2.playerextensions.ExtendedProperties)

Example 23 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.

the class ArcaneCompendium method unlockEntry.

/**
 * Unlocks a Compendium Entry and all of it's related entries
 *
 * @param key The key used to identify the entry to unlock
 */
public void unlockEntry(String key) {
    boolean verbose = key.startsWith("cmd::");
    key = key.replace("cmd::", "");
    if (verbose && key.equals("all")) {
        for (CompendiumEntry entry : compendium.values()) {
            entry.setIsLocked(false);
        }
        Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.unlockSuccess")));
        return;
    }
    CompendiumEntry entry = getEntry(key);
    if (entry == null) {
        if (key.contains("@")) {
            entry = getEntry(key.split("@")[0]);
        }
        if (entry == null) {
            LogHelper.warn("Attempted to unlock a compendium entry for a non-existant key: " + key);
            if (verbose) {
                String message = String.format(StatCollector.translateToLocal("am2.tooltip.compEntryNotFound"), key);
                Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
            }
            return;
        }
    }
    while (entry.getParent() != null) entry = entry.getParent();
    if (entry.isLocked) {
        unlockEntry(entry, true);
        if (verbose) {
            Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("am2.tooltip.unlockSuccess"));
        }
    }
}
Also used : ChatComponentText(net.minecraft.util.ChatComponentText)

Example 24 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.

the class DumpNBT method processCommand.

@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
    EntityPlayerMP player = getCommandSenderAsPlayer(icommandsender);
    if (player.getCurrentEquippedItem() == null) {
        player.addChatMessage(new ChatComponentText("This command dumps the NBT of your current equipped item...see the problem here?"));
        return;
    }
    if (!player.getCurrentEquippedItem().hasTagCompound()) {
        player.addChatMessage(new ChatComponentText("No NBT exists on this item."));
        return;
    }
    AMNetHandler.INSTANCE.sendPacketToClientPlayer((EntityPlayerMP) player, AMPacketIDs.NBT_DUMP, new byte[0]);
}
Also used : EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 25 with ChatComponentText

use of v1_8_9.net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.

the class AffinityData method onAffinityAbility.

public void onAffinityAbility() {
    if (getAffinityDepth(Affinity.ENDER) >= 0.75) {
        if (this.entity.isSneaking()) {
            this.hasActivatedNightVision = !this.hasActivatedNightVision;
        } else {
            if (this.lastGroundPosition != null) {
                if (positionIsValid(lastGroundPosition)) {
                    spawnParticlesAt(lastGroundPosition);
                    spawnParticlesAt(new AMVector3(entity));
                    this.entity.setPosition(this.lastGroundPosition.x, this.lastGroundPosition.y + 1, this.lastGroundPosition.z);
                    ExtendedProperties.For((EntityLivingBase) this.entity).setFallProtection(20000);
                    this.entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
                    this.setCooldown(AMCore.config.getEnderAffinityAbilityCooldown());
                } else {
                    ((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
                }
            } else {
                ((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
            }
        }
    }
// beyond here we can handle other affinities that have activatable abilities
}
Also used : AMVector3(am2.api.math.AMVector3) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

ChatComponentText (net.minecraft.util.ChatComponentText)383 IChatComponent (net.minecraft.util.IChatComponent)55 EntityPlayer (net.minecraft.entity.player.EntityPlayer)43 ChatStyle (net.minecraft.util.ChatStyle)39 ItemStack (net.minecraft.item.ItemStack)36 ClickEvent (net.minecraft.event.ClickEvent)31 World (net.minecraft.world.World)28 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)26 TileEntity (net.minecraft.tileentity.TileEntity)25 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)25 HoverEvent (net.minecraft.event.HoverEvent)23 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)21 ArrayList (java.util.ArrayList)17 RfToolsDimensionManager (mcjty.rftools.dimension.RfToolsDimensionManager)16 Block (net.minecraft.block.Block)15 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)15 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)14 Entity (net.minecraft.entity.Entity)14 DimensionInformation (mcjty.rftools.dimension.DimensionInformation)13 File (java.io.File)12