well I want to change the icon of Minecraft in the Hotbar. I already know that I have to edit the source code and already found the line, in which the icon is set (see below). I have to make an InputStream, but I have no clue what path I have to put the icons in and what path the original icons are.
I already tried to make a new assets folder an put the png files there or putting them directly into the minecraft folder.
Thank you in advance Aaron
called setWindowIcon() Method:
//Original Code InputStreams
//InputStream inputstream = this.getPackFinder().getVanillaPack().getResourceStream(ResourcePackType.CLIENT_RESOURCES, new ResourceLocation("icons/icon_16x16.png"));
//InputStream inputstream1 = this.getPackFinder().getVanillaPack().getResourceStream(ResourcePackType.CLIENT_RESOURCES, new ResourceLocation("icons/icon_32x32.png"));
//My attempt on InputStreams
InputStream inputstream = new FileInputStream("icons/icon_16x16.png");
InputStream inputstream1 = new FileInputStream("icons/icon_32x32.png");
this.mainWindow.setWindowIcon(inputstream, inputstream1);
setWindowIcon() Method:
public void setWindowIcon(InputStream p_216529_1_, InputStream p_216529_2_) {
RenderSystem.assertThread(RenderSystem::isInInitPhase);
try (MemoryStack memorystack = MemoryStack.stackPush()) {
if (p_216529_1_ == null) {
throw new FileNotFoundException("icons/icon_16x16.png");
}
if (p_216529_2_ == null) {
throw new FileNotFoundException("icons/icon_32x32.png");
}
IntBuffer intbuffer = memorystack.mallocInt(1);
IntBuffer intbuffer1 = memorystack.mallocInt(1);
IntBuffer intbuffer2 = memorystack.mallocInt(1);
Buffer buffer = GLFWImage.mallocStack(2, memorystack);
ByteBuffer bytebuffer = this.loadIcon(p_216529_1_, intbuffer, intbuffer1, intbuffer2);
if (bytebuffer == null) {
throw new IllegalStateException("Could not load icon: " + STBImage.stbi_failure_reason());
}
buffer.position(0);
buffer.width(intbuffer.get(0));
buffer.height(intbuffer1.get(0));
buffer.pixels(bytebuffer);
ByteBuffer bytebuffer1 = this.loadIcon(p_216529_2_, intbuffer, intbuffer1, intbuffer2);
if (bytebuffer1 == null) {
throw new IllegalStateException("Could not load icon: " + STBImage.stbi_failure_reason());
}
buffer.position(1);
buffer.width(intbuffer.get(0));
buffer.height(intbuffer1.get(0));
buffer.pixels(bytebuffer1);
buffer.position(0);
GLFW.glfwSetWindowIcon(this.handle, buffer);
STBImage.stbi_image_free(bytebuffer);
STBImage.stbi_image_free(bytebuffer1);
} catch (IOException ioexception) {
LOGGER.error("Couldn't set icon", (Throwable)ioexception);
}
}