net.minecraft.client.resources.IResourceManager Java Examples
The following examples show how to use
net.minecraft.client.resources.IResourceManager.
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: HarvesterAnimationStateMachine.java From EmergingTechnology with MIT License | 6 votes |
/** * Load a new instance of HarvesterAnimationStateMachine at specified location, * with specified custom parameters. */ @SideOnly(Side.CLIENT) public static HarvesterAnimationStateMachine load(IResourceManager manager, ResourceLocation location, ImmutableMap<String, ITimeValue> customParameters) { try (IResource resource = manager.getResource(location)) { ClipResolver clipResolver = new ClipResolver(); ParameterResolver parameterResolver = new ParameterResolver(customParameters); Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(clipResolver); TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(parameterResolver); HarvesterAnimationStateMachine asm = asmGson.fromJson( new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), HarvesterAnimationStateMachine.class); clipResolver.asm = asm; parameterResolver.asm = asm; asm.initialize(); return asm; } catch (IOException | JsonParseException e) { FMLLog.log.error("Exception loading Animation State Machine {}, skipping", location, e); return missing; } finally { Clips.CommonClipTypeAdapterFactory.INSTANCE.setClipResolver(null); TimeValues.CommonTimeValueTypeAdapterFactory.INSTANCE.setValueResolver(null); } }
Example #2
Source File: NewThreadDownloadImageData.java From Et-Futurum with The Unlicense | 6 votes |
@Override public void loadTexture(IResourceManager p_110551_1_) throws IOException { if (bufferedImage == null && textureLocation != null) super.loadTexture(p_110551_1_); if (imageThread == null) if (field_152434_e != null && field_152434_e.isFile()) { logger.debug("Loading http texture from local cache ({})", new Object[] { field_152434_e }); try { bufferedImage = ImageIO.read(field_152434_e); if (imageBuffer != null) setBufferedImage(imageBuffer.parseUserSkin(bufferedImage)); } catch (IOException ioexception) { logger.error("Couldn\'t load skin " + field_152434_e, ioexception); func_152433_a(); } } else func_152433_a(); }
Example #3
Source File: BaseTexture.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
protected BufferedImage loadImage(IResourceManager resourceManager, ResourceLocation location) throws IOException { InputStream inputstream = null; try { IResource iresource = resourceManager.getResource(location); inputstream = iresource.getInputStream(); return ImageIO.read(inputstream); } finally { if (inputstream != null) { inputstream.close(); } } }
Example #4
Source File: TextureDynamic.java From ExNihiloAdscensio with MIT License | 6 votes |
private BufferedImage tryLoadImage(IResourceManager manager, ResourceLocation location) { try { IResource res = manager.getResource(location); BufferedImage imgOutput = ImageIO.read(res.getInputStream()); return imgOutput; } catch (Exception e) { //ExNihilo.log.error("Failed to load image: " + location.toString()); return null; } }
Example #5
Source File: HitboxManager.java From OpenModsLib with MIT License | 5 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { this.resourceManager = resourceManager; if (resourceManager != null) { synchronized (holders) { for (Holder holder : holders.values()) holder.reload(); } } }
Example #6
Source File: GolemGuiTexture.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
private BufferedImage manipulateImage(IResourceManager resourceManager, BufferedImage image) throws IOException { int scale = image.getWidth() / 256; List<AdditionalGolemType> types = GadomancyApi.getAdditionalGolemTypes(); int newHeight = (24*scale) * (getMaxOrdinal() + 1); BufferedImage newImg = new BufferedImage(image.getWidth(), newHeight < image.getHeight() ? image.getHeight() : newHeight, image.getType()); for(int x = 0; x < image.getWidth(); x++) { for(int y = 0; y < image.getHeight(); y++) { newImg.setRGB(x, y, image.getRGB(x, y)); } } for(AdditionalGolemType type : types) { try { int ordinal = type.getEnumEntry().ordinal(); BufferedImage slotImg = loadImage(resourceManager, type.getInvSlotTexture()); float slotScale = (24*scale) / (float)slotImg.getWidth(); if(slotScale > 1) { slotImg = scaleImage(slotImg, slotScale, slotScale); } for(int x = 0; x < slotImg.getWidth(); x++) { for(int y = 0; y < slotImg.getHeight(); y++) { newImg.setRGB((184*scale) + x, ordinal * (24*scale) + y, slotImg.getRGB(x, y)); } } } catch (IOException e) { LOGGER.warn("Failed loading golem inventory slot texture of: " + type.getModId() + ":" + type.getName()); } } return newImg; }
Example #7
Source File: ClientProxy.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void postInitalize() { IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); if(manager instanceof SimpleReloadableResourceManager) { SimpleReloadableResourceManager rm = (SimpleReloadableResourceManager) manager; rm.registerReloadListener(ResourceReloadListener.getInstance()); } MinecraftForge.EVENT_BUS.register(EffectHandler.getInstance()); MinecraftForge.EVENT_BUS.register(new RenderEventHandler()); FMLCommonHandler.instance().bus().register(new ClientHandler()); super.postInitalize(); }
Example #8
Source File: ResourcePackHook.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static void init() { IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); Minecraft.getMinecraft().defaultResourcePacks.add(instance); if (resourceManager instanceof SimpleReloadableResourceManager) { ((SimpleReloadableResourceManager) resourceManager).registerReloadListener(instance); } }
Example #9
Source File: TextureDynamic.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public boolean load(IResourceManager manager, ResourceLocation location) { // get mipmapping levels int mipmapLevels = Minecraft.getMinecraft().gameSettings.mipmapLevels; try { BufferedImage[] imgFinal = new BufferedImage[1 + mipmapLevels]; imgFinal[0] = tryLoadImage(manager, template); if (color != null) { imgFinal[0] = ImageManipulator.Recolor(imgFinal[0], color); } if (this.base != null) { BufferedImage imgBase = tryLoadImage(manager, base); if (imgBase != null) { imgFinal[0] = ImageManipulator.Composite(imgBase, imgFinal[0]); } } // load the texture (note the null is where animation data would normally go) //this.loadSprite(new PngSizeInfo(imgFinal), null); } catch (Exception e) { e.printStackTrace(); return true; } //ExNihilo.log.info("Succesfully generated texture for '" + this.getIconName() + "'. Place " + this.getIconName() + ".png in the assets folder to override."); return false; }
Example #10
Source File: TextureDynamic.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { try { manager.getResource(location); } catch (Exception e) { return true; } // ExNihiloAdscensio.log.info("Icon: " + template + " was overwritten by a texturepack or embedded resource."); return false; }
Example #11
Source File: ModelCamouflageBlock.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { for (Map.Entry<BlockRenderLayer, Map<ImmutablePair<IBlockState, IBlockState>, ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>>>> entry : BakedModelCamouflageBlock.QUAD_CACHE.entrySet()) { entry.getValue().clear(); } }
Example #12
Source File: GibsModelRegistry.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
public static void onResourceManagerReload(IResourceManager resourceManager) { // When Minecraft resources are reloaded we must delete the render caches. // Otherwise we'll start rendering pink garbage. System.out.println( "Valkyrien Skies got a resource reload event! " + NAMES_TO_RESOURCE_LOCATION.size()); System.out.println(NAMES_TO_RESOURCE_LOCATION.toString()); NAMES_TO_BAKED_MODELS.clear(); NAMES_TO_BUFFER_STATES.clear(); NAMES_AND_BRIGHTNESS_TO_VERTEX_BUFFER.clear(); OPTIFINE_SHADERS_ENABLED = Optional.empty(); // Also clean up FastBlockModelRenderer // TODO: Merge the functionality of Fast and Gibs eventually. FastBlockModelRenderer.blockstateToVertexData.clear(); FastBlockModelRenderer.blockstateBrightnessToVertexBuffer.clear(); }
Example #13
Source File: AnimationHelper.java From EmergingTechnology with MIT License | 4 votes |
@SideOnly(Side.CLIENT) public static HarvesterAnimationStateMachine loadHarvesterASM(ResourceLocation location, ImmutableMap<String, ITimeValue> customParameters) { IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); return HarvesterAnimationStateMachine.load(manager, location, customParameters); }
Example #14
Source File: ToolRenderHandler.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { this.updateDestroyBlockIcons(); }
Example #15
Source File: ModelLoader.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { this.resourceManager = resourceManager; }
Example #16
Source File: ModelEnderBucket.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { // no need to clear cache since we create a new model instance }
Example #17
Source File: BakedModelInserter.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { QUAD_CACHE.clear(); }
Example #18
Source File: BakedModelBarrel.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { QUAD_CACHE_NORMAL.clear(); QUAD_CACHE_CAMO.clear(); }
Example #19
Source File: ModelEnderTools.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { // no need to clear cache since we create a new model instance }
Example #20
Source File: ModelNullifierBaked.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { NULLIFIER_MODEL_CACHE.clear(); ITEM_MODEL_CACHE.clear(); }
Example #21
Source File: TextureSpecial.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@Override public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { return true; }
Example #22
Source File: PlaceholderTexture.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@Override public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { return true; }
Example #23
Source File: PlaceholderTexture.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
@Override public boolean load(IResourceManager manager, ResourceLocation location) { return true; }
Example #24
Source File: DisposableDynamicTexture.java From OpenModsLib with MIT License | 4 votes |
@Override public void loadTexture(IResourceManager par1ResourceManager) {}
Example #25
Source File: MappedModelLoader.java From OpenModsLib with MIT License | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) {}
Example #26
Source File: ResourceReloadListener.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { reloadGolemResources(); }
Example #27
Source File: GolemGuiTexture.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void loadTexture(IResourceManager resourceManager) throws IOException { this.deleteGlTexture(); InputStream inputstream = null; try { IResource iresource = resourceManager.getResource(this.textureLocation); inputstream = iresource.getInputStream(); BufferedImage bufferedimage = manipulateImage(resourceManager, ImageIO.read(inputstream)); boolean flag = false; boolean flag1 = false; if (iresource.hasMetadata()) { try { TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); if (texturemetadatasection != null) { flag = texturemetadatasection.getTextureBlur(); flag1 = texturemetadatasection.getTextureClamp(); } } catch (RuntimeException runtimeexception) { LOGGER.warn("Failed reading metadata of: " + this.textureLocation, runtimeexception); } } TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); } finally { if (inputstream != null) { inputstream.close(); } } }
Example #28
Source File: ResourcePackHook.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { for (IResourcePackFileHook hook : hooks) { hook.onResourceManagerReload((SimpleReloadableResourceManager) resourceManager); } }
Example #29
Source File: TextureHelper.java From malmo with MIT License | 4 votes |
public MalmoEntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) { super(mcIn, resourceManagerIn); }
Example #30
Source File: MarkersRenderGlobal.java From ForgeHax with MIT License | 4 votes |
@Override public void onResourceManagerReload(IResourceManager resourceManager) { super.onResourceManagerReload(resourceManager); }