/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Set; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.util.BlockPos; import net.minecraft.world.World; public final class BuildCraftAPI { public static ICoreProxy proxy; public static final Set<Block> softBlocks = Sets.newHashSet(); public static final HashMap<String, IWorldProperty> worldProperties = Maps.newHashMap(); /** Deactivate constructor */ private BuildCraftAPI() {} public static String getVersion() { try { Class<?> clazz = Class.forName("buildcraft.core.Version"); Method method = clazz.getDeclaredMethod("getVersion"); return String.valueOf(method.invoke(null)); } catch (Exception e) { return "UNKNOWN VERSION"; } } public static IWorldProperty getWorldProperty(String name) { return worldProperties.get(name); } public static void registerWorldProperty(String name, IWorldProperty property) { if (worldProperties.containsKey(name)) { BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!"); } worldProperties.put(name, property); } public static boolean isSoftBlock(World world, BlockPos pos) { return worldProperties.get("soft").get(world, pos); } }