本文整理汇总了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/");
}
}
示例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();
}
}
示例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());
}
}
示例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;
}
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
示例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!"));
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
}