Skip to content

Commit

Permalink
Update rotation handling to use Rotation instead of Vector2f
Browse files Browse the repository at this point in the history
Replaced `Vector2f` with the new `Rotation` API in relevant methods and interfaces. This improves type clarity and aligns with the updated math utility framework. Changes include method signatures and implementations for better consistency.
  • Loading branch information
NonSwag committed Feb 11, 2025
1 parent 2ece2ac commit afb2d86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.papermc.paper.command.brigadier.argument.resolvers;

import io.papermc.paper.command.brigadier.CommandSourceStack;
import io.papermc.paper.math.Rotation;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Vector2f;

Expand All @@ -12,5 +13,5 @@
*/
@ApiStatus.Experimental
@ApiStatus.NonExtendable
public interface RotationResolver extends ArgumentResolver<Vector2f> {
public interface RotationResolver extends ArgumentResolver<Rotation> {
}
6 changes: 3 additions & 3 deletions paper-server/src/main/java/io/papermc/paper/util/MCUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import io.papermc.paper.math.Rotation;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.resources.ResourceKey;
Expand All @@ -29,7 +30,6 @@
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.craftbukkit.util.Waitable;
import org.joml.Vector2f;

public final class MCUtil {
public static final java.util.concurrent.Executor MAIN_EXECUTOR = (run) -> {
Expand Down Expand Up @@ -166,8 +166,8 @@ public static BlockPosition toPosition(Vec3i vector) {
return Position.block(vector.getX(), vector.getY(), vector.getZ());
}

public static Vector2f toRotation(Vec2 vector) {
return new Vector2f(vector.x, vector.y);
public static Rotation toRotation(Vec2 vector) {
return new RotationImpl(vector.y, vector.x);
}

public static Vec3 toVec3(Position position) {
Expand Down

0 comments on commit afb2d86

Please sign in to comment.