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;
}
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;
}
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"));
}
}
}
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]);
}
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
}
Aggregations