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


Java NetworkRegistry.TargetPoint方法代码示例

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


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

示例1: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
/**
 * Send this message to everyone within a certain range of a point.
 * <p/>
 * Adapted from CPW's code in
 * cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper
 *
 * @param message The message to send
 * @param point   The
 *                {@link cpw.mods.fml.common.network.NetworkRegistry.TargetPoint}
 *                around which to send
 */
public void sendToAllAround(IPacket message, NetworkRegistry.TargetPoint point)
{
	try {
     this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
     this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
     this.channels.get(Side.SERVER).writeOutbound(message);
	} catch (Exception e)
	{
		GCLog.severe("Forge error when sending network packet to nearby players - this is not a Galacticraft bug, does another mod make fake players?");
		e.printStackTrace();
	}
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:24,代码来源:GalacticraftChannelHandler.java

示例2: onBlockActivated

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int these, float are, float some, float variables) { //LUL side, hitx, hity, hitz
    if(world.isRemote) return false;
    TileEntity te = world.getTileEntity(x, y, z);
    if(te == null || !(te instanceof TileEssentiaCompressor)) return false;
    if(((TileEssentiaCompressor) te).isMultiblockFormed()) {
        if(!((TileEssentiaCompressor) te).isMasterTile()) {
            int yOffset = ((TileEssentiaCompressor) te).getMultiblockYIndex();
            return RegisteredBlocks.blockEssentiaCompressor.onBlockActivated(world, x, y - yOffset, z, player, these, are, some, variables);
        }
    } else {
        ItemStack heldItem = player.getHeldItem();
        if(heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
                ResearchManager.isResearchComplete(player.getCommandSenderName(), SimpleResearchItem.getFullName("ESSENTIA_COMPRESSOR"))) {
            ChunkCoordinates lowest = findLowestCompressorBlock(world, x, y, z);
            boolean canForm = lowest != null && isMuliblockPossible(world, lowest);
            if(canForm && ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsCompressorMultiblock, true)) {
                int multiblockID = TileEssentiaCompressor.getAndIncrementNewMultiblockId();
                TileEssentiaCompressor compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY, lowest.posZ);
                compressor.setInMultiblock(true, 0, multiblockID);
                PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY, lowest.posZ);
                NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 1, lowest.posZ);
                compressor.setInMultiblock(false, 1, multiblockID);
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 1, lowest.posZ);
                point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 1, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                compressor = (TileEssentiaCompressor) world.getTileEntity(lowest.posX, lowest.posY + 2, lowest.posZ);
                compressor.setInMultiblock(false, 2, multiblockID);
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, lowest.posX, lowest.posY + 2, lowest.posZ);
                point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, lowest.posX, lowest.posY + 2, lowest.posZ, 32);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
            }
        }
    }
    return false;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:39,代码来源:BlockEssentiaCompressor.java

示例3: onBlockActivated

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
    if(world.getBlockMetadata(x, y, z) != 1) {
        Block up = world.getBlock(x, y + 1, z);
        return up != null && up instanceof BlockAuraPylon && up.onBlockActivated(world, x, y + 1, z, player, side, par7, par8, par9);
    }
    ItemStack heldItem = player.getHeldItem();
    if(!world.isRemote && heldItem != null && heldItem.getItem() instanceof ItemWandCasting &&
            ResearchManager.isResearchComplete(player.getCommandSenderName(), Gadomancy.MODID.toUpperCase() + ".AURA_PYLON")) {
        TileAuraPylon tileAuraPylon = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
        if(MultiblockHelper.isMultiblockPresent(world, x, y, z, RegisteredMultiblocks.auraPylonPattern) &&
                !tileAuraPylon.isPartOfMultiblock() &&
                ThaumcraftApiHelper.consumeVisFromWandCrafting(player.getCurrentEquippedItem(), player, RegisteredRecipes.costsAuraPylonMultiblock, true)) {
            PacketStartAnimation pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y, z);
            NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32);
            PacketHandler.INSTANCE.sendToAllAround(pkt, point);
            TileAuraPylon ta = (TileAuraPylon) world.getTileEntity(x, y - 1, z);
            ta.setTileInformation(true, false);
            ta = (TileAuraPylon) world.getTileEntity(x, y - 3, z);
            ta.setTileInformation(false, true);
            int count = 1;
            TileEntity iter = world.getTileEntity(x, y - count, z);
            while(iter != null && iter instanceof TileAuraPylon) {
                ((TileAuraPylon) iter).setPartOfMultiblock(true);
                world.markBlockForUpdate(x, y - count, z);
                iter.markDirty();
                pkt = new PacketStartAnimation(PacketStartAnimation.ID_SPARKLE_SPREAD, x, y - count, z);
                PacketHandler.INSTANCE.sendToAllAround(pkt, point);
                count++;
                iter = world.getTileEntity(x, y - count, z);
            }
        }
    }
    return false;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:36,代码来源:BlockAuraPylon.java

示例4: playAspectDrainFromWand

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
private void playAspectDrainFromWand(Aspect drained) {
    if(drained == null) return;
    NetworkRegistry.TargetPoint point = getTargetPoint(32);
    PacketTCWispyLine line = new PacketTCWispyLine(worldObj.provider.dimensionId, xCoord + 0.5, yCoord + 0.8, zCoord + 0.5,
            xCoord + 0.5, yCoord + 1.4 + (((double) worldObj.rand.nextInt(4)) / 10D), zCoord + 0.5, 40, drained.getColor());
    PacketHandler.INSTANCE.sendToAllAround(line, point);
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:8,代码来源:TileNodeManipulator.java

示例5: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public static void sendToAllAround(final XUPacketBase packet, final NetworkRegistry.TargetPoint point) {
    checkPacket(packet, Side.SERVER);
    NetworkHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
    NetworkHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
    NetworkHandler.channels.get(Side.SERVER).writeAndFlush(packet).addListener((GenericFutureListener)ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:7,代码来源:NetworkHandler.java

示例6: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public static final void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point) {
    AgeOfKingdom.channel.sendToAllAround(message, point);
}
 
开发者ID:jackey8616,项目名称:Age-of-Kingdom,代码行数:4,代码来源:NetworkManager.java

示例7: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void sendToAllAround(IPacket message, NetworkRegistry.TargetPoint point) {
	this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
	this.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
	this.channels.get(Side.SERVER).writeOutbound(message);
}
 
开发者ID:Techjar,项目名称:VivecraftForgeExtensions,代码行数:6,代码来源:VivecraftForgeChannelHandler.java

示例8: sendAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void sendAllAround(final ImaginePacket packet, final NetworkRegistry.TargetPoint point) {
    this.mServerChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set((Object)FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
    this.mServerChannel.attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set((Object)point);
    this.mServerChannel.writeOutbound(new Object[] { packet });
}
 
开发者ID:CyberdyneCC,项目名称:ThermosRebased,代码行数:6,代码来源:ImagineNetwork.java

示例9: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void sendToAllAround(PacketAbstract message, NetworkRegistry.TargetPoint point) {
	this.channelEnumMap.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
	this.channelEnumMap.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
	this.channelEnumMap.get(Side.SERVER).writeAndFlush(message);
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:6,代码来源:MCNetworkManager.java

示例10: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void sendToAllAround(IBarrelMessage message, NetworkRegistry.TargetPoint point)
{
    ((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
    ((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
    ((FMLEmbeddedChannel)this.channels.get(Side.SERVER)).writeAndFlush(message).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
}
 
开发者ID:Dennisbonke,项目名称:JABBA,代码行数:7,代码来源:BarrelPacketHandler.java

示例11: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void sendToAllAround(MMMessage message, NetworkRegistry.TargetPoint point) {
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
    channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
    channels.get(Side.SERVER).writeAndFlush(message);
}
 
开发者ID:MHuanterAxe,项目名称:MHuanterMod,代码行数:6,代码来源:MMMessagePipeline.java

示例12: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public static void sendToAllAround(Packet message, NetworkRegistry.TargetPoint point)
{
	Technotronics.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT);
	Technotronics.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(point);
	Technotronics.channels.get(Side.SERVER).writeOutbound(message);
}
 
开发者ID:asiekierka,项目名称:ConveyorBelts,代码行数:7,代码来源:NetworkUtils.java

示例13: updateEntity

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
@Override
public void updateEntity()
{
	boolean flag = canSmelt();
	boolean flag1 = false;

	if (!worldObj.isRemote)
	{
		if (canSmelt())
		{
			++ovenCookTime;
			if (ovenCookTime == COOKTIME)
			{
				ovenCookTime = 0;
				smeltItem();
				flag1 = true;
			}
		}
		else
		{
			ovenCookTime = 0;
		}

		if (ovenStacks[FUELINPUT] != null)
		{
			if (fuelTank.fillFromContainer(ovenStacks[FUELINPUT]))
			{
				ovenStacks[FUELINPUT] = ovenStacks[FUELINPUT].getItem().getContainerItem(ovenStacks[FUELINPUT]);

				NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId,
				                                                                    xCoord, yCoord, zCoord, 16.0d);
				ModMain.network.sendToAllAround(
						new PacketNetherBrickOvenFuelLevel(xCoord, yCoord, zCoord, fuelTank.getFluid()), point);
			}
		}
	}

	if (flag != canSmelt())
	{
		flag1 = true;
		BlockNetherBrickOven.updateBlockState(canSmelt(), worldObj, xCoord, yCoord, zCoord);
	}

	if (flag1)
	{
		markDirty();
	}
}
 
开发者ID:einsteinsci,项目名称:betterbeginnings-MC1.7,代码行数:49,代码来源:TileEntityNetherBrickOven.java

示例14: smeltItem

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
public void smeltItem()
{
	if (canSmelt())
	{
		ItemStack itemStack = NetherBrickOvenRecipeHandler.instance().findMatchingRecipe(this);

		if (ovenStacks[OUTPUT] == null)
		{
			ovenStacks[OUTPUT] = itemStack.copy();
		}
		else if (ovenStacks[OUTPUT].getItem() == itemStack.getItem())
		{
			ovenStacks[OUTPUT].stackSize += itemStack.stackSize;
		}

		for (int i = INPUTSTART; i < ovenStacks.length; ++i)
		{
			ItemStack stack = ovenStacks[i];

			if (stack != null)
			{
				ItemStack containerItem = null;

				if (ovenStacks[i].getItem().hasContainerItem(ovenStacks[i]))
				{
					containerItem = ovenStacks[i].getItem().getContainerItem(ovenStacks[i]);
				}

				--ovenStacks[i].stackSize;

				if (ovenStacks[i].stackSize <= 0)
				{
					ovenStacks[i] = null;
				}

				if (containerItem != null)
				{
					ovenStacks[i] = containerItem;
				}
			}
		}

		fuelTank.getFluid().amount -= getFuelNeededForSmelt();
	}

	NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord,
	                                                                    yCoord, zCoord, 16.0d);
	ModMain.network.sendToAllAround(new PacketNetherBrickOvenFuelLevel(xCoord, yCoord, zCoord, fuelTank.getFluid()),
	                                point);
}
 
开发者ID:einsteinsci,项目名称:betterbeginnings-MC1.7,代码行数:51,代码来源:TileEntityNetherBrickOven.java

示例15: sendToAllAround

import cpw.mods.fml.common.network.NetworkRegistry; //导入方法依赖的package包/类
/**
 * Send this message to everyone within a certain range of a point.
 * See {@link SimpleNetworkWrapper#sendToDimension(IMessage, NetworkRegistry.TargetPoint)}
 */
public final void sendToAllAround( IMessage pMessage, NetworkRegistry.TargetPoint pPoint )
{
  dispatcher.sendToAllAround( pMessage, pPoint );
}
 
开发者ID:GTNewHorizons,项目名称:Yamcl,代码行数:9,代码来源:PacketDispatcher.java


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