Jump to content

mewewe8

Members
  • Posts

    4
  • Joined

  • Last visited

mewewe8's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. 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
  2. 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
  3. 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
  4. 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?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.