New recipe registration API
This commit is contained in:
parent
59f171ca5b
commit
d67ed054ff
9 changed files with 493 additions and 4 deletions
|
@ -9,6 +9,7 @@ import com.google.common.collect.Multimap;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.*;
|
||||
|
||||
public class BloodMagicAPI implements IBloodMagicAPI {
|
||||
|
@ -16,27 +17,36 @@ public class BloodMagicAPI implements IBloodMagicAPI {
|
|||
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
|
||||
|
||||
private final BloodMagicBlacklist blacklist;
|
||||
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
||||
private final Map<ResourceLocation, Integer> sacrificialValues;
|
||||
private final Multimap<EnumAltarComponent, IBlockState> altarComponents;
|
||||
|
||||
public BloodMagicAPI() {
|
||||
this.blacklist = new BloodMagicBlacklist();
|
||||
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
||||
this.sacrificialValues = Maps.newHashMap();
|
||||
this.altarComponents = ArrayListMultimap.create();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicBlacklist getBlacklist() {
|
||||
return blacklist;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public void setSacrificialValue(ResourceLocation entityId, int value) {
|
||||
public BloodMagicRecipeRegistrar getRecipeRegistrar() {
|
||||
return recipeRegistrar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSacrificialValue(@Nonnull ResourceLocation entityId, int value) {
|
||||
sacrificialValues.put(entityId, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAltarComponent(IBlockState state, String componentType) {
|
||||
public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) {
|
||||
EnumAltarComponent component = EnumAltarComponent.NOTAIR;
|
||||
for (EnumAltarComponent type : EnumAltarComponent.VALUES) {
|
||||
if (type.name().equalsIgnoreCase(componentType)) {
|
||||
|
@ -48,10 +58,12 @@ public class BloodMagicAPI implements IBloodMagicAPI {
|
|||
altarComponents.put(component, state);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Map<ResourceLocation, Integer> getSacrificialValues() {
|
||||
return ImmutableMap.copyOf(sacrificialValues);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public List<IBlockState> getComponentStates(EnumAltarComponent component) {
|
||||
return (List<IBlockState>) altarComponents.get(component);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue