diff options
author | Jake Potrebic <[email protected]> | 2023-06-27 14:46:27 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-06-27 14:46:27 -0700 |
commit | e4b40ddc22bbf101b8edb636ed28430c99736a3b (patch) | |
tree | 634cd00167066956595ac94c925dba60f620ac92 | |
parent | 8582999344a22ce0e04e89ed1fb199aca09f3358 (diff) | |
download | Paper-e4b40ddc22bbf101b8edb636ed28430c99736a3b.tar.gz Paper-e4b40ddc22bbf101b8edb636ed28430c99736a3b.zip |
Fix entity selectors while spectating (#9402)
-rw-r--r-- | patches/server/0753-Fix-entity-type-tags-suggestions-in-selectors.patch | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/patches/server/0753-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/0753-Fix-entity-type-tags-suggestions-in-selectors.patch index 913bb30928..0eceb810df 100644 --- a/patches/server/0753-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/0753-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -10,7 +10,7 @@ when if this was fixed on the client, that wouldn't be needed. Mojira Issue: https://bugs.mojang.com/browse/MC-235045 diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 308b3a36f063c401a447f9b7f0364700eee5a54c..22884a2b148b9a5af8655bb754ebe73618218a83 100644 +index 308b3a36f063c401a447f9b7f0364700eee5a54c..43c71d9bf2eac98023057b4483fdd143a8343e98 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -441,4 +441,20 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy @@ -21,13 +21,13 @@ index 308b3a36f063c401a447f9b7f0364700eee5a54c..22884a2b148b9a5af8655bb754ebe736 + @Override + public Collection<String> getSelectedEntities() { + if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) { -+ double pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 5.0F : 4.5F; -+ Vec3 min = player.getEyePosition(1.0F); -+ Vec3 viewVector = player.getViewVector(1.0F); -+ Vec3 max = min.add(viewVector.x * pickDistance, viewVector.y * pickDistance, viewVector.z * pickDistance); -+ net.minecraft.world.phys.AABB aabb = player.getBoundingBox().expandTowards(viewVector.scale(pickDistance)).inflate(1.0D, 1.0D, 1.0D); -+ pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 6.0F : pickDistance; -+ net.minecraft.world.phys.EntityHitResult hitResult = net.minecraft.world.entity.projectile.ProjectileUtil.getEntityHitResult(player, min, max, aabb, (e) -> !e.isSpectator() && e.isPickable(), pickDistance); ++ final Entity cameraEntity = player.getCamera(); ++ final double pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 6.0F : 4.5F; ++ final Vec3 min = cameraEntity.getEyePosition(1.0F); ++ final Vec3 viewVector = cameraEntity.getViewVector(1.0F); ++ final Vec3 max = min.add(viewVector.x * pickDistance, viewVector.y * pickDistance, viewVector.z * pickDistance); ++ final net.minecraft.world.phys.AABB aabb = cameraEntity.getBoundingBox().expandTowards(viewVector.scale(pickDistance)).inflate(1.0D, 1.0D, 1.0D); ++ final net.minecraft.world.phys.EntityHitResult hitResult = net.minecraft.world.entity.projectile.ProjectileUtil.getEntityHitResult(cameraEntity, min, max, aabb, (e) -> !e.isSpectator() && e.isPickable(), pickDistance * pickDistance); + return hitResult != null ? java.util.Collections.singletonList(hitResult.getEntity().getStringUUID()) : SharedSuggestionProvider.super.getSelectedEntities(); + } + return SharedSuggestionProvider.super.getSelectedEntities(); |