本文整理汇总了Java中net.minecraft.network.packet.Packet3Chat类的典型用法代码示例。如果您正苦于以下问题:Java Packet3Chat类的具体用法?Java Packet3Chat怎么用?Java Packet3Chat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Packet3Chat类属于net.minecraft.network.packet包,在下文中一共展示了Packet3Chat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_72567_b
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_72567_b(Packet p_72567_1_) {
if(p_72567_1_ instanceof Packet3Chat) {
Packet3Chat var2 = (Packet3Chat)p_72567_1_;
int var3 = this.field_72574_e.func_71126_v();
if(var3 == 2) {
return;
}
if(var3 == 1 && !var2.func_73475_d()) {
return;
}
}
try {
this.field_72575_b.func_74429_a(p_72567_1_);
} catch (Throwable var5) {
CrashReport var6 = CrashReport.func_85055_a(var5, "Sending packet");
CrashReportCategory var4 = var6.func_85058_a("Packet being sent");
var4.func_71500_a("Packet ID", new CallablePacketID(this, p_72567_1_));
var4.func_71500_a("Packet class", new CallablePacketClass(this, p_72567_1_));
throw new ReportedException(var6);
}
}
示例2: func_72481_a
import net.minecraft.network.packet.Packet3Chat; //导入依赖的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");
}
}
}
}
示例3: sendPacketToPlayer
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
/**
* addToSendQueue. if it is a chat packet, check before sending it
*/
public void sendPacketToPlayer(Packet par1Packet)
{
if (par1Packet instanceof Packet3Chat)
{
Packet3Chat packet3chat = (Packet3Chat)par1Packet;
int i = this.playerEntity.getChatVisibility();
if (i == 2)
{
return;
}
if (i == 1 && !packet3chat.getIsServer())
{
return;
}
}
try
{
this.netManager.addToSendQueue(par1Packet);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Sending packet");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Packet being sent");
crashreportcategory.addCrashSectionCallable("Packet ID", new CallablePacketID(this, par1Packet));
crashreportcategory.addCrashSectionCallable("Packet class", new CallablePacketClass(this, par1Packet));
throw new ReportedException(crashreport);
}
}
示例4: handleChat
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void handleChat(Packet3Chat par1Packet3Chat)
{
par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat);
if (par1Packet3Chat == null)
{
return;
}
ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message);
if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)
{
this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(event.message).toStringWithFormatting(true));
}
}
示例5: commandSend
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
@Override
public void commandSend(String command, ICommandSender icommandsender, String[] astring) {
//Make sure, that we are currently accepting new leaders
if (teamManager.getTeamCount() >= TeamConfig.teamCount) return;
if (icommandsender instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP)icommandsender;
//If player has no team
if (TeamManager.getInstance().getTeamByPlayerName(player) == null) {
if (astring.length > 0) {
Team t = teamManager.registerTeam(astring[0]);
if (t == null) {
player.sendChatToPlayer(invalidTeamNameMessage);
} else {
//Create team and inform players
t.setLeader(player);
ChatMessageComponent teamRegisteredMessage = new ChatMessageComponent();
teamRegisteredMessage.addText("Team " + t.getTeamName() + " created by " + player.getDisplayName());
player.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(teamRegisteredMessage, true));
}
}
}
}
if (teamManager.getTeamCount() == TeamConfig.teamCount) {
Chat.sendToAllPlayersFromRegistry("command.registerteam.sucessfull.all");
Chat.sendToGameMod(StatCollector.translateToLocal("command.registerteam.sucessfull.gamemod"));
this.switchState(fsmConfirmLeaderState);
}
}
示例6: sendChatMessageToPlayer
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
/**
* Sends a Packet3Chat packet to the defined player, with the defined
* message.
*
* @param player
* - Player to send packet to.
* @param msg
* - message sent to player.
*/
public static void sendChatMessageToPlayer(String playerUsername, String msg) {
EntityPlayer player = FMLServerHandler.instance().getServer().getConfigurationManager()
.getPlayerForUsername(playerUsername);
Packet3Chat chatPacket = new Packet3Chat(msg);
if (player != null) {
((EntityPlayerMP) player).playerNetServerHandler.sendPacketToPlayer(chatPacket);
}
}
示例7: EntityRocket2
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public EntityRocket2(World par1World, Rocket rLogic, double x, double y, double z, int controlX, int controlY, int controlZ)
{
this(par1World);
this.setPosition(x, y, z);
ControlPos[0] = controlX;
ControlPos[1] = controlY;
ControlPos[2] = controlZ;
PacketDispatcher.sendPacketToAllAround(controlX, controlY, controlZ, 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Rocket entity initialized!")));
}
示例8: sendChatMessageToAllPlayers
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public static void sendChatMessageToAllPlayers(String msg)
{
PacketDispatcher.sendPacketToAllPlayers(new Packet3Chat(msg));
}
示例9: handleChat
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
@Override
public void handleChat(Packet3Chat par1Packet3Chat)
{
nch.handleChat(par1Packet3Chat);
}
示例10: func_71035_c
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_71035_c(String p_71035_1_) {
this.field_71135_a.func_72567_b(new Packet3Chat(ChatMessageComponent.func_111077_e(p_71035_1_)));
}
示例11: func_70006_a
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_70006_a(ChatMessageComponent p_70006_1_) {
this.field_71135_a.func_72567_b(new Packet3Chat(p_70006_1_));
}
示例12: func_72481_a
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_72481_a(Packet3Chat p_72481_1_) {
this.func_72509_a(p_72481_1_);
}
示例13: func_72472_a
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_72472_a(Packet15Place p_72472_1_) {
WorldServer var2 = this.field_72573_d.func_71218_a(this.field_72574_e.field_71093_bK);
ItemStack var3 = this.field_72574_e.field_71071_by.func_70448_g();
boolean var4 = false;
int var5 = p_72472_1_.func_73403_d();
int var6 = p_72472_1_.func_73402_f();
int var7 = p_72472_1_.func_73407_g();
int var8 = p_72472_1_.func_73401_h();
this.field_72574_e.func_143004_u();
if(p_72472_1_.func_73401_h() == 255) {
if(var3 == null) {
return;
}
this.field_72574_e.field_71134_c.func_73085_a(this.field_72574_e, var2, var3);
} else if(p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z() - 1 && (p_72472_1_.func_73401_h() == 1 || p_72472_1_.func_73402_f() >= this.field_72573_d.func_71207_Z())) {
this.field_72574_e.field_71135_a.func_72567_b(new Packet3Chat(ChatMessageComponent.func_111082_b("build.tooHigh", new Object[]{Integer.valueOf(this.field_72573_d.func_71207_Z())}).func_111059_a(EnumChatFormatting.RED)));
var4 = true;
} else {
if(this.field_72587_r && this.field_72574_e.func_70092_e((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && !this.field_72573_d.func_96290_a(var2, var5, var6, var7, this.field_72574_e)) {
this.field_72574_e.field_71134_c.func_73078_a(this.field_72574_e, var2, var3, var5, var6, var7, var8, p_72472_1_.func_73406_j(), p_72472_1_.func_73404_l(), p_72472_1_.func_73408_m());
}
var4 = true;
}
if(var4) {
this.field_72574_e.field_71135_a.func_72567_b(new Packet53BlockChange(var5, var6, var7, var2));
if(var8 == 0) {
--var6;
}
if(var8 == 1) {
++var6;
}
if(var8 == 2) {
--var7;
}
if(var8 == 3) {
++var7;
}
if(var8 == 4) {
--var5;
}
if(var8 == 5) {
++var5;
}
this.field_72574_e.field_71135_a.func_72567_b(new Packet53BlockChange(var5, var6, var7, var2));
}
var3 = this.field_72574_e.field_71071_by.func_70448_g();
if(var3 != null && var3.field_77994_a == 0) {
this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = null;
var3 = null;
}
if(var3 == null || var3.func_77988_m() == 0) {
this.field_72574_e.field_71137_h = true;
this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c] = ItemStack.func_77944_b(this.field_72574_e.field_71071_by.field_70462_a[this.field_72574_e.field_71071_by.field_70461_c]);
Slot var9 = this.field_72574_e.field_71070_bA.func_75147_a(this.field_72574_e.field_71071_by, this.field_72574_e.field_71071_by.field_70461_c);
this.field_72574_e.field_71070_bA.func_75142_b();
this.field_72574_e.field_71137_h = false;
if(!ItemStack.func_77989_b(this.field_72574_e.field_71071_by.func_70448_g(), p_72472_1_.func_73405_i())) {
this.func_72567_b(new Packet103SetSlot(this.field_72574_e.field_71070_bA.field_75152_c, var9.field_75222_d, this.field_72574_e.field_71071_by.func_70448_g()));
}
}
}
示例14: func_71165_d
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_71165_d(String p_71165_1_) {
this.field_71174_a.func_72552_c(new Packet3Chat(p_71165_1_));
}
示例15: func_72481_a
import net.minecraft.network.packet.Packet3Chat; //导入依赖的package包/类
public void func_72481_a(Packet3Chat p_72481_1_) {
this.field_72563_h.field_71456_v.func_73827_b().func_73765_a(ChatMessageComponent.func_111078_c(p_72481_1_.field_73476_b).func_111068_a(true));
}