net.minecraftforge.common.ForgeModContainer Java Examples

The following examples show how to use net.minecraftforge.common.ForgeModContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XrayMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public void onEnabled() {
  previousForgeLightPipelineEnabled = ForgeModContainer.forgeLightPipelineEnabled;
  ForgeModContainer.forgeLightPipelineEnabled = false;
  ForgeHaxHooks.COLOR_MULTIPLIER_ALPHA = (this.opacity.getAsFloat() / 255.f);
  ForgeHaxHooks.SHOULD_UPDATE_ALPHA = true;
  reloadChunks();
  ForgeHaxHooks.SHOULD_DISABLE_CAVE_CULLING.enable("Xray");
}
 
Example #2
Source File: XrayMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@Override
public void onDisabled() {
  ForgeModContainer.forgeLightPipelineEnabled = previousForgeLightPipelineEnabled;
  ForgeHaxHooks.SHOULD_UPDATE_ALPHA = false;
  reloadChunks();
  ForgeHaxHooks.SHOULD_DISABLE_CAVE_CULLING.disable("Xray");
}
 
Example #3
Source File: MixinModelManager.java    From VanillaFix with MIT License 4 votes vote down vote up
/**
 * @reason Don't set up the ModelLoader. Instead, set up the caching DynamicModelProvider
 * and DynamicBakedModelProviders, which will act as the model registry.
 */
@Overwrite
public void onResourceManagerReload(IResourceManager resourceManager) {
    // Generate information about model locations, such as the blockstate location to block map
    // and the item variant to model location map.
    ModelLocationInformation.init(modelProvider.getBlockStateMapper());

    // Get custom loaders
    Set<ICustomModelLoader> loaders;
    try {
        Field loadersField = ModelLoaderRegistry.class.getDeclaredField("loaders");
        loadersField.setAccessible(true);
        // noinspection unchecked
        loaders = (Set<ICustomModelLoader>) loadersField.get(null);
    } catch (ReflectiveOperationException e) {
        throw new RuntimeException(e);
    }

    // Create the dynamic model and bake model providers
    DynamicModelProvider dynamicModelProvider = new DynamicModelProvider(loaders);
    DynamicModelProvider.instance = dynamicModelProvider;
    DynamicBakedModelProvider dynamicBakedModelProvider = new DynamicBakedModelProvider(dynamicModelProvider);
    DynamicBakedModelProvider.instance = dynamicBakedModelProvider;
    modelRegistry = dynamicBakedModelProvider;

    // Create the texture map
    ((DynamicTextureMap) texMap).init();

    // Get the default model, returned by getModel when the model provider returns null
    defaultModel = modelRegistry.getObject(new ModelResourceLocation("builtin/missing", "missing"));

    // Register the universal bucket item
    if (FluidRegistry.isUniversalBucketEnabled()) {
        ModelLoader.setBucketModelDefinition(ForgeModContainer.getInstance().universalBucket);
    }

    // Post the event, but just log an error if a listener throws an exception. The ModelLoader is
    // null, but very few mods use it. Custom support will be needed for those that do.
    EventUtil.postEventAllowingErrors(new ModelBakeEvent((ModelManager) (Object) this, modelRegistry, null));

    // Make the model provider load blockstate to model information. See MixinBlockModelShapes
    modelProvider.reloadModels();
}
 
Example #4
Source File: Util.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
public static ItemStack getBucketStack(Fluid fluid)
{
    return UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid);
}
 
Example #5
Source File: VersionChecker.java    From LunatriusCore with MIT License 4 votes vote down vote up
public static boolean isAllowedToCheck(final String scope) {
    return ForgeModContainer.getConfig().get(ForgeModContainer.VERSION_CHECK_CAT, scope, true).getBoolean();
}