Java 类net.minecraft.client.network.NetHandlerPlayClient 实例源码

项目:BaseClient    文件:WorldClient.java   
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
    super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
    this.sendQueue = p_i45063_1_;
    this.getWorldInfo().setDifficulty(p_i45063_4_);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this});

    if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class)
    {
        this.mc.playerController = new PlayerControllerOF(this.mc, p_i45063_1_);
    }
}
项目:EMC    文件:IEntityPlayer.java   
public static int getPing() {
    if (isNull()) {
        return 0;
    }
    new Thread() {
        @Override
        public void run() {
            NetHandlerPlayClient nethandlerplayclient = Minecraft.getMinecraft().player.connection;
            List<NetworkPlayerInfo> list = GuiPlayerTabOverlay.ENTRY_ORDERING
                    .<NetworkPlayerInfo>sortedCopy(nethandlerplayclient.getPlayerInfoMap());

            for (NetworkPlayerInfo networkplayerinfo : list) {
                String uuid = networkplayerinfo.getGameProfile().getId().toString();
                if (uuid.equals(Minecraft.getMinecraft().player.getUniqueID().toString())) {
                    ping = networkplayerinfo.getResponseTime();
                }
            }
        }
    }.start();
    return ping;
}
项目:Backmemed    文件:WorldClient.java   
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
    super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), makeWorldProvider(dimension), profilerIn, true);
    this.ambienceTicks = this.rand.nextInt(12000);
    this.viewableChunks = Sets.<ChunkPos>newHashSet();
    this.connection = netHandler;
    this.getWorldInfo().setDifficulty(difficulty);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    Reflector.call(this, Reflector.ForgeWorld_initCapabilities, new Object[0]);
    Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this});

    if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class)
    {
        this.mc.playerController = new PlayerControllerOF(this.mc, netHandler);
    }
}
项目:CustomWorldGen    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.getNetworkManager(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.getNetworkManager(), msg);
    }
    return event;
}
项目:CustomWorldGen    文件:GuiIngameForge.java   
protected void renderPlayerList(int width, int height)
{
    ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0);
    NetHandlerPlayClient handler = mc.thePlayer.connection;

    if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
    {
        this.overlayPlayerList.updatePlayerList(true);
        if (pre(PLAYER_LIST)) return;
        this.overlayPlayerList.renderPlayerlist(width, this.mc.theWorld.getScoreboard(), scoreobjective);
        post(PLAYER_LIST);
    }
    else
    {
        this.overlayPlayerList.updatePlayerList(false);
    }
}
项目:CustomWorldGen    文件:WorldClient.java   
public WorldClient(NetHandlerPlayClient netHandler, WorldSettings settings, int dimension, EnumDifficulty difficulty, Profiler profilerIn)
{
    super(new SaveHandlerMP(), new WorldInfo(settings, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(dimension), profilerIn, true);
    this.ambienceTicks = this.rand.nextInt(12000);
    this.viewableChunks = Sets.<ChunkPos>newHashSet();
    this.connection = netHandler;
    this.getWorldInfo().setDifficulty(difficulty);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
    this.initCapabilities();
    net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
项目:CrystalMod    文件:PacketExtendedPlayer.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    EntityPlayer player = CrystalMod.proxy.getClientPlayer();
    if(player !=null){
        if(nbt !=null){
            String command = nbt.hasKey("Command") ? nbt.getString("Command") : "Error";
            if(command.equalsIgnoreCase("Flag")){

                ExtendedPlayer extPlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
                if(extPlayer == null)return;
                if(nbt.hasKey("hasFlag")){
                    boolean hasFlag = nbt.getBoolean("hasFlag");
                    extPlayer.setHasFlag(hasFlag);
                }
                if(nbt.hasKey("FlagColor")){
                    int flagColor = nbt.getInteger("FlagColor");
                    extPlayer.setFlagColor(flagColor);
                }
            }
        }
    }
}
项目:CrystalMod    文件:PacketTileMessage.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    World world = CrystalMod.proxy.getClientPlayer() == null ? null : CrystalMod.proxy.getClientPlayer().getEntityWorld();
    if(world == null){
        return;
    }
    if(type.equals("#LightUpdate#")){
        world.checkLightFor(EnumSkyBlock.BLOCK, new BlockPos(x, y, z));
        return;
    }

    TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
    if(tile !=null){
        if(tile instanceof IMessageHandler)((IMessageHandler)tile).handleMessage(type, data, true);
        if(tile instanceof IPedistal){
            if(type.equalsIgnoreCase("StackSync")){
                IPedistal pedistal = (IPedistal)tile;
                if(data.hasNoTags()){
                    pedistal.setStack(ItemStackTools.getEmptyStack());
                } else {
                    pedistal.setStack(ItemStackTools.loadFromNBT(data));
                }
            }
        }
    }
}
项目:CrystalMod    文件:PacketPipe.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    World world = CrystalMod.proxy.getClientPlayer() == null ? null : CrystalMod.proxy.getClientPlayer().getEntityWorld();
    if(world == null){
        return;
    }
    TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
    if(tile !=null && tile instanceof TileEntityPipe){
        TileEntityPipe pipe = (TileEntityPipe) tile;
        EnumFacing dir = this.dir == -1 ? null : EnumFacing.getFront(this.dir);
        if(dir==null)return;
        if(type.equalsIgnoreCase("FilterGhost")){
            if(pipe instanceof TileEntityPipeItem){
                TileEntityPipeItem item = (TileEntityPipeItem) pipe;
                if(item.getFilter(dir).getStackInSlot(0) !=null && item.getFilter(dir).getStackInSlot(0).getMetadata() == FilterType.NORMAL.ordinal()){
                    data.substring(0, data.lastIndexOf(";"));
                    data.substring(data.lastIndexOf(";"));
                }
            }
        }
    }
}
项目:CrystalMod    文件:PacketSyncBufferList.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    /*if(nbt !=null){
        EnderBufferManager.buffers.clear();
        NBTTagCompound nbtData = nbt;

        Iterator<String> iterator = nbtData.getKeySet().iterator();
        while (iterator.hasNext())
        {
          String key = (String)iterator.next();
          NBTTagCompound nbt = nbtData.getCompoundTag(key);
          EnderBuffer chestContents = new EnderBuffer("*ERROR*", null);
          chestContents.deserializeNBT(nbt);
          EnderBufferManager.buffers.put(Integer.parseInt(key), chestContents);
        }
    }*/
}
项目:CrystalMod    文件:PacketSyncBuffer.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    /*if(mode == 0){
        //ADD & SYNC
        EnderBuffer buffer = new EnderBuffer("*ERROR*", null);
        buffer.deserializeNBT(nbt);
        EnderBufferManager.buffers.put(channel, buffer);
    }
    else if(mode == 1){
        //REMOVE
        EnderBufferManager.buffers.remove(channel);
    }
    else if(mode == 2){
        //SYNC
        EnderBuffer buffer = EnderBufferManager.getBuffer(channel);
        if(buffer !=null){
            buffer.deserializeNBT(nbt);
        }
    }*/
}
项目:CrystalMod    文件:TileEntitiesMessage.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    if (chunk != null && tagCompound != null && chunk instanceof FakeChunkClient) {
        NBTTagList list = tagCompound.getTagList("list", 10);
        for (int i = 0; i < list.tagCount(); i++) {
            NBTTagCompound nbt = list.getCompoundTagAt(i);
            if (nbt == null) continue;
            int x = nbt.getInteger("x");
            int y = nbt.getInteger("y");
            int z = nbt.getInteger("z");
            BlockPos pos = new BlockPos(x, y, z);
            try {
                TileEntity te = chunk.getTileEntity(pos);
                if (te != null)
                    te.readFromNBT(nbt);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        ((FakeChunkClient) chunk).getRenderer().markDirty();
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.func_147298_b(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg);
    }
    return event;
}
项目:CauldronGit    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.getNetworkManager(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg);
    }
    return event;
}
项目:Cyclic    文件:ClientProxy.java   
/**
 * INSPIRED by universallp
 * 
 * This function was is part of VanillaAutomation which is licenced under the MOZILLA PUBLIC LICENCE 2.0 - mozilla.org/en-US/MPL/2.0/ github.com/UniversalLP/VanillaAutomation
 */
public void setPlayerReach(EntityPlayer player, int currentReach) {
  super.setPlayerReach(player, currentReach);
  Minecraft mc = Minecraft.getMinecraft();
  try {
    if (player == mc.player && !(mc.playerController instanceof ReachPlayerController)) {
      GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, CURRENT_GAME_TYPE);
      NetHandlerPlayClient netHandler = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, NET_CLIENT_HANDLER);
      ReachPlayerController controller = new ReachPlayerController(mc, netHandler);
      boolean isFlying = player.capabilities.isFlying;
      boolean allowFlying = player.capabilities.allowFlying;
      controller.setGameType(type);
      player.capabilities.isFlying = isFlying;
      player.capabilities.allowFlying = allowFlying;
      mc.playerController = controller;
    }
    ((ReachPlayerController) mc.playerController).setReachDistance(currentReach);
  }
  catch (Exception e) {
    //sometimes it crashes just AS the world is loading, but then it works after everythings set up
    //does not affect functionality, its working before the player can ever make use of this.
    ModCyclic.logger.error("Error setting reach : " + e.getMessage());
  }
}
项目:Farrago    文件:ToolBlockRenderer.java   
@PaneEventHandler
public void onDisplay(PaneDisplayEvent e) {
    oldRenderDistance = mc.gameSettings.renderDistanceChunks;
    mc.gameSettings.renderDistanceChunks = 3;
    fakeWorld = new WorldClient(new NetHandlerPlayClient(Minecraft.getMinecraft(), null, new NetworkManager(true)), new WorldSettings(new WorldInfo(new NBTTagCompound())), 0, EnumDifficulty.EASY, Minecraft.getMinecraft().mcProfiler);
    for (int x = -1; x <= 1; x++) {
        for (int z = -1; z <= 1; z++) {
            fakeWorld.getChunkProvider().loadChunk(x, z);
        }
    }
    fakeWorld.setBlock(0, 64, 0, Blocks.lit_furnace);
    fakeWorld.getGameRules().setOrCreateGameRule("doDaylightCycle", "false");
    fakeWorld.setWorldTime(6000);
    mc.thePlayer = new EntityClientPlayerMP(mc, fakeWorld,
            new FakeSession(), new FakeNetHandler(mc, null, new FakeNetManager(true)),
            new FakeStatFileWriter());
    mc.thePlayer.sendQueue.getNetworkManager().setNetHandler(mc.thePlayer.sendQueue);
    mc.thePlayer.movementInput = new MovementInput();
    mc.playerController = new PlayerControllerMP(mc, mc.thePlayer.sendQueue);
    mc.renderViewEntity = mc.thePlayer;
    mc.theWorld = fakeWorld;
    mc.renderGlobal.setWorldAndLoadRenderers(fakeWorld);
    MinecraftForge.EVENT_BUS.register(this);
}
项目:Cauldron    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.getNetworkManager(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg);
    }
    return event;
}
项目:Cauldron    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.getNetworkManager(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg);
    }
    return event;
}
项目:Cauldron    文件:FMLEventChannel.java   
@Override
FMLNetworkEvent.CustomPacketEvent<?> make(FMLProxyPacket msg)
{
    FMLNetworkEvent.CustomPacketEvent<?> event = null;
    if (msg.handler() instanceof NetHandlerPlayClient)
    {
        NetHandlerPlayClient client = (NetHandlerPlayClient) msg.handler();
        event = new FMLNetworkEvent.ClientCustomPacketEvent(client.getNetworkManager(), msg);
    }
    else if (msg.handler() instanceof NetHandlerPlayServer)
    {
        NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
        event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg);
    }
    return event;
}
项目:BlazeLoader    文件:EventHandlerClient.java   
public static void eventHandleHeldItemChange(EventInfo<NetHandlerPlayClient> event, S09PacketHeldItemChange packet) {
    try {
    if (inventoryEventHandlers.size() > 0) {
    if (packet.func_149385_c() >= 0 && packet.func_149385_c() < InventoryPlayer.getHotbarSize()) {
        Minecraft mc = Minecraft.getMinecraft();
        if (mc != null && mc.thePlayer != null) {
        if (!inventoryEventHandlers.all().onSlotSelectionChanged(mc.thePlayer, mc.thePlayer.inventory.getCurrentItem(), mc.thePlayer.inventory.currentItem)) {
            event.cancel();
        }
        }
    }
    }
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
项目:DecompiledMinecraft    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statFile)
{
    super(worldIn, netHandler.getGameProfile());
    this.sendQueue = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:DecompiledMinecraft    文件:WorldClient.java   
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
    super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
    this.sendQueue = p_i45063_1_;
    this.getWorldInfo().setDifficulty(p_i45063_4_);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.provider.registerWorld(this);
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
}
项目:DecompiledMinecraft    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:BaseClient    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statFile)
{
    super(worldIn, netHandler.getGameProfile());
    this.sendQueue = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:BaseClient    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statFile) {
    super(worldIn, netHandler.getGameProfile());
    this.sendQueue = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:BaseClient    文件:WorldClient.java   
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
    super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
    this.sendQueue = p_i45063_1_;
    this.getWorldInfo().setDifficulty(p_i45063_4_);
    this.provider.registerWorld(this);
    this.setSpawnPoint(new BlockPos(8, 64, 8));
    this.chunkProvider = this.createChunkProvider();
    this.mapStorage = new SaveDataMemoryStorage();
    this.calculateInitialSkylight();
    this.calculateInitialWeather();
}
项目:BaseClient    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:UniversalRemote    文件:HookedClientWorld.java   
public HookedClientWorld(WorldClient originalWorld) throws IllegalAccessException {
    super(InjectionHandler.readFieldOfType(originalWorld, NetHandlerPlayClient.class),
            new WorldSettings(originalWorld.getWorldInfo()),
            originalWorld.provider.getDimension(), originalWorld.getDifficulty(), originalWorld.profiler);

    HookedChunkProviderClient chunkProvider = new HookedChunkProviderClient(this);

    // replace the chunk provider with our own!
    InjectionHandler.writeFieldOfType(this, chunkProvider, ChunkProviderClient.class);
    InjectionHandler.writeFieldOfType(this, chunkProvider, IChunkProvider.class);

    SetupWorldProviderProxy();

}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatisticsManager statFile)
{
    super(worldIn, netHandler.getGameProfile());
    this.connection = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:Backmemed    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatisticsManager statFile)
{
    super(worldIn, netHandler.getGameProfile());
    this.connection = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:Backmemed    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getConnection();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.sendPacket(new CPacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:CustomWorldGen    文件:FMLClientHandler.java   
@Override
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
{
    if (side == Side.CLIENT)
    {
        bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayClient>(manager, channelSet, channel, side, NetHandlerPlayClient.class));
    }
    else
    {
        bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayServer>(manager, channelSet, channel, side, NetHandlerPlayServer.class));
    }
}
项目:CustomWorldGen    文件:EntityPlayerSP.java   
public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatisticsManager statFile)
{
    super(worldIn, netHandler.getGameProfile());
    this.connection = netHandler;
    this.statWriter = statFile;
    this.mc = mcIn;
    this.dimension = 0;
}
项目:CustomWorldGen    文件:GuiEditSign.java   
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
public void onGuiClosed()
{
    Keyboard.enableRepeatEvents(false);
    NetHandlerPlayClient nethandlerplayclient = this.mc.getConnection();

    if (nethandlerplayclient != null)
    {
        nethandlerplayclient.sendPacket(new CPacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText));
    }

    this.tileSign.setEditable(true);
}
项目:wizards-of-lua    文件:ReconnectAction.java   
@Override
public void handleClientSide(EntityPlayer player) {
  System.out.println("reconnect");

  NetHandlerPlayClient c = ((EntityPlayerSP) player).connection;
  NetworkManager nm = c.getNetworkManager();
  InetSocketAddress addr = (InetSocketAddress) nm.channel().remoteAddress();

  // disconnect
  Minecraft.getMinecraft().addScheduledTask(() -> {
    nm.closeChannel(null);
  });

  // connect
  new Thread(()-> {
    sleep(1000);
    Minecraft.getMinecraft().addScheduledTask(() -> {
      String ip = addr.getHostString();
      int port = addr.getPort();
      try {
        connect(ip, port);
      } catch (UnknownHostException e) {
        throw new RuntimeException(e);
      }
    });      
  }).start();
}
项目:CrystalMod    文件:PacketGuiMessage.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    EntityPlayer player = CrystalMod.proxy.getClientPlayer();
    if(player !=null && player.openContainer !=null){
        if(player.openContainer instanceof IMessageHandler){
            ((IMessageHandler)player.openContainer).handleMessage(type, data, true);
        }
    }
}
项目:CrystalMod    文件:PacketItemNBT.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    EntityPlayer player = CrystalMod.proxy.getClientPlayer();
    if(player == null){
        return;
    }
    ItemStack stack = player.inventory.getStackInSlot(slot < 0 ? player.inventory.currentItem : slot);
    if(ItemStackTools.isValid(stack)){
        stack.setTagCompound(data);
    }
}
项目:CrystalMod    文件:AbstractPacketThreadsafe.java   
@Override
 public final IMessage handleClient(final NetHandlerPlayClient netHandler) {
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
     @Override
     public void run() {
       handleClientSafe(netHandler);
     }
   });
   return null;
 }
项目:CrystalMod    文件:PacketExtendedPlayerInvSync.java   
@Override
public void handleClientSafe(NetHandlerPlayClient netHandler) {
    World world = CrystalMod.proxy.getClientWorld();
    if(world !=null){
        Entity entity = world.getEntityByID(playerId);
        if(entity !=null && entity instanceof EntityPlayer){
            EntityPlayer player = (EntityPlayer)entity;
            ExtendedPlayer ePlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
            ExtendedPlayerInventory inv = ePlayer.getInventory();
            inv.setStackInSlot(slot, stack);
        }
    }
}