Posted September 25, 20186 yr I am getting the TextureAtlasSprite for the Water block in PostInit, because I need the average color value of water in order to draw a minimap. Somehow though, the code is returning the missing texture sprite instead of the water texture sprite. It works for all blocks in the game except for water and lava... This is the code used to get the sprite: IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); List<BakedQuad> quads = model.getQuads(state, EnumFacing.UP, 0); quads.addAll(model.getQuads(state, null, 0)); if(quads.size() == 0) return null; return quads.get(0).getSprite(); Edited September 29, 20186 yr by deerangle
September 26, 20186 yr If you want to render fluids use Minecraft.getMinecraft().getBlockRendererDispatcher()#fluidRenderer (Its private you'll have to use reflection) About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
September 26, 20186 yr I don't think the OP wants to render fluids since they mentioned that they need the sprite for the average color to draw on a minimap. My solution would be to get the fluid associated with the block if it has one. If the block is LAVA or WATER then default to FluidRegistry.WATER/LAVA respectively, otherwise check if the block is an instance of IFluidBlock and use IFluidBlock#getFluid to obtain the fluid. Then once you know the fluid you can querry the sprite name using Fluid#getStill/getFlowing. Lastly you can now use TextureMap#getAtlasSprite to get the actual sprite(like I do here). You can even get the fluid's color from the fluid by using Fluid#getColor.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.