NaturesAura/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java

55 lines
1.4 KiB
Java
Raw Normal View History

package de.ellpeck.naturesaura.api.aura.type;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.util.ResourceLocation;
2020-01-21 21:04:44 +01:00
import net.minecraft.world.IWorld;
2019-10-20 22:30:49 +02:00
import net.minecraft.world.dimension.DimensionType;
import java.util.HashSet;
import java.util.Set;
public class BasicAuraType implements IAuraType {
private final ResourceLocation name;
private final int color;
private final int priority;
private final Set<ResourceLocation> dimensions = new HashSet<>();
public BasicAuraType(ResourceLocation name, DimensionType dimension, int color, int priority) {
this.name = name;
this.color = color;
this.priority = priority;
if (dimension != null)
this.dimensions.add(dimension.getRegistryName());
}
public BasicAuraType register() {
NaturesAuraAPI.AURA_TYPES.put(this.name, this);
return this;
}
@Override
public ResourceLocation getName() {
return this.name;
}
@Override
2020-01-21 21:04:44 +01:00
public boolean isPresentInWorld(IWorld world) {
return this.dimensions.isEmpty() || this.dimensions.contains(world.getDimension().getType().getRegistryName());
}
@Override
public int getColor() {
return this.color;
}
@Override
public int getPriority() {
return this.priority;
}
public void addDimensionType(ResourceLocation typeName) {
this.dimensions.add(typeName);
}
}