<commit_before>package org.pfaa.geologica.client.render;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

public class CompositeBlockItemRenderer implements IItemRenderer {

	@Override
	public boolean handleRenderType(ItemStack item, ItemRenderType type) {
		return true;
	}

	@Override
	public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
			ItemRendererHelper helper) {
		return true;
	}

	@Override
	public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
		Block block = Block.getBlockFromItem(item.getItem());
		RenderBlocks renderer = (RenderBlocks)data[0];
		renderer.useInventoryTint = false;
		if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
			this.translateToHand();
		} else if (type == ItemRenderType.INVENTORY) {
			this.setupAlphaBlending(block);
		}
		if (block.canRenderInPass(0)) {
			renderer.renderBlockAsItem(block, item.getItemDamage(), 1.0F);
		}
		if (block.canRenderInPass(1)) {
			this.setupOverlayColor(item);
			renderer.renderBlockAsItem(block, item.getItemDamage(), 1.0F);
		}
		renderer.useInventoryTint = true;<commit_msg>eliminate flickering when rendering block items in the world<commit_after>package org.pfaa.geologica.client.render;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

public class CompositeBlockItemRenderer implements IItemRenderer {

	@Override
	public boolean handleRenderType(ItemStack item, ItemRenderType type) {
		return true;
	}

	@Override
	public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
			ItemRendererHelper helper) {
		return true;
	}

	@Override
	public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
		Block block = Block.getBlockFromItem(item.getItem());
		RenderBlocks renderer = (RenderBlocks)data[0];
		renderer.useInventoryTint = false;
		if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
			this.translateToHand();
		}
		if (block.canRenderInPass(0)) {
			renderer.renderBlockAsItem(block, item.getItemDamage(), 1.0F);
		}
		if (block.canRenderInPass(1)) {
			if (type == ItemRenderType.INVENTORY) {
				this.setupAlphaBlending(block);
			} else { // hack to get the overlay quads to render on outside; otherwise, it flickers
				GL11.glScalef(1.01F, 1.01F, 1.01F);
			}
			this.setupOverlayColor(item);
			renderer.renderBlockAsItem(block, item.getItemDamage(), 1.0F);
		}
		renderer.useInventoryTint = true;
{'fraction_non_alphanumeric': 0.105907025515554, 'fraction_numerical': 0.010136315973435861, 'mean_word_length': 5.3039647577092515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3143627', 'n_tokens_mistral': 992, 'n_tokens_neox': 932, 'n_words': 183}