Java 类cpw.mods.fml.common.network.NetworkRegistry.TargetPoint 实例源码

项目:connor41-etfuturum2    文件:ServerEventHandler.java   
@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));
            }
        }
    }
}
项目:4Space-5    文件:EntitySkeletonBoss.java   
@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);
}
项目:TRHS_Club_Mod_2016    文件:FMLOutboundHandler.java   
@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();
}
项目:CauldronGit    文件:FMLOutboundHandler.java   
@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();
}
项目:Et-Futurum    文件:ServerEventHandler.java   
@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));
            }
        }
    }
}
项目:Chisel-1.7.2    文件:Packets.java   
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;
    }

}
项目:Cauldron    文件:FMLOutboundHandler.java   
@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();
}
项目:Cauldron    文件:FMLOutboundHandler.java   
@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();
}
项目:Cauldron    文件:FMLOutboundHandler.java   
@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();
}
项目:projectzulu1.7.10-pre-1.3a    文件:EntityFollower.java   
@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);
}
项目:archimedes-ships    文件:ShipHandlerServer.java   
@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;
}
项目:OpenGX    文件:ComponentGX.java   
@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;
}
项目:OpenGX    文件:ComponentGX.java   
@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;
}
项目:OpenGX    文件:ComponentMonitor.java   
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));
}
项目:projectzulu1.7.10    文件:EntityFollower.java   
@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);
}
项目:4Space-5    文件:BlockTransmitter.java   
@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();
    }
}
项目:4Space-5    文件:GCPlayerHandler.java   
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));
    }
}
项目:4Space-5    文件:GCPlayerHandler.java   
public static void sendGearUpdatePacket(EntityPlayerMP player, EnumModelPacket gearType, int subtype)
{
    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(), subtype }), new TargetPoint(player.worldObj.provider.dimensionId, player.posX, player.posY, player.posZ, 50.0D));
    }
}
项目:4Space-5    文件:NetworkedEntity.java   
@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>())));
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLOutboundHandler.java   
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
项目:LambdaLib    文件:TargetPoints.java   
public static TargetPoint convert(Object obj, double range) {
    TargetPointConverter conv = findConverter(obj);
    if (conv == null) {
        throw new UnsupportedOperationException("Didn't find TargetPoint converter for " + obj);
    }
    return conv.convert(obj, range);
}
项目:LambdaLib    文件:TargetPoints.java   
@Override
public TargetPoint convert(TileEntity object, double range) {
    if (range == -1)
        range = DEFAULT_RANGE;
    return new TargetPoint(object.getWorldObj().provider.dimensionId, object.xCoord + 0.5,
            object.yCoord + 0.5, object.zCoord + 0.5, range);
}
项目:CauldronGit    文件:FMLOutboundHandler.java   
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
项目:Structures    文件:VirtualSpawnerInstance.java   
private void spawnActiveParticles() {
  if(!behaviour.isRenderParticles()) {
    return;
  }
  PacketHandler.INSTANCE.sendToAllAround(new PacketSpawnParticles(worldPos),
      new TargetPoint(world.provider.dimensionId, worldPos.x, worldPos.y, worldPos.z, 64));
}
项目:EnderIOAddons    文件:EioaCropPlant.java   
@Override
public boolean onAllowedGrowthTick(World world, int x, int y, int z, int oldGrowthStage) {
  if (!isMature(oldGrowthStage)) {
    eioaGrowthRequirement.usePower(world, x, y, z);
    PacketHandler.INSTANCE.sendToAllAround(new PacketFarmAction(new BlockCoord(x, y, z)), new TargetPoint(world.provider.dimensionId, x, y, z, 64));
    return true;
  } else {
    return false;
  }
}
项目:StellarForge    文件:NetworkTileEntity.java   
public void broadcastPacketInRange()
{
    int dim = worldObj.provider.dimensionId;
    if(worldObj.isRemote)
        StellarForge.packetPipeline.sendToServer(this.createDataPacket());
    else
        StellarForge.packetPipeline.sendToAllAround(this.createDataPacket(), 
                new TargetPoint(dim, xCoord,yCoord,zCoord,broadcastRange));
}
项目:StellarForge    文件:NetworkTileEntity.java   
public void broadcastPacketInRange(AbstractPacket packet)
{
    if(worldObj.isRemote)
        StellarForge.packetPipeline.sendToServer(packet);
    else
        StellarForge.packetPipeline.sendToAllAround(packet, 
                new TargetPoint(worldObj.provider.dimensionId,xCoord,yCoord,zCoord,broadcastRange));
}
项目:Farrago    文件:FarragoMod.java   
private static void _breakUtilityBelt(EntityPlayer p, ItemStack belt) {
    p.worldObj.playSoundAtEntity(p, "farrago:belt_break", 0.8f, 1.0f);
    CHANNEL.sendToAllAround(new SpawnBeltBreakParticleMessage(p.getEntityId()), new TargetPoint(p.dimension, p.posX, p.posY, p.posZ, 64));
    for (ItemStack s : FarragoMod.UTILITY_BELT.getCompleteContents(belt)) {
        p.entityDropItem(s, 0.2f);
    }
}
项目:balkons-weaponmod    文件:PhysHelper.java   
private static void sendExplosion(World world, AdvancedExplosion explosion, boolean smallparts, boolean bigparts)
{
    if (world instanceof WorldServer && !world.isRemote)
    {
        MsgExplosion msg = new MsgExplosion(explosion, smallparts, bigparts);
        BalkonsWeaponMod.instance.messagePipeline.sendToAllAround(msg, new TargetPoint(world.provider.dimensionId, explosion.explosionX, explosion.explosionY, explosion.explosionZ, 64D));
    }
}
项目:ThaumicEnergistics    文件:NetworkHandler.java   
public static void sendAreaPacketToClients( final ThEAreaPacket areaPacket, final float range )
{
    // Create the wrapper packet
    WrapperPacket wrapper = new WrapperPacket_C( areaPacket );

    // Create the target point
    TargetPoint targetPoint = new TargetPoint( areaPacket.getDimension(), areaPacket.getX(), areaPacket.getY(), areaPacket.getZ(), range );

    // Send the packet
    NetworkHandler.channel.sendToAllAround( wrapper, targetPoint );

}
项目:Cauldron    文件:FMLOutboundHandler.java   
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
项目:Cauldron    文件:FMLOutboundHandler.java   
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
项目:Cauldron    文件:FMLOutboundHandler.java   
@Override
public void validateArgs(Object args)
{
    if (!(args instanceof TargetPoint))
    {
        throw new RuntimeException("ALLAROUNDPOINT expects a TargetPoint argument");
    }
}
项目:projectzulu1.7.10-pre-1.3a    文件:CommandPlaySound.java   
/**
 * Command stringArgs == 2: /playsound [targetPlayer] [fileName] <range> <x> <y> <z> Command stringArgs == 2:
 * /playsound @p sounds.fileName Command stringArgs == 3: /playsound @p sounds.fileName <range> Command stringArgs
 * == 5: /playsound @p sounds.fileName <xDouble, yDouble, zDouble> Command stringArgs == 6: /playsound @p
 * sounds.fileName <range> <xDouble, yDouble, zDouble>
 */
@Override
public void processCommand(ICommandSender commandSender, String[] stringArgs) {
    if (stringArgs.length < 2) {
        throw new WrongUsageException("commands.playsound.usage", new Object[0]);
    } else {
        int soundTargetX = 0;
        int soundTargetY = 0;
        int soundTargetZ = 0;

        EntityPlayerMP targetPlayer = getPlayer(commandSender, stringArgs[0]);
        if (targetPlayer == null) {
            throw new PlayerNotFoundException();
        }

        if (stringArgs.length == 2 || stringArgs.length == 3) {
            soundTargetX = (int) targetPlayer.posX;
            soundTargetY = (int) targetPlayer.posY;
            soundTargetZ = (int) targetPlayer.posZ;
        } else if (stringArgs.length == 5 || stringArgs.length == 6) {
            int indexOfPos = stringArgs.length - 3;
            soundTargetX = (int) parsePosition(commandSender, targetPlayer.posX, stringArgs[indexOfPos++]);
            soundTargetY = (int) parsePositionWithBounds(commandSender, targetPlayer.posY,
                    stringArgs[indexOfPos++], 0, 0);
            soundTargetZ = (int) parsePosition(commandSender, targetPlayer.posZ, stringArgs[indexOfPos++]);
        }

        int soundRange = stringArgs.length == 3 || stringArgs.length == 6 ? parseIntBounded(commandSender,
                stringArgs[2], 0, 120) : 60;

        PZPacket packet = new PacketPlaySound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
                stringArgs[1]);
        ProjectZulu_Core.getPipeline().sendToAllAround(packet,
                new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
    }
}
项目:projectzulu1.7.10-pre-1.3a    文件:CommandStreamSound.java   
/**
 * Command stringArgs == 2: /streamsound [targetPlayer] [fileName] <range> <x> <y> <z> Command stringArgs == 2:
 * /streamsound @p sounds.fileName Command stringArgs == 3: /streamsound @p sounds.fileName <range> Command
 * stringArgs == 5: /streamsound @p sounds.fileName <xDouble, yDouble, zDouble> Command stringArgs == 6:
 * /streamsound @p sounds.fileName <range> <xDouble, yDouble, zDouble>
 */
@Override
public void processCommand(ICommandSender commandSender, String[] stringArgs) {
    if (stringArgs.length < 2) {
        throw new WrongUsageException("commands.streamsound.usage", new Object[0]);
    } else {
        int soundTargetX = 0;
        int soundTargetY = 0;
        int soundTargetZ = 0;

        EntityPlayerMP targetPlayer = getPlayer(commandSender, stringArgs[0]);
        if (targetPlayer == null) {
            throw new PlayerNotFoundException();
        }

        if (stringArgs.length == 2 || stringArgs.length == 3) {
            soundTargetX = (int) targetPlayer.posX;
            soundTargetY = (int) targetPlayer.posY;
            soundTargetZ = (int) targetPlayer.posZ;
        } else if (stringArgs.length == 5 || stringArgs.length == 6) {
            int indexOfPos = stringArgs.length - 3;
            soundTargetX = (int) parsePosition(commandSender, targetPlayer.posX, stringArgs[indexOfPos++]);
            soundTargetY = (int) parsePositionWithBounds(commandSender, targetPlayer.posY,
                    stringArgs[indexOfPos++], 0, 0);
            soundTargetZ = (int) parsePosition(commandSender, targetPlayer.posZ, stringArgs[indexOfPos++]);
        }

        int soundRange = stringArgs.length == 3 || stringArgs.length == 6 ? parseIntBounded(commandSender,
                stringArgs[2], 0, 120) : 60;

        PZPacket packet = new PacketStreamSound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
                stringArgs[1]);
        ProjectZulu_Core.getPipeline().sendToAllAround(packet,
                new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
    }
}
项目:SimplyJetpacks    文件:LivingTickHandler.java   
@SubscribeEvent
public void onLivingTick(LivingUpdateEvent evt) {
    if (!evt.entityLiving.worldObj.isRemote) {
        ParticleType jetpackState = null;
        ItemStack armor = evt.entityLiving.getEquipmentInSlot(3);
        Jetpack jetpack = null;
        if (armor != null && armor.getItem() instanceof ItemJetpack) {
            jetpack = ((ItemJetpack) armor.getItem()).getPack(armor);
            if (jetpack != null) {
                jetpackState = jetpack.getDisplayParticleType(armor, (ItemJetpack) armor.getItem(), evt.entityLiving);
            }
        }

        if (jetpackState != lastJetpackState.get(evt.entityLiving.getEntityId())) {
            if (jetpackState == null) {
                lastJetpackState.remove(evt.entityLiving.getEntityId());
            } else {
                lastJetpackState.put(evt.entityLiving.getEntityId(), jetpackState);
            }
            PacketHandler.instance.sendToAllAround(new MessageJetpackSync(evt.entityLiving.getEntityId(), jetpackState != null ? jetpackState.ordinal() : -1), new TargetPoint(evt.entityLiving.dimension, evt.entityLiving.posX, evt.entityLiving.posY, evt.entityLiving.posZ, 256));
        } else if (jetpack != null && evt.entityLiving.worldObj.getTotalWorldTime() % 160L == 0) {
            PacketHandler.instance.sendToAllAround(new MessageJetpackSync(evt.entityLiving.getEntityId(), jetpackState != null ? jetpackState.ordinal() : -1), new TargetPoint(evt.entityLiving.dimension, evt.entityLiving.posX, evt.entityLiving.posY, evt.entityLiving.posZ, 256));
        }

        if (evt.entityLiving.worldObj.getTotalWorldTime() % 200L == 0) {
            Iterator<Integer> itr = lastJetpackState.keySet().iterator();
            while (itr.hasNext()) {
                int entityId = itr.next();
                if (evt.entityLiving.worldObj.getEntityByID(entityId) == null) {
                    itr.remove();
                }
            }
        }
    }
}
项目:OpenGX    文件:ComponentMonitor.java   
@Override
public void update() {
    if (width<=0) width=128;
    if (height<=0) height=96;
    if (countdown-- == 0)
    {
        countdown = 100;
        MonitorSizeMessage msm = new MonitorSizeMessage();
        msm.uuid = uuid;
        msm.w = width;
        msm.h = height;
        OpenGX.network.sendToAllAround(msm, new TargetPoint(worldObj.provider.dimensionId, own.x(), own.y(), own.z(), 64));
    }
}
项目:projectzulu1.7.10    文件:CommandPlaySound.java   
/**
 * Command stringArgs == 2: /playsound [targetPlayer] [fileName] <range> <x> <y> <z> Command stringArgs == 2:
 * /playsound @p sounds.fileName Command stringArgs == 3: /playsound @p sounds.fileName <range> Command stringArgs
 * == 5: /playsound @p sounds.fileName <xDouble, yDouble, zDouble> Command stringArgs == 6: /playsound @p
 * sounds.fileName <range> <xDouble, yDouble, zDouble>
 */
@Override
public void processCommand(ICommandSender commandSender, String[] stringArgs) {
    if (stringArgs.length < 2) {
        throw new WrongUsageException("commands.playsound.usage", new Object[0]);
    } else {
        int soundTargetX = 0;
        int soundTargetY = 0;
        int soundTargetZ = 0;

        EntityPlayerMP targetPlayer = getPlayer(commandSender, stringArgs[0]);
        if (targetPlayer == null) {
            throw new PlayerNotFoundException();
        }

        if (stringArgs.length == 2 || stringArgs.length == 3) {
            soundTargetX = (int) targetPlayer.posX;
            soundTargetY = (int) targetPlayer.posY;
            soundTargetZ = (int) targetPlayer.posZ;
        } else if (stringArgs.length == 5 || stringArgs.length == 6) {
            int indexOfPos = stringArgs.length - 3;
            soundTargetX = (int) parsePosition(commandSender, targetPlayer.posX, stringArgs[indexOfPos++]);
            soundTargetY = (int) parsePositionWithBounds(commandSender, targetPlayer.posY,
                    stringArgs[indexOfPos++], 0, 0);
            soundTargetZ = (int) parsePosition(commandSender, targetPlayer.posZ, stringArgs[indexOfPos++]);
        }

        int soundRange = stringArgs.length == 3 || stringArgs.length == 6 ? parseIntBounded(commandSender,
                stringArgs[2], 0, 120) : 60;

        //PZPacket packet = new PacketPlaySound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
        //        stringArgs[1]);
        //ProjectZulu_Core.getPipeline().sendToAllAround(packet,
        //        new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
        PZPacketPlaySound message = new PZPacketPlaySound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
                       stringArgs[1]);
        ProjectZulu_Core.packetHandler.sendToAllAround(message, new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
    }
}
项目:projectzulu1.7.10    文件:CommandStreamSound.java   
/**
 * Command stringArgs == 2: /streamsound [targetPlayer] [fileName] <range> <x> <y> <z> Command stringArgs == 2:
 * /streamsound @p sounds.fileName Command stringArgs == 3: /streamsound @p sounds.fileName <range> Command
 * stringArgs == 5: /streamsound @p sounds.fileName <xDouble, yDouble, zDouble> Command stringArgs == 6:
 * /streamsound @p sounds.fileName <range> <xDouble, yDouble, zDouble>
 */
@Override
public void processCommand(ICommandSender commandSender, String[] stringArgs) {
    if (stringArgs.length < 2) {
        throw new WrongUsageException("commands.streamsound.usage", new Object[0]);
    } else {
        int soundTargetX = 0;
        int soundTargetY = 0;
        int soundTargetZ = 0;

        EntityPlayerMP targetPlayer = getPlayer(commandSender, stringArgs[0]);
        if (targetPlayer == null) {
            throw new PlayerNotFoundException();
        }

        if (stringArgs.length == 2 || stringArgs.length == 3) {
            soundTargetX = (int) targetPlayer.posX;
            soundTargetY = (int) targetPlayer.posY;
            soundTargetZ = (int) targetPlayer.posZ;
        } else if (stringArgs.length == 5 || stringArgs.length == 6) {
            int indexOfPos = stringArgs.length - 3;
            soundTargetX = (int) parsePosition(commandSender, targetPlayer.posX, stringArgs[indexOfPos++]);
            soundTargetY = (int) parsePositionWithBounds(commandSender, targetPlayer.posY,
                    stringArgs[indexOfPos++], 0, 0);
            soundTargetZ = (int) parsePosition(commandSender, targetPlayer.posZ, stringArgs[indexOfPos++]);
        }

        int soundRange = stringArgs.length == 3 || stringArgs.length == 6 ? parseIntBounded(commandSender,
                stringArgs[2], 0, 120) : 60;

        //PZPacket packet = new PacketStreamSound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
        //        stringArgs[1]);
        //ProjectZulu_Core.getPipeline().sendToAllAround(packet,
        //        new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
        PZPacketStreamSound message = new PZPacketStreamSound().setPacketData(soundTargetX, soundTargetY, soundTargetZ,
                        stringArgs[1]);
        ProjectZulu_Core.packetHandler.sendToAllAround(message, 
                new TargetPoint(targetPlayer.dimension, soundTargetX, soundTargetY, soundTargetZ, soundRange));
    }
}
项目:Elemental-Sciences-2    文件:BlockES.java   
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
    if (canSendUpdatePacket() && world.getTileEntity(x, y, z) instanceof TileES)
        PacketDispatcher.sendToAllAround(new NeighbourChangedPacket(new CoordSet(x, y, z)), new TargetPoint(world.provider.dimensionId, x, y, z, 64));

    super.onNeighborBlockChange(world, x, y, z, block);
}