mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-06 15:51:50 +00:00
Continued work with moving NMS to a module
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.hibiscusmc.hmccosmetics.util;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ServerUtils {
|
||||
|
||||
@@ -22,19 +19,7 @@ public class ServerUtils {
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static org.bukkit.entity.Entity getEntity(int entityId) {
|
||||
net.minecraft.world.entity.Entity entity = getNMSEntity(entityId);
|
||||
if (entity == null) return null;
|
||||
return entity.getBukkitEntity();
|
||||
}
|
||||
@Nullable
|
||||
public static net.minecraft.world.entity.Entity getNMSEntity(int entityId) {
|
||||
for (ServerLevel world : ((CraftServer) Bukkit.getServer()).getHandle().getServer().getAllLevels()) {
|
||||
net.minecraft.world.entity.Entity entity = world.getEntity(entityId);
|
||||
if (entity == null) return null;
|
||||
return entity;
|
||||
}
|
||||
return null;
|
||||
return NMSHandlers.getHandler().getEntity(entityId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user