Java 类net.minecraft.client.resources.IResourceManagerReloadListener 实例源码

项目:Factorization    文件:FlatMod.java   
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);
}
项目:JABBA    文件:ClientProxy.java   
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();
        }
    });
}
项目:BaseClient    文件:Client.java   
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);
}
项目:ExtraUtilities    文件:ExtraUtilsClient.java   
@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();
}
项目:CrystalMod    文件:BuiltinModelLoader.java   
@Override
public void onResourceManagerReload( IResourceManager resourceManager )
{
    for( IModel model : builtInModels.values() )
    {
        if( model instanceof IResourceManagerReloadListener )
        {
            ( (IResourceManagerReloadListener) model ).onResourceManagerReload( resourceManager );
        }
    }
}
项目:MiscUtils    文件:LocalizationUpdater.java   
@SideOnly(Side.CLIENT)
public void registerListener() {
    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() {
        @Override
        public void onResourceManagerReload(IResourceManager resourceManager) {
            LocalizationUpdater.this.loadLangFiles();
        }
    });
}
项目:D3Core    文件:LanguageHelper.java   
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);
        }
    });
}
项目:CosmeticArmor    文件:LocalizationUpdater.java   
@SideOnly(Side.CLIENT)
public void registerListener() {
    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() {
        @Override
        public void onResourceManagerReload(IResourceManager resourceManager) {
            LocalizationUpdater.this.loadLangFiles();
        }
    });
}
项目:Extra-Food    文件:OBJRender.java   
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();
            }
        });
    }
}
项目:Solar    文件:ClientProxy.java   
public static void registerResourceReloadListener(IResourceManagerReloadListener listener) {
    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager())
            .registerReloadListener(listener);
}
项目:ExtraUtilities    文件:TConTextureResourcePackBase.java   
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]);
}
项目:EnderCore    文件:RenderUtil.java   
public static void registerReloadListener(IResourceManagerReloadListener obj) {
  ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(obj);
}
项目:MCAnm    文件:ClientProxy.java   
@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"));
    }
}
项目:CodeChickenLib    文件:ResourceUtils.java   
/**
 * 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);
}