var renderClass = "jp.ngt.rtm.render.OrnamentPartsRenderer";
importPackage(Packages.org.lwjgl.opengl);
importPackage(Packages.jp.ngt.rtm.render);
importPackage(Packages.jp.ngt.rtm.block);

function init(par1, par2)
{
	block1 = renderer.registerParts(new Parts("block1"));
	block2 = renderer.registerParts(new Parts("block2"));
	block3 = renderer.registerParts(new Parts("block3"));
	block4 = renderer.registerParts(new Parts("block4"));
	block5 = renderer.registerParts(new Parts("block5"));
	block6 = renderer.registerParts(new Parts("block6"));
	block7 = renderer.registerParts(new Parts("block7"));
	block8 = renderer.registerParts(new Parts("block8"));
	block9 = renderer.registerParts(new Parts("block9"));
	block10 = renderer.registerParts(new Parts("block10"));
}

function render(entity, pass, par3)
{
	GL11.glPushMatrix();
	GL11.glTranslatef(0.0, -0.5, 0.0);

	if(pass == 0)
	{
		if(entity != null)
		{
			var x = entity.getX();
			var y = entity.getY();
			var z = entity.getZ();
			var world = renderer.getWorld(entity);
			var blockplace1 = BlockLinePole.isConnected(world, x, y - 1, z, 0);
			var blockplace2 = BlockLinePole.isConnected(world, x, y - 2, z, 0);
			var blockplace3 = BlockLinePole.isConnected(world, x, y - 3, z, 0);
			var blockplace4 = BlockLinePole.isConnected(world, x, y - 4, z, 0);
			var blockplace5 = BlockLinePole.isConnected(world, x, y - 5, z, 0);
			var blockplace6 = BlockLinePole.isConnected(world, x, y - 6, z, 0);
			var blockplace7 = BlockLinePole.isConnected(world, x, y - 7, z, 0);
			var blockplace8 = BlockLinePole.isConnected(world, x, y - 8, z, 0);
			var blockplace9 = BlockLinePole.isConnected(world, x, y - 9, z, 0);
			
			if(blockplace9)
			{
				block10.render(renderer);
			}
			else
			{
				
				if(blockplace8)
			{
				block9.render(renderer);
			}
			else
			{
				if(blockplace7)
			{
				block8.render(renderer);
			}
			else
			{
				if(blockplace6)
			{
				block7.render(renderer);
			}
			else
			{
				if(blockplace5)
			{
				block6.render(renderer);
			}
			else
			{
				if(blockplace4)
			{
				block5.render(renderer);
			}
			else
			{
				if(blockplace3)
			{
				block4.render(renderer);
			}
			else
			{
				if(blockplace2)
			{
				block3.render(renderer);
			}
			else
			{
				if(blockplace1)
			{
				block2.render(renderer);
			}
			else
			{
				block1.render(renderer);
			}
			}
			}
			}
			}
			}
			}
			}
			
			}
			

		}
	}
	
	GL11.glPopMatrix();
}
