Jump to content

[1.12] TESR rendering .obj model way too dark


Recommended Posts

So I'm trying to render my .obj model in my TESR, but it is always dark. If I don't disable the lighting, it renders completely black.


What am I doing wrong? Is there something to tweak while exporting my models or?


P.S. I'm using TESR because there are going to be some animations and whatnot, so don't bother telling me that I shouldn't use TESR when I should. 



package tt.kitchenstuffmod.client.renderer.blockentity;

import org.lwjgl.opengl.GL11;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockModelRenderer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import tt.kitchenstuffmod.blockentity.BlockEntityCounter;
import tt.kitchenstuffmod.main.KitchenStuffMod;
import tt.kitchenstuffmod.util.ModelLoader;

public class TESRCounter extends TileEntitySpecialRenderer<BlockEntityCounter>
	private static IBakedModel top;
	private static IBakedModel body;
	private static IBakedModel lower;
	private static IBakedModel upper;
	public static void loadModels()
		top = ModelLoader.loadModel("counter/counter_top"); // 'loadModel' just loads the models and handles exceptions, nothing special...
		body = ModelLoader.loadModel("counter/top_01");
		lower = ModelLoader.loadModel("counter/lowerdraw");
		upper = ModelLoader.loadModel("counter/upperdraw"); 
		KitchenStuffMod.log("Models loaded...");
	private Tessellator tessellator;
	private BufferBuilder buffer;
	private World world;
	private BlockPos position;
	private IBlockState block_state;

	private BlockModelRenderer renderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer();
	public void render(BlockEntityCounter block_entity, double x, double y, double z, float partial_ticks, int destroy_stage, float alpha)
		this.tessellator = Tessellator.getInstance();
		this.buffer = this.tessellator.getBuffer();
		this.world = block_entity.getWorld();
		this.position = block_entity.getPos();
		this.block_state = world.getBlockState(position);
		BlockPos entity_position = block_entity.getPos();

		GlStateManager.translate(x - entity_position.getX(), y - entity_position.getY(), z - entity_position.getZ());
        // the name of the texture is wrong, on purpose (top get the purple-black thingy)
        render_model(body, new ResourceLocation("minecraft", "textures/blocks/planks_fbirch.png"));

	private void render_model(IBakedModel model, ResourceLocation texture)
		this.buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
		this.renderer.renderModel(world, model, block_state, position, buffer, true);
	private void push()
	private void push_all()
	private void pop()
	private void pop_all()


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.

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.


  • Create New...

Important Information

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