2018-11-12 01:29:33 +01:00
|
|
|
package de.ellpeck.naturesaura.api.aura.type;
|
|
|
|
|
|
|
|
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
2020-09-22 03:17:02 +02:00
|
|
|
import net.minecraft.util.RegistryKey;
|
2018-11-12 01:29:33 +01:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2020-01-21 21:04:44 +01:00
|
|
|
import net.minecraft.world.IWorld;
|
2020-09-22 03:17:02 +02:00
|
|
|
import net.minecraft.world.World;
|
2018-11-12 01:29:33 +01:00
|
|
|
|
2018-12-02 13:49:20 +01:00
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2018-11-12 01:29:33 +01:00
|
|
|
public class BasicAuraType implements IAuraType {
|
|
|
|
|
|
|
|
private final ResourceLocation name;
|
|
|
|
private final int color;
|
2018-12-02 13:49:20 +01:00
|
|
|
private final int priority;
|
2020-09-22 15:19:14 +02:00
|
|
|
private final Set<ResourceLocation> dimensions = new HashSet<>();
|
2018-11-12 01:29:33 +01:00
|
|
|
|
2020-09-22 03:17:02 +02:00
|
|
|
public BasicAuraType(ResourceLocation name, RegistryKey<World> dimension, int color, int priority) {
|
2018-11-12 01:29:33 +01:00
|
|
|
this.name = name;
|
|
|
|
this.color = color;
|
2018-12-02 13:49:20 +01:00
|
|
|
this.priority = priority;
|
|
|
|
if (dimension != null)
|
2020-09-22 15:19:14 +02:00
|
|
|
this.dimensions.add(dimension.func_240901_a_());
|
2018-11-12 01:29:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
2020-09-22 15:19:14 +02:00
|
|
|
return this.dimensions.isEmpty() || this.dimensions.contains(((World) world).func_234923_W_().func_240901_a_());
|
2018-11-12 01:29:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-11-12 01:35:02 +01:00
|
|
|
public int getColor() {
|
2018-11-12 01:29:33 +01:00
|
|
|
return this.color;
|
|
|
|
}
|
2018-12-02 13:49:20 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getPriority() {
|
|
|
|
return this.priority;
|
|
|
|
}
|
|
|
|
|
2020-09-22 15:19:14 +02:00
|
|
|
public void addDimensionType(ResourceLocation type) {
|
2020-09-22 03:17:02 +02:00
|
|
|
this.dimensions.add(type);
|
2018-12-02 13:49:20 +01:00
|
|
|
}
|
2018-11-12 01:29:33 +01:00
|
|
|
}
|