Posted December 30, 20195 yr Where does Forge/Modded Minecraft define what model uses what Texture and in that Texture what coordinates? In the "client.model.modelEntityX" all i can find is this.textureWidth, this.textureHeight. But that doesnt specify the UV. So what im looking for is a way to do somthing like this <model,renderer,entity whatever> .Add/SetTexture("textures/bla/mygoblin_top.png"); <model,renderer,entity whatever> .SetUvOfLastTexture(0,0,16,16); <model,renderer,entity whatever> .Add/SetTexture("textures/bla/mygoblin_side.png"); <model,renderer,entity whatever> .SetUvOfLastTexture(0,0,16,16); <model,renderer,entity whatever> .Add/SetTexture("textures/bla/mygoblin_bottom.png"); <model,renderer,entity whatever> .SetUvOfLastTexture(0,0,16,16); // yes, mygoblin is a block Also it doesnt matter if the Texture is a single file or not for me, thats changed fast. All i need to know is how to properly Map Textures onto Models. Where does this hidden magic happen?
December 30, 20195 yr 3 hours ago, mewewe8 said: Where does this hidden magic happen? Looking at the pixel coordinates in an image viewer and then using those values in code. And some trial + error. 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)
December 30, 20195 yr Author Thanks, i have done that and i found out that my Box Renderer Entity Model is using the Texture i want it to use. But its UV coordinates are wrong. I need to change those UV coordinates and i dont know where to do it. Then i futher checked AND when i make the PNG large egnouth i could pinpoint where those Wrong UVs are point at. Check this out This Texture is 256x256. The top right Green bar with TNT on it is where the Mapping picks the pixels. I would love if i could change to x.model.renderer.texture.uv[0].x = 0 x.model.renderer.texture.uv[0].y = 0 x.model.renderer.texture.uv[0].x2 = 16 x.model.renderer.texture.uv[0].y2 = 16 Not only could i then design what Texture to use, but i could also use a Texture of 32x32 pixels, where 4 sides are 1 of those 16x16 panes, 1 is top and 1 is bottom, instead of the usual CubeTextureMapping that normally applies. This is the Texture i would like to use instead (for a completly custom EntityPrimedTNTBlock): or
December 30, 20195 yr You can just change the texture based on some conditions each time you render? Overriding getEntityTexture allows you to do this. Entities are each rendered once per frame. 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)
December 30, 20195 yr Author import com.venor.redmore.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderTNTPrimed; import net.minecraft.client.renderer.texture.TextureMap; @SideOnly(Side.CLIENT) public class RenderEntityRedstoneBlastBlockPrimed extends Render<EntityRedstoneBlastBlockPrimed> { private static final ResourceLocation entityRedstoneBlastBlockPrimedTexture = new ResourceLocation(Reference.MODID+":textures/entity/redstoneblast_block_all.png"); public RenderEntityRedstoneBlastBlockPrimed(RenderManager renderManagerIn) { super(renderManagerIn); } //protected void setEntityTexture() { // entityRedstoneBlastBlockPrimedTexture = new ResourceLocation(Reference.MODID +":textures/blocks/redstoneblast_block.png"); //} /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(EntityRedstoneBlastBlockPrimed entity) { return new ResourceLocation(Reference.MODID+":textures/entity/redstoneblast_block_all.png"); } public void doRender(EntityRedstoneBlastBlockPrimed entity, double x, double y, double z, float entityYaw, float partialTicks) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); if ((float)entity.getFuse() - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; GlStateManager.scale(f1, f1, f1); } float f2 = (1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 100.0F) * 0.8F; //System.out.println("GR:"+ (this.getEntityTexture(entity).toString() )); this.bindEntityTexture(entity); GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), entity.getBrightness()); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 1.0F); GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } else if (entity.getFuse() / 5 % 2 == 0) { GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 1.0F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); } GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } protected void applyRotations(EntityRedstoneBlastBlockPrimed entity, float a , float r,float e) { } } Above is the Render Code, and i tried what you said with: @Override protected ResourceLocation getEntityTexture(EntityRedstoneBlastBlockPrimed entity) { return new ResourceLocation(Reference.MODID+":textures/entity/redstoneblast_block_all.png"); } But even thou it takes the right Texture, the position of the UVs is way too the right. i try to crack this case since yesterday with no succses
December 30, 20195 yr You would change the texture and have the UVs remain constant. 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)
December 30, 20195 yr Author It works now! You were right i cant change UVs. This is the working Solution: Its a bit big but it works and i can finish writing my tutorial. THank you so much!!! Cadiboo
January 1, 20205 yr You can also use GL state and BlockRendererDispatcher#renderBlockState to achieve this probably more cleanly. 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)
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.