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


Java MessageContext类代码示例

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


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

示例1: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(LobbyBeginGamePacket packet, MessageContext ctx) {
	int x = packet.x;
	int y = packet.y;
	int z = packet.z;

	World w = ctx.getServerHandler().playerEntity.worldObj;

	TileEntity te = w.getTileEntity(x, y, z);

	if (te != null && te instanceof LobbyTileEntity) {
		LobbyTileEntity tile = (LobbyTileEntity) te;

		tile.setGameLive(true);

		for (EntityPlayer p : UUIDUtil.getPlayersFromProfileUUIDs(w, tile.players))
			p.travelToDimension(PAYDAY.dimensionID);
	}

	return null;
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:22,代码来源:LobbyBeginGamePacketHandler.java

示例2: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(LobbyPlayerOpenedGuiPacket packet, MessageContext ctx) {
	// SERVER
	int x = packet.x;
	int y = packet.y;
	int z = packet.z;

	EntityPlayerMP p = ctx.getServerHandler().playerEntity;

	World w = p.worldObj;
	if (w == null)
		return null;

	LobbyTileEntity tile = (LobbyTileEntity) w.getTileEntity(x, y, z);

	if (tile == null)
		return null;
	
	PAYDAY.INSTANCE.sendTo(new PacketSyncTileEntityClient(tile), p);

	return null;
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:23,代码来源:LobbyPlayerOpenedGuiPacketHandler.java

示例3: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(final PacketSyncPlayerPropertiesServer packet, final MessageContext ctx) {
	// SERVER
	new Thread() {
		@Override
		public void run() {
			EntityPlayerMP player = ctx.getServerHandler().playerEntity;
			
			PlayerData data = PlayerData.get(player);
			data.setInLobby(packet.inLobby);
			data.setReady(packet.ready);
			
			PAYDAY.INSTANCE.sendToAll(new PacketSyncPlayerPropertiesClient(player.getGameProfile().getId(), packet.ready, packet.inLobby));
		}
	}.start();

	return null;
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:19,代码来源:PacketSyncPlayerPropertiesServerHandler.java

示例4: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(SupportedFeaturesPacket message, MessageContext ctx) {
	
    MineDonate.cfg.sellItems = message.items;
    MineDonate.cfg.itemsMoneyType = message.itemsMoneyType;
    MineDonate.cfg.sellPrivelegies = message.privelegies;
    MineDonate.cfg.privelegiesMoneyType = message.privelegiesMoneyType;
    MineDonate.cfg.sellRegions = message.regions;
    MineDonate.cfg.regionMoneyType = message.regionsMoneyType;
    MineDonate.cfg.sellEntities = message.entities;
    MineDonate.cfg.entitiesMoneyType = message.entitiesMoneyType;
    MineDonate.cfg.userShops = message.userShops;

    MineDonate . loadClientMerch ( ) ;
    
    ShopGUI . instance . defaultCategory = message . firstCatId ;

    return null;
    
}
 
开发者ID:Pishka,项目名称:MineDonate,代码行数:22,代码来源:SupportedFeaturesPacketHandler.java

示例5: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(MsgSyncRadiation message, MessageContext ctx)
{
	PlayerTracker tracker = TrackerManager.lookupTrackerFromUsername(Minecraft.getMinecraft().thePlayer.getCommandSenderName());
	
	if (tracker == null) {
		tracker = new PlayerTracker(Minecraft.getMinecraft().thePlayer);
		TrackerManager.addToManager(tracker);
		System.out.println("Tracker == null? Add new!");
	}
	
	
	if (tracker != null) {
		tracker.prevRadiation = tracker.radiation;
		tracker.radiation = message.radiation;
	}
	
	//System.out.println("RECV! " + message.radiation);

	return null;
}
 
开发者ID:TwilightWingsStudio,项目名称:HazardsLib,代码行数:23,代码来源:MsgSyncRadiation.java

示例6: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(MessageSyncRoleplayMode message, MessageContext ctx)
{
    EntityPlayer player = YeOldeChat.proxy.getPlayerFromMessageContext(ctx);
    if (player == null)
        return null;
    
    PlayerRoleplayMode props = PlayerRoleplayMode.get(player);
    if (props == null) {
    	return null;
    }
    
    if (player.worldObj.isRemote)
    props.setRoleplayMode(message.roleplayMode, true);
    
    return null;
}
 
开发者ID:Zundrel,项目名称:Ye-Olde-Chat,代码行数:18,代码来源:MessageSyncRoleplayMode.java

示例7: getPlayerFromMessageContext

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public EntityPlayer getPlayerFromMessageContext(MessageContext ctx)
{
    switch (ctx.side)
    {
        case CLIENT:
        {
            EntityPlayer entityClientPlayerMP = Minecraft.getMinecraft().thePlayer;
            return entityClientPlayerMP;
        }
        case SERVER:
        {
            EntityPlayer entityPlayerMP = ctx.getServerHandler().playerEntity;
            return entityPlayerMP;
        }
        default:
        {
            break;
        }
    }
    return null;
}
 
开发者ID:Zundrel,项目名称:Ye-Olde-Chat,代码行数:23,代码来源:ClientProxy.java

示例8: getPlayerFromMessageContext

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
public EntityPlayer getPlayerFromMessageContext(MessageContext ctx)
{
    switch (ctx.side)
    {
        case SERVER:
        {
            EntityPlayer entityPlayerMP = ctx.getServerHandler().playerEntity;
            return entityPlayerMP;
        }
        default:
        {
            break;
        }
    }
    return null;
}
 
开发者ID:Zundrel,项目名称:Ye-Olde-Chat,代码行数:17,代码来源:CommonProxy.java

示例9: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(PacketClientCommand message, MessageContext ctx) {
    switch (message.commandType) {
    case 0: // Command /cnp reload
        ConfigLoader.reloadPlugins();
        Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("customneiplugins.command.reload.info", ConfigLoader.loadedPlugins.size()));
        break;
    case 1: // Command /cnp status
        Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("customneiplugins.command.status.info", ConfigLoader.loadedPlugins.size(), ConfigLoader.disabledPlugins.size(), ConfigLoader.erroredPlugins.size()));
        for (String loadedPluginName: ConfigLoader.loadedPlugins)
            Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("customneiplugins.command.status_loaded.info", loadedPluginName));
        for (String disabledPluginName: ConfigLoader.disabledPlugins)
            Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("customneiplugins.command.status_disabled.info", disabledPluginName));
        for (String erroredPluginName: ConfigLoader.erroredPlugins)
            Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation("customneiplugins.command.status_errored.info", erroredPluginName));
    }
    return null;
}
 
开发者ID:GWYOG,项目名称:CustomNEIPlugins,代码行数:19,代码来源:PacketClientCommand.java

示例10: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(BlockMessage message, MessageContext ctx) {
	/*int d = message.dimension == 0 ? 0 : (message.dimension == -1 ? 1 : 2);
	switch(message.id){
	case 0:
	MinecraftServer.getServer().worldServers[d].setBlock(message.x, message.y - 1, message.z, Blocks.planks);break;
	case 1:
	MinecraftServer.getServer().worldServers[d].setBlock(message.x, message.y - 1, message.z, Blocks.dirt);break;
	case 2:
	MinecraftServer.getServer().worldServers[d].setBlock(message.x, message.y - 1, message.z, Blocks.stone);break;
	}*/
	int d = message.dimension == 0 ? 0 : (message.dimension == -1 ? 1 : 2);
	switch(message.id){
	case 0:
		ctx.getServerHandler().playerEntity.worldObj.setBlock(message.x, message.y - 1, message.z, Blocks.planks);break;
	case 1:
		ctx.getServerHandler().playerEntity.worldObj.setBlock(message.x, message.y - 1, message.z, Blocks.dirt);break;
	case 2:
		ctx.getServerHandler().playerEntity.worldObj.setBlock(message.x, message.y - 1, message.z, Blocks.stone);break;
	}
	TileEntityNote entity = (TileEntityNote) ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z);
	entity.note = (byte) message.note;
	entity.triggerNote(ctx.getServerHandler().playerEntity.worldObj, message.x, message.y, message.z);
	return null;
}
 
开发者ID:cqjjjzr,项目名称:NoteblockTweak,代码行数:26,代码来源:BlockMessageHandler.java

示例11: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(ADSUpdatePacket m, MessageContext ctx)
{
	TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
	
	if (te instanceof TileEntityReciever)
	{
		TileEntityReciever ter = (TileEntityReciever) te;
		ter.yawLimit = m.range;
		ter.kMobs = m.mob;
		ter.kTeam = m.chip;
		ter.kPlayers = m.player;
		ter.hasWeapon = m.haswep;
		ter.username = m.user;
	}
	return null;
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:18,代码来源:ADSUpdatePacket.java

示例12: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(EntityDebrisPacket m, MessageContext ctx)
{
	Iterator iter = Minecraft.getMinecraft().theWorld.loadedEntityList.iterator();
	while (iter.hasNext())
	{
		Entity e = (Entity) iter.next();
		if (e.getEntityId() == m.id && e instanceof EntityDebris)
		{
			EntityDebris ed = (EntityDebris) e;
			ed.block = m.block;
			ed.metadata = m.metadata;
			break;
		}
	}
	return null;
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:18,代码来源:EntityDebrisPacket.java

示例13: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(ItemUpdate message, MessageContext ctx)
{
	ItemStack itemstack = ctx.getServerHandler().playerEntity.inventory.getStackInSlot(message.item);
	if (itemstack.getItem() instanceof ItemTesla)
	{
		if (itemstack.stackTagCompound == null) itemstack.stackTagCompound = new NBTTagCompound();
		itemstack.stackTagCompound.setInteger("dial", message.value);
	}
	if (itemstack.getItem() instanceof ItemFlameThrower)
	{
		if (itemstack.stackTagCompound == null) itemstack.stackTagCompound = new NBTTagCompound();
		itemstack.stackTagCompound.setInteger("mode", message.value);
	}
	return null;
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:17,代码来源:ItemUpdate.java

示例14: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(TextPacket m, MessageContext ctx)
{
	if (m.text.startsWith("-t"))
	{
		String[] str = m.text.substring(2, m.text.length()).split("\n");
		for (int i = 0; i < str.length; i++) Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(str[i]));
	}
	else
	{
		String[] s = m.text.split(" ");
		StringBuilder strb = new StringBuilder();
		for (int i = 0; i < s.length; i++)
		{
			strb.append(StatCollector.translateToLocal(s[i]));
			strb.append(" ");
		}
		Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(strb.toString()));
	}
	return null;
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:22,代码来源:TextPacket.java

示例15: onMessage

import cpw.mods.fml.common.network.simpleimpl.MessageContext; //导入依赖的package包/类
@Override
public IMessage onMessage(EntityGorePacket m, MessageContext ctx)
{
	Iterator iter = Minecraft.getMinecraft().theWorld.loadedEntityList.iterator();
	while (iter.hasNext())
	{
		Entity e = (Entity) iter.next();
		if (e.getEntityId() == m.id && e instanceof EntityGore)
		{
			EntityGore eg = (EntityGore) e;
			eg.mob = m.mob;
			eg.type = m.type;
			eg.greenblood = m.green;
			
			if (m.mob == 0) eg.username = m.username;
			if (m.mob == 11) eg.size = m.size;
			break;
		}
	}
	return null;
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:22,代码来源:EntityGorePacket.java


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