use of net.minecraft.resources.IReloadableResourceManager in project Structurize by ldtteam.
the class ClientLifecycleSubscriber method onClientInit.
/**
* Called when client app is initialized.
*
* @param event event
*/
@SubscribeEvent
public static void onClientInit(final FMLClientSetupEvent event) {
OptifineCompat.getInstance().intialize();
final IResourceManager rm = event.getMinecraftSupplier().get().getResourceManager();
if (rm instanceof IReloadableResourceManager) {
((IReloadableResourceManager) rm).registerReloadListener((ISelectiveResourceReloadListener) (resourceManager, resourcePredicate) -> {
if (resourcePredicate.test(VanillaResourceType.MODELS) || resourcePredicate.test(VanillaResourceType.TEXTURES) || resourcePredicate.test(VanillaResourceType.SHADERS)) {
Log.getLogger().debug("Clearing blueprint renderer cache.");
BlueprintHandler.getInstance().clearCache();
}
Log.getLogger().debug("Clearing gui XML cache.");
Loader.cleanParsedCache();
});
}
// final RenderType s = RenderType.getSolid();
// ModBlocks.blockSubstitution;
// ModBlocks.blockSolidSubstitution;
// ModBlocks.blockFluidSubstitution;
// ModBlocks.multiBlock;
// ModBlocks.blockDecoBarrel_onside;
// ModBlocks.blockDecoBarrel_standing;
// ModBlocks.paperWalls;
// ModBlocks.floatingCarpets;
// ModBlocks.timberFrames;
// ModBlocks.shingles;
// ModBlocks.shingleSlabs;
// final RenderType c = RenderType.getCutout();
// final RenderType cm = RenderType.getCutoutMipped();
final RenderType t = RenderType.translucent();
ModBlocks.getPaperWalls().forEach(frame -> RenderTypeLookup.setRenderLayer(frame, t));
// ModBlocks.CACTI_BLOCKS
// ModBlocks.BRICKS
DELAYED_RENDER_TYPE_SETUP.forEach(tu -> {
if (!tu.getB().equals(RenderType.solid())) {
RenderTypeLookup.setRenderLayer(tu.getA().get(), tu.getB());
}
});
DELAYED_RENDER_TYPE_SETUP.clear();
DELAYED_RENDER_TYPE_SETUP.trimToSize();
}
use of net.minecraft.resources.IReloadableResourceManager in project RGBBlocks by PlatinPython.
the class ClientUtils method registerVirtualPack.
private static void registerVirtualPack() {
Minecraft minecraft = Minecraft.getInstance();
minecraft.getResourcePackRepository().addPackFinder((infoConsumer, packInfo) -> infoConsumer.accept(new ResourcePackInfo("rgbblocks_textures", true, () -> VIRTUAL_PACK, new TranslationTextComponent("rgbblocks.pack_title"), new TranslationTextComponent("rgbblocks.pack_description"), PackCompatibility.COMPATIBLE, ResourcePackInfo.Priority.TOP, true, IPackNameDecorator.DEFAULT, true)));
IReloadableResourceManager resourceManager = (IReloadableResourceManager) minecraft.getResourceManager();
resourceManager.registerReloadListener(VIRTUAL_PACK);
}
use of net.minecraft.resources.IReloadableResourceManager in project Vampirism by TeamLapen.
the class ModEntitiesRender method registerEntityRenderer.
public static void registerEntityRenderer(Supplier<Minecraft> minecraftSupplier) {
RenderingRegistry.registerEntityRenderingHandler(ModEntities.blinding_bat, safeFactory(BatRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_creature_imob, safeFactory(ConvertedCreatureRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_creature, safeFactory(ConvertedCreatureRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_horse, renderingManager -> {
HorseRenderer renderer = new HorseRenderer(renderingManager);
renderer.addLayer(new VampireEntityLayer<>(renderer, new ResourceLocation(REFERENCE.MODID, "textures/entity/vanilla/horse_overlay.png"), false));
return renderer;
});
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_donkey, safeFactory(ConvertedChestedHorseRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_mule, safeFactory(ConvertedChestedHorseRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_sheep, safeFactory(ConvertedCreatureRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.converted_cow, safeFactory(ConvertedCreatureRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.hunter, safeFactory(BasicHunterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.hunter_imob, safeFactory(BasicHunterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.vampire, safeFactory(BasicVampireRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.vampire_imob, safeFactory(BasicVampireRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.hunter_trainer, e -> new HunterTrainerRenderer(e, true));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.vampire_baron, safeFactory(VampireBaronRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.advanced_hunter, safeFactory(AdvancedHunterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.advanced_hunter_imob, safeFactory(AdvancedHunterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.advanced_vampire, safeFactory(AdvancedVampireRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.advanced_vampire_imob, safeFactory(AdvancedVampireRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.villager_converted, safeFactory(ConvertedVillagerRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.villager_angry, (renderManager) -> new HunterVillagerRenderer(renderManager, (IReloadableResourceManager) minecraftSupplier.get().getResourceManager()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.crossbow_arrow, safeFactory(CrossbowArrowRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.particle_cloud, safeFactory(RenderAreaParticleCloud::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.throwable_item, manager -> new ThrowableItemRenderer(manager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.dark_blood_projectile, safeFactory(DarkBloodProjectileRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.soul_orb, manager -> new SoulOrbRenderer(manager, Minecraft.getInstance().getItemRenderer()));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.hunter_trainer_dummy, e -> new HunterTrainerRenderer(e, false));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.dummy_creature, safeFactory(DummyRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.vampire_minion, safeFactory(VampireMinionRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.hunter_minion, safeFactory(HunterMinionRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.task_master_vampire, safeFactory(VampireTaskMasterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.task_master_hunter, safeFactory(HunterTaskMasterRenderer::new));
RenderingRegistry.registerEntityRenderingHandler(ModEntities.dummy_sit_entity, safeFactory(DummyRenderer::new));
}
use of net.minecraft.resources.IReloadableResourceManager in project AstralSorcery by HellFirePvP.
the class ClientProxy method initialize.
@Override
public void initialize() {
this.clientScheduler = new ClientScheduler();
if (!AstralSorcery.isDoingDataGeneration()) {
IReloadableResourceManager resMgr = (IReloadableResourceManager) Minecraft.getInstance().getResourceManager();
resMgr.addReloadListener(AssetLibrary.INSTANCE);
resMgr.addReloadListener(AssetPreLoader.INSTANCE);
resMgr.addReloadListener(ColorizationHelper.onReload());
resMgr.addReloadListener((stage, resourceManager, preparationsProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> stage.markCompleteAwaitingOthers(Unit.INSTANCE).thenRunAsync(() -> {
if (!SelectiveReloadStateHandler.INSTANCE.get().test(VanillaResourceType.LANGUAGES)) {
return;
}
PerkTree.PERK_TREE.getPerkPoints(LogicalSide.CLIENT).stream().map(PerkTreePoint::getPerk).forEach(AbstractPerk::clearClientTextCaches);
}));
}
this.clientConfig = new ClientConfig();
super.initialize();
this.addTomeBookmarks();
RandomWordGenerator.init();
this.clientConfig.buildConfiguration();
}
use of net.minecraft.resources.IReloadableResourceManager in project Mekanism by mekanism.
the class ClientRegistration method createRobitTextureAtlas.
private static void createRobitTextureAtlas() {
// TODO - 1.18: Move registering the sprite uploader to RegisterClientReloadListenersEvent
Minecraft minecraft = Minecraft.getInstance();
RobitSpriteUploader spriteUploader = new RobitSpriteUploader(minecraft.getTextureManager());
IResourceManager resourceManager = minecraft.getResourceManager();
if (resourceManager instanceof IReloadableResourceManager) {
IReloadableResourceManager reloadableResourceManager = (IReloadableResourceManager) resourceManager;
reloadableResourceManager.registerReloadListener(spriteUploader);
}
}
Aggregations