use of net.minecraft.util.InclusiveRange in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelperImpl method setSpawnerCustomRules.
@Override
public void setSpawnerCustomRules(CreatureSpawner spawner, int skyMin, int skyMax, int blockMin, int blockMax) {
try {
CraftCreatureSpawner bukkitSpawner = (CraftCreatureSpawner) spawner;
SpawnerBlockEntity nmsSnapshot = (SpawnerBlockEntity) craftBlockEntityState_snapshot.get(bukkitSpawner);
BaseSpawner nmsSpawner = nmsSnapshot.getSpawner();
SpawnData toSpawn = nmsSpawner.nextSpawnData;
SpawnData.CustomSpawnRules rules = skyMin == -1 ? null : new SpawnData.CustomSpawnRules(new InclusiveRange<>(skyMin, skyMax), new InclusiveRange<>(blockMin, blockMax));
nmsSpawner.nextSpawnData = new SpawnData(toSpawn.entityToSpawn(), Optional.ofNullable(rules));
nmsSpawner.spawnPotentials = SimpleWeightedRandomList.empty();
} catch (Throwable ex) {
Debug.echoError(ex);
}
}
Aggregations