use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class BlockAstralBarrier method onBlockActivated.
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
TileEntityAstralBarrier abte = null;
if (te != null && te instanceof TileEntityAstralBarrier) {
abte = (TileEntityAstralBarrier) te;
} else {
return true;
}
if (HandleSpecialItems(par1World, par5EntityPlayer, par2, par3, par4)) {
return true;
}
if (!par1World.isRemote)
if (KeystoneUtilities.HandleKeystoneRecovery(par5EntityPlayer, ((IKeystoneLockable) par1World.getTileEntity(par2, par3, par4))))
return true;
if (KeystoneUtilities.instance.canPlayerAccess((IKeystoneLockable) par1World.getTileEntity(par2, par3, par4), par5EntityPlayer, KeystoneAccessType.USE)) {
if (par5EntityPlayer.isSneaking()) {
if (par1World.isRemote) {
abte.ToggleAuraDisplay();
par5EntityPlayer.addChatMessage(new ChatComponentText("Barrier Aura Toggled"));
}
} else {
if (!par1World.isRemote) {
super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9);
FMLNetworkHandler.openGui(par5EntityPlayer, AMCore.instance, ArsMagicaGuiIdList.GUI_ASTRAL_BARRIER, par1World, par2, par3, par4);
}
}
}
return true;
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class SetAffinityCommand method processCommand.
@Override
public void processCommand(ICommandSender var1, String[] var2) {
if (var2.length != 3 && var2.length != 2) {
throw new WrongUsageException(this.getCommandUsage(var1), new Object[0]);
}
EntityPlayer player = null;
String affinity = "";
float depth = 0f;
if (var2.length == 3) {
player = getPlayer(var1, var2[0]);
affinity = var2[1].toUpperCase();
depth = tryParseInt(var2[2]);
} else {
player = getCommandSenderAsPlayer(var1);
affinity = var2[0].toUpperCase();
depth = tryParseInt(var2[1]);
}
if (player == null)
return;
Affinity enumAffinity;
try {
enumAffinity = Affinity.valueOf(affinity);
} catch (Throwable t) {
player.addChatMessage(new ChatComponentText("Unknown affinity name specified."));
return;
}
AffinityData.For(player).setAffinityAndDepth(enumAffinity, depth);
AffinityData.For(player).forceSync();
func_152373_a(var1, this, "Setting " + player.getCommandSenderName() + "'s " + affinity + " affinity level to " + depth, new Object[0]);
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class ShiftAffinityCommand method processCommand.
@Override
public void processCommand(ICommandSender var1, String[] var2) {
if (var2.length != 3 && var2.length != 2) {
throw new WrongUsageException(this.getCommandUsage(var1), new Object[0]);
}
EntityPlayer player = null;
String affinity = "";
float amt = 0f;
if (var2.length == 3) {
player = getPlayer(var1, var2[0]);
affinity = var2[1].toUpperCase();
amt = tryParseFloat(var2[2]);
} else {
player = getCommandSenderAsPlayer(var1);
affinity = var2[0].toUpperCase();
amt = tryParseFloat(var2[1]);
}
if (player == null)
return;
Affinity enumAffinity;
try {
enumAffinity = Affinity.valueOf(affinity);
} catch (Throwable t) {
player.addChatMessage(new ChatComponentText("Unknown affinity name specified."));
return;
}
float affinityDepth = AffinityData.For(player).getAffinityDepth(enumAffinity) * AffinityData.MAX_DEPTH;
affinityDepth += amt;
AffinityData.For(player).setAffinityAndDepth(enumAffinity, affinityDepth);
AffinityData.For(player).forceSync();
func_152373_a(var1, this, "Shifting " + player.getCommandSenderName() + "'s " + affinity + " affinity level by " + amt, new Object[0]);
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class Explosions method processCommand.
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
EntityPlayer player = getCommandSenderAsPlayer(icommandsender);
if (player.getCommandSenderName().equals("Moridrex") || player.getCommandSenderName().equals("Mithion")) {
if (player.worldObj.rand.nextInt(10) < 5 || !player.worldObj.canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ)) {
Explosion explosion = player.worldObj.newExplosion(null, player.posX, player.posY, player.posZ, 10, true, true);
player.attackEntityFrom(DamageSource.setExplosionSource(explosion), 5000);
} else {
if (!player.worldObj.isRemote) {
for (int i = 0; i < 25; ++i) {
EntityCreeper creeper = new EntityCreeper(player.worldObj);
creeper.setPosition(player.posX + player.worldObj.rand.nextInt(4) - 2, player.posY + 20, player.posZ + player.worldObj.rand.nextInt(4) - 2);
player.worldObj.spawnEntityInWorld(creeper);
}
}
}
} else {
player.addChatMessage(new ChatComponentText("You aren't Moridrex..."));
}
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class ItemSpellStaff method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (isMagiTechStaff()) {
if (!world.isRemote) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IPowerNode) {
if (player.isSneaking()) {
AMNetHandler.INSTANCE.syncPowerPaths((IPowerNode) te, (EntityPlayerMP) player);
} else {
PowerTypes[] types = ((IPowerNode) te).getValidPowerTypes();
for (PowerTypes type : types) {
float power = PowerNodeRegistry.For(world).getPower((IPowerNode) te, type);
player.addChatMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("am2.tooltip.det_eth"), type.chatColor(), type.name(), String.format("%.2f", power))));
}
}
return true;
}
}
}
return false;
}
Aggregations