/*******************************************************************************
 * Arekkuusu / Solar 2018
 *
 * This project is licensed under the MIT.
 * The source code is available on github:
 * https://github.com/ArekkuusuJerii/Solar#solar
 ******************************************************************************/
package arekkuusu.solar.client.render;

import arekkuusu.solar.client.util.baker.BlockBaker;
import arekkuusu.solar.client.util.helper.GLHelper;
import arekkuusu.solar.client.util.helper.RenderHelper;
import arekkuusu.solar.common.block.tile.TileVacuumConveyor;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumFacing;

/**
 * Created by <Snack> on 07/01/2018.
 * It's distributed as part of Solar.
 */
public class VacuumConveyorRenderer extends SpecialModelRenderer<TileVacuumConveyor> {

	@Override
	void renderTile(TileVacuumConveyor te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
		renderModel(te.getFacingLazy(), x, y, z, partialTicks);
	}

	@Override
	void renderStack(double x, double y, double z, float partialTicks) {
		renderModel(null, x, y, z, partialTicks);
	}

	private void renderModel(EnumFacing facing, double x, double y, double z, float partialTicks) {
		float tick = RenderHelper.getRenderWorldTime(partialTicks);
		final float prevU = OpenGlHelper.lastBrightnessX;
		final float prevV = OpenGlHelper.lastBrightnessY;
		bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		//Top
		GlStateManager.pushMatrix();
		GlStateManager.translate(x + 0.5D, y + 0.5D, z + 0.5D);
		if(facing != null && facing != EnumFacing.UP && facing != EnumFacing.DOWN) {
			GlStateManager.rotate(90F, facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH ? 1F : 0F, 0F, facing == EnumFacing.EAST || facing == EnumFacing.WEST ? 1F : 0F);
		}
		GlStateManager.pushMatrix();
		GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, 1F, 0F);
		BlockBaker.render(BlockBaker.VACUUM_TOP);
		GlStateManager.popMatrix();
		//Middle
		GlStateManager.disableLighting();
		GLHelper.lightMap(255F, 255F);
		BlockBaker.render(BlockBaker.VACUUM_PIECE);
		GLHelper.lightMap(prevU, prevV);
		GlStateManager.enableLighting();
		//Bottom
		GlStateManager.pushMatrix();
		GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, -1F, 0F);
		BlockBaker.render(BlockBaker.VACUUM_BOTTOM);
		GlStateManager.popMatrix();
		GlStateManager.popMatrix();
	}
}

@@ -398,24 +398,21 @@
 til.
-baker.BlockBaker
+ShaderLibrary
 ;%0Aim
@@ -448,21 +448,22 @@
 til.
-helper.GLHelp
+baker.BlockBak
 er;%0A
@@ -636,59 +636,8 @@
 er;%0A
-import net.minecraft.client.renderer.OpenGlHelper;%0A
 impo
@@ -1387,112 +1387,8 @@
 s);%0A
-%09%09final float prevU = OpenGlHelper.lastBrightnessX;%0A%09%09final float prevV = OpenGlHelper.lastBrightnessY;%0A
 %09%09bi
@@ -2013,36 +2013,104 @@
 ;%0A%09%09
-GLHelper.lightMap(255F, 255F
+ShaderLibrary.BRIGHT.getUniformJ(%22brightness%22).ifPresent(b -%3E %7B%0A%09%09%09b.set(0F);%0A%09%09%09b.upload();%0A%09%09%7D
 );%0A%09
@@ -2160,38 +2160,33 @@
 ;%0A%09%09
-GLHelper.lightMap(prevU, prevV
+ShaderLibrary.BRIGHT.end(
 );%0A%09

Fix Vacuum Conveyor lightning