当前位置: 首页>>代码示例>>Java>>正文


Java Player类代码示例

本文整理汇总了Java中cpw.mods.fml.common.network.Player的典型用法代码示例。如果您正苦于以下问题:Java Player类的具体用法?Java Player怎么用?Java Player使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Player类属于cpw.mods.fml.common.network包,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playerLoggedIn

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
{
    try
    {URL version = new URL("https://raw.github.com/DrEinsteinium/WikiLink/master/version.txt");
        BufferedReader in = new BufferedReader(new InputStreamReader(version.openStream())); 
        
        String line; 
        String wholeString = "";
        
        while((line = in.readLine()) != null)
            wholeString += " "+line;

        if(!wholeString.contains(Reference.VER_MODHASH))
            netHandler.getPlayer().addChatMessage("\u00A76[\u00A7aWikiLink\u00A76]\u00A7c WikiLink is out of date for your Minecraft version. Please update at www.catacombs.co for the latest version.");
            in.close();
    } 
    catch (Exception e)
    {
        e.printStackTrace();
        netHandler.getPlayer().addChatMessage("\u00A76[\u00A7aWikiLink\u00A76]\u00A74 There was a problem while checking the version of WikiLink. Please report this at \u00A79www.catacombs.co/contact-me/");
    }
}
 
开发者ID:ElConquistador,项目名称:WikiLink,代码行数:24,代码来源:ConnectionHandler.java

示例2: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    try
    {
        if (packet.channel.equals(CHANNEL_GRAVE_UPGRADE))
        {
            if (FMLCommonHandler.instance().getEffectiveSide().isClient())
            {
                if (Minecraft.getMinecraft().currentScreen instanceof GraveUpgradeGui)
                {
                    ((GraveUpgradeGui) (Minecraft.getMinecraft().currentScreen)).updateInfoFromPacket(NetworkHelper.byteArrayToNBT(packet.data));
                }
            }
            else
            {
                MiscHelper.setPersistentDataTag((EntityPlayer) player, BSConstants.NBT_PLAYER_GRAVE_DATA, NetworkHelper.byteArrayToNBT(packet.data));
            }
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:CCM-Modding,项目名称:CcmBurialServicesInc,代码行数:26,代码来源:PacketHandler.java

示例3: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    if (player instanceof EntityPlayerMP) {
        EntityPlayerMP playerMP = (EntityPlayerMP) player;
        RemoteKey rk = new RemoteKey(packet);
        
        Map<String, Boolean> playerKeyMap;
        if (!playerKeys.containsKey(playerMP.username)) {
            playerKeyMap = new HashMap<String, Boolean>();
            playerKeys.put(playerMP.username, playerKeyMap);
        } else {
            playerKeyMap = playerKeys.get(playerMP.username);
        }
        playerKeyMap.put(rk.getName(), rk.isDown());
    }
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:17,代码来源:RemoteKeyPacketHandler.java

示例4: handlePacket

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
public static void handlePacket( BillundPacket packet, Player player )
{
	switch( packet.packetType )
	{
		case BillundPacket.OrderSet:
		{
			EntityPlayer entity = (EntityPlayer)player;
			World world = entity.worldObj;
			int set = packet.dataInt[0];
			int cost = BillundSet.get( set ).getCost();
			if( removeEmeralds( entity, cost ) )
			{
				Random r = new Random();
				world.spawnEntityInWorld( new EntityAirDrop(
					world,
					Math.floor( entity.posX - 8 + r.nextInt(16) ) + 0.5f,
					Math.min( world.getHeight(), 255 ) - r.nextInt(32) - 0.5f,
					Math.floor( entity.posZ - 8 + r.nextInt(16) ) + 0.5f,
					set
				) );
			}
			break;
		}
	}
}
 
开发者ID:dan200,项目名称:Billund,代码行数:26,代码来源:Billund.java

示例5: handleStats

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
private void handleStats(Packet250CustomPayload packet, Player player, DataInputStream inputStream){
	FCraftJobCore props = FCraftJobCore.get((EntityPlayer) player);
	float[] newStats = new float[4];
	
	try {
		for(int i=0;i<4;i++){
			newStats[i] = inputStream.readFloat();
		}
		props.setStats(newStats[0], newStats[1], newStats[2], newStats[3]);
		props.setLevelUpPoints(inputStream.readInt());
		props.setLevel(inputStream.readInt());
		props.setMaxExperience(inputStream.readInt());
		props.setCurrentMateria(inputStream.readInt());
	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:Unrelentless,项目名称:FantasyCraft-Mod,代码行数:19,代码来源:PacketHandler.java

示例6: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    EntityPlayer sender = (EntityPlayer) player;

    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
        int id = -1;

        try
        {
            id = data.readInt();

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:22,代码来源:ServerPacketHandler.java

示例7: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));

        try
        {
            int id = -1;
            id = data.readInt();
            EntityPlayer p = (EntityPlayer) player;

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:21,代码来源:ClientPacketHandler.java

示例8: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager network, int packetID, DataInputStream data, Player player) {

	try {

		switch (packetID) {
		case PacketIds.HABITAT_BIOME_POINTER:
			PacketCoordinates packetC = new PacketCoordinates();
			packetC.readData(data);
			Proxies.common.setBiomeFinderCoordinates(null, packetC.getCoordinates());
			break;
		case PacketIds.GENOME_TRACKER_UPDATE:
			PacketNBT packetN = new PacketNBT();
			packetN.readData(data);
			onGenomeTrackerUpdate((EntityPlayer) player, packetN);
			break;
		case PacketIds.IMPRINT_SELECTION_GET:
			onImprintSelectionGet((EntityPlayer) player);
			break;
		}
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:25,代码来源:PacketHandlerApiculture.java

示例9: onBlockActivated

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer me, int par6, float par7, float par8, float par9) {
    if(!me.isSneaking()){
        int meta = world.getBlockMetadata(x, y, z);
        TileEntity tile = world.getBlockTileEntity(x, y, z);
        if(meta == 0 && tile != null && tile instanceof TileDualFurnace){
            PacketDispatcher.sendPacketToPlayer(tile.getDescriptionPacket(), (Player)me);
            me.openGui(MineTechPlus.instance, GuiIds.GUI_DUALFURNACE, world, x, y, z);
            return true;
        }
        if(meta == 1 && tile != null && tile instanceof TileSuperContainer){
            me.openGui(MineTechPlus.instance, GuiIds.GUI_SUPER_CONTAINER, world, x, y, z);
            return true;
        }
    }
    return false;
}
 
开发者ID:aronthor,项目名称:MineTech,代码行数:17,代码来源:BlockIdeaBlocks.java

示例10: handleClientPacket

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
private void handleClientPacket(Packet250CustomPayload packet, Player player) {
    if(Reference.DEBUG)System.out.println("Client Packet Received");
    DataInputStream dis = new DataInputStream(new ByteArrayInputStream(packet.data));
       try {
           int packetId = dis.readInt();
           
           if(Reference.DEBUG)System.out.println("Handling packet with id:"+packetId);
           
           if(packetId == 1){
               
           }
           if(packetId == 2){ // Idea refining
               /*int x = dis.readInt();
               int y = dis.readInt();
               int z = dis.readInt();
               int d = dis.readInt();
               int c = dis.readInt();
               World w = DimensionManager.getWorld(d);
               TileEntity tile = w.getBlockTileEntity(x, y, z);
               if(tile instanceof TileWorkstation)
                   ((TileWorkstation) tile).cooldown = c;*/
           }
       }catch(Exception e){
           e.printStackTrace();
       }
}
 
开发者ID:aronthor,项目名称:MineTech,代码行数:27,代码来源:PacketHandler.java

示例11: playerLoggedIn

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {
	try {
		if (UpdateCheck.isUpdateAvailable()) {
			netHandler.getPlayer().sendChatToPlayer(ChatMessageComponent.createFromText("["+EnumChatFormatting.GOLD +"SkullForge"+EnumChatFormatting.RESET+"] An Update is available for this mod. Check http://goo.gl/ya0VpP for more info. (Your Version: "+EnumChatFormatting.AQUA+SkullForge.version+EnumChatFormatting.RESET+")"));
		}
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		netHandler.getPlayer().sendChatToPlayer(ChatMessageComponent.createFromText("["+EnumChatFormatting.GOLD +"SkullForge"+EnumChatFormatting.RESET+"]"+EnumChatFormatting.RED+" Unable to contact the Update Server!"));
	}
	
	
	//Uncomment for testing purposes only kthxbye :D
	//netHandler.getPlayer().sendChatToPlayer(ChatMessageComponent.createFromText("["+EnumChatFormatting.GOLD +"SkullForge"+EnumChatFormatting.RESET+"] Version "+EnumChatFormatting.AQUA+SkullForge.version+EnumChatFormatting.RESET+" loaded!"));
}
 
开发者ID:LanceShield,项目名称:SkullForge,代码行数:17,代码来源:ConnectionHandler.java

示例12: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager,
		Packet250CustomPayload packet, Player player) {
	try{
		NBTTagCompound packetTag = CompressedStreamTools.readCompressed(new ByteArrayInputStream(packet.data));

		if(packetTag.getName().equalsIgnoreCase("favourite")){
			handleFavouritePacket(packetTag);return;
		}

		if(packetTag.getName().equalsIgnoreCase("notify")){
			handleNotifyPacket(packetTag);return;
		}



	}catch(Exception e){
		throw new RuntimeException(e);
	}
}
 
开发者ID:tehbeard,项目名称:EnchancedAdventuronics,代码行数:21,代码来源:NetworkControl.java

示例13: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
	ByteArrayDataInput dat = ByteStreams.newDataInput(packet.data);
	byte packetID = dat.readByte();
	switch(packetID) {
	case 0: 
		handleSkillUpdate(dat);
		break;
	case 1: 
		handleAllSkillsUpdate(dat);
		break;
	case 2:
		handleSkillAllUpdate(dat);
		break;
	}
}
 
开发者ID:ElConquistador,项目名称:SkillCraft,代码行数:17,代码来源:SCPacketHandlerClient.java

示例14: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player playerEntity) {
    DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
    int packetSender;
    
    try {
      packetSender = inputStream.readInt();
    } catch (IOException e) {
      e.printStackTrace();
      return;
    }
    
    if (playerEntity instanceof EntityPlayer) {
      EntityPlayer player = ((EntityPlayer)playerEntity);
      if (packetSender==1) { //Jetpack
          updateJetpack(packet, player);
      } else if (packetSender==2) { //ExplosionRing
          updateExplosionRing(packet, player);
      }
    }
}
 
开发者ID:ictrobot,项目名称:Gems,代码行数:22,代码来源:GemsPacketHandler.java

示例15: onPacketData

import cpw.mods.fml.common.network.Player; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player p)
{
    final DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
    final int packetType = PacketUtil.readPacketID(data);
    EntityPlayer player = (EntityPlayer) p;

    if (packetType == 0)
    {
        final Class<?>[] decodeAs = { Integer.class, Integer.class, Integer.class };
        final Object[] packetReadout = PacketUtil.readPacketData(data, decodeAs);

        int entityID = 0;
        Entity entity = null;
        
        switch ((Integer) packetReadout[1])
        {
        case 0:
            entityID = (Integer) packetReadout[2];
            entity = player.worldObj.getEntityByID(entityID);
        }
    }
}
 
开发者ID:4Space,项目名称:4-Space-Legacy,代码行数:24,代码来源:ClientProxyEuropa.java


注:本文中的cpw.mods.fml.common.network.Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。