2018-02-05 17:04:38 -08:00
|
|
|
package WayofTime.bloodmagic.api.impl;
|
2017-08-15 18:14:28 -07:00
|
|
|
|
2018-02-05 17:04:38 -08:00
|
|
|
import WayofTime.bloodmagic.apibutnotreally.altar.EnumAltarComponent;
|
|
|
|
import WayofTime.bloodmagic.api.IBloodMagicAPI;
|
2017-08-16 17:29:24 -07:00
|
|
|
import com.google.common.collect.ArrayListMultimap;
|
2017-08-15 18:14:28 -07:00
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
|
import com.google.common.collect.Maps;
|
2017-08-16 17:29:24 -07:00
|
|
|
import com.google.common.collect.Multimap;
|
2017-08-15 18:14:28 -07:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
2018-02-06 19:18:29 -08:00
|
|
|
import javax.annotation.Nonnull;
|
2017-08-16 17:29:24 -07:00
|
|
|
import java.util.*;
|
2017-08-15 18:14:28 -07:00
|
|
|
|
|
|
|
public class BloodMagicAPI implements IBloodMagicAPI {
|
|
|
|
|
|
|
|
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
|
|
|
|
|
|
|
|
private final BloodMagicBlacklist blacklist;
|
2018-02-06 19:18:29 -08:00
|
|
|
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
2017-08-15 18:14:28 -07:00
|
|
|
private final Map<ResourceLocation, Integer> sacrificialValues;
|
2017-08-16 17:29:24 -07:00
|
|
|
private final Multimap<EnumAltarComponent, IBlockState> altarComponents;
|
2017-08-15 18:14:28 -07:00
|
|
|
|
|
|
|
public BloodMagicAPI() {
|
|
|
|
this.blacklist = new BloodMagicBlacklist();
|
2018-02-06 19:18:29 -08:00
|
|
|
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
2017-08-15 18:14:28 -07:00
|
|
|
this.sacrificialValues = Maps.newHashMap();
|
2017-08-16 17:29:24 -07:00
|
|
|
this.altarComponents = ArrayListMultimap.create();
|
2017-08-15 18:14:28 -07:00
|
|
|
}
|
|
|
|
|
2018-02-06 19:18:29 -08:00
|
|
|
@Nonnull
|
2017-08-15 18:14:28 -07:00
|
|
|
@Override
|
|
|
|
public BloodMagicBlacklist getBlacklist() {
|
|
|
|
return blacklist;
|
|
|
|
}
|
|
|
|
|
2018-02-06 19:18:29 -08:00
|
|
|
@Nonnull
|
2017-08-15 18:14:28 -07:00
|
|
|
@Override
|
2018-02-06 19:18:29 -08:00
|
|
|
public BloodMagicRecipeRegistrar getRecipeRegistrar() {
|
|
|
|
return recipeRegistrar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setSacrificialValue(@Nonnull ResourceLocation entityId, int value) {
|
2017-08-15 18:14:28 -07:00
|
|
|
sacrificialValues.put(entityId, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-02-06 19:18:29 -08:00
|
|
|
public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) {
|
2017-08-15 18:14:28 -07:00
|
|
|
EnumAltarComponent component = EnumAltarComponent.NOTAIR;
|
|
|
|
for (EnumAltarComponent type : EnumAltarComponent.VALUES) {
|
|
|
|
if (type.name().equalsIgnoreCase(componentType)) {
|
|
|
|
component = type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 17:29:24 -07:00
|
|
|
altarComponents.put(component, state);
|
2017-08-15 18:14:28 -07:00
|
|
|
}
|
|
|
|
|
2018-02-06 19:18:29 -08:00
|
|
|
@Nonnull
|
2017-08-15 18:14:28 -07:00
|
|
|
public Map<ResourceLocation, Integer> getSacrificialValues() {
|
|
|
|
return ImmutableMap.copyOf(sacrificialValues);
|
|
|
|
}
|
|
|
|
|
2018-02-06 19:18:29 -08:00
|
|
|
@Nonnull
|
2017-08-16 17:29:24 -07:00
|
|
|
public List<IBlockState> getComponentStates(EnumAltarComponent component) {
|
|
|
|
return (List<IBlockState>) altarComponents.get(component);
|
2017-08-15 18:14:28 -07:00
|
|
|
}
|
|
|
|
}
|