當前位置: 首頁>>代碼示例>>Java>>正文


Java NetHandlerPlayClient類代碼示例

本文整理匯總了Java中net.minecraft.client.network.NetHandlerPlayClient的典型用法代碼示例。如果您正苦於以下問題:Java NetHandlerPlayClient類的具體用法?Java NetHandlerPlayClient怎麽用?Java NetHandlerPlayClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetHandlerPlayClient類屬於net.minecraft.client.network包,在下文中一共展示了NetHandlerPlayClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: WorldClient

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
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_);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:WorldClient.java

示例2: getPing

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
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;
}
 
開發者ID:Moudoux,項目名稱:EMC,代碼行數:22,代碼來源:IEntityPlayer.java

示例3: WorldClient

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
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);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:22,代碼來源:WorldClient.java

示例4: make

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:FMLEventChannel.java

示例5: renderPlayerList

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:GuiIngameForge.java

示例6: WorldClient

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
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));
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:WorldClient.java

示例7: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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);
				}
			}
		}
	}
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:23,代碼來源:PacketExtendedPlayer.java

示例8: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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));
				}
			}
		}
	}
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:27,代碼來源:PacketTileMessage.java

示例9: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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(";"));
				}
			}
		}
	}
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:23,代碼來源:PacketPipe.java

示例10: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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);
	    }
	}*/
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:18,代碼來源:PacketSyncBufferList.java

示例11: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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);
		}
	}*/
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:21,代碼來源:PacketSyncBuffer.java

示例12: handleClientSafe

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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();
    }
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:23,代碼來源:TileEntitiesMessage.java

示例13: make

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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;
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:17,代碼來源:FMLEventChannel.java

示例14: make

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
@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;
}
 
開發者ID:alexandrage,項目名稱:CauldronGit,代碼行數:17,代碼來源:FMLEventChannel.java

示例15: setPlayerReach

import net.minecraft.client.network.NetHandlerPlayClient; //導入依賴的package包/類
/**
 * 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());
  }
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:29,代碼來源:ClientProxy.java


注:本文中的net.minecraft.client.network.NetHandlerPlayClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。