Posted June 9, 20196 yr So I have a mob whose job it is is to drop enchanted golden apples. As such, I'd like the entity itself to have the enchantment glint present like items would, except I can't just override the hasEffect() method like an item. I thought about taking the texture and using it as a second layer but I have no idea where to begin as far as the code. I may or may not know a bit about Java. But if I do, it's probably because of my AP Computer Science textbook...
June 9, 20196 yr You might want to look at how RenderItem#renderEffect works 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)
June 9, 20196 yr Author 1 minute ago, Cadiboo said: You might want to look at how RenderItem#renderEffect works I've noticed that the function is using a TextureManager. Is there any other way to apply the texture to the model? I may or may not know a bit about Java. But if I do, it's probably because of my AP Computer Science textbook...
June 9, 20196 yr Why? I’m sure there is but due to how the enchantment texture works, it will probably require some significant effort to do. 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)
June 9, 20196 yr Author Just now, Cadiboo said: Why? I’m sure there is but due to how the enchantment texture works, it will probably require some significant effort to do. Simply because I'm not familiar with how TextureManager works. Oh well, looks like I've got some researching to do. I may or may not know a bit about Java. But if I do, it's probably because of my AP Computer Science textbook...
June 9, 20196 yr this.textureManager.bindTexture(RES_ITEM_GLINT); simply sets the texture that is going to be used when rendering the next thing. This call just sets the texture to the item glint/enchantment texture. 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)
June 10, 20196 yr Author So I've implemented the code but nothing happens. Where should I call the bindTexture() function? Code: Spoiler package xeno.spawnore.entity.render; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelCow; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import xeno.spawnore.entity.EntityEnchantedCow; import javax.annotation.Nullable; @SideOnly(Side.CLIENT) public class RenderEnchantedCow extends RenderLiving<EntityEnchantedCow> { private static ResourceLocation TEXTURE = new ResourceLocation("spawnore:textures/entity/goldencow/goldencow.png"); private static ResourceLocation GLINT = new ResourceLocation("minecraft:textures/misc/enchanted_item_glint.png"); public static final Factory FACTORY = new Factory(); private static IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); private static TextureManager textureManager = new TextureManager(resourceManager); public RenderEnchantedCow(RenderManager rendermanagerIn) { super(rendermanagerIn, new ModelCow(), 0.5F); } @Override public void doRender(EntityEnchantedCow entity, double x, double y, double z, float entityYaw, float partialTicks) { super.doRender(entity, x, y, z, entityYaw, partialTicks); this.textureManager.bindTexture(GLINT); } @Nullable @Override protected ResourceLocation getEntityTexture(EntityEnchantedCow entity) { return TEXTURE; } public static class Factory implements IRenderFactory<EntityEnchantedCow> { @Override public Render<? super EntityEnchantedCow> createRenderFor(RenderManager manager) { return new RenderEnchantedCow(manager); } } } I may or may not know a bit about Java. But if I do, it's probably because of my AP Computer Science textbook...
June 10, 20196 yr 9 hours ago, Xenocorpse said: public static final Factory FACTORY = new Factory(); No. Use constructor references 9 hours ago, Xenocorpse said: private static IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); Don’t store this in a static field unless it changes 9 hours ago, Xenocorpse said: private static TextureManager textureManager = new TextureManager(resourceManager); No. Use Minecraft’s texture manager 9 hours ago, Xenocorpse said: this.textureManager.bindTexture(GLINT); You’ve got to do the rest of the rendering. 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.