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


Java PacketDispatcher.sendPacketToAllPlayers方法代码示例

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


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

示例1: dispatchPackage

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
public void dispatchPackage() { //packet server-to-player
	Packet250CustomPayload packet = new Packet250CustomPayload();
	ByteArrayOutputStream stream = new ByteArrayOutputStream(21);
	DataOutputStream outputStream = new DataOutputStream(stream);
	try {
		outputStream.writeInt(coinSum);
		outputStream.writeInt(xCoord);
		outputStream.writeInt(yCoord);
		outputStream.writeInt(zCoord);
		outputStream.writeInt(this.worldObj.getWorldInfo().getVanillaDimension());
		outputStream.writeBoolean(bypassActive);
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	packet.channel = "UCTS_TileEntity";
	packet.data = stream.toByteArray();
	packet.length = stream.size();
	PacketDispatcher.sendPacketToAllPlayers(packet);
}
 
开发者ID:TED-996,项目名称:UniversalCoinsMod,代码行数:20,代码来源:UCTileEntity.java

示例2: BlockVisibilitySender

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
public static void BlockVisibilitySender(boolean result) {
    ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
    DataOutputStream outputStream = new DataOutputStream(bos);
    try {
        outputStream.writeBoolean(result);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    Packet250CustomPayload packet_sender = new Packet250CustomPayload();
    packet_sender.channel = "Apocalyptic-bv";
    packet_sender.data = bos.toByteArray();
    packet_sender.length = bos.size();
    if (side == Side.SERVER) {
        PacketDispatcher.sendPacketToAllPlayers(packet_sender);
    }
}
 
开发者ID:kunik-ru,项目名称:Apocalyptic,代码行数:18,代码来源:PacketHandler.java

示例3: onNetworkPatternChange

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@ForgeSubscribe
public void onNetworkPatternChange(GridPatternUpdateEvent e)
{
	if (grid != null)
	{
		IMEInventoryHandler inventoryHandler = grid.getCraftableArray();
		if (inventoryHandler != null)
		{
			craftableFluidsInNetwork = new ArrayList<Fluid>();
			for (IAEItemStack stack : inventoryHandler.getAvailableItems())
			{
				if (stack.getItem() == FLUIDDISPLAY.getItemInstance())
				{
					craftableFluidsInNetwork.add(FluidRegistry.getFluid(stack.getItemDamage()));
				}
			}
		}
	}
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:21,代码来源:TileEntityTerminalFluid.java

示例4: onItemRightClick

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
	MinecraftForge.EVENT_BUS.post(new UseItemEvent(player, this));
	itemStack.stackSize--;
	EntityStats stats = Dota2Items.stats.getOrCreateEntityStats(player);
	long startTime = world.getTotalWorldTime();
	long endTime = startTime + (long) (duration * MCConstants.TICKS_PER_SECOND);
	BuffInstance buffInst = new BuffInstance(Buff.clarity, player, startTime, endTime, true);
	boolean buffAdded = stats.addBuff(buffInst);
	PacketDispatcher.sendPacketToAllPlayers(new BuffForcePacket(buffInst).makePacket());
	player.playSound(Sound.CLARITY.getName(), 0.7f, 1);
	if (!player.worldObj.isRemote && buffAdded) {
		EffectClarity effect = new EffectClarity(player);
		player.worldObj.spawnEntityInWorld(effect);
	}
	return itemStack;
}
 
开发者ID:Hunternif,项目名称:Dota2Items,代码行数:18,代码来源:Clarity.java

示例5: doSpellTargetEffect

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public void doSpellTargetEffect(World worldObj, int posX, int posY, int posZ, EntityLivingBase entityHit) 
{
	for (int i = 0; i < 3; i++)
	{
		final double nextX = SpellboundCore.modRandom.nextBoolean() ? SpellboundCore.modRandom.nextInt(15) + 10 : SpellboundCore.modRandom.nextInt(15) + 10 * -1;
		final double nextZ = SpellboundCore.modRandom.nextBoolean() ? SpellboundCore.modRandom.nextInt(15) + 10 : SpellboundCore.modRandom.nextInt(15) + 10 * -1;
		
		worldObj.spawnEntityInWorld(new EntityLightningBolt(worldObj, posX + nextX, posY, posZ + nextZ));
		PacketDispatcher.sendPacketToAllPlayers(PacketHandler.createLightningPacket(posX + nextX, posY, posZ + nextZ));
	}
	
	final EntityMeteor meteor = new EntityMeteor(caster, this);
	meteor.setPosition(posX + SpellboundCore.modRandom.nextGaussian(), 255, posZ + SpellboundCore.modRandom.nextGaussian());
	worldObj.spawnEntityInWorld(meteor);
}
 
开发者ID:WildBamaBoy,项目名称:spellbound,代码行数:17,代码来源:SpellMeteor.java

示例6: onNeighborBlockChange

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
	super.onNeighborBlockChange(world, x, y, z, neighborID);
	if (!world.isRemote)
	{
		if (world.getBlockTileEntity(x, y, z) instanceof TileEntityBusFluidExport)
			PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
		((TileEntityBusFluidExport) world.getBlockTileEntity(x, y, z)).setRedstoneStatus(world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z));
	}
	ForgeDirection blockOrientation = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityBusFluidExport)
	{
		TileEntity fluidHandler = world.getBlockTileEntity(x + blockOrientation.offsetX, y + blockOrientation.offsetY, z + blockOrientation.offsetZ);
		((TileEntityBusFluidExport) blockTE).setFluidHandler(fluidHandler instanceof IFluidHandler ? (IFluidHandler) fluidHandler : null);
	}
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:19,代码来源:BlockBusFluidExport.java

示例7: syncSpear

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
public void syncSpear() 
   {
   	if(!worldObj.isRemote)
   	{
   		try
   		{
   			Packet packet = PacketManagerMF.getPacketItemStackArray(this, 0, getSpear());
   			PacketDispatcher.sendPacketToAllPlayers(packet);
   		}catch(Exception e){}
   	}
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:12,代码来源:EntityThrownSpear.java

示例8: syncItems

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
public void syncItems() 
   {
   	if(!worldObj.isRemote)
   	{
   		try
   		{
   			for(int a = 0; a < this.getSizeInventory(); a ++)
   			{
   				Packet packet = PacketManagerMF.getPacketItemStackArray(this, a, getStackInSlot(a));
   				PacketDispatcher.sendPacketToAllPlayers(packet);
   			}
   						
   		}catch(Exception e){}
   	}
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:16,代码来源:TileEntityWeaponRack.java

示例9: onNeighborBlockChange

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighbourID)
{
	if (!world.isRemote)
	{
		PacketDispatcher.sendPacketToAllPlayers(world.getBlockTileEntity(x, y, z).getDescriptionPacket());
	}
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:9,代码来源:BlockCertusTank.java

示例10: setPowerStatus

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public void setPowerStatus(boolean hasPower)
{
	powerStatus = hasPower;
	PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:8,代码来源:TileEntityMonitorStorageFluid.java

示例11: playerLoggedIn

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
//SERVER SIDE
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {
	PacketDispatcher.sendPacketToPlayer(getSkillAllUpdatePacket(), player);
	PacketDispatcher.sendPacketToAllPlayers(getAllSkillsUpdatePacket(netHandler.getPlayer().username));
	SCLog.info("Send all skills to " + netHandler.getPlayer().username);
}
 
开发者ID:ElConquistador,项目名称:SkillCraft,代码行数:8,代码来源:SCPacketHandler.java

示例12: drain

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
	if (from == ForgeDirection.UNKNOWN)
		return null;
	FluidStack drained = tanks[from.ordinal()].drain(maxDrain, doDrain);
	if (drained != null)
		PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	return drained;
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:11,代码来源:TileEntityInterfaceFluid.java

示例13: fill

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
	if (from == ForgeDirection.UNKNOWN || resource == null)
		return 0;

	int filled = 0;
	filled += fillToNetwork(resource, doFill);

	if (filled < resource.amount)
		filled += tanks[from.ordinal()].fill(new FluidStack(resource.fluidID, resource.amount - filled), doFill);
	if (filled > 0)
		PacketDispatcher.sendPacketToAllPlayers(getDescriptionPacket());
	return filled;
}
 
开发者ID:ExtraCells,项目名称:ExtraCells1,代码行数:16,代码来源:TileEntityInterfaceFluid.java

示例14: sendCapeUpdate

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
public static void sendCapeUpdate(String player, String capeUrl) {
    if (capeUrl == null) {
        capeUrl = "";
    }
    Object[] data = new Object[] { player, capeUrl };

    PacketDispatcher.sendPacketToAllPlayers(PacketWrapper.createPacket(HexxitGear.modNetworkChannel, Packets.CapeChange, data));
}
 
开发者ID:sct,项目名称:HexxitGear,代码行数:9,代码来源:CapeHandler.java

示例15: doSpellTargetEffect

import cpw.mods.fml.common.network.PacketDispatcher; //导入方法依赖的package包/类
@Override
public void doSpellTargetEffect(World worldObj, int posX, int posY, int posZ, EntityLivingBase entityHit) 
{
	if (entityHit != null)
	{
		PacketDispatcher.sendPacketToAllPlayers(PacketHandler.createColdGFXPacket(2, 0, entityHit.posX, entityHit.posY, entityHit.posZ));
		
		for (final Point3D point : Logic.getNearbyBlocks(worldObj, (int)entityHit.posX, (int)entityHit.posY, (int)entityHit.posZ, 3, Constants.SNOW_SUPPORTERS))
		{
			if (worldObj.getBlockId(point.posX, point.posY + 1, point.posZ) == 0)
			{
				worldObj.setBlock(point.posX, point.posY + 1, point.posZ, Block.snow.blockID);
			}
		}

		if (entityHit instanceof EntityPlayer)
		{
			if (!SpellboundCore.getInstance().entityHasActiveSpell((EntityPlayer)entityHit, SpellShieldOfInvulnerability.class) && !SpellboundCore.getInstance().entityHasActiveSpell((EntityPlayer)entityHit, SpellColdShield.class))
			{							
				entityHit.attackEntityFrom(DamageSource.magic, 5.0F);
				entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 1200));
				entityHit.extinguish();
			}
		}

		else
		{
			entityHit.attackEntityFrom(DamageSource.magic, 5.0F);
			entityHit.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 1200));
			entityHit.extinguish();
		}
	}
}
 
开发者ID:WildBamaBoy,项目名称:spellbound,代码行数:34,代码来源:SpellColdLvl2.java


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