当前位置: 首页>>代码示例>>Java>>正文


Java ChatMessageComponent类代码示例

本文整理汇总了Java中net.minecraft.util.ChatMessageComponent的典型用法代码示例。如果您正苦于以下问题:Java ChatMessageComponent类的具体用法?Java ChatMessageComponent怎么用?Java ChatMessageComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChatMessageComponent类属于net.minecraft.util包,在下文中一共展示了ChatMessageComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDeathMessage

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
/**
 * Returns the message to be displayed on player death.
 */
@Override
public ChatMessageComponent getDeathMessage(EntityLivingBase hurtEnemy)
{
    String throwername = this.thrower == null ? this.damageSourceEntity.getTranslatedEntityName() : this.thrower.getTranslatedEntityName();
    ItemStack itemstack = this.thrower instanceof EntityLivingBase ? ((EntityLivingBase)this.thrower).getHeldItem() : null;
    String damageType = "death.attack.bomb";
    
    String src = "";
    if(thrower != null && thrower != getSourceOfDamage())
    {
    	if(thrower == hurtEnemy)
    	{
    		src = ".suicide";
    	}
    	else
    	{
    		src = ".thrown";
    	}
    }
    String s2 = damageType + src;
    return  ChatMessageComponent.createFromTranslationWithSubstitutions(s2, new Object[] {hurtEnemy.getTranslatedEntityName(), throwername});
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:26,代码来源:EntityDamageSourceBomb.java

示例2: onEntityJoinWorld

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
@ForgeSubscribe
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
	//Only need to synchronize when the world is remote (i.e. we're on the server side)
	if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer){
		FCraftJobCore.get((EntityPlayer) event.entity).sync();
		FCraftJobCore props = FCraftJobCore.get((EntityPlayer) event.entity);
		if(event.entity.dimension==0){
			MinecraftServer.getServer().getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromText(props.getJob()+" "+event.entity.getEntityName()+" has joined the search for the grimoire."));		
		}else if(event.entity.dimension==-1){
			MinecraftServer.getServer().getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromText(props.getJob()+" "+event.entity.getEntityName()+" went to hell!"));			
		}else if(event.entity.dimension==DimensionID.WORLD_OF_BALANCE_ID){
			MinecraftServer.getServer().getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromText(props.getJob()+" "+event.entity.getEntityName()+" entered the World of Balance!"));		
		}
		
		FCraftJobCore playerData = FCraftJobCore.get((EntityPlayer)event.entity);
		NBTTagCompound savedData = CommonProxy.getEntityData(getSaveKey((EntityPlayer)event.entity));

		if(savedData != null) {
		playerData.loadNBTData(savedData);
		}
		playerData.sync();
	}
}
 
开发者ID:Unrelentless,项目名称:FantasyCraft-Mod,代码行数:25,代码来源:FCraftEntityConsturctionHandler.java

示例3: onPlayerLogin

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
@Override
public void onPlayerLogin(EntityPlayer player) {
	JsonRootNode response = MineticketAPI.registerUser(player.getCommandSenderName());

	if (response.isStringValue("account_status")) {
		if (response.getStringValue("account_status").equals("unactivated")) {
			ChatMessageComponent chat = ChatMessageComponent
					.createFromText("[MineTicket] "
							+ "Your account is unactivated. "
							+ "You can activate by using the \"/mineticket activate <email>\" command, "
							+ "or by using the following activation key on the MineTicket website: "
							+ response.getStringValue("activation_key"));

			player.sendChatToPlayer(chat);
		}
	}
}
 
开发者ID:schlarpc,项目名称:MineTicketForge,代码行数:18,代码来源:MineticketPlayer.java

示例4: func_72487_a

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void func_72487_a(Packet130UpdateSign p_72487_1_) {
   boolean var2 = false;
   if(this.field_72563_h.field_71441_e.func_72899_e(p_72487_1_.field_73311_a, p_72487_1_.field_73309_b, p_72487_1_.field_73310_c)) {
      TileEntity var3 = this.field_72563_h.field_71441_e.func_72796_p(p_72487_1_.field_73311_a, p_72487_1_.field_73309_b, p_72487_1_.field_73310_c);
      if(var3 instanceof TileEntitySign) {
         TileEntitySign var4 = (TileEntitySign)var3;
         if(var4.func_70409_a()) {
            for(int var5 = 0; var5 < 4; ++var5) {
               var4.field_70412_a[var5] = p_72487_1_.field_73308_d[var5];
            }

            var4.func_70296_d();
         }

         var2 = true;
      }
   }

   if(!var2 && this.field_72563_h.field_71439_g != null) {
      this.field_72563_h.field_71439_g.func_70006_a(ChatMessageComponent.func_111066_d("Unable to locate sign at " + p_72487_1_.field_73311_a + ", " + p_72487_1_.field_73309_b + ", " + p_72487_1_.field_73310_c));
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:24,代码来源:NetClientHandler.java

示例5: func_96336_d

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
protected void func_96336_d(ICommandSender p_96336_1_) {
   Scoreboard var2 = this.func_96334_d();
   Collection var3 = var2.func_96514_c();
   if(var3.size() <= 0) {
      throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
   } else {
      p_96336_1_.func_70006_a(ChatMessageComponent.func_111082_b("commands.scoreboard.objectives.list.count", new Object[]{Integer.valueOf(var3.size())}).func_111059_a(EnumChatFormatting.DARK_GREEN));
      Iterator var4 = var3.iterator();

      while(var4.hasNext()) {
         ScoreObjective var5 = (ScoreObjective)var4.next();
         p_96336_1_.func_70006_a(ChatMessageComponent.func_111082_b("commands.scoreboard.objectives.list.entry", new Object[]{var5.func_96679_b(), var5.func_96678_d(), var5.func_96680_c().func_96636_a()}));
      }

   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:ServerCommandScoreboard.java

示例6: getObjectivesList

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
/**
 * Handler for the 'scoreboard objectives list' command.
 */
protected void getObjectivesList(ICommandSender par1ICommandSender)
{
    Scoreboard scoreboard = this.getScoreboardFromWorldServer();
    Collection collection = scoreboard.getScoreObjectives();

    if (collection.size() <= 0)
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())}).setColor(EnumChatFormatting.DARK_GREEN));
        Iterator iterator = collection.iterator();

        while (iterator.hasNext())
        {
            ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
            par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().func_96636_a()}));
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:ServerCommandScoreboard.java

示例7: processCommand

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length > 0)
    {
        EnumGameType enumgametype = this.getGameModeFromCommand(par1ICommandSender, par2ArrayOfStr[0]);
        EntityPlayerMP entityplayermp = par2ArrayOfStr.length >= 2 ? getPlayer(par1ICommandSender, par2ArrayOfStr[1]) : getCommandSenderAsPlayer(par1ICommandSender);
        entityplayermp.setGameType(enumgametype);
        entityplayermp.fallDistance = 0.0F;
        ChatMessageComponent chatmessagecomponent = ChatMessageComponent.createFromTranslationKey("gameMode." + enumgametype.getName());

        if (entityplayermp != par1ICommandSender)
        {
            notifyAdmins(par1ICommandSender, 1, "commands.gamemode.success.other", new Object[] {entityplayermp.getEntityName(), chatmessagecomponent});
        }
        else
        {
            notifyAdmins(par1ICommandSender, 1, "commands.gamemode.success.self", new Object[] {chatmessagecomponent});
        }
    }
    else
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:CommandGameMode.java

示例8: processCommand

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP entityplayermp = getPlayer(par1ICommandSender, par2ArrayOfStr[0]);

        if (entityplayermp == null)
        {
            throw new PlayerNotFoundException();
        }
        else if (entityplayermp == par1ICommandSender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            String s = func_82361_a(par1ICommandSender, par2ArrayOfStr, 1, !(par1ICommandSender instanceof EntityPlayer));
            entityplayermp.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.message.display.incoming", new Object[] {par1ICommandSender.getCommandSenderName(), s}).setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true)));
            par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.message.display.outgoing", new Object[] {entityplayermp.getCommandSenderName(), s}).setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true)));
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:CommandServerMessage.java

示例9: getDeathMessage

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
@Override
public ChatMessageComponent getDeathMessage(EntityLivingBase entity)
{
    ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItem() : null;
    String s = "death.attack." + this.damageType;
    String s1 = s + ".item";
    return itemstack != null && itemstack.hasDisplayName() && StatCollector.func_94522_b(s1) ? ChatMessageComponent.createFromTranslationWithSubstitutions(s1, new Object[] {entity.getTranslatedEntityName(), this.damageSourceEntity.getTranslatedEntityName(), itemstack.getDisplayName()}): ChatMessageComponent.createFromTranslationWithSubstitutions(s, new Object[] {entity.getTranslatedEntityName(), this.damageSourceEntity.getTranslatedEntityName()});
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:9,代码来源:DamageSourceWeaponBonus.java

示例10: func_73075_a

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void func_73075_a() {
   super.func_73075_a();
   ++this.field_73102_f;
   long var1 = this.field_73092_a.func_82737_E();
   long var3 = var1 / 24000L + 1L;
   if(!this.field_73105_c && this.field_73102_f > 20) {
      this.field_73105_c = true;
      this.field_73090_b.field_71135_a.func_72567_b(new Packet70GameEvent(5, 0));
   }

   this.field_73103_d = var1 > 120500L;
   if(this.field_73103_d) {
      ++this.field_73104_e;
   }

   if(var1 % 24000L == 500L) {
      if(var3 <= 6L) {
         this.field_73090_b.func_70006_a(ChatMessageComponent.func_111077_e("demo.day." + var3));
      }
   } else if(var3 == 1L) {
      if(var1 == 100L) {
         this.field_73090_b.field_71135_a.func_72567_b(new Packet70GameEvent(5, 101));
      } else if(var1 == 175L) {
         this.field_73090_b.field_71135_a.func_72567_b(new Packet70GameEvent(5, 102));
      } else if(var1 == 250L) {
         this.field_73090_b.field_71135_a.func_72567_b(new Packet70GameEvent(5, 103));
      }
   } else if(var3 == 5L && var1 % 24000L == 22000L) {
      this.field_73090_b.func_70006_a(ChatMessageComponent.func_111077_e("demo.day.warning"));
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:33,代码来源:DemoWorldManager.java

示例11: func_73101_e

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
private void func_73101_e() {
   if(this.field_73104_e > 100) {
      this.field_73090_b.func_70006_a(ChatMessageComponent.func_111077_e("demo.reminder"));
      this.field_73104_e = 0;
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:DemoWorldManager.java

示例12: func_72565_c

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void func_72565_c(String p_72565_1_) {
   if(!this.field_72576_c) {
      this.field_72574_e.func_71123_m();
      this.func_72567_b(new Packet255KickDisconnect(p_72565_1_));
      this.field_72575_b.func_74423_d();
      this.field_72573_d.func_71203_ab().func_92062_k(ChatMessageComponent.func_111082_b("multiplayer.player.left", new Object[]{this.field_72574_e.func_96090_ax()}).func_111059_a(EnumChatFormatting.YELLOW));
      this.field_72573_d.func_71203_ab().func_72367_e(this.field_72574_e);
      this.field_72576_c = true;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:NetServerHandler.java

示例13: func_72515_a

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void func_72515_a(String p_72515_1_, Object[] p_72515_2_) {
   this.field_72573_d.func_98033_al().func_98233_a(this.field_72574_e.func_70005_c_() + " lost connection: " + p_72515_1_);
   this.field_72573_d.func_71203_ab().func_92062_k(ChatMessageComponent.func_111082_b("multiplayer.player.left", new Object[]{this.field_72574_e.func_96090_ax()}).func_111059_a(EnumChatFormatting.YELLOW));
   this.field_72573_d.func_71203_ab().func_72367_e(this.field_72574_e);
   this.field_72576_c = true;
   if(this.field_72573_d.func_71264_H() && this.field_72574_e.func_70005_c_().equals(this.field_72573_d.func_71214_G())) {
      this.field_72573_d.func_98033_al().func_98233_a("Stopping singleplayer server as player logged out");
      this.field_72573_d.func_71263_m();
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:12,代码来源:NetServerHandler.java

示例14: func_72481_a

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
public void func_72481_a(Packet3Chat p_72481_1_) {
   if(this.field_72574_e.func_71126_v() == 2) {
      this.func_72567_b(new Packet3Chat(ChatMessageComponent.func_111077_e("chat.cannotSend").func_111059_a(EnumChatFormatting.RED)));
   } else {
      this.field_72574_e.func_143004_u();
      String var2 = p_72481_1_.field_73476_b;
      if(var2.length() > 100) {
         this.func_72565_c("Chat message too long");
      } else {
         var2 = StringUtils.normalizeSpace(var2);

         for(int var3 = 0; var3 < var2.length(); ++var3) {
            if(!ChatAllowedCharacters.func_71566_a(var2.charAt(var3))) {
               this.func_72565_c("Illegal characters in chat");
               return;
            }
         }

         if(var2.startsWith("/")) {
            this.func_72566_d(var2);
         } else {
            if(this.field_72574_e.func_71126_v() == 1) {
               this.func_72567_b(new Packet3Chat(ChatMessageComponent.func_111077_e("chat.cannotSend").func_111059_a(EnumChatFormatting.RED)));
               return;
            }

            ChatMessageComponent var4 = ChatMessageComponent.func_111082_b("chat.type.text", new Object[]{this.field_72574_e.func_96090_ax(), var2});
            this.field_72573_d.func_71203_ab().func_110459_a(var4, false);
         }

         this.field_72581_m += 20;
         if(this.field_72581_m > 200 && !this.field_72573_d.func_71203_ab().func_72353_e(this.field_72574_e.func_70005_c_())) {
            this.func_72565_c("disconnect.spam");
         }

      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:39,代码来源:NetServerHandler.java

示例15: func_73875_a

import net.minecraft.util.ChatMessageComponent; //导入依赖的package包/类
protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73741_f == 102) {
      this.field_73882_e.func_71373_a(this.field_74092_a);
   } else if(p_73875_1_.field_73741_f == 104) {
      if(this.field_74089_d.equals("survival")) {
         this.field_74089_d = "creative";
      } else if(this.field_74089_d.equals("creative")) {
         this.field_74089_d = "adventure";
      } else {
         this.field_74089_d = "survival";
      }

      this.func_74088_g();
   } else if(p_73875_1_.field_73741_f == 103) {
      this.field_74093_m = !this.field_74093_m;
      this.func_74088_g();
   } else if(p_73875_1_.field_73741_f == 101) {
      this.field_73882_e.func_71373_a((GuiScreen)null);
      String var2 = this.field_73882_e.func_71401_C().func_71206_a(EnumGameType.func_77142_a(this.field_74089_d), this.field_74093_m);
      ChatMessageComponent var3;
      if(var2 != null) {
         var3 = ChatMessageComponent.func_111082_b("commands.publish.started", new Object[]{var2});
      } else {
         var3 = ChatMessageComponent.func_111066_d("commands.publish.failed");
      }

      this.field_73882_e.field_71456_v.func_73827_b().func_73765_a(var3.func_111068_a(true));
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:31,代码来源:GuiShareToLan.java


注:本文中的net.minecraft.util.ChatMessageComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。