Commits

Parker Hawke authored and md_5 committed e938d62afac
#819: Allow Player#sendBlockDamage() to specify a source entity
No tags

src/main/java/org/bukkit/entity/Player.java

Modified
535 535 * responsibility of the caller to ensure that the client is within range
536 536 * of the changed blocks or to handle any side effects caused as a result.
537 537 *
538 538 * @param blocks the block states to send to the player
539 539 * @param suppressLightUpdates whether or not light updates should be
540 540 * suppressed when updating the blocks on the client
541 541 */
542 542 public void sendBlockChanges(@NotNull Collection<BlockState> blocks, boolean suppressLightUpdates);
543 543
544 544 /**
545 - * Send block damage. This fakes block break progress for a user at a
546 - * certain location. This will not actually change the block's break
545 + * Send block damage. This fakes block break progress at a certain location
546 + * sourced by this player. This will not actually change the block's break
547 547 * progress in any way.
548 548 *
549 549 * @param loc the location of the damaged block
550 550 * @param progress the progress from 0.0 - 1.0 where 0 is no damage and
551 551 * 1.0 is the most damaged
552 552 */
553 553 public void sendBlockDamage(@NotNull Location loc, float progress);
554 554
555 + /**
556 + * Send block damage. This fakes block break progress at a certain location
557 + * sourced by the provided entity. This will not actually change the block's
558 + * break progress in any way.
559 + * <p>
560 + * At the same location for each unique damage source sent to the player, a
561 + * separate damage overlay will be displayed with the given progress. This allows
562 + * for block damage at different progress from multiple entities at once.
563 + *
564 + * @param loc the location of the damaged block
565 + * @param progress the progress from 0.0 - 1.0 where 0 is no damage and
566 + * 1.0 is the most damaged
567 + * @param source the entity to which the damage belongs
568 + */
569 + public void sendBlockDamage(@NotNull Location loc, float progress, @NotNull Entity source);
570 +
571 + /**
572 + * Send block damage. This fakes block break progress at a certain location
573 + * sourced by the provided entity id. This will not actually change the block's
574 + * break progress in any way.
575 + * <p>
576 + * At the same location for each unique damage source sent to the player, a
577 + * separate damage overlay will be displayed with the given progress. This allows
578 + * for block damage at different progress from multiple entities at once.
579 + *
580 + * @param loc the location of the damaged block
581 + * @param progress the progress from 0.0 - 1.0 where 0 is no damage and
582 + * 1.0 is the most damaged
583 + * @param sourceId the entity id of the entity to which the damage belongs.
584 + * Can be an id that does not associate directly with an existing or loaded entity.
585 + */
586 + public void sendBlockDamage(@NotNull Location loc, float progress, int sourceId);
587 +
555 588 /**
556 589 * Send an equipment change for the target entity. This will not
557 590 * actually change the entity's equipment in any way.
558 591 *
559 592 * @param entity the entity whose equipment to change
560 593 * @param slot the slot to change
561 594 * @param item the item to which the slot should be changed, or null to set
562 595 * it to air
563 596 */
564 597 public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @Nullable ItemStack item);

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut