Jump to content

[Solved][1.12] Ignoring light/lack of light in TESR using Tesselator


oldcheese

Recommended Posts

Heya. 

 

I'm working on a TileEntity and since it's something that's rarely used I wanted to add a moving part to it that always turned towards you regardless of where you were. For this I used the Tesselator and TESR using GlStatemanager to make sure it always rotates towards the player.

 

code here: 

public class TESRHenge extends TileEntitySpecialRenderer<TileEntityHenge> {
    @Override
    public void render(TileEntityHenge te, double x, double y, double z, float partialTicks, int destroyStage, float alpha){
            GlStateManager.enableRescaleNormal();
            GlStateManager.pushMatrix();
            GlStateManager.enableBlend();
            GlStateManager.translate(x+0.5, y+0.5 , z+0.5);
            GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
            GlStateManager.rotate((float)(Minecraft.getMinecraft().getRenderManager().playerViewX == 2 ? -1 : 1) * Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
            GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.scale(0.6, 0.6, 0.6);
            Tessellator tess = Tessellator.getInstance();
            BufferBuilder buff = tess.getBuffer();
            Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/modeltex/sphere.png"));
            buff.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            buff.pos(-0.5, -0.5, 0.0D).tex(1, 1).color(1.0F, 1.0F, 1.0F, 1F).endVertex();
            buff.pos(0.5, -0.5, 0.0D).tex(0, 1).color(1.0F, 1.0F, 1.0F, 1F).endVertex();
            buff.pos(0.5,0.5, 0.0).tex(0, 0).color(1.0F, 1.0F, 1.0F, 1F).endVertex();
            buff.pos(-0.5,0.5, 0.0).tex(1, 0).color(1.0F, 1.0F, 1.0F, 1F).endVertex();
            tess.draw();
            GlStateManager.popMatrix();
            GlStateManager.disableRescaleNormal();
            GlStateManager.disableBlend();
    }

 

As a disclaimer: I have never used the Tessellator before. It took me about an hour of experimenting before I realized I needed to draw the four corners. I'm also still reading into GlStateManager

 

 

The thing is, I want this spawned 'particle' to completely ignore lighting and always be at maximum brightness. I've tried using GlStateManager.disableLighting and Enablelighting. I'm just not quite sure what each one does. 

 

Anyhow. Seems the easiest way would be to simply make my block be a light source. But I'd rather not do that. I feel like there should be a way here. Am I supposed to use GlStateManager for this or should I somehow implement a lightmap into my Tessellator? How would I start doing this?

 

If anyone could point me in the right direction that'd be great.

 

 

Edit: I'm not very smart. There's a function for this in the TESR class itself.

Edited by oldcheese
solved
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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