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


Java TargetPoint类代码示例

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


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

示例1: entityHurtEvent

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@SubscribeEvent
public void entityHurtEvent(LivingHurtEvent event) {
	if (!EtFuturum.enableDmgIndicator)
		return;
	int amount = MathHelper.floor_float(Math.min(event.entityLiving.getHealth(), event.ammount) / 2F);
	if (amount <= 0)
		return;

	// If the attacker is a player spawn the hearts aligned and facing it
	if (event.source instanceof EntityDamageSource) {
		EntityDamageSource src = (EntityDamageSource) event.source;
		Entity attacker = src.getSourceOfDamage();
		if (attacker instanceof EntityPlayer && !(attacker instanceof FakePlayer)) {
			EntityPlayer player = (EntityPlayer) attacker;
			Vec3 look = player.getLookVec();
			look.rotateAroundY((float) Math.PI / 2);
			for (int i = 0; i < amount; i++) {
				double x = event.entityLiving.posX - amount * 0.35 * look.xCoord / 2 + i * 0.35 * look.xCoord;
				double y = event.entityLiving.posY + 1.5 + event.entityLiving.worldObj.rand.nextGaussian() * 0.05;
				double z = event.entityLiving.posZ - amount * 0.35 * look.zCoord / 2 + i * 0.35 * look.zCoord;
				EtFuturum.networkWrapper.sendToAllAround(new BlackHeartParticlesMessage(x, y, z), new TargetPoint(player.worldObj.provider.dimensionId, x, y, z, 64));
			}
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:26,代码来源:ServerEventHandler.java

示例2: onCollideWithPlayer

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
{
    if (this.riddenByEntity == null && this.postThrowDelay == 0 && this.throwTimer == 0 && par1EntityPlayer.equals(this.targetEntity) && this.deathTicks == 0)
    {
        if (!this.worldObj.isRemote)
        {
        	GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_BOSS_LAUGH, new Object[] {}), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 40.0D));
            par1EntityPlayer.mountEntity(this);
        }

        this.throwTimer = 40;
    }

    super.onCollideWithPlayer(par1EntityPlayer);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:17,代码来源:EntitySkeletonBoss.java

示例3: selectNetworks

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
    TargetPoint tp = (TargetPoint)args;
    ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.<NetworkDispatcher>builder();
    for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().func_71203_ab().field_72404_b)
    {
        if (player.field_71093_bK == tp.dimension)
        {
            double d4 = tp.x - player.field_70165_t;
            double d5 = tp.y - player.field_70163_u;
            double d6 = tp.z - player.field_70161_v;

            if (d4 * d4 + d5 * d5 + d6 * d6 < tp.range * tp.range)
            {
                NetworkDispatcher dispatcher = player.field_71135_a.field_147371_a.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
                if (dispatcher != null) builder.add(dispatcher);
            }
        }
    }
    return builder.build();
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:24,代码来源:FMLOutboundHandler.java

示例4: selectNetworks

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
    TargetPoint tp = (TargetPoint)args;
    ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.<NetworkDispatcher>builder();
    for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList)
    {
        if (player.dimension == tp.dimension)
        {
            double d4 = tp.x - player.posX;
            double d5 = tp.y - player.posY;
            double d6 = tp.z - player.posZ;

            if (d4 * d4 + d5 * d5 + d6 * d6 < tp.range * tp.range)
            {
                NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
                if (dispatcher != null) builder.add(dispatcher);
            }
        }
    }
    return builder.build();
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:24,代码来源:FMLOutboundHandler.java

示例5: onChiseled

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public void onChiseled(Packet stream, EntityPlayer player) throws IOException {
	final int x=stream.readInt();
	final int y=stream.readInt();
	final int z=stream.readInt();
	
	switch(FMLCommonHandler.instance().getEffectiveSide()){
		case SERVER:
			Packet packet = Chisel.packet.create(CHISELED).writeInt(x).writeInt(y).writeInt(z);
			Chisel.packet.sendToAllAround(packet, new TargetPoint(player.dimension, x, y, z, 30.0f));
			break;
		case CLIENT:
			Block block =player.worldObj.getBlock(x,y,z);
			int blockMeta=player.worldObj.getBlockMetadata(x,y,z);
			GeneralChiselClient.spawnChiselEffect(x, y, z, Carving.chisel.getVariationSound(block, blockMeta));

			break;
		default:
			break;
	}

}
 
开发者ID:asiekierka,项目名称:Chisel-1.7.2,代码行数:22,代码来源:Packets.java

示例6: onLivingUpdate

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onLivingUpdate() {
    super.onLivingUpdate();

    /* If Master Head is dead, Entity should be dead */
    if (masterEntity != null && (masterEntity.isDead || masterEntity.deathTime > 0 || shouldBeDying)) {
        onDeathUpdate();
    }

    /*
     * Send Packet Server -> Client with EntityData to Connect Child+Master : Packet calls linkMasterWithFollower
     * from Child
     */
    if (ticksExisted % 40 == 0 && !worldObj.isRemote && masterEntity != null) {
        PZPacket packet = new PacketFollowerMasterData().setPacketData(getEntityId(), masterEntity.getEntityId(), followerIndex);
        ProjectZulu_Core.getPipeline().sendToAllAround(packet, new TargetPoint(dimension, posX, posY, posZ, 60));
    }

    moveToTargetPosition(0.5f);
    adjustRotationToTarget(10.0f);
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:22,代码来源:EntityFollower.java

示例7: onChunkUpdate

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onChunkUpdate()
{
	super.onChunkUpdate();
	Collection<ChunkPosition> list = ((MobileChunkServer) ship.getShipChunk()).getSendQueue();
	if (firstChunkUpdate)
	{
		ship.getCapabilities().spawnSeatEntities();
	} else
	{
		MsgChunkBlockUpdate msg = new MsgChunkBlockUpdate(ship, list);
		ArchimedesShipMod.instance.pipeline.sendToAllAround(msg, new TargetPoint(ship.worldObj.provider.dimensionId, ship.posX, ship.posY, ship.posZ, 64D));
	}
	list.clear();
	firstChunkUpdate = false;
}
 
开发者ID:Ckathode,项目名称:archimedes-ships,代码行数:17,代码来源:ShipHandlerServer.java

示例8: upload

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Callback(direct=true)
public Object[] upload(Context context, Arguments arguments)
{
	//convert fifo to byte array
	byte[] data = fifo.toByteArray();
	try
	{
		gx.uploadFIFO(ByteStreams.newDataInput(data),data);
		GXFifoUploadMessage msg = new GXFifoUploadMessage();
		msg.uuid = uuid;
		msg.tier = tier;
		msg.data = data;
		OpenGX.network.sendToAllAround(msg, new TargetPoint(worldObj.provider.dimensionId, own.x(), own.y(), own.z(), 64));
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
	double waitTime = (((double)fifoBytes)/((double)fifoSize))*(1D/15D);
	//System.out.println(waitTime);
	//context.pause(waitTime);
	fifoBytes = 0;
	fifo = ByteStreams.newDataOutput(fifoSize);
	return null;
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:26,代码来源:ComponentGX.java

示例9: uploadTexture

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Callback(limit=5)
public Object[] uploadTexture(Context context, Arguments arguments)
{
	byte id = (byte) arguments.checkInteger(0);
	byte[] data = arguments.checkByteArray(1);
	byte fmt = (byte) arguments.checkInteger(2);
	
	GXTextureUploadMessage msg = new GXTextureUploadMessage();
	msg.uuid = uuid;
	msg.tier = tier;
	msg.id = id;
	msg.fmt = fmt;
	msg.data = data;
	OpenGX.network.sendToAllAround(msg, new TargetPoint(worldObj.provider.dimensionId, own.x(), own.y(), own.z(), 64));
	gx.uploadTexture(id, new ByteArrayInputStream(data), fmt);
	//technically, the fifo would have to be copied into memory in order for a texture to upload
	//context.pause((data.length/1024D)*(1/5D));
	
	return null;
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:21,代码来源:ComponentGX.java

示例10: setOwner

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public void setOwner(ComponentGX gx)
{
	if (owner != null)
		owner.monitor = null;
	owner = gx;
	MonitorOwnMessage m = new MonitorOwnMessage();
	m.muuid = uuid;
	
	if (gx != null)
	{
		m.hasOwner = true;
		m.uuid = gx.uuid;
		m.tier = gx.tier;
		gx.monitor = this;
		
		if (gx.gx != null)
			gx.gx.requestRerender();
	}
	
	System.out.println("set owner of "+uuid);
	OpenGX.network.sendToAllAround(m, new TargetPoint(worldObj.provider.dimensionId, own.x(), own.y(), own.z(), 64));
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:23,代码来源:ComponentMonitor.java

示例11: onLivingUpdate

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onLivingUpdate() {
    super.onLivingUpdate();

    /* If Master Head is dead, Entity should be dead */
    if (masterEntity != null && (masterEntity.isDead || masterEntity.deathTime > 0 || shouldBeDying)) {
        onDeathUpdate();
    }

    /*
     * Send Packet Server -> Client with EntityData to Connect Child+Master : Packet calls linkMasterWithFollower
     * from Child
     */
    if (ticksExisted % 40 == 0 && !worldObj.isRemote && masterEntity != null) {
       // PZPacket packet = new PacketFollowerMasterData().setPacketData(getEntityId(), masterEntity.getEntityId(), followerIndex);
       // ProjectZulu_Core.getPipeline().sendToAllAround(packet, new TargetPoint(dimension, posX, posY, posZ, 60));
        PZPacketFollowerMasterData message = new PZPacketFollowerMasterData().setPacketData(getEntityId(), masterEntity.getEntityId(), followerIndex);
        ProjectZulu_Core.packetHandler.sendToAllAround(message, new TargetPoint(dimension, posX, posY, posZ, 60));
    }

    moveToTargetPosition(0.5f);
    adjustRotationToTarget(10.0f);
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10,代码行数:24,代码来源:EntityFollower.java

示例12: onNeighborBlockChange

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
{
    super.onNeighborBlockChange(world, x, y, z, block);

    TileEntity tile = world.getTileEntity(x, y, z);

    this.setBlockBoundsBasedOnState(world, x, y, z);
    GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_WIRE_BOUNDS, new Object[] { x, y, z }), new TargetPoint(world.provider.dimensionId, x, y, z, 10.0D));

    if (tile instanceof INetworkConnection)
    {
        ((INetworkConnection) tile).refresh();
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:16,代码来源:BlockTransmitter.java

示例13: sendGearUpdatePacket

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
public static void sendGearUpdatePacket(EntityPlayerMP player, EnumModelPacket gearType)
{
	MinecraftServer theServer = FMLCommonHandler.instance().getMinecraftServerInstance();
	if (theServer != null && PlayerUtil.getPlayerForUsernameVanilla(theServer, player.getGameProfile().getName()) != null)
    {
        GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_GEAR_SLOT, new Object[] { player.getGameProfile().getName(), gearType.ordinal(), -1 }), new TargetPoint(player.worldObj.provider.dimensionId, player.posX, player.posY, player.posZ, 50.0D));
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:9,代码来源:GCPlayerHandler.java

示例14: onUpdate

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote)
    {
        GalacticraftCore.packetPipeline.sendToAllAround(new PacketDynamic(this), new TargetPoint(this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, this.getPacketRange()));
        // PacketDispatcher.sendPacketToAllAround(this.posX, this.posY,
        // this.posZ, this.getPacketRange(),
        // this.worldObj.provider.dimensionId,
        // GCCorePacketManager.getPacket(GalacticraftCore.CHANNELENTITIES,
        // this, this.getNetworkedData(new ArrayList<Object>())));
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:16,代码来源:NetworkedEntity.java

示例15: validateArgs

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; //导入依赖的package包/类
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:9,代码来源:FMLOutboundHandler.java


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