private void redrawWhenSettingsChange() { IResourceManagerReloadListener redrawFlats = new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager resourceManager) { if (mc.theWorld == null) return; IChunkProvider cp = mc.theWorld.getChunkProvider(); if (cp instanceof ChunkProviderClient) { ChunkProviderClient cpc = (ChunkProviderClient) cp; for (Chunk chunk : cpc.chunkListing) { FlatChunkLayer fcl = ((IExtraChunkData) chunk).getFlatLayer(); fcl.renderInfo.markDirty(null); } } } }; ((SimpleReloadableResourceManager) mc.getResourceManager()).registerReloadListener(redrawFlats); }
public void postInit() { ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { private boolean ranOnce = false; public void onResourceManagerReload(IResourceManager resourcemanager) { if (!this.ranOnce) { this.ranOnce = true; return; } StructuralLevelClientData.loadBaseTextureData(); if (StructuralLevel.LEVELS != null) { for (StructuralLevel level : StructuralLevel.LEVELS) { if (level.levelNum != 0) { level.clientData.generateIcons(); StringTranslate.inject(new ByteArrayInputStream(("item.upgrade.structural." + String.valueOf(level.levelNum) + ".name=" + StatCollector.translateToLocal("item.upgrade.structural") + " " + Utils.romanNumeral(level.levelNum) + " (" + level.clientData.getMaterialName() + ")").getBytes())); } } } StructuralLevelClientData.unloadBaseTextureData(); } }); }
private static void configureFont() { Minecraft mc = Minecraft.getMinecraft(); font = new FontRenderer(mc.gameSettings, new ResourceLocation(NAME.toLowerCase() + "/font/ascii.png"), mc.renderEngine, false); if (mc.gameSettings.language != null) { mc.fontRendererObj.setUnicodeFlag(mc.isUnicode()); mc.fontRendererObj.setBidiFlag(mc.mcLanguageManager.isCurrentLanguageBidirectional()); } mc.mcResourceManager.registerReloadListener((IResourceManagerReloadListener)font); }
@Override public void registerEventHandler() { MinecraftForge.EVENT_BUS.register((Object)new EventHandlerClient()); FMLCommonHandler.instance().bus().register((Object)new EventHandlerClient()); ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener((IResourceManagerReloadListener)new LiquidColorRegistry()); ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener((IResourceManagerReloadListener)new ParticleHelperClient()); ExtraUtils.handlesClientMethods = true; if (Loader.isModLoaded("ForgeMultipart")) { RenderBlockConnectedTextures.fakeRender = new FakeRenderBlocksMultiPart(); } ClientCommandHandler.instance.registerCommand((ICommand)new CommandHologram()); ClientCommandHandler.instance.registerCommand((ICommand)new CommandUUID()); KeyHandler.INSTANCE.register(); super.registerEventHandler(); }
@Override public void onResourceManagerReload( IResourceManager resourceManager ) { for( IModel model : builtInModels.values() ) { if( model instanceof IResourceManagerReloadListener ) { ( (IResourceManagerReloadListener) model ).onResourceManagerReload( resourceManager ); } } }
@SideOnly(Side.CLIENT) public void registerListener() { ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager resourceManager) { LocalizationUpdater.this.loadLangFiles(); } }); }
public static void run() { //noinspection NullableProblems ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager resourceManager) { D3LanguageInjectEvent event = new D3LanguageInjectEvent(); MinecraftForge.EVENT_BUS.post(event); LanguageMap.replaceWith(event.map); } }); }
public static void init() { IResourceManager rm = Minecraft.getMinecraft().getResourceManager(); if (rm instanceof IReloadableResourceManager) { ((IReloadableResourceManager) rm).registerReloadListener(new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager ignored) { loadedModels.clear(); } }); } }
public static void registerResourceReloadListener(IResourceManagerReloadListener listener) { ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) .registerReloadListener(listener); }
public void register() { final List<IResourcePack> packs = this.getiResourcePacks(); packs.add((IResourcePack)this); ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener((IResourceManagerReloadListener)this); LogHelper.info("Registered TCon Resource Pack (" + this.name + ") - " + this.getClass().getSimpleName(), new Object[0]); }
public static void registerReloadListener(IResourceManagerReloadListener obj) { ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(obj); }
@Override public void preInit() { ModelLoaderRegistry.registerLoader(ModelLoader.INSTANCE); IResourceManager resManager = Minecraft.getMinecraft().getResourceManager(); if (resManager instanceof IReloadableResourceManager) { IReloadableResourceManager registry = (IReloadableResourceManager) resManager; registry.registerReloadListener(new IResourceManagerReloadListener() { @Override public void onResourceManagerReload(IResourceManager p_110549_1_) { ClientProxy.reload(); } }); } else { MCAnm.logger() .warn("Couldn't register reload managers. Models will not be reloaded on switching resource pack"); } if (MCAnm.isDebug) { ResourceLocation modelSrc = new ResourceLocation("mcanm:models/Cube/Cube.mcmd"); @SuppressWarnings("deprecation") ISkeleton skeleton = CommonLoader.loadLegacySkeleton(modelSrc); IModel model = ClientLoader.loadModel(modelSrc, skeleton); IRenderFactory<CubeEntity> renderer = RenderAnimatedModel.fromModel(model, 1.0f); ResourceLocation model2Src = new ResourceLocation("mcanm:models/CubeV2/Cube.mcmd"); IModel model2 = ClientLoader.loadModel(model2Src, ISkeleton.EMPTY); IRenderFactory<CubeEntityV2> renderer2 = RenderAnimatedModel .fromModel(makeAnimator("mcanm:textures/models/Cube/Untitled.png"), model2, 1.0f); RenderingRegistry.registerEntityRenderingHandler(CubeEntity.class, renderer); RenderingRegistry.registerEntityRenderingHandler(CubeEntityV2.class, renderer2); Item debug = new Item(); debug.addPropertyOverride(new ResourceLocation("test"), new IItemPropertyGetter() { @Override public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { return (entityIn.ticksExisted / 100f) % 1f; } }); GameRegistry.register(debug.setFull3D().setRegistryName("debug_item")); net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation( debug, 0, new ModelResourceLocation("mcanm:models/item/debug_item.mcmdl#inventory")); } }
/** * Registers a IResourceManagerReloadListener to MC's resource manager. * * @param reloadListener The listener. */ public static void registerReloadListener(IResourceManagerReloadListener reloadListener) { //If this crashes people need to stop using reflection.. getResourceManager().registerReloadListener(reloadListener); }