<commit_before>package com.jumbo.rendering;
import com.jubmo.components.interfaces.RenderAction;
import com.jubmo.components.interfaces.TriggeredAction;

/**
*Class that contains various interfaces to be used for renderring by the {@link JumboRenderer}. 
*<p>
*Contains default interfaces that can be overridden to provide a custom OpenGL implementation.
*<p>
*The JumboRenderer can have multiple JumboRenderModes at once, and can switch between them easily.
*<p>
*Additionally, each {@link JumboViewport} has a default JumboRenderMode, for {@link JumboGraphicsObject}s that dont want to override it.
*@see JumboRenderer
*@see RenderAction
*@see TriggeredAction
*@see JumboViewport
**/
public final class JumboRenderMode{
    /**
    *Each render pass, when you bind a new texture, set this {@link LamdbaInteger} to be the new texture ID. This way, you can avoid repeat texture rebindings.
    **/
    public LambdaInteger prevousid=-1;

    private static RenderAction render = (JumboEntity e, int renderwidth, int renderheight)->{	
			Rectangle rect = new Rectangle();
			try {
				rect = e.getInheritedOutbounds();
			} catch (NullPointerException ex) {
				System.err.println("Entity " + e + " has a null parent!");
				ErrorHandler.handle(ex);
			}
			e.setRenderposition(new Position(rect.x, rect.y));
			final boolean outofbounds = (rect.x + rect.width <= 0 || rect.x >= renderwidth || rect.y + rect.height <= 0
					|| rect.y >= renderheight);
			e.setOutofbounds(outofbounds);
			if (e.isRenderable() && !outofbounds) {
				// GL11.glLoadIdentity();
				// check to make sure its not offscreen
				// texture binding
				final JumboTexture tex = e.getTexture();
				// to prevent repeat method calls
				int id = tex.getID();
				if (previousid != id) {
					tex.bind();
					previousid = id;
				}
				// color
				FloatRectangle c = tex.getColor();
				final boolean trippy = JumboSettings.trippy;
				if (trippy) {
					Color c2 = Dice.randomColor();
					c = new FloatRectangle(c2.getRed() / 255.0f, c2.getGreen() / 255.0f, c2.getBlue() / 255.0f,
							c.height);
				}
				GL11.glColor4f(c.x, c.y, c.width, c.height);
				final FloatRectangle texturecoords = tex.getTextureCoords();
				// float texturex = e.getTexture().getTextureCoords().x,
				// texturey =
				// e<commit_msg>fixed minor bug<commit_after>package com.jumbo.rendering;
import com.jubmo.components.interfaces.RenderAction;
import com.jubmo.components.interfaces.TriggeredAction;

/**
*Class that contains various interfaces to be used for renderring by the {@link JumboRenderer}. 
*<p>
*Contains default interfaces that can be overridden to provide a custom OpenGL implementation.
*<p>
*The JumboRenderer can have multiple JumboRenderModes at once, and can switch between them easily.
*<p>
*Additionally, each {@link JumboViewport} has a default JumboRenderMode, for {@link JumboGraphicsObject}s that dont want to override it.
*@see JumboRenderer
*@see RenderAction
*@see TriggeredAction
*@see JumboViewport
**/
public final class JumboRenderMode{
    /**
    *Each render pass, when you bind a new texture, set this {@link LamdbaInteger} to be the new texture ID. This way, you can avoid repeat texture rebindings.
    **/
    //TODO need to move this somewhere else
    public LambdaInteger prevousid=-1;

    private static RenderAction render = (JumboEntity e, int renderwidth, int renderheight)->{	
			Rectangle rect = new Rectangle();
			try {
				rect = e.getInheritedOutbounds();
			} catch (NullPointerException ex) {
				System.err.println("Entity " + e + " has a null parent!");
				ErrorHandler.handle(ex);
			}
			e.setRenderposition(new Position(rect.x, rect.y));
			final boolean outofbounds = (rect.x + rect.width <= 0 || rect.x >= renderwidth || rect.y + rect.height <= 0
					|| rect.y >= renderheight);
			e.setOutofbounds(outofbounds);
			if (e.isRenderable() && !outofbounds) {
				// GL11.glLoadIdentity();
				// check to make sure its not offscreen
				// texture binding
				final JumboTexture tex = e.getTexture();
				// to prevent repeat method calls
				int id = tex.getID();
				if (previousid.getNum() != id) {
					tex.bind();
					previousid.setNum(id);
				}
				// color
				FloatRectangle c = tex.getColor();
				final boolean trippy = JumboSettings.trippy;
				if (trippy) {
					Color c2 = Dice.randomColor();
					c = new FloatRectangle(c2.getRed() / 255.0f, c2.getGreen() / 255.0f, c2.getBlue() / 255.0f,
							c.height);
				}
				GL11.glColor4f(c.x, c.y, c.width, c.height);
				final FloatRectangle texturecoords = tex.getTextureCoords();
				// float texturex = e.getTexture().getTextureCoords().x,
				// texturey =
				// e
{'fraction_non_alphanumeric': 0.11879699248120301, 'fraction_numerical': 0.010311493018259935, 'mean_word_length': 3.4597701149425286, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '815224', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1458, 'n_words': 445}