All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cat.nyaa.nyaacore.utils.EntityUtils Maven / Gradle / Ivy

There is a newer version: 3.12.2
Show newest version
package cat.nyaa.nyaacore.utils;


import net.minecraft.world.entity.EntityType;

import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;

public class EntityUtils {
    public static AtomicInteger FAKE_ENTITY_COUNTER = new AtomicInteger(0xffcc);

    private static Optional> getNmsEntityTypes(org.bukkit.entity.EntityType bukkitEntityType) {
        return EntityType.byString(bukkitEntityType.getKey().getKey());
    }

    public static int getUpdateInterval(org.bukkit.entity.EntityType bukkitEntityType) {
        return getNmsEntityTypes(bukkitEntityType).map(EntityType::updateInterval).orElse(3);
    }

    public static int getClientTrackingRange(org.bukkit.entity.EntityType bukkitEntityType) {
        return getNmsEntityTypes(bukkitEntityType).map(EntityType::clientTrackingRange).orElse(5);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy