Java 类net.minecraft.network.packet.Packet3Chat 实例源码

项目:RuneCraftery    文件:NetServerHandler.java   
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);
   }
}
项目:RuneCraftery    文件:NetServerHandler.java   
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");
         }

      }
   }
}
项目:RuneCraftery    文件:NetServerHandler.java   
/**
 * 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);
    }
}
项目:RuneCraftery    文件:NetClientHandler.java   
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));
    }
}
项目:TeamCore    文件:RegisterTeamState.java   
@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);
    }
}
项目:BetterNutritionMod    文件:NetServerHandler.java   
/**
 * 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);
    }
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
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));
    }
}
项目:AltEnergy    文件:AltEnergyUtils.java   
/**
 * 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);
    }
}
项目:MinecraftSpaceAgency    文件:EntityRocket2.java   
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!")));
}
项目:Apocalyptic    文件:Utils.java   
public static void sendChatMessageToAllPlayers(String msg)
{
    PacketDispatcher.sendPacketToAllPlayers(new Packet3Chat(msg));
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleChat(Packet3Chat par1Packet3Chat)
{
    nch.handleChat(par1Packet3Chat);        
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
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_)));
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void func_70006_a(ChatMessageComponent p_70006_1_) {
   this.field_71135_a.func_72567_b(new Packet3Chat(p_70006_1_));
}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72481_a(Packet3Chat p_72481_1_) {
   this.func_72509_a(p_72481_1_);
}
项目:RuneCraftery    文件:NetServerHandler.java   
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()));
      }
   }

}
项目:RuneCraftery    文件:EntityClientPlayerMP.java   
public void func_71165_d(String p_71165_1_) {
   this.field_71174_a.func_72552_c(new Packet3Chat(p_71165_1_));
}
项目:RuneCraftery    文件:NetClientHandler.java   
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));
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void func_110459_a(ChatMessageComponent p_110459_1_, boolean p_110459_2_) {
   this.field_72400_f.func_70006_a(p_110459_1_);
   this.func_72384_a(new Packet3Chat(p_110459_1_, p_110459_2_));
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
/**
 * Add a chat message to the player
 */
public void addChatMessage(String par1Str)
{
    this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey(par1Str)));
}
项目:RuneCraftery    文件:EntityPlayerMP.java   
public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent)
{
    this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(par1ChatMessageComponent));
}
项目:RuneCraftery    文件:NetServerHandler.java   
public void handleChat(Packet3Chat par1Packet3Chat)
{
    par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat);

    if (par1Packet3Chat == null || par1Packet3Chat.message == null)
    {
        return;
    }
    if (this.playerEntity.getChatVisibility() == 2)
    {
        this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED)));
    }
    else
    {
        this.playerEntity.func_143004_u();
        String s = par1Packet3Chat.message;

        if (s.length() > 100)
        {
            this.kickPlayerFromServer("Chat message too long");
        }
        else
        {
            for (int i = 0; i < s.length(); ++i)
            {
                if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i)))
                {
                    this.kickPlayerFromServer("Illegal characters in chat");
                    return;
                }
            }

            if (s.startsWith("/"))
            {
                this.handleSlashCommand(s);
            }
            else
            {
                if (this.playerEntity.getChatVisibility() == 1)
                {
                    this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED)));
                    return;
                }

                ChatMessageComponent chatmessagecomponent = ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), s});
                chatmessagecomponent = ForgeHooks.onServerChatEvent(this, s, chatmessagecomponent);
                if (chatmessagecomponent == null) return;
                this.mcServer.getConfigurationManager().func_110459_a(chatmessagecomponent, false);
            }

            this.chatSpamThresholdCount += 20;

            if (this.chatSpamThresholdCount > 200 && !this.mcServer.getConfigurationManager().isPlayerOpped(this.playerEntity.getCommandSenderName()))
            {
                this.kickPlayerFromServer("disconnect.spam");
            }
        }
    }
}
项目:RuneCraftery    文件:EntityClientPlayerMP.java   
/**
 * Sends a chat message from the player. Args: chatMessage
 */
public void sendChatMessage(String par1Str)
{
    this.sendQueue.addToSendQueue(new Packet3Chat(par1Str));
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void func_110459_a(ChatMessageComponent par1ChatMessageComponent, boolean par2)
{
    this.mcServer.sendChatToPlayer(par1ChatMessageComponent);
    this.sendPacketToAllPlayers(new Packet3Chat(par1ChatMessageComponent, par2));
}
项目:TeamCore    文件:Chat.java   
public static void sendToAllPlayersFromRegistry(String reg) {
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(fromRegistry(reg), true));
}
项目:TeamCore    文件:Chat.java   
public static void sendToAllPlayersFromRegistryFormatted(String reg, Object... args) {
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(fromRegistryFormatted(reg, args), true));
}
项目:TeamCore    文件:Chat.java   
public static void sendToAllPlayers(String s) {
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(ChatMessageComponent.createFromText(s), true));
}
项目:BetterNutritionMod    文件:EntityPlayerMP.java   
/**
 * Add a chat message to the player
 */
public void addChatMessage(String par1Str)
{
    this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey(par1Str)));
}
项目:BetterNutritionMod    文件:EntityPlayerMP.java   
public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent)
{
    this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(par1ChatMessageComponent));
}
项目:BetterNutritionMod    文件:NetServerHandler.java   
public void handleChat(Packet3Chat par1Packet3Chat)
{
    par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat);

    if (par1Packet3Chat == null || par1Packet3Chat.message == null)
    {
        return;
    }
    if (this.playerEntity.getChatVisibility() == 2)
    {
        this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED)));
    }
    else
    {
        this.playerEntity.func_143004_u();
        String s = par1Packet3Chat.message;

        if (s.length() > 100)
        {
            this.kickPlayerFromServer("Chat message too long");
        }
        else
        {
            for (int i = 0; i < s.length(); ++i)
            {
                if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i)))
                {
                    this.kickPlayerFromServer("Illegal characters in chat");
                    return;
                }
            }

            if (s.startsWith("/"))
            {
                this.handleSlashCommand(s);
            }
            else
            {
                if (this.playerEntity.getChatVisibility() == 1)
                {
                    this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED)));
                    return;
                }

                ChatMessageComponent chatmessagecomponent = ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), s});
                chatmessagecomponent = ForgeHooks.onServerChatEvent(this, s, chatmessagecomponent);
                if (chatmessagecomponent == null) return;
                this.mcServer.getConfigurationManager().func_110459_a(chatmessagecomponent, false);
            }

            this.chatSpamThresholdCount += 20;

            if (this.chatSpamThresholdCount > 200 && !this.mcServer.getConfigurationManager().isPlayerOpped(this.playerEntity.getCommandSenderName()))
            {
                this.kickPlayerFromServer("disconnect.spam");
            }
        }
    }
}
项目:BetterNutritionMod    文件:EntityClientPlayerMP.java   
/**
 * Sends a chat message from the player. Args: chatMessage
 */
public void sendChatMessage(String par1Str)
{
    this.sendQueue.addToSendQueue(new Packet3Chat(par1Str));
}
项目:BetterNutritionMod    文件:ServerConfigurationManager.java   
public void func_110459_a(ChatMessageComponent par1ChatMessageComponent, boolean par2)
{
    this.mcServer.sendChatToPlayer(par1ChatMessageComponent);
    this.sendPacketToAllPlayers(new Packet3Chat(par1ChatMessageComponent, par2));
}
项目:MinecraftSpaceAgency    文件:LaunchControlLogic.java   
public void LaunchSequence()
{
    if (!isValidStructure) return;
    if (RocketLogic != null)
    {
        PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Rocket already launched and not yet gone, please wait.")));
        return;
    }
    NBTTagCompound tag = inventory[ROCKET_INV_LOC].stackTagCompound;
    EngineBase[] engines = new SolidFueledEngine[tag.getInteger("CountEngines")];
    for (int i = 0; i < tag.getInteger("CountEngines"); i++)
    {
        engines[i] = new SolidFueledEngine(RocketSize.values()[tag.getCompoundTag("Engine" + i).getInteger("Size")]);
    }
    Fuselage fuselage = new Fuselage();
    for (int i = 0; i < tag.getInteger("CountAddons"); i++)
    {
        fuselage.AddAddon(new Fin(RocketSize.values()[tag.getCompoundTag("Addon" + i).getInteger("Size")]));
    }
    PayloadBase payload = new PayloadSatellite();// @#^#%@#^
    RocketLogic = new Rocket(engines, fuselage, payload);
    System.out.println("Launching " + RocketLogic.Size.toString() + " size rocket...");
    if (RocketLogic.Size.ordinal() > this.size)
    {
        // explodeLaunchPad();
        PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] The rocket is too big! It's going to blow!")));
        RocketLogic = null;
        // failLaunch();
        return;
    }
    if ((((RocketLogic.Size.ordinal() + 1) ^ 3) * 2) > height)
    {
        // setRocketAccuracy(-.005*size.ordinal()^3*2-height);
        System.out.println(((RocketLogic.Size.ordinal() + 1) ^ 3) * 2);
        PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Launch tower not high enough. The rocket looses accuracy.")));
    }
    if ((((RocketLogic.Size.ordinal() + 1) ^ 3) * 3) > flameOutLength)
    {
        // flamesAroundEnd()
        System.out.println(((RocketLogic.Size.ordinal() + 1) ^ 3) * 3);
        PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Flame outlets not long enough. Watch out for flames around the ends!")));
    }
    if (!worldObj.isRemote) worldObj.spawnEntityInWorld(new EntityRocket(worldObj, RocketLogic, centerX + 0.5, centerY + 3.5, centerZ + 0.5, this.xCoord, this.yCoord, this.zCoord));
}
项目:MinecraftSpaceAgency    文件:EntityRocket.java   
@Override
public void onUpdate()
{
    // if (firstTick && worldObj.isRemote)
    // {
    // firstTick = false;
    // ticksExisted = 0;
    // return;
    // }
    if (ticksExisted > 400) this.kill();
    if (this.posY > this.worldObj.getActualHeight() + 200)
    {
        PacketDispatcher.sendPacketToAllAround(ControlPos[0], ControlPos[1], ControlPos[2], 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Congratulations! Your rocket sucessfully made it to space!")));
        this.kill();
    }
    if (rocketLogic == null) return;
    if (!worldObj.isRemote)
    {
        rocketLogic.tick();
    }
    this.motionX = rocketLogic.velX;
    this.motionY = rocketLogic.velY;
    this.motionZ = rocketLogic.velZ;
    if (this.motionY < -.5) this.motionY = -.5;// min negative speed is -.5;
    if (this.motionY < 0)
    {
        if (worldObj.getBlockId((int) this.posX, (int) this.posY - 1, (int) this.posZ) != 0)
        {
            // explode
            PacketDispatcher.sendPacketToAllAround(ControlPos[0], ControlPos[1], ControlPos[2], 10, 0, new Packet3Chat(ChatMessageComponent.createFromText("[" + StringUtils.localize("strings.Title") + "] Uh Oh, your rocket hit the ground and blew up!")));
            this.kill();
        }
    }
    setPosition(posX + motionX, posY + motionY, posZ + motionZ);
    // if (worldObj.isRemote)
    // {
    Random rand = new Random();
    for (int i = 0; i < (0 + rocketLogic.Size.ordinal()) * (2 - MSA.proxy.getCurrentParticleSetting()); i++)
    {
        worldObj.spawnParticle("flame", this.posX + rand.nextDouble() * (rand.nextBoolean() ? -1 : 1), this.posY - rand.nextDouble(), this.posZ + rand.nextDouble() * (rand.nextBoolean() ? -1 : 1), rand.nextInt(35) / 100 * (rand.nextBoolean() ? -1 : 1), -rand.nextDouble(), rand.nextInt(35) / 100 * (rand.nextBoolean() ? -1 : 1));
    }
    // }
    // if (worldObj.isRemote)
    // {
    // System.out.println("Rocket entity-Client x:" + posX + " y:" + posY +
    // " z:" + posZ);
    // }
    // else
    // {
    // System.out.println("Rocket entity-Server x:" + posX + " y:" + posY +
    // " z:" + posZ);
    // }
    super.onUpdate();
}
项目:AltEnergy    文件:AltEnergyUtils.java   
/**
 * Sends the defined message to all players.
 * 
 * @param msg
 *            - message to send
 */
public static void sendChatMessageToAllPlayers(String msg) {

    PacketDispatcher.sendPacketToAllPlayers(new Packet3Chat(msg));
}