package net.minecraft.client.renderer.entity;

import java.util.Map;

import com.google.common.collect.Maps;

import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.profile.RenderHighPoly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBed;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.model.ModelChicken;
import net.minecraft.client.model.ModelCow;
import net.minecraft.client.model.ModelHorse;
import net.minecraft.client.model.ModelOcelot;
import net.minecraft.client.model.ModelPig;
import net.minecraft.client.model.ModelRabbit;
import net.minecraft.client.model.ModelSheep2;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.model.ModelSquid;
import net.minecraft.client.model.ModelWolf;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.tileentity.RenderEnderCrystal;
import net.minecraft.client.renderer.tileentity.RenderItemFrame;
import net.minecraft.client.renderer.tileentity.RenderWitherSkull;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLeashKnot;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ReportedException;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.starlikeclient.StarlikeClient;
import net.starlikeclient.minecraft.init.EntitiesStarlike;

/**
 * + This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source
 * code.
 *
 * Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" Mod
 * Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
 *
 * EaglercraftX 1.8 patch files (c) 2022-2025 lax1dude, ayunami2000. All Rights
 * Reserved.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */
public class RenderManager {
	public static void setupLightmapCoords(Entity entity, float partialTicks) {
		int i = entity.getBrightnessForRender(partialTicks);
		if (entity.isBurning()) {
			DeferredStateManager.setEmissionConstant(1.0f);
			i = 15728880;
		}
		int j = i % 65536;
		int k = i / 65536;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
	}

	public Map<Class<? extends Entity>, Render<? extends Entity>> entityRenderMap = Maps.newHashMap();
	private Map<String, RenderPlayer> skinMap = Maps.newHashMap();
	private RenderPlayer playerRenderer;
	private RenderPlayer eaglerRenderer;
	private FontRenderer textRenderer;
	private double renderPosX;
	private double renderPosY;
	private double renderPosZ;
	public TextureManager renderEngine;
	public World worldObj;
	public Entity livingPlayer;
	public Entity pointedEntity;
	public float playerViewY;
	public float playerViewX;
	public GameSettings options;
	public double viewerPosX;
	public double viewerPosY;
	public double viewerPosZ;
	private boolean renderOutlines = false;
	private boolean renderShadow = true;

	/**
	 * + whether bounding box should be rendered or not
	 */
	private boolean debugBoundingBox = false;

	public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn) {
		this.renderEngine = renderEngineIn;
		this.entityRenderMap.put(EntityCaveSpider.class, new RenderCaveSpider(this));
		this.entityRenderMap.put(EntitySpider.class, new RenderSpider(this));
		this.entityRenderMap.put(EntityPig.class, new RenderPig(this, new ModelPig(), 0.7F));
		this.entityRenderMap.put(EntitySheep.class, new RenderSheep(this, new ModelSheep2(), 0.7F));
		this.entityRenderMap.put(EntityCow.class, new RenderCow(this, new ModelCow(), 0.7F));
		this.entityRenderMap.put(EntityMooshroom.class, new RenderMooshroom(this, new ModelCow(), 0.7F));
		this.entityRenderMap.put(EntityWolf.class, new RenderWolf(this, new ModelWolf(), 0.5F));
		this.entityRenderMap.put(EntityChicken.class, new RenderChicken(this, new ModelChicken(), 0.3F));
		this.entityRenderMap.put(EntityOcelot.class, new RenderOcelot(this, new ModelOcelot(), 0.4F));
		this.entityRenderMap.put(EntityRabbit.class, new RenderRabbit(this, new ModelRabbit(), 0.3F));
		this.entityRenderMap.put(EntitySilverfish.class, new RenderSilverfish(this));
		this.entityRenderMap.put(EntityEndermite.class, new RenderEndermite(this));
		this.entityRenderMap.put(EntityCreeper.class, new RenderCreeper(this));
		this.entityRenderMap.put(EntityEnderman.class, new RenderEnderman(this));
		this.entityRenderMap.put(EntitySnowman.class, new RenderSnowMan(this));
		this.entityRenderMap.put(EntitySkeleton.class, new RenderSkeleton(this));
		this.entityRenderMap.put(EntityWitch.class, new RenderWitch(this));
		this.entityRenderMap.put(EntityBlaze.class, new RenderBlaze(this));
		this.entityRenderMap.put(EntityPigZombie.class, new RenderPigZombie(this));
		this.entityRenderMap.put(EntityZombie.class, new RenderZombie(this));
		this.entityRenderMap.put(EntitySlime.class, new RenderSlime(this, new ModelSlime(16), 0.25F));
		this.entityRenderMap.put(EntityMagmaCube.class, new RenderMagmaCube(this));
		this.entityRenderMap.put(EntityGiantZombie.class, new RenderGiantZombie(this, new ModelZombie(), 0.5F, 6.0F));
		this.entityRenderMap.put(EntityGhast.class, new RenderGhast(this));
		this.entityRenderMap.put(EntitySquid.class, new RenderSquid(this, new ModelSquid(), 0.7F));
		this.entityRenderMap.put(EntityVillager.class, new RenderVillager(this));
		this.entityRenderMap.put(EntityIronGolem.class, new RenderIronGolem(this));
		this.entityRenderMap.put(EntityBat.class, new RenderBat(this));
		this.entityRenderMap.put(EntityGuardian.class, new RenderGuardian(this));
		this.entityRenderMap.put(EntityDragon.class, new RenderDragon(this));
		this.entityRenderMap.put(EntityEnderCrystal.class, new RenderEnderCrystal(this));
		this.entityRenderMap.put(EntityWither.class, new RenderWither(this));
		this.entityRenderMap.put(Entity.class, new RenderEntity(this));
		this.entityRenderMap.put(EntityPainting.class, new RenderPainting(this));
		this.entityRenderMap.put(EntityItemFrame.class, new RenderItemFrame(this, itemRendererIn));
		this.entityRenderMap.put(EntityLeashKnot.class, new RenderLeashKnot(this));
		this.entityRenderMap.put(EntityArrow.class, new RenderArrow(this));
		this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball(this, Items.snowball, itemRendererIn));
		this.entityRenderMap.put(EntityEnderPearl.class, new RenderSnowball(this, Items.ender_pearl, itemRendererIn));
		this.entityRenderMap.put(EntityEnderEye.class, new RenderSnowball(this, Items.ender_eye, itemRendererIn));
		this.entityRenderMap.put(EntityEgg.class, new RenderSnowball(this, Items.egg, itemRendererIn));
		this.entityRenderMap.put(EntityPotion.class, new RenderPotion(this, itemRendererIn));
		this.entityRenderMap.put(EntityExpBottle.class,
				new RenderSnowball(this, Items.experience_bottle, itemRendererIn));
		this.entityRenderMap.put(EntityFireworkRocket.class, new RenderSnowball(this, Items.fireworks, itemRendererIn));
		this.entityRenderMap.put(EntityLargeFireball.class, new RenderFireball(this, 2.0F));
		this.entityRenderMap.put(EntitySmallFireball.class, new RenderFireball(this, 0.5F));
		this.entityRenderMap.put(EntityWitherSkull.class, new RenderWitherSkull(this));
		this.entityRenderMap.put(EntityItem.class, new RenderEntityItem(this, itemRendererIn));
		this.entityRenderMap.put(EntityXPOrb.class, new RenderXPOrb(this));
		this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed(this));
		this.entityRenderMap.put(EntityFallingBlock.class, new RenderFallingBlock(this));
		this.entityRenderMap.put(EntityArmorStand.class, new ArmorStandRenderer(this));
		this.entityRenderMap.put(EntityMinecartTNT.class, new RenderTntMinecart(this));
		this.entityRenderMap.put(EntityMinecartMobSpawner.class, new RenderMinecartMobSpawner(this));
		this.entityRenderMap.put(EntityMinecart.class, new RenderMinecart(this));
		this.entityRenderMap.put(EntityBoat.class, new RenderBoat(this));
		this.entityRenderMap.put(EntityFishHook.class, new RenderFish(this));
		this.entityRenderMap.put(EntityHorse.class, new RenderHorse(this, new ModelHorse(), 0.75F));
		this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt(this));

		EntitiesStarlike.renderEntities(this);

		this.playerRenderer = new RenderPlayer(this);
		this.skinMap.put("default", this.playerRenderer);
		this.skinMap.put("slim", new RenderPlayer(this, true, false));
		this.skinMap.put("zombie", new RenderPlayer(this, false, true));
		if (EagRuntime.getConfiguration().isAllowFNAWSkins()) {
			this.eaglerRenderer = new RenderHighPoly(this, this.playerRenderer.getMainModel(),
					this.playerRenderer.shadowSize);
		} else {
			this.eaglerRenderer = this.playerRenderer;
		}
		this.skinMap.put("eagler",
				Minecraft.getMinecraft().gameSettings.enableFNAWSkins ? this.eaglerRenderer : this.playerRenderer);
	}

	public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn,
			Entity pointedEntityIn, GameSettings optionsIn, float partialTicks) {
		this.worldObj = worldIn;
		this.options = optionsIn;
		this.livingPlayer = livingPlayerIn;
		this.pointedEntity = pointedEntityIn;
		this.textRenderer = textRendererIn;
		if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase) livingPlayerIn).isPlayerSleeping()) {
			IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn));
			Block block = iblockstate.getBlock();
			if (block == Blocks.bed) {
				int i = ((EnumFacing) iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
				this.playerViewY = (float) (i * 90 + 180);
				this.playerViewX = 0.0F;
			}
		} else {
			this.playerViewY = livingPlayerIn.prevRotationYaw
					+ (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks;
			this.playerViewX = livingPlayerIn.prevRotationPitch
					+ (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks;
		}

		if (optionsIn.thirdPersonView == 2) {
			this.playerViewY += 180.0F;
		}

		this.viewerPosX = livingPlayerIn.lastTickPosX
				+ (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double) partialTicks;
		this.viewerPosY = livingPlayerIn.lastTickPosY
				+ (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double) partialTicks;
		this.viewerPosZ = livingPlayerIn.lastTickPosZ
				+ (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double) partialTicks;
	}

	public boolean doRenderEntity(Entity entity, double x, double y, double z, float entityYaw, float partialTicks,
			boolean parFlag) {
		if (entity.shouldCull) {
			Render render = getEntityRenderObject(entity);
			if (render.canRenderName(entity) && StarlikeClient.Config.Culling.renderNameTagsOnCulledEntities) {
				render.renderLivingLabel(entity, entity.getDisplayName().getFormattedText(), x, y, z, 64);
			}
			return false;
		}

		Render render = null;

		try {
			render = this.getEntityRenderObject(entity);
			if (render != null && this.renderEngine != null) {
				try {
					if (render instanceof RendererLivingEntity) {
						((RendererLivingEntity) render).setRenderOutlines(this.renderOutlines);
					}

					RenderItem.renderPosX = (float) x;
					RenderItem.renderPosY = (float) y + entity.height * 0.5f;
					RenderItem.renderPosZ = (float) z;
					render.doRender(entity, x, y, z, entityYaw, partialTicks);
				} catch (Throwable throwable2) {
					throw new ReportedException(CrashReport.makeCrashReport(throwable2, "Rendering entity in world"));
				}

				try {
					if (!this.renderOutlines) {
						render.doRenderShadowAndFire(entity, x, y, z, entityYaw, partialTicks);
					}
				} catch (Throwable throwable1) {
					throw new ReportedException(
							CrashReport.makeCrashReport(throwable1, "Post-rendering entity in world"));
				}

				if (this.debugBoundingBox && !entity.isInvisible() && !parFlag
						&& !DeferredStateManager.isDeferredRenderer()) {
					try {
						this.renderDebugBoundingBox(entity, x, y, z, entityYaw, partialTicks);
					} catch (Throwable throwable) {
						throw new ReportedException(
								CrashReport.makeCrashReport(throwable, "Rendering entity hitbox in world"));
					}
				}
			} else if (this.renderEngine != null) {
				return false;
			}

			return true;
		} catch (Throwable throwable3) {
			CrashReport crashreport = CrashReport.makeCrashReport(throwable3, "Rendering entity in world");
			CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being rendered");
			entity.addEntityCrashInfo(crashreportcategory);
			CrashReportCategory crashreportcategory1 = crashreport.makeCategory("Renderer details");
			crashreportcategory1.addCrashSection("Assigned renderer", render);
			crashreportcategory1.addCrashSection("Location", CrashReportCategory.getCoordinateInfo(x, y, z));
			crashreportcategory1.addCrashSection("Rotation", Float.valueOf(entityYaw));
			crashreportcategory1.addCrashSection("Delta", Float.valueOf(partialTicks));
			throw new ReportedException(crashreport);
		}
	}

	public double getDistanceToCamera(double parDouble1, double parDouble2, double parDouble3) {
		double d0 = parDouble1 - this.viewerPosX;
		double d1 = parDouble2 - this.viewerPosY;
		double d2 = parDouble3 - this.viewerPosZ;
		return d0 * d0 + d1 * d1 + d2 * d2;
	}

	public <T extends Entity> Render<T> getEntityClassRenderObject(Class<? extends Entity> parClass1) {
		Render render = (Render) this.entityRenderMap.get(parClass1);
		if (render == null && parClass1 != Entity.class) {
			render = this.getEntityClassRenderObject((Class<? extends Entity>) parClass1.getSuperclass());
			this.entityRenderMap.put(parClass1, render);
		}

		return render;
	}

	public <T extends Entity> Render getEntityRenderObject(Entity entityIn) {
		if (entityIn instanceof AbstractClientPlayer) {
			String s = ((AbstractClientPlayer) entityIn).getSkinType();
			RenderPlayer renderplayer = (RenderPlayer) this.skinMap.get(s);
			return renderplayer != null ? renderplayer : this.playerRenderer;
		} else {
			return this.<T>getEntityClassRenderObject(entityIn.getClass());
		}
	}

	/**
	 * + Returns the font renderer
	 */
	public FontRenderer getFontRenderer() {
		return this.textRenderer;
	}

	public boolean isDebugBoundingBox() {
		return this.debugBoundingBox;
	}

	public boolean isRenderShadow() {
		return this.renderShadow;
	}

	/**
	 * + Renders the bounding box around an entity when F3+B is pressed
	 */
	private void renderDebugBoundingBox(Entity entityIn, double parDouble1, double parDouble2, double parDouble3,
			float parFloat1, float parFloat2) {
		GlStateManager.depthMask(false);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		GlStateManager.disableCull();
		GlStateManager.disableBlend();
		float f = entityIn.width / 2.0F;
		AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
		AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entityIn.posX + parDouble1,
				axisalignedbb.minY - entityIn.posY + parDouble2, axisalignedbb.minZ - entityIn.posZ + parDouble3,
				axisalignedbb.maxX - entityIn.posX + parDouble1, axisalignedbb.maxY - entityIn.posY + parDouble2,
				axisalignedbb.maxZ - entityIn.posZ + parDouble3);
		RenderGlobal.func_181563_a(axisalignedbb1, 255, 255, 255, 255);
		if (entityIn instanceof EntityLivingBase) {
			float f1 = 0.01F;
			RenderGlobal.func_181563_a(new AxisAlignedBB(parDouble1 - (double) f,
					parDouble2 + (double) entityIn.getEyeHeight() - 0.009999999776482582D, parDouble3 - (double) f,
					parDouble1 + (double) f, parDouble2 + (double) entityIn.getEyeHeight() + 0.009999999776482582D,
					parDouble3 + (double) f), 255, 0, 0, 255);
		}

		Tessellator tessellator = Tessellator.getInstance();
		WorldRenderer worldrenderer = tessellator.getWorldRenderer();
		Vec3 vec3 = entityIn.getLook(parFloat2);
		worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR);
		worldrenderer.pos(parDouble1, parDouble2 + (double) entityIn.getEyeHeight(), parDouble3).color(0, 0, 255, 255)
				.endVertex();
		worldrenderer.pos(parDouble1 + vec3.xCoord * 2.0D,
				parDouble2 + (double) entityIn.getEyeHeight() + vec3.yCoord * 2.0D, parDouble3 + vec3.zCoord * 2.0D)
				.color(0, 0, 255, 255).endVertex();
		tessellator.draw();
		GlStateManager.enableTexture2D();
		GlStateManager.enableLighting();
		GlStateManager.enableCull();
		GlStateManager.disableBlend();
		GlStateManager.depthMask(true);
	}

	public boolean renderEntitySimple(Entity entityIn, float partialTicks) {
		return this.renderEntityStatic(entityIn, partialTicks, false);
	}

	public boolean renderEntityStatic(Entity entity, float partialTicks, boolean parFlag) {
		if (entity.ticksExisted == 0) {
			entity.lastTickPosX = entity.posX;
			entity.lastTickPosY = entity.posY;
			entity.lastTickPosZ = entity.posZ;
		}

		double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
		double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
		double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
		if (DynamicLightsStateManager.isInDynamicLightsPass()) {
			DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) (d0 - viewerPosX),
					(float) (d1 - viewerPosY), (float) (d2 - viewerPosZ));
		}
		float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
		int i = entity.getBrightnessForRender(partialTicks);
		if (entity.isBurning()) {
			DeferredStateManager.setEmissionConstant(1.0f);
			i = 15728880;
		}

		int j = i % 65536;
		int k = i / 65536;
		OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
		GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
		try {
			return this.doRenderEntity(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, f,
					partialTicks, parFlag);
		} finally {
			DeferredStateManager.setEmissionConstant(0.0f);
		}
	}

	public boolean renderEntityWithPosYaw(Entity entityIn, double x, double y, double z, float entityYaw,
			float partialTicks) {
		try {
			return this.doRenderEntity(entityIn, x, y, z, entityYaw, partialTicks, false);
		} finally {
			DeferredStateManager.setEmissionConstant(0.0f);
		}
	}

	public void renderWitherSkull(Entity entityIn, float partialTicks) {
		double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double) partialTicks;
		double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double) partialTicks;
		double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double) partialTicks;
		Render render = this.getEntityRenderObject(entityIn);
		if (render != null && this.renderEngine != null) {
			int i = entityIn.getBrightnessForRender(partialTicks);
			int j = i % 65536;
			int k = i / 65536;
			OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
			render.renderName(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ);
		}

	}

	/**
	 * + World sets this RenderManager's worldObj to the world provided
	 */
	public void set(World worldIn) {
		this.worldObj = worldIn;
	}

	public void setDebugBoundingBox(boolean debugBoundingBoxIn) {
		this.debugBoundingBox = debugBoundingBoxIn;
	}

	public void setEnableFNAWSkins(boolean en) {
		this.skinMap.put("eagler", en ? this.eaglerRenderer : this.playerRenderer);
	}

	public void setPlayerViewY(float playerViewYIn) {
		this.playerViewY = playerViewYIn;
	}

	public void setRenderOutlines(boolean renderOutlinesIn) {
		this.renderOutlines = renderOutlinesIn;
	}

	public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) {
		this.renderPosX = renderPosXIn;
		this.renderPosY = renderPosYIn;
		this.renderPosZ = renderPosZIn;
	}

	public void setRenderShadow(boolean renderShadowIn) {
		this.renderShadow = renderShadowIn;
	}

	public boolean shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ) {
		Render render = this.getEntityRenderObject(entityIn);
		return render != null && render.shouldRender(entityIn, camera, camX, camY, camZ);
	}
}
