feat: SpigotConversionUtil#getEntityMetadata is now part of the API
This commit is contained in:
1 parent
59596653a2
commit
8eff09ff6e
1 file changed
+16
@@ -20,6 +20,7 @@ package io.github.retrooper.packetevents.util;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
|
||||
@@ -41,10 +42,13 @@ import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.mappings.SimpleTypesBuilderData;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.bukkit.inventory.MainHand;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SpigotConversionUtil {
|
||||
public static Location fromBukkitLocation(org.bukkit.Location location) {
|
||||
return new Location(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
@@ -233,4 +237,16 @@ public class SpigotConversionUtil {
|
||||
public static MainHand toBukkitHand(HumanoidArm arm) {
|
||||
return MainHand.values()[arm.ordinal()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the metadata of a given Bukkit {@link org.bukkit.entity.Entity},
|
||||
* returned as a list of {@link com.github.retrooper.packetevents.protocol.entity.data.EntityData}
|
||||
* compatible with PacketEvents.
|
||||
*
|
||||
* @param entity the Bukkit entity to extract metadata from
|
||||
* @return a list of the entity's metadata values
|
||||
*/
|
||||
public static List<EntityData<?>> getEntityMetadata(Entity entity) {
|
||||
return SpigotReflectionUtil.getEntityMetadata(entity);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user