Java 类net.minecraft.network.NetServerHandler 实例源码

项目:RuneCraftery    文件:NetworkListenThread.java   
public void func_71747_b() {
   for(int var1 = 0; var1 < this.field_71748_d.size(); ++var1) {
      NetServerHandler var2 = (NetServerHandler)this.field_71748_d.get(var1);

      try {
         var2.func_72570_d();
      } catch (Exception var6) {
         if(var2.field_72575_b instanceof MemoryConnection) {
            CrashReport var4 = CrashReport.func_85055_a(var6, "Ticking memory connection");
            CrashReportCategory var5 = var4.func_85058_a("Ticking connection");
            var5.func_71500_a("Connection", new CallableConnectionName(this, var2));
            throw new ReportedException(var4);
         }

         this.field_71750_c.func_98033_al().func_98235_b("Failed to handle packet for " + var2.field_72574_e.func_70023_ak() + "/" + var2.field_72574_e.func_71114_r() + ": " + var6, var6);
         var2.func_72565_c("Internal server error");
      }

      if(var2.field_72576_c) {
         this.field_71748_d.remove(var1--);
      }

      var2.field_72575_b.func_74427_a();
   }

}
项目:MobVsMob    文件:MapPacketHandler.java   
public void handleServerPacket(NetServerHandler handler, short id, byte[] data, EntityPlayerMP player)
{
    DataInputStream stream = new DataInputStream(new ByteArrayInputStream(data));
    try
    {
        switch(id)
        {
            case 0:
            {
                stream.readByte();
                break;
            }
        }
    }
    catch(IOException e)
    {
    }

}
项目:RuneCraftery    文件:ModLoader.java   
@Deprecated
public static void serverSendPacket(NetServerHandler handler, Packet packet)
{
    if (handler != null)
    {
        PacketDispatcher.sendPacketToPlayer(packet, (Player)handler.getPlayer());
    }
}
项目:RuneCraftery    文件:ForgeHooks.java   
public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp)
{
    ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }
    return event.component;
}
项目:RuneCraftery    文件:ModLoader.java   
@Deprecated
public static void serverSendPacket(NetServerHandler handler, Packet packet)
{
    if (handler != null)
    {
        PacketDispatcher.sendPacketToPlayer(packet, (Player)handler.getPlayer());
    }
}
项目:RuneCraftery    文件:ForgeHooks.java   
public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp)
{
    ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }
    return event.component;
}
项目:SevenCommons    文件:Network.java   
/**
 * gets the INetworkManager associated with the given NetHandler
 *
 * @param netHandler the NetHandler to get the INetworkManager from
 * @return the INetworkManager
 */
public static INetworkManager getNetworkManager(NetHandler netHandler) {
    if (!netHandler.isServerHandler()) {
        return SevenCommons.proxy.getNetworkManagerFromClient(netHandler);
    } else if (netHandler instanceof NetServerHandler) {
        return ((NetServerHandler) netHandler).netManager;
    } else {
        return ((NetLoginHandler) netHandler).myTCPConnection;
    }
}
项目:BetterNutritionMod    文件:ForgeHooks.java   
public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp)
{
    ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }
    return event.component;
}
项目:BetterNutritionMod    文件:ModLoader.java   
@Deprecated
public static void serverSendPacket(NetServerHandler handler, Packet packet)
{
    if (handler != null)
    {
        PacketDispatcher.sendPacketToPlayer(packet, (Player)handler.getPlayer());
    }
}
项目:MobVsMob    文件:MapPacketHandler.java   
@Override
public void handle(NetHandler handler, Packet131MapData mapData) 
{
    int id = mapData.uniqueID;
    if(handler instanceof NetServerHandler)
    {
        handleServerPacket((NetServerHandler)handler, mapData.uniqueID, mapData.itemData, (EntityPlayerMP)handler.getPlayer());
    }
    else
    {
        handleClientPacket((NetClientHandler)handler, mapData.uniqueID, mapData.itemData);
    }
}
项目:Chisel    文件:TinyChiselPacketHandler.java   
@Override
public void handle(NetHandler handler, Packet131MapData mapData) {
    if (handler instanceof NetServerHandler)
        ChiselEventHandler.place(handler.getPlayer(),
                handler.getPlayer().worldObj);
}
项目:RuneCraftery    文件:BaseMod.java   
@Override
@Deprecated
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
{

}
项目:RuneCraftery    文件:BaseMod.java   
/**
 * Called when a chat message is received. Return true to stop further processing
 */
@Override
@Deprecated
public void serverChat(NetServerHandler source, String message)
{
}
项目:RuneCraftery    文件:ModLoaderChatListener.java   
@Override
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message)
{
    mod.serverChat((NetServerHandler)handler, message.field_73476_b);
    return message;
}
项目:RuneCraftery    文件:CallablePacketID.java   
CallablePacketID(NetServerHandler p_i1528_1_, Packet p_i1528_2_) {
   this.field_98244_b = p_i1528_1_;
   this.field_98245_a = p_i1528_2_;
}
项目:RuneCraftery    文件:CallableConnectionName.java   
CallableConnectionName(NetworkListenThread p_i1531_1_, NetServerHandler p_i1531_2_) {
   this.field_111200_b = p_i1531_1_;
   this.field_111201_a = p_i1531_2_;
}
项目:RuneCraftery    文件:CallablePacketClass.java   
CallablePacketClass(NetServerHandler p_i1529_1_, Packet p_i1529_2_) {
   this.field_98226_b = p_i1529_1_;
   this.field_98227_a = p_i1529_2_;
}
项目:RuneCraftery    文件:NetworkListenThread.java   
public void func_71745_a(NetServerHandler p_71745_1_) {
   this.field_71748_d.add(p_71745_1_);
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void func_72355_a(INetworkManager p_72355_1_, EntityPlayerMP p_72355_2_) {
   NBTTagCompound var3 = this.func_72380_a(p_72355_2_);
   p_72355_2_.func_70029_a(this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK));
   p_72355_2_.field_71134_c.func_73080_a((WorldServer)p_72355_2_.field_70170_p);
   String var4 = "local";
   if(p_72355_1_.func_74430_c() != null) {
      var4 = p_72355_1_.func_74430_c().toString();
   }

   this.field_72400_f.func_98033_al().func_98233_a(p_72355_2_.func_70005_c_() + "[" + var4 + "] logged in with entity id " + p_72355_2_.field_70157_k + " at (" + p_72355_2_.field_70165_t + ", " + p_72355_2_.field_70163_u + ", " + p_72355_2_.field_70161_v + ")");
   WorldServer var5 = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK);
   ChunkCoordinates var6 = var5.func_72861_E();
   this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, var5);
   NetServerHandler var7 = new NetServerHandler(this.field_72400_f, p_72355_1_, p_72355_2_);
   var7.func_72567_b(new Packet1Login(p_72355_2_.field_70157_k, var5.func_72912_H().func_76067_t(), p_72355_2_.field_71134_c.func_73081_b(), var5.func_72912_H().func_76093_s(), var5.field_73011_w.field_76574_g, var5.field_73013_u, var5.func_72800_K(), this.func_72352_l()));
   var7.func_72567_b(new Packet250CustomPayload("MC|Brand", this.func_72365_p().getServerModName().getBytes(Charsets.UTF_8)));
   var7.func_72567_b(new Packet6SpawnPosition(var6.field_71574_a, var6.field_71572_b, var6.field_71573_c));
   var7.func_72567_b(new Packet202PlayerAbilities(p_72355_2_.field_71075_bZ));
   var7.func_72567_b(new Packet16BlockItemSwitch(p_72355_2_.field_71071_by.field_70461_c));
   this.func_96456_a((ServerScoreboard)var5.func_96441_U(), p_72355_2_);
   this.func_72354_b(p_72355_2_, var5);
   this.func_92062_k(ChatMessageComponent.func_111082_b("multiplayer.player.joined", new Object[]{p_72355_2_.func_96090_ax()}).func_111059_a(EnumChatFormatting.YELLOW));
   this.func_72377_c(p_72355_2_);
   var7.func_72569_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
   this.field_72400_f.func_71212_ac().func_71745_a(var7);
   var7.func_72567_b(new Packet4UpdateTime(var5.func_82737_E(), var5.func_72820_D(), var5.func_82736_K().func_82766_b("doDaylightCycle")));
   if(this.field_72400_f.func_71202_P().length() > 0) {
      p_72355_2_.func_71115_a(this.field_72400_f.func_71202_P(), this.field_72400_f.func_71227_R());
   }

   Iterator var8 = p_72355_2_.func_70651_bq().iterator();

   while(var8.hasNext()) {
      PotionEffect var9 = (PotionEffect)var8.next();
      var7.func_72567_b(new Packet41EntityEffect(p_72355_2_.field_70157_k, var9));
   }

   p_72355_2_.func_71116_b();
   if(var3 != null && var3.func_74764_b("Riding")) {
      Entity var10 = EntityList.func_75615_a(var3.func_74775_l("Riding"), var5);
      if(var10 != null) {
         var10.field_98038_p = true;
         var5.func_72838_d(var10);
         p_72355_2_.func_70078_a(var10);
         var10.field_98038_p = false;
      }
   }

}
项目:RuneCraftery    文件:ModLoaderChatListener.java   
@Override
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message)
{
    mod.serverChat((NetServerHandler)handler, message.message);
    return message;
}
项目:RuneCraftery    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String s = "local";

    if (par1INetworkManager.getSocketAddress() != null)
    {
        s = par1INetworkManager.getSocketAddress().toString();
    }

    this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + s + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer worldserver = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, worldserver);
    NetServerHandler netserverhandler = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    netserverhandler.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, worldserver.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, worldserver.getHeight(), this.getMaxPlayers()));
    netserverhandler.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    netserverhandler.sendPacketToPlayer(new Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));
    netserverhandler.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities));
    netserverhandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem));
    this.func_96456_a((ServerScoreboard)worldserver.getScoreboard(), par2EntityPlayerMP);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, worldserver);
    this.sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW));
    this.playerLoggedIn(par2EntityPlayerMP);
    netserverhandler.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.mcServer.getNetworkThread().addPlayer(netserverhandler);
    netserverhandler.sendPacketToPlayer(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (this.mcServer.getTexturePack().length() > 0)
    {
        par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize());
    }

    Iterator iterator = par2EntityPlayerMP.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        netserverhandler.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, potioneffect));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    FMLNetworkHandler.handlePlayerLogin(par2EntityPlayerMP, netserverhandler, par1INetworkManager);

    if (nbttagcompound != null && nbttagcompound.hasKey("Riding"))
    {
        Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver);

        if (entity != null)
        {
            entity.forceSpawn = true;
            worldserver.spawnEntityInWorld(entity);
            par2EntityPlayerMP.mountEntity(entity);
            entity.forceSpawn = false;
        }
    }
}
项目:RuneCraftery    文件:BaseMod.java   
@Override
@Deprecated
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
{

}
项目:RuneCraftery    文件:BaseMod.java   
/**
 * Called when a chat message is received. Return true to stop further processing
 */
@Override
@Deprecated
public void serverChat(NetServerHandler source, String message)
{
}
项目:BetterNutritionMod    文件:ModLoaderChatListener.java   
@Override
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message)
{
    mod.serverChat((NetServerHandler)handler, message.message);
    return message;
}
项目:BetterNutritionMod    文件:ServerConfigurationManager.java   
public void initializeConnectionToPlayer(INetworkManager par1INetworkManager, EntityPlayerMP par2EntityPlayerMP)
{
    NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(par2EntityPlayerMP);
    par2EntityPlayerMP.setWorld(this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension));
    par2EntityPlayerMP.theItemInWorldManager.setWorld((WorldServer)par2EntityPlayerMP.worldObj);
    String s = "local";

    if (par1INetworkManager.getSocketAddress() != null)
    {
        s = par1INetworkManager.getSocketAddress().toString();
    }

    this.mcServer.getLogAgent().logInfo(par2EntityPlayerMP.getCommandSenderName() + "[" + s + "] logged in with entity id " + par2EntityPlayerMP.entityId + " at (" + par2EntityPlayerMP.posX + ", " + par2EntityPlayerMP.posY + ", " + par2EntityPlayerMP.posZ + ")");
    WorldServer worldserver = this.mcServer.worldServerForDimension(par2EntityPlayerMP.dimension);
    ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
    this.func_72381_a(par2EntityPlayerMP, (EntityPlayerMP)null, worldserver);
    NetServerHandler netserverhandler = new NetServerHandler(this.mcServer, par1INetworkManager, par2EntityPlayerMP);
    netserverhandler.sendPacketToPlayer(new Packet1Login(par2EntityPlayerMP.entityId, worldserver.getWorldInfo().getTerrainType(), par2EntityPlayerMP.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, worldserver.getHeight(), this.getMaxPlayers()));
    netserverhandler.sendPacketToPlayer(new Packet250CustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
    netserverhandler.sendPacketToPlayer(new Packet6SpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));
    netserverhandler.sendPacketToPlayer(new Packet202PlayerAbilities(par2EntityPlayerMP.capabilities));
    netserverhandler.sendPacketToPlayer(new Packet16BlockItemSwitch(par2EntityPlayerMP.inventory.currentItem));
    this.func_96456_a((ServerScoreboard)worldserver.getScoreboard(), par2EntityPlayerMP);
    this.updateTimeAndWeatherForPlayer(par2EntityPlayerMP, worldserver);
    this.sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.joined", new Object[] {par2EntityPlayerMP.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW));
    this.playerLoggedIn(par2EntityPlayerMP);
    netserverhandler.setPlayerLocation(par2EntityPlayerMP.posX, par2EntityPlayerMP.posY, par2EntityPlayerMP.posZ, par2EntityPlayerMP.rotationYaw, par2EntityPlayerMP.rotationPitch);
    this.mcServer.getNetworkThread().addPlayer(netserverhandler);
    netserverhandler.sendPacketToPlayer(new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getGameRuleBooleanValue("doDaylightCycle")));

    if (this.mcServer.getTexturePack().length() > 0)
    {
        par2EntityPlayerMP.requestTexturePackLoad(this.mcServer.getTexturePack(), this.mcServer.textureSize());
    }

    Iterator iterator = par2EntityPlayerMP.getActivePotionEffects().iterator();

    while (iterator.hasNext())
    {
        PotionEffect potioneffect = (PotionEffect)iterator.next();
        netserverhandler.sendPacketToPlayer(new Packet41EntityEffect(par2EntityPlayerMP.entityId, potioneffect));
    }

    par2EntityPlayerMP.addSelfToInternalCraftingInventory();

    FMLNetworkHandler.handlePlayerLogin(par2EntityPlayerMP, netserverhandler, par1INetworkManager);

    if (nbttagcompound != null && nbttagcompound.hasKey("Riding"))
    {
        Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver);

        if (entity != null)
        {
            entity.forceSpawn = true;
            worldserver.spawnEntityInWorld(entity);
            par2EntityPlayerMP.mountEntity(entity);
            entity.forceSpawn = false;
        }
    }
}
项目:BetterNutritionMod    文件:BaseMod.java   
@Override
@Deprecated
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
{

}
项目:BetterNutritionMod    文件:BaseMod.java   
/**
 * Called when a chat message is received. Return true to stop further processing
 */
@Override
@Deprecated
public void serverChat(NetServerHandler source, String message)
{
}
项目:RuneCraftery    文件:BaseModProxy.java   
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
项目:RuneCraftery    文件:BaseModProxy.java   
public abstract void serverChat(NetServerHandler source, String message);
项目:RuneCraftery    文件:BaseModProxy.java   
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
项目:RuneCraftery    文件:BaseModProxy.java   
public abstract void serverChat(NetServerHandler source, String message);
项目:BetterNutritionMod    文件:BaseModProxy.java   
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
项目:BetterNutritionMod    文件:BaseModProxy.java   
public abstract void serverChat(NetServerHandler source, String message);