public static void sendToAllAround(PacketBase message, World world, int x, int y, int z) { INSTANCE.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); INSTANCE.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new TargetPoint(world.provider.getDimension(), x, y, z, CoreProps.NETWORK_UPDATE_RANGE)); INSTANCE.channels.get(Side.SERVER).writeAndFlush(message); }
public static void sendToAllAround(PacketBase message, TileEntity theTile) { INSTANCE.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALLAROUNDPOINT); INSTANCE.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(new TargetPoint(theTile.getWorld().provider.getDimension(), theTile.getPos().getX(), theTile.getPos().getY(), theTile.getPos().getZ(), CoreProps.NETWORK_UPDATE_RANGE)); INSTANCE.channels.get(Side.SERVER).writeAndFlush(message); }
public final void sendRenderPacket(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Vec3d target = spell.getTargetWithFallback(); if (target != null) PacketHandler.NETWORK.sendToAllAround(new PacketRenderSpell(spell, spellRing), new NetworkRegistry.TargetPoint(spell.world.provider.getDimension(), target.x, target.y, target.z, 60)); }
public void sendEnergy(long energy) { markDirty(); this.lastEnergy = this.latestEnergy; this.latestEnergy = energy; if (!this.world.isRemote) Calculator.network.sendToAllAround(new PacketCalculatorScreen(pos, 1, energy), new TargetPoint(this.world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64)); }
public void sendMax(long max) { markDirty(); this.lastMax = this.latestMax; this.latestMax = max; if (!this.world.isRemote) Calculator.network.sendToAllAround(new PacketCalculatorScreen(pos, 0, max), new TargetPoint(this.world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64)); }
@Override public void onDeath(@Nonnull DamageSource cause) { super.onDeath(cause); if (getHealth() <= 0) PacketHandler.NETWORK.sendToAllAround(new PacketExplode(getPositionVector().add(0, 0.25, 0), color, color, 0.5, 0.5, RandUtil.nextInt(100, 200), 75, 25, true), new NetworkRegistry.TargetPoint(world.provider.getDimension(), posX, posY, posZ, 256)); }
private void sendMessage() { final MessageParticleEffect message = new MessageParticleEffect(world, EnumParticleTypes.REDSTONE, x, y, z); final NetworkRegistry.TargetPoint target = new NetworkRegistry.TargetPoint(world.provider.getDimension(), x, y, z, RANGE_LOW); Network.INSTANCE.getWrapper().sendToAllAround(message, target); if (areAnyPlayersNear(target)) { particlesSent++; } }
public static NetworkRegistry.TargetPoint asTarget(TileEntity te, double radius) { return new NetworkRegistry.TargetPoint( te.getWorld().provider.getDimension(), te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), radius ); }
public void pop() { if (!this.worldObj.isRemote) { NetworkRegistry.TargetPoint target = new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 80); NetworkHandler.channel.sendToAllAround(new MessageFX(posX, posY, posZ, MessageFX.FX.BUBBLE_POP), target); this.setDead(); } }
@Override protected void renderRay(Vec3d start, Vec3d end) { OMLibNetworkingHandler.INSTANCE.sendToAllAround( new MessageRenderRay(start, end, color, 3, true), new NetworkRegistry.TargetPoint(this.getWorld().provider.getDimension(), start.x, start.y, start.z, 120)); }
/** * Sends a message to everyone within a certain range of the coordinates in the same dimension. * See {@link SimpleNetworkWrapper#sendToAllAround(IMessage, NetworkRegistry.TargetPoint)} */ public final void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range) { sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range)); }
@Override protected void onContentsChanged(int slot) { markDirty(); if (!world.isRemote) { PacketHandler.NETWORK.sendToAllAround(new PacketUpdateCraftingPlateRenderer(pos, slot), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 256)); } }
public void tick(World world, BlockPos pos) { currentDuration++; if (currentDuration % 10 == 0) { PacketHandler.NETWORK.sendToAllAround(new PacketDevilDustFizzle(new Vec3d(pos).add(0.5, 0.5, 0.5), currentDuration), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 20)); world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.FRYING_SIZZLE, SoundCategory.BLOCKS, 0.7F, (float) RandUtil.nextDouble(0.8, 1.3)); } }
@Override protected void renderRay(Vec3d start, Vec3d end) { OMLibNetworkingHandler.INSTANCE.sendToAllAround( new MessageRenderRay(start, end, color, 5, true), new NetworkRegistry.TargetPoint(this.getWorld().provider.getDimension(), start.x, start.y, start.z, 120)); }
public static void playSoundFromServer(SoundEvent soundEvent, SoundCategory cat, BlockPos nextPos, int dim, int range) { //https://github.com/PrinceOfAmber/Cyclic/issues/506 if (soundEvent != null && soundEvent.getRegistryName() != null) // dont crash trying to play invalid sound ModCyclic.network.sendToAllAround(new PacketSound(nextPos, soundEvent, cat), new NetworkRegistry.TargetPoint(dim, nextPos.getX(), nextPos.getY(), nextPos.getZ(), range)); } }
public static void doLightningRender(long seed, World world, Vec3d from, Vec3d to, double offshootRange) { PacketHandler.NETWORK.sendToAllAround(new PacketRenderLightningBolt(seed, from, to, offshootRange), new NetworkRegistry.TargetPoint(world.provider.getDimension(), from.x, from.y, from.z, 256)); } }
/** * Sends a message to everyone within a certain range of the coordinates in the same dimension. */ private static void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range) { PacketDispatcher.sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range)); }
/** * Sends the message to everyone near a point. * * @param message The message to send. * @param world The world to send the message to. * @param pos The position to send the message to. * @param range The range of the message. */ public void sendToAllAround (IMessage message, World world, BlockPos pos, double range) { this.sendToAllAround(message, new TargetPoint(world.provider.getDimension(), pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, range)); }
final TargetPoint where = new TargetPoint( this.world.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 32 ); final IAEItemStack item = AEItemStack.fromItemStack( output ); NetworkHandler.instance().sendToAllAround( new PacketAssemblerAnimation( this.pos, (byte) speed, item ), where );
public void spawnParticle(Particles particleType, World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, int... data) { // 32*32 = 1024 = vanilla particle range NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.getDimension(), x, y, z, 32); AbstractPacket packet = new SpawnParticlePacket(particleType, x, y, z, xSpeed, ySpeed, zSpeed, data); TinkerNetwork.sendToAllAround(packet, point); }