use of fr.neatmonster.nocheatplus.compat.blocks.init.vanilla.VanillaBlocksFactory in project NoCheatPlus by NoCheatPlus.
the class BlockProperties method init.
/**
* Initialize blocks and tools properties. This can be called at any time
* during runtime.
*
* @param mcAccess
* If mcAccess implements BlockPropertiesSetup,
* mcAccess.setupBlockProperties will be called directly after
* basic initialization but before the configuration is applied.
* @param worldConfigProvider
* the world config provider
*/
public static void init(final IHandle<MCAccess> mcAccess, final WorldConfigProvider<?> worldConfigProvider) {
wrapBlockCache = new WrapBlockCache();
rtRay = new PassableRayTracing();
rtAxis = new PassableAxisTracing();
pLoc = new PlayerLocation(mcAccess, null);
// getClass().getName() or some abstract.
final Set<String> blocksFeatures = new LinkedHashSet<String>();
try {
initTools(mcAccess, worldConfigProvider);
initBlocks(mcAccess, worldConfigProvider);
blocksFeatures.add("BlocksMC1_4");
// Extra hand picked setups.
try {
blocksFeatures.addAll(new VanillaBlocksFactory().setupVanillaBlocks(worldConfigProvider));
} catch (Throwable t) {
StaticLog.logSevere("Could not initialize vanilla blocks: " + t.getClass().getSimpleName() + " - " + t.getMessage());
StaticLog.logSevere(t);
}
// Allow mcAccess to setup block properties.
if (mcAccess instanceof BlockPropertiesSetup) {
try {
((BlockPropertiesSetup) mcAccess).setupBlockProperties(worldConfigProvider);
blocksFeatures.add(mcAccess.getClass().getSimpleName());
} catch (Throwable t) {
StaticLog.logSevere("McAccess.setupBlockProperties (" + mcAccess.getClass().getSimpleName() + ") could not execute properly: " + t.getClass().getSimpleName() + " - " + t.getMessage());
StaticLog.logSevere(t);
}
}
// TODO: Add registry for further BlockPropertiesSetup instances.
} catch (Throwable t) {
StaticLog.logSevere(t);
}
// Override feature tags for blocks.
NCPAPIProvider.getNoCheatPlusAPI().setFeatureTags("blocks", blocksFeatures);
}
Aggregations