public void sendPacketAround(Entity entity, double range, FMLProxyPacket packet){ channels.get(packet.channel()).sendToAllAround(packet, new NetworkRegistry.TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, range)); }
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha){ if(!world.isRemote){ NBTTagCompound data = new NBTTagCompound(); data.setDouble("StartX", startX); data.setDouble("StartY", startY); data.setDouble("StartZ", startZ); data.setDouble("EndX", endX); data.setDouble("EndY", endY); data.setDouble("EndZ", endZ); data.setFloat("Color1", color[0]); data.setFloat("Color2", color[1]); data.setFloat("Color3", color[2]); data.setDouble("RotationTime", rotationTime); data.setFloat("Size", size); data.setInteger("MaxAge", maxAge); data.setFloat("Alpha", alpha); PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.LASER_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96)); } }
@SubscribeEvent public void onEntityDamage(LivingAttackEvent event) { if (!ModConfig.general.cowJarEnabled) { return; } if (event.getSource() == DamageSource.ANVIL && isCow(event.getEntityLiving())) { BlockPos pos = event.getEntity().getPosition().down(); IBlockState blockBelow = event.getEntity().getEntityWorld().getBlockState(pos); if (blockBelow.getBlock() == ModBlocks.milkJar) { event.getEntity().getEntityWorld().setBlockState(pos, ModBlocks.cowJar.getDefaultState()); } NetworkHandler.instance.sendToAllAround(new MessageSyncedEffect(pos, MessageSyncedEffect.Type.COW_IN_A_JAR), new NetworkRegistry.TargetPoint(event.getEntity().world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32)); event.getEntity().setDead(); event.setCanceled(true); } }
/** * Called when the projectile entity hits another block or entity, or reaches the end of its path. * * @param data The {@link SpellData} attached to the spell. */ protected void goBoom(SpellRing spellRing, SpellData data) { motionX = 0; motionY = 0; motionZ = 0; if (spellRing.getChildRing() != null) spellRing.getChildRing().runSpellRing(data); if (doesRender()) PacketHandler.NETWORK.sendToAllAround(new PacketExplode(getPositionVector(), spellRing.getPrimaryColor(), spellRing.getSecondaryColor(), 0.3, 0.3, RandUtil.nextInt(30, 50), 10, 25, true), new NetworkRegistry.TargetPoint(world.provider.getDimension(), posX, posY, posZ, 512)); setDead(); world.removeEntity(this); }
@Override protected void onImpact(RayTraceResult rayTraceResult) { if (rayTraceResult.entityHit != null) { rayTraceResult.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 0.0F); } if (!worldObj.isRemote) { NetworkRegistry.TargetPoint target = new NetworkRegistry.TargetPoint(dimension, posX, posY, posZ, 80); NetworkHandler.channel.sendToAllAround(new MessageFX(posX, posY, posZ, MessageFX.FX.PLASTIC_EGG_BREAK), target); setDead(); } } }
@Override public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileFridge && !((TileFridge) tileEntity).getBaseFridge().hasPreservationUpgrade()) { if (!player.capabilities.isCreativeMode) { player.getHeldItem(hand).shrink(1); } ((TileFridge) tileEntity).getBaseFridge().setHasPreservationUpgrade(true); if (!world.isRemote) { NetworkHandler.instance.sendToAllAround(new MessageSyncedEffect(pos, MessageSyncedEffect.Type.FRIDGE_UPGRADE), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32)); } return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }
@Override public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileOven && !((TileOven) tileEntity).hasPowerUpgrade()) { if (!player.capabilities.isCreativeMode) { player.getHeldItem(hand).shrink(1); } ((TileOven) tileEntity).setHasPowerUpgrade(true); if (!world.isRemote) { NetworkHandler.instance.sendToAllAround(new MessageSyncedEffect(pos, MessageSyncedEffect.Type.OVEN_UPGRADE), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32)); } return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }
@Override public void onUpdate() { super.onUpdate(); if (!getEntityWorld().isRemote) { if (ticksExisted > 20) setDead(); if (ticksExisted == 1) { if (getFlameType() == 0) Erebus.NETWORK_WRAPPER.sendToAllAround((new PacketParticle(ParticleType.GAS_VENT_SWAMP, (float) posX, (float)posY, (float)posZ)), new TargetPoint(this.dimension, (double) posX, (double)posY, (double)posZ, 16D)); if (getFlameType() == 1) Erebus.NETWORK_WRAPPER.sendToAllAround((new PacketParticle(ParticleType.GAS_VENT_VOLCANIC, (float) posX, (float)posY, (float)posZ)), new TargetPoint(this.dimension, (double) posX, (double)posY, (double)posZ, 16D)); } } }
public void sendToAllAround(IMessage message, int dimension, double x, double y, double z, double range) { dispatcher.sendToAllAround(message, new NetworkRegistry.TargetPoint(dimension, x, y, z, range)); }
public TargetPoint getDimCoords() { return new TargetPoint(dimension, blockPos.getX(), blockPos.getY(), blockPos.getZ(), 0); }
@Override public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileFridge && !((TileFridge) tileEntity).getBaseFridge().hasIceUpgrade) { if (!player.capabilities.isCreativeMode) { player.getHeldItem(hand).shrink(1); } ((TileFridge) tileEntity).getBaseFridge().setHasIceUpgrade(true); if (!world.isRemote) { NetworkHandler.instance.sendToAllAround(new MessageSyncedEffect(pos, MessageSyncedEffect.Type.FRIDGE_UPGRADE), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32)); } return EnumActionResult.SUCCESS; } return EnumActionResult.PASS; }
public static NetworkRegistry.TargetPoint getTargetPoint(final World world, final double x, final double y, final double z, final int range) { return new NetworkRegistry.TargetPoint(world.provider.getDimension(), x, y, z, range); }
public void sendToAllAround(IMessage packet, int dim, double x, double y, double z, int distance) { INSTANCE.sendToAllAround(packet, new TargetPoint(dim, x, y, z, distance)); }
public void UpdateClientPower() { MatterOverdrive.NETWORK.sendToAllAround(new PacketPowerUpdate(this), new NetworkRegistry.TargetPoint(world.provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), ENERGY_CLIENT_SYNC_RANGE)); }
public TargetPoint getDimCoords() { return new TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0); }
public static void sendToAllAround(IMessage message, TileEntity te, int range) { INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(te.getWorld().provider.getDimension(), te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), range)); }
public static void spawnParticlePacket(EnumParticleTypes particle, int dimension, double x, double y, double z) { ModCyclic.network.sendToAllAround(new PacketParticleAtPosition(new BlockPos(x, y, z), particle.getParticleID(), count), new TargetPoint(dimension, x, y, z, RANGE)); } }
public void sendToAllAround(IMessage message, TileEntity tileEntity, double range) { dispatcher.sendToAllAround(message, new NetworkRegistry.TargetPoint(tileEntity.getWorld().provider.getDimension(), tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ(), range)); }
public void sendToAllAround(IMessage message, EntityPlayer player, double range) { dispatcher.sendToAllAround(message, new NetworkRegistry.TargetPoint(player.world.provider.getDimension(), player.posX, player.posY, player.posZ, range)); }
/** * Sends a message to everyone within a certain range of the coordinates in the same dimension. * Shortcut to {@link SimpleNetworkWrapper#sendToAllAround(IMessage, NetworkRegistry.TargetPoint)} */ public static final 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)); }