Jump to content

Recommended Posts

Posted (edited)

Hello, I've created a new model from Craft Studio and I added it to my mod but I having some problems with the render in the world, in the inventory the block look exactly like it would look but in the world when I place it it's way darker than it should be ? Do you know where it can come from ?

 

Here is a picture of the problem and my code maybe could be useful :/ 

 

package fr.fifou.economy.blocks.tileentity;

import org.lwjgl.opengl.GL11;

import fr.fifou.economy.ModEconomy;
import fr.fifou.economy.blocks.models.modelAtm;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

public class TileEntityEconomySpecialRenderer extends TileEntitySpecialRenderer
{

	private static modelAtm modelBlock = new modelAtm();
	public static ResourceLocation texture = new ResourceLocation(ModEconomy.MODID, "textures/blocks_models/atm.png");
 

	public void renderTileEntityEconomyAt(TileEntityBlockAtm tileEntity, double posX, double posY, double posZ, float partialTicks, int damageCount) 
	{
			//Open Matrix
		GlStateManager.pushMatrix();
		//Place the block at X Y Z coordinates
		GlStateManager.translate(posX + 0.5F, posY + 1.5F, posZ + 0.5F);
		//Turn up side down the block
		GlStateManager.rotate(180F, 1.0F, 0.0F, 0.0F);
		GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F);
		GlStateManager.rotate(90F * tileEntity.getDirection(), 0.0F, 1.0F, 0.0F);
		//Draw the texture
		this.bindTexture(texture);
		//Doing the 3D render
		modelBlock.renderAll();
		//We close Matrix
		GlStateManager.popMatrix();
		 
	}
	
	@Override
	public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float partialTicks, int damageCount) 
	{
	    this.renderTileEntityEconomyAt(((TileEntityBlockAtm) tileEntity), posX, posY, posZ, partialTicks, damageCount);
	}
 

 

Thank you

2017-05-25_14.41.46.png

Edited by Fifou_BE
Posted

I had something similar happen before.

what i did was before the rendering i added

GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 15 * 16, 15 * 16);

 

in your case it will be before the "renderAll()" call.

 

and after the call i enable lighting again using

GlStateManager.enableLighting();

 

 

I'm not sure if you have to have both disable lighting and set the light map texture coords or just one of them, try it and see if it helps.

  • Like 1
Posted
4 minutes ago, LRocket said:

I had something similar happen before.

what i did was before the rendering i added


GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 15 * 16, 15 * 16);

 

in your case it will be before the "renderAll()" call.

 

and after the call i enable lighting again using


GlStateManager.enableLighting();

 

 

I'm not sure if you have to have both disable lighting and set the light map texture coords or just one of them, try it and see if it helps.

 

Yep It works perfectly :) Thank you :) 

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.